@openwebf/react-router 0.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.
@@ -0,0 +1,511 @@
1
+ import { webf } from '@openwebf/webf-enterprise-typings';
2
+ import React, { useRef, useMemo, useState, createContext, useContext, useEffect, Children, isValidElement } from 'react';
3
+ import { createWebFComponent } from '@openwebf/react-core-ui';
4
+
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
20
+
21
+
22
+ function __awaiter(thisArg, _arguments, P, generator) {
23
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
+ return new (P || (P = Promise))(function (resolve, reject) {
25
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
26
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
27
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
29
+ });
30
+ }
31
+
32
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
33
+ var e = new Error(message);
34
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
35
+ };
36
+
37
+ /**
38
+ * WebF Router object - provides comprehensive navigation APIs
39
+ * Combines web-like history management with Flutter-like navigation patterns
40
+ */
41
+ const WebFRouter = {
42
+ /**
43
+ * Get the current state object associated with the history entry
44
+ */
45
+ get state() {
46
+ return webf.hybridHistory.state;
47
+ },
48
+ /**
49
+ * Get the current route path
50
+ */
51
+ get path() {
52
+ return webf.hybridHistory.path;
53
+ },
54
+ /**
55
+ * Navigate to a specified route
56
+ * Applies route guards for permission checks before navigation
57
+ */
58
+ push: (path, state) => __awaiter(void 0, void 0, void 0, function* () {
59
+ webf.hybridHistory.pushNamed(path, { arguments: state });
60
+ }),
61
+ /**
62
+ * Replace the current route without adding to history
63
+ * Applies route guards for permission checks before navigation
64
+ */
65
+ replace: (path, state) => __awaiter(void 0, void 0, void 0, function* () {
66
+ webf.hybridHistory.pushReplacementNamed(path, { arguments: state });
67
+ }),
68
+ /**
69
+ * Navigate back to the previous route
70
+ */
71
+ back: () => {
72
+ webf.hybridHistory.back();
73
+ },
74
+ /**
75
+ * Close the current screen and return to the previous one
76
+ * Flutter-style navigation method
77
+ */
78
+ pop: (result) => {
79
+ webf.hybridHistory.pop(result);
80
+ },
81
+ /**
82
+ * Pop routes until reaching a specific route
83
+ */
84
+ popUntil: (path) => {
85
+ webf.hybridHistory.popUntil(path);
86
+ },
87
+ /**
88
+ * Pop the current route and push a new named route
89
+ */
90
+ popAndPushNamed: (path, state) => __awaiter(void 0, void 0, void 0, function* () {
91
+ webf.hybridHistory.popAndPushNamed(path, { arguments: state });
92
+ }),
93
+ /**
94
+ * Push a new route and remove routes until reaching a specific route
95
+ */
96
+ pushNamedAndRemoveUntil: (path, state, untilPath) => __awaiter(void 0, void 0, void 0, function* () {
97
+ webf.hybridHistory.pushNamedAndRemoveUntil(state, path, untilPath);
98
+ }),
99
+ /**
100
+ * Push a new route and remove all routes until a specific route (Flutter-style)
101
+ */
102
+ pushNamedAndRemoveUntilRoute: (newPath, untilPath, state) => __awaiter(void 0, void 0, void 0, function* () {
103
+ webf.hybridHistory.pushNamedAndRemoveUntilRoute(newPath, untilPath, { arguments: state });
104
+ }),
105
+ /**
106
+ * Check if the navigator can go back
107
+ */
108
+ canPop: () => {
109
+ return webf.hybridHistory.canPop();
110
+ },
111
+ /**
112
+ * Pop the current route if possible
113
+ * Returns true if the pop was successful, false otherwise
114
+ */
115
+ maybePop: (result) => {
116
+ return webf.hybridHistory.maybePop(result);
117
+ },
118
+ /**
119
+ * Push a new state to the history stack (web-style navigation)
120
+ */
121
+ pushState: (state, name) => {
122
+ webf.hybridHistory.pushState(state, name);
123
+ },
124
+ /**
125
+ * Replace the current history entry with a new one (web-style navigation)
126
+ */
127
+ replaceState: (state, name) => {
128
+ webf.hybridHistory.replaceState(state, name);
129
+ },
130
+ /**
131
+ * Pop and push with restoration capability
132
+ * Returns a restoration ID string
133
+ */
134
+ restorablePopAndPushState: (state, name) => {
135
+ return webf.hybridHistory.restorablePopAndPushState(state, name);
136
+ },
137
+ /**
138
+ * Pop and push named route with restoration capability
139
+ * Returns a restoration ID string
140
+ */
141
+ restorablePopAndPushNamed: (path, state) => __awaiter(void 0, void 0, void 0, function* () {
142
+ return webf.hybridHistory.restorablePopAndPushNamed(path, { arguments: state });
143
+ })
144
+ };
145
+
146
+ var isFunction = function (value) {
147
+ return typeof value === 'function';
148
+ };
149
+
150
+ var isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
151
+
152
+ function useMemoizedFn(fn) {
153
+ if (isDev) {
154
+ if (!isFunction(fn)) {
155
+ console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof fn));
156
+ }
157
+ }
158
+ var fnRef = useRef(fn);
159
+ // why not write `fnRef.current = fn`?
160
+ // https://github.com/alibaba/hooks/issues/728
161
+ fnRef.current = useMemo(function () {
162
+ return fn;
163
+ }, [fn]);
164
+ var memoizedFn = useRef();
165
+ if (!memoizedFn.current) {
166
+ memoizedFn.current = function () {
167
+ var args = [];
168
+ for (var _i = 0; _i < arguments.length; _i++) {
169
+ args[_i] = arguments[_i];
170
+ }
171
+ return fnRef.current.apply(this, args);
172
+ };
173
+ }
174
+ return memoizedFn.current;
175
+ }
176
+
177
+ // Create the raw component using createWebFComponent
178
+ const RawWebFRouterLink = createWebFComponent({
179
+ tagName: 'webf-router-link',
180
+ displayName: 'WebFRouterLink',
181
+ // Map props to attributes
182
+ attributeProps: ['path'],
183
+ // Event handlers
184
+ events: [
185
+ {
186
+ propName: 'onScreen',
187
+ eventName: 'onscreen',
188
+ handler: (callback) => (event) => {
189
+ // Cast through unknown first for proper type conversion
190
+ callback(event);
191
+ },
192
+ },
193
+ {
194
+ propName: 'offScreen',
195
+ eventName: 'offscreen',
196
+ handler: (callback) => (event) => {
197
+ // Cast through unknown first for proper type conversion
198
+ callback(event);
199
+ },
200
+ },
201
+ ],
202
+ });
203
+ const WebFRouterLink = function (props) {
204
+ const [isRender, enableRender] = useState(false);
205
+ const handleOnScreen = (event) => {
206
+ enableRender(true);
207
+ if (props.onScreen) {
208
+ props.onScreen(event);
209
+ }
210
+ };
211
+ return (React.createElement(RawWebFRouterLink, { path: props.path, onScreen: handleOnScreen, offScreen: props.offScreen }, isRender ? props.children : null));
212
+ };
213
+
214
+ /**
215
+ * Route Component
216
+ *
217
+ * This component is a core part of the application routing system, responsible for:
218
+ * 1. Managing page rendering and lifecycle
219
+ * 2. Providing route context (RouteContext)
220
+ * 3. Handling page navigation bar (AppBar)
221
+ * 4. Providing page lifecycle hooks
222
+ */
223
+ /**
224
+ * Route Component
225
+ *
226
+ * Responsible for managing page rendering, lifecycle and navigation bar
227
+ */
228
+ function Route({ path, prerender = false, element }) {
229
+ // Mark whether the page has been rendered
230
+ const [hasRendered, updateRender] = useState(WebFRouter.path === path);
231
+ /**
232
+ * Rendering control logic
233
+ */
234
+ const shouldPrerender = prerender || WebFRouter.path === path;
235
+ const shouldRenderChildren = shouldPrerender || hasRendered;
236
+ /**
237
+ * Handle page display event
238
+ */
239
+ const handleOnScreen = useMemoizedFn(() => {
240
+ updateRender(true);
241
+ });
242
+ /**
243
+ * Handle page hide event
244
+ */
245
+ const handleOffScreen = useMemoizedFn(() => {
246
+ });
247
+ return (React.createElement(WebFRouterLink, { path: path, onScreen: handleOnScreen, offScreen: handleOffScreen }, shouldRenderChildren ? element : null));
248
+ }
249
+
250
+ /**
251
+ * Route context default value
252
+ */
253
+ const RouteContext = createContext({
254
+ path: undefined,
255
+ params: undefined,
256
+ activePath: undefined,
257
+ routeEventKind: undefined
258
+ });
259
+ /**
260
+ * Hook to get route context
261
+ *
262
+ * Use generic parameters to specify the route path and automatically infer the corresponding state type
263
+ *
264
+ * @template T - Route path type, must be a member of the RoutePath enum
265
+ * @returns Type-safe route context object
266
+ *
267
+ * @example
268
+ * ```tsx
269
+ * const { params, path, isActive } = useRouteContext();
270
+ * ```
271
+ */
272
+ function useRouteContext() {
273
+ const context = useContext(RouteContext);
274
+ // isActive is true only for push events with matching path
275
+ const isActive = (context.routeEventKind === 'didPush' || context.routeEventKind === 'didPushNext')
276
+ && context.path === context.activePath;
277
+ return Object.assign(Object.assign({}, context), { isActive });
278
+ }
279
+ /**
280
+ * Hook to get the current location
281
+ *
282
+ * @returns Current location object with pathname and state
283
+ *
284
+ * @example
285
+ * ```tsx
286
+ * function MyComponent() {
287
+ * const location = useLocation();
288
+ *
289
+ * console.log('Current path:', location.pathname);
290
+ * console.log('Location state:', location.state);
291
+ * console.log('Is active:', location.isActive);
292
+ *
293
+ * return <div>Current path: {location.pathname}</div>;
294
+ * }
295
+ * ```
296
+ */
297
+ function useLocation() {
298
+ const context = useRouteContext();
299
+ // Create location object from context
300
+ const location = useMemo(() => {
301
+ // For active routes, return the current location with state
302
+ if (context.isActive) {
303
+ return {
304
+ pathname: context.path || context.activePath || WebFRouter.path,
305
+ state: context.params,
306
+ isActive: true,
307
+ key: `${context.path}-active-${Date.now()}`
308
+ };
309
+ }
310
+ // For inactive routes, return the global location without state
311
+ return {
312
+ pathname: context.activePath || WebFRouter.path,
313
+ state: undefined,
314
+ isActive: false,
315
+ key: `${context.activePath}-inactive`
316
+ };
317
+ }, [context.isActive, context.path, context.activePath, context.params]);
318
+ return location;
319
+ }
320
+ /**
321
+ * Routes component that wraps multiple Route components and provides shared context
322
+ *
323
+ * @example
324
+ * ```tsx
325
+ * <Routes sharedData={{ user: currentUser, theme: 'dark' }}>
326
+ * <Route path="/" element={<Home />} />
327
+ * <Route path="/about" element={<About />} />
328
+ * <Route path="/profile" element={<Profile />} />
329
+ * </Routes>
330
+ * ```
331
+ */
332
+ /**
333
+ * Route-specific context provider that only updates when the route is active
334
+ */
335
+ function RouteContextProvider({ path, children }) {
336
+ const globalContext = useContext(RouteContext);
337
+ // Create a route-specific context that only updates when this route is active
338
+ const routeSpecificContext = useMemo(() => {
339
+ // Only update if this route is the active one
340
+ if (globalContext.activePath === path) {
341
+ return {
342
+ path,
343
+ params: globalContext.params,
344
+ activePath: globalContext.activePath,
345
+ routeEventKind: globalContext.routeEventKind
346
+ };
347
+ }
348
+ // Return previous values if not active
349
+ return {
350
+ path,
351
+ params: undefined,
352
+ activePath: globalContext.activePath,
353
+ routeEventKind: undefined
354
+ };
355
+ }, [path, globalContext.activePath, globalContext.params, globalContext.routeEventKind]);
356
+ return (React.createElement(RouteContext.Provider, { value: routeSpecificContext }, children));
357
+ }
358
+ function Routes({ children }) {
359
+ // State to track current route information
360
+ const [routeState, setRouteState] = useState({
361
+ activePath: WebFRouter.path,
362
+ params: WebFRouter.state,
363
+ routeEventKind: undefined
364
+ });
365
+ // Listen to hybridrouterchange event
366
+ useEffect(() => {
367
+ const handleRouteChange = (event) => {
368
+ const routeEvent = event;
369
+ console.log(routeEvent);
370
+ // Only update activePath for push events
371
+ const newActivePath = (routeEvent.kind === 'didPushNext' || routeEvent.kind === 'didPush')
372
+ ? routeEvent.path
373
+ : routeState.activePath;
374
+ // Update state based on event kind
375
+ setRouteState({
376
+ activePath: newActivePath,
377
+ params: routeEvent.state,
378
+ routeEventKind: routeEvent.kind
379
+ });
380
+ };
381
+ // Add event listener
382
+ document.addEventListener('hybridrouterchange', handleRouteChange);
383
+ // Cleanup on unmount
384
+ return () => {
385
+ document.removeEventListener('hybridrouterchange', handleRouteChange);
386
+ };
387
+ }, [routeState.activePath]);
388
+ // Global context value
389
+ const globalContextValue = useMemo(() => ({
390
+ path: undefined,
391
+ params: routeState.params,
392
+ activePath: routeState.activePath,
393
+ routeEventKind: routeState.routeEventKind
394
+ }), [routeState.activePath, routeState.params, routeState.routeEventKind]);
395
+ // Wrap each Route component with its own context provider
396
+ const wrappedChildren = useMemo(() => {
397
+ return Children.map(children, (child) => {
398
+ if (!isValidElement(child)) {
399
+ return child;
400
+ }
401
+ // Ensure only Route components are direct children
402
+ if (child.type !== Route) {
403
+ console.warn('Routes component should only contain Route components as direct children');
404
+ return child;
405
+ }
406
+ // Wrap each Route with its own context provider
407
+ const routePath = child.props.path;
408
+ return (React.createElement(RouteContextProvider, { key: routePath, path: routePath }, child));
409
+ });
410
+ }, [children]);
411
+ return (React.createElement(RouteContext.Provider, { value: globalContextValue }, wrappedChildren));
412
+ }
413
+ /**
414
+ * Hook to create routes from a configuration object
415
+ *
416
+ * @param routes Array of route configuration objects
417
+ * @returns React element tree of Routes and Route components
418
+ *
419
+ * @example
420
+ * ```tsx
421
+ * function App() {
422
+ * const routes = useRoutes([
423
+ * { path: '/', element: <Home /> },
424
+ * { path: '/about', element: <About /> },
425
+ * { path: '/users', element: <Users /> },
426
+ * { path: '/contact', element: <Contact /> }
427
+ * ]);
428
+ *
429
+ * return routes;
430
+ * }
431
+ * ```
432
+ */
433
+ function useRoutes(routes) {
434
+ // Convert route objects to Route components
435
+ const routeElements = useMemo(() => {
436
+ return routes.map((route) => {
437
+ if (route.children && route.children.length > 0) {
438
+ console.warn('Nested routes are not supported yet');
439
+ }
440
+ return (React.createElement(Route, { key: route.path, path: route.path, element: route.element, prerender: route.prerender }));
441
+ });
442
+ }, [routes]);
443
+ // Return Routes component with Route children
444
+ return React.createElement(Routes, null, routeElements);
445
+ }
446
+ /**
447
+ * Hook to navigate between routes programmatically
448
+ *
449
+ * @example
450
+ * ```tsx
451
+ * function LoginPage() {
452
+ * const { navigate, pop, canPop } = useNavigate();
453
+ *
454
+ * const handleLogin = async () => {
455
+ * await login();
456
+ * navigate('/dashboard');
457
+ * };
458
+ *
459
+ * const handleReplace = () => {
460
+ * navigate('/home', { replace: true });
461
+ * };
462
+ *
463
+ * const handleWithState = () => {
464
+ * navigate('/profile', { state: { from: 'login' } });
465
+ * };
466
+ *
467
+ * const goBack = () => {
468
+ * if (canPop()) {
469
+ * pop();
470
+ * } else {
471
+ * navigate('/');
472
+ * }
473
+ * };
474
+ * }
475
+ * ```
476
+ */
477
+ function useNavigate() {
478
+ return useMemo(() => {
479
+ function navigate(to, options) {
480
+ if (typeof to === 'number') {
481
+ // Handle relative navigation (e.g., -1 for back)
482
+ if (to === -1) {
483
+ WebFRouter.back();
484
+ }
485
+ else {
486
+ console.warn('Relative navigation other than -1 is not supported yet');
487
+ }
488
+ return;
489
+ }
490
+ // Handle absolute navigation
491
+ if (options === null || options === void 0 ? void 0 : options.replace) {
492
+ WebFRouter.replace(to, options.state);
493
+ }
494
+ else {
495
+ WebFRouter.push(to, options === null || options === void 0 ? void 0 : options.state);
496
+ }
497
+ }
498
+ return {
499
+ navigate: navigate,
500
+ pop: WebFRouter.pop,
501
+ popUntil: WebFRouter.popUntil,
502
+ popAndPush: WebFRouter.popAndPushNamed,
503
+ pushAndRemoveUntil: WebFRouter.pushNamedAndRemoveUntilRoute,
504
+ canPop: WebFRouter.canPop,
505
+ maybePop: WebFRouter.maybePop
506
+ };
507
+ }, []);
508
+ }
509
+
510
+ export { Route, Routes, WebFRouter, useLocation, useNavigate, useRouteContext, useRoutes };
511
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../node_modules/tslib/tslib.es6.js","../src/routes/utils.ts","../node_modules/ahooks/es/utils/index.js","../node_modules/ahooks/es/utils/isDev.js","../node_modules/ahooks/es/useMemoizedFn/index.js","../src/utils/RouterLink.tsx","../src/routes/Route.tsx","../src/routes/Routes.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * Router management module\n *\n * Encapsulates routing navigation functionality with route guard mechanism for permission checks\n */\n// eslint-disable-next-line no-restricted-imports\nimport { webf } from '@openwebf/webf-enterprise-typings';\n\ntype RoutePath = string;\n\n/**\n * WebF Router object - provides comprehensive navigation APIs\n * Combines web-like history management with Flutter-like navigation patterns\n */\nexport const WebFRouter = {\n /**\n * Get the current state object associated with the history entry\n */\n get state() {\n return webf.hybridHistory.state;\n },\n \n /**\n * Get the current route path\n */\n get path() {\n return webf.hybridHistory.path as RoutePath\n },\n \n /**\n * Navigate to a specified route\n * Applies route guards for permission checks before navigation\n */\n push: async <P extends RoutePath>(path: P, state?: any) => {\n webf.hybridHistory.pushNamed(path, { arguments: state })\n },\n \n /**\n * Replace the current route without adding to history\n * Applies route guards for permission checks before navigation\n */\n replace: async <P extends RoutePath>(path: P, state?: any) => {\n webf.hybridHistory.pushReplacementNamed(path, { arguments: state});\n },\n \n /**\n * Navigate back to the previous route\n */\n back: () => {\n webf.hybridHistory.back();\n },\n \n /**\n * Close the current screen and return to the previous one\n * Flutter-style navigation method\n */\n pop: (result?: any) => {\n webf.hybridHistory.pop(result);\n },\n \n /**\n * Pop routes until reaching a specific route\n */\n popUntil: (path: RoutePath) => {\n webf.hybridHistory.popUntil(path)\n },\n \n /**\n * Pop the current route and push a new named route\n */\n popAndPushNamed: async <T extends RoutePath>(path: T, state?: any) => {\n webf.hybridHistory.popAndPushNamed(path, {arguments: state})\n },\n \n /**\n * Push a new route and remove routes until reaching a specific route\n */\n pushNamedAndRemoveUntil: async <T extends RoutePath>(path: T, state: any, untilPath: RoutePath) => {\n webf.hybridHistory.pushNamedAndRemoveUntil(state, path, untilPath)\n },\n \n /**\n * Push a new route and remove all routes until a specific route (Flutter-style)\n */\n pushNamedAndRemoveUntilRoute: async <T extends RoutePath>(newPath: T, untilPath: RoutePath, state?: any) => {\n webf.hybridHistory.pushNamedAndRemoveUntilRoute(newPath, untilPath, { arguments: state })\n },\n \n /**\n * Check if the navigator can go back\n */\n canPop: (): boolean => {\n return webf.hybridHistory.canPop();\n },\n \n /**\n * Pop the current route if possible\n * Returns true if the pop was successful, false otherwise\n */\n maybePop: (result?: any): boolean => {\n return webf.hybridHistory.maybePop(result);\n },\n \n /**\n * Push a new state to the history stack (web-style navigation)\n */\n pushState: (state: any, name: string) => {\n webf.hybridHistory.pushState(state, name);\n },\n \n /**\n * Replace the current history entry with a new one (web-style navigation)\n */\n replaceState: (state: any, name: string) => {\n webf.hybridHistory.replaceState(state, name);\n },\n \n /**\n * Pop and push with restoration capability\n * Returns a restoration ID string\n */\n restorablePopAndPushState: (state: any, name: string): string => {\n return webf.hybridHistory.restorablePopAndPushState(state, name);\n },\n \n /**\n * Pop and push named route with restoration capability\n * Returns a restoration ID string\n */\n restorablePopAndPushNamed: async <T extends RoutePath>(path: T, state?: any): Promise<string> => {\n return webf.hybridHistory.restorablePopAndPushNamed(path, { arguments: state });\n }\n}\n","export var isObject = function (value) {\n return value !== null && typeof value === 'object';\n};\nexport var isFunction = function (value) {\n return typeof value === 'function';\n};\nexport var isString = function (value) {\n return typeof value === 'string';\n};\nexport var isBoolean = function (value) {\n return typeof value === 'boolean';\n};\nexport var isNumber = function (value) {\n return typeof value === 'number';\n};\nexport var isUndef = function (value) {\n return typeof value === 'undefined';\n};","var isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';\nexport default isDev;","import { useMemo, useRef } from 'react';\nimport { isFunction } from '../utils';\nimport isDev from '../utils/isDev';\nfunction useMemoizedFn(fn) {\n if (isDev) {\n if (!isFunction(fn)) {\n console.error(\"useMemoizedFn expected parameter is a function, got \".concat(typeof fn));\n }\n }\n var fnRef = useRef(fn);\n // why not write `fnRef.current = fn`?\n // https://github.com/alibaba/hooks/issues/728\n fnRef.current = useMemo(function () {\n return fn;\n }, [fn]);\n var memoizedFn = useRef();\n if (!memoizedFn.current) {\n memoizedFn.current = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return fnRef.current.apply(this, args);\n };\n }\n return memoizedFn.current;\n}\nexport default useMemoizedFn;","import React, { EventHandler, FC, ReactNode, SyntheticEvent, useState } from \"react\";\nimport { createWebFComponent, WebFElementWithMethods } from \"@openwebf/react-core-ui\";\n\nexport interface HybridRouterChangeEvent extends SyntheticEvent {\n readonly state: any;\n readonly kind: 'didPushNext' | 'didPush' | 'didPop' | 'didPupNext';\n readonly path: string;\n}\n\nexport type HybridRouterChangeEventHandler = EventHandler<HybridRouterChangeEvent>;\n\nexport interface WebFHybridRouterProps {\n path: string;\n onScreen?: HybridRouterChangeEventHandler;\n offScreen?: HybridRouterChangeEventHandler;\n children?: ReactNode;\n}\n\n// Define the element interface for WebFRouterLink\nexport interface WebFRouterLinkElement extends WebFElementWithMethods<{}> {}\n\n// Create the raw component using createWebFComponent\nconst RawWebFRouterLink = createWebFComponent<WebFRouterLinkElement, WebFHybridRouterProps>({\n tagName: 'webf-router-link',\n displayName: 'WebFRouterLink',\n \n // Map props to attributes\n attributeProps: ['path'],\n \n // Event handlers\n events: [\n {\n propName: 'onScreen',\n eventName: 'onscreen',\n handler: (callback) => (event) => {\n // Cast through unknown first for proper type conversion\n callback(event as unknown as HybridRouterChangeEvent);\n },\n },\n {\n propName: 'offScreen',\n eventName: 'offscreen',\n handler: (callback) => (event) => {\n // Cast through unknown first for proper type conversion\n callback(event as unknown as HybridRouterChangeEvent);\n },\n },\n ],\n});\n\nexport const WebFRouterLink: FC<WebFHybridRouterProps> = function (props: WebFHybridRouterProps) {\n const [isRender, enableRender] = useState(false);\n\n const handleOnScreen = (event: HybridRouterChangeEvent) => {\n enableRender(true);\n \n if (props.onScreen) {\n props.onScreen(event);\n }\n };\n\n return (\n <RawWebFRouterLink path={props.path} onScreen={handleOnScreen} offScreen={props.offScreen}>\n {isRender ? props.children : null}\n </RawWebFRouterLink>\n );\n}","/**\n * Route Component\n *\n * This component is a core part of the application routing system, responsible for:\n * 1. Managing page rendering and lifecycle\n * 2. Providing route context (RouteContext)\n * 3. Handling page navigation bar (AppBar)\n * 4. Providing page lifecycle hooks\n */\n\nimport React, { useState } from 'react'\n// import { Router, RouterEvents$ } from './router'\nimport { useMemoizedFn } from 'ahooks';\nimport { WebFRouterLink } from '../utils/RouterLink';\nimport { WebFRouter } from './utils';\n\n/**\n * Route component props interface\n */\nexport interface RouteProps {\n /**\n * Page title\n * Displayed in the center of the navigation bar\n */\n title?: string\n /**\n * Page path\n * Must be a member of the RoutePath enum\n */\n path: string\n /**\n * Whether to pre-render\n * If true, the page will be rendered when the app starts, rather than waiting for route navigation\n * Can be used to improve page switching performance or preload data\n *\n * @default false\n */\n prerender?: boolean\n /**\n * Page content\n * The actual page component to render\n */\n element: React.ReactNode\n}\n\n/**\n * Route Component\n *\n * Responsible for managing page rendering, lifecycle and navigation bar\n */\nexport function Route({path, prerender = false, element }: RouteProps) {\n // Mark whether the page has been rendered\n const [hasRendered, updateRender] = useState(WebFRouter.path === path)\n\n /**\n * Rendering control logic\n */\n const shouldPrerender = prerender || WebFRouter.path === path\n const shouldRenderChildren = shouldPrerender || hasRendered\n\n /**\n * Handle page display event\n */\n const handleOnScreen = useMemoizedFn(() => {\n updateRender(true);\n })\n\n /**\n * Handle page hide event\n */\n const handleOffScreen = useMemoizedFn(() => {\n })\n\n return (\n <WebFRouterLink path={path} onScreen={handleOnScreen} offScreen={handleOffScreen}>\n {shouldRenderChildren ? element : null}\n </WebFRouterLink>\n )\n}\n","import React, { createContext, useContext, useMemo, Children, isValidElement, useState, useEffect } from 'react';\nimport { Route } from './Route';\nimport { WebFRouter } from './utils';\nimport { HybridRouterChangeEvent } from '../utils/RouterLink';\n\n/**\n * Route context interface\n *\n * Provides page route related state and methods, accessed through the useRouteContext hook\n *\n * @template S - Page state type, defaults to undefined\n */\ninterface RouteContext<S = any> {\n /**\n * Page path\n * Current route path, corresponds to RoutePath enum\n */\n path: string | undefined\n /**\n * Page state\n * State data passed during route navigation\n */\n params: S | undefined\n /**\n * Current active path from router\n */\n activePath: string | undefined\n /**\n * Route event kind\n */\n routeEventKind?: 'didPushNext' | 'didPush' | 'didPop' | 'didPupNext'\n}\n\n/**\n * Route context default value\n */\nconst RouteContext = createContext<RouteContext>({\n path: undefined,\n params: undefined,\n activePath: undefined,\n routeEventKind: undefined\n});\n\n/**\n * Hook to get route context\n *\n * Use generic parameters to specify the route path and automatically infer the corresponding state type\n *\n * @template T - Route path type, must be a member of the RoutePath enum\n * @returns Type-safe route context object\n *\n * @example\n * ```tsx\n * const { params, path, isActive } = useRouteContext();\n * ```\n */\nexport function useRouteContext() {\n const context = useContext<RouteContext>(RouteContext);\n \n // isActive is true only for push events with matching path\n const isActive = (context.routeEventKind === 'didPush' || context.routeEventKind === 'didPushNext') \n && context.path === context.activePath;\n \n return {\n ...context,\n isActive\n };\n}\n\n/**\n * Location object interface\n */\nexport interface Location {\n /**\n * The path of the current location\n */\n pathname: string;\n /**\n * The state object associated with this location\n */\n state: any;\n /**\n * A unique key for this location\n */\n key?: string;\n}\n\n/**\n * Hook to get the current location\n * \n * @returns Current location object with pathname and state\n * \n * @example\n * ```tsx\n * function MyComponent() {\n * const location = useLocation();\n * \n * console.log('Current path:', location.pathname);\n * console.log('Location state:', location.state);\n * console.log('Is active:', location.isActive);\n * \n * return <div>Current path: {location.pathname}</div>;\n * }\n * ```\n */\nexport function useLocation(): Location & { isActive: boolean } {\n const context = useRouteContext();\n \n // Create location object from context\n const location = useMemo(() => {\n // For active routes, return the current location with state\n if (context.isActive) {\n return {\n pathname: context.path || context.activePath || WebFRouter.path,\n state: context.params,\n isActive: true,\n key: `${context.path}-active-${Date.now()}`\n };\n }\n \n // For inactive routes, return the global location without state\n return {\n pathname: context.activePath || WebFRouter.path,\n state: undefined,\n isActive: false,\n key: `${context.activePath}-inactive`\n };\n }, [context.isActive, context.path, context.activePath, context.params]);\n \n return location;\n}\n\n/**\n * Route configuration object\n */\nexport interface RouteObject {\n /**\n * Path for the route\n */\n path: string;\n /**\n * Element to render for this route\n */\n element: React.ReactNode;\n /**\n * Whether to pre-render this route\n */\n prerender?: boolean;\n /**\n * Child routes (not supported yet)\n */\n children?: RouteObject[];\n}\n\n/**\n * Props for the Routes component\n */\nexport interface RoutesProps {\n /**\n * Route components as children\n */\n children: React.ReactNode;\n}\n\n/**\n * Routes component that wraps multiple Route components and provides shared context\n * \n * @example\n * ```tsx\n * <Routes sharedData={{ user: currentUser, theme: 'dark' }}>\n * <Route path=\"/\" element={<Home />} />\n * <Route path=\"/about\" element={<About />} />\n * <Route path=\"/profile\" element={<Profile />} />\n * </Routes>\n * ```\n */\n/**\n * Route-specific context provider that only updates when the route is active\n */\nfunction RouteContextProvider({ path, children }: { path: string, children: React.ReactNode }) {\n const globalContext = useContext(RouteContext);\n \n // Create a route-specific context that only updates when this route is active\n const routeSpecificContext = useMemo(() => {\n // Only update if this route is the active one\n if (globalContext.activePath === path) {\n return {\n path,\n params: globalContext.params,\n activePath: globalContext.activePath,\n routeEventKind: globalContext.routeEventKind\n };\n }\n // Return previous values if not active\n return {\n path,\n params: undefined,\n activePath: globalContext.activePath,\n routeEventKind: undefined\n };\n }, [path, globalContext.activePath, globalContext.params, globalContext.routeEventKind]);\n\n return (\n <RouteContext.Provider value={routeSpecificContext}>\n {children}\n </RouteContext.Provider>\n );\n}\n\nexport function Routes({ children }: RoutesProps) {\n // State to track current route information\n const [routeState, setRouteState] = useState({\n activePath: WebFRouter.path,\n params: WebFRouter.state,\n routeEventKind: undefined as 'didPushNext' | 'didPush' | 'didPop' | 'didPupNext' | undefined\n });\n\n // Listen to hybridrouterchange event\n useEffect(() => {\n const handleRouteChange = (event: Event) => {\n const routeEvent = event as unknown as HybridRouterChangeEvent;\n console.log(routeEvent);\n \n // Only update activePath for push events\n const newActivePath = (routeEvent.kind === 'didPushNext' || routeEvent.kind === 'didPush') \n ? routeEvent.path \n : routeState.activePath;\n \n // Update state based on event kind\n setRouteState({\n activePath: newActivePath,\n params: routeEvent.state,\n routeEventKind: routeEvent.kind\n });\n };\n\n // Add event listener\n document.addEventListener('hybridrouterchange', handleRouteChange);\n\n // Cleanup on unmount\n return () => {\n document.removeEventListener('hybridrouterchange', handleRouteChange);\n };\n }, [routeState.activePath]);\n\n // Global context value\n const globalContextValue = useMemo(() => ({\n path: undefined,\n params: routeState.params,\n activePath: routeState.activePath,\n routeEventKind: routeState.routeEventKind\n }), [routeState.activePath, routeState.params, routeState.routeEventKind]);\n\n // Wrap each Route component with its own context provider\n const wrappedChildren = useMemo(() => {\n return Children.map(children, (child: React.ReactNode) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n // Ensure only Route components are direct children\n if (child.type !== Route) {\n console.warn('Routes component should only contain Route components as direct children');\n return child;\n }\n\n // Wrap each Route with its own context provider\n const routePath = child.props.path;\n return (\n <RouteContextProvider key={routePath} path={routePath}>\n {child}\n </RouteContextProvider>\n );\n });\n }, [children]);\n\n return (\n <RouteContext.Provider value={globalContextValue}>\n {wrappedChildren}\n </RouteContext.Provider>\n );\n}\n\n/**\n * Hook to create routes from a configuration object\n * \n * @param routes Array of route configuration objects\n * @returns React element tree of Routes and Route components\n * \n * @example\n * ```tsx\n * function App() {\n * const routes = useRoutes([\n * { path: '/', element: <Home /> },\n * { path: '/about', element: <About /> },\n * { path: '/users', element: <Users /> },\n * { path: '/contact', element: <Contact /> }\n * ]);\n * \n * return routes;\n * }\n * ```\n */\nexport function useRoutes(routes: RouteObject[]): React.ReactElement | null {\n // Convert route objects to Route components\n const routeElements = useMemo(() => {\n return routes.map((route) => {\n if (route.children && route.children.length > 0) {\n console.warn('Nested routes are not supported yet');\n }\n \n return (\n <Route\n key={route.path}\n path={route.path}\n element={route.element}\n prerender={route.prerender}\n />\n );\n });\n }, [routes]);\n\n // Return Routes component with Route children\n return <Routes>{routeElements}</Routes>;\n}\n\n\n/**\n * Navigation function type\n */\nexport interface NavigateFunction {\n (to: string, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\n/**\n * Navigation options\n */\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Extended navigation object with additional methods\n */\nexport interface NavigationMethods {\n /**\n * Navigate to a route or go back\n */\n navigate: NavigateFunction;\n \n /**\n * Close the current screen and return to the previous one\n */\n pop: (result?: any) => void;\n \n /**\n * Pop routes until reaching a specific route\n */\n popUntil: (path: string) => void;\n \n /**\n * Pop the current route and push a new route\n */\n popAndPush: (path: string, state?: any) => Promise<void>;\n \n /**\n * Push a new route and remove all routes until a specific route\n */\n pushAndRemoveUntil: (newPath: string, untilPath: string, state?: any) => Promise<void>;\n \n /**\n * Check if the navigator can go back\n */\n canPop: () => boolean;\n \n /**\n * Pop the current route if possible\n */\n maybePop: (result?: any) => boolean;\n}\n\n/**\n * Hook to navigate between routes programmatically\n * \n * @example\n * ```tsx\n * function LoginPage() {\n * const { navigate, pop, canPop } = useNavigate();\n * \n * const handleLogin = async () => {\n * await login();\n * navigate('/dashboard');\n * };\n * \n * const handleReplace = () => {\n * navigate('/home', { replace: true });\n * };\n * \n * const handleWithState = () => {\n * navigate('/profile', { state: { from: 'login' } });\n * };\n * \n * const goBack = () => {\n * if (canPop()) {\n * pop();\n * } else {\n * navigate('/');\n * }\n * };\n * }\n * ```\n */\nexport function useNavigate(): NavigationMethods {\n return useMemo(() => {\n function navigate(to: string | number, options?: NavigateOptions): void {\n if (typeof to === 'number') {\n // Handle relative navigation (e.g., -1 for back)\n if (to === -1) {\n WebFRouter.back();\n } else {\n console.warn('Relative navigation other than -1 is not supported yet');\n }\n return;\n }\n\n // Handle absolute navigation\n if (options?.replace) {\n WebFRouter.replace(to, options.state);\n } else {\n WebFRouter.push(to, options?.state);\n }\n }\n\n return {\n navigate: navigate as NavigateFunction,\n pop: WebFRouter.pop,\n popUntil: WebFRouter.popUntil,\n popAndPush: WebFRouter.popAndPushNamed,\n pushAndRemoveUntil: WebFRouter.pushNamedAndRemoveUntilRoute,\n canPop: WebFRouter.canPop,\n maybePop: WebFRouter.maybePop\n };\n }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