@idealyst/navigation 1.2.21 → 1.2.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/navigation",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "Cross-platform navigation library for React and React Native",
5
5
  "readme": "README.md",
6
6
  "main": "src/index.ts",
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@idealyst/camera": "^1.1.6",
47
- "@idealyst/components": "^1.2.21",
47
+ "@idealyst/components": "^1.2.23",
48
48
  "@idealyst/microphone": "^1.1.7",
49
- "@idealyst/theme": "^1.2.21",
49
+ "@idealyst/theme": "^1.2.23",
50
50
  "@react-navigation/bottom-tabs": ">=7.0.0",
51
51
  "@react-navigation/drawer": ">=7.0.0",
52
52
  "@react-navigation/native": ">=7.0.0",
@@ -71,11 +71,11 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@idealyst/camera": "^1.1.6",
74
- "@idealyst/components": "^1.2.21",
74
+ "@idealyst/components": "^1.2.23",
75
75
  "@idealyst/datagrid": "^1.0.93",
76
76
  "@idealyst/datepicker": "^1.0.93",
77
77
  "@idealyst/microphone": "^1.1.7",
78
- "@idealyst/theme": "^1.2.21",
78
+ "@idealyst/theme": "^1.2.23",
79
79
  "@types/react": "^19.1.8",
80
80
  "@types/react-dom": "^19.1.6",
81
81
  "react": "^19.1.0",
@@ -3,6 +3,7 @@ export * from './context';
3
3
  export * from './layouts';
4
4
  export * from './routing';
5
5
  export * from './hooks';
6
+ export { Linking } from './linking/index.native';
6
7
 
7
8
  // Outlet is a web-only concept (React Router).
8
9
  // On native, we export a no-op component that renders nothing.
package/src/index.ts CHANGED
@@ -2,4 +2,5 @@
2
2
  export * from './context';
3
3
  export * from './layouts';
4
4
  export * from './routing';
5
- export * from './hooks';
5
+ export * from './hooks';
6
+ export * from './linking';
package/src/index.web.ts CHANGED
@@ -7,8 +7,13 @@ export { NavigatorProvider, useNavigator } from './context/NavigatorContext.web'
7
7
  // [DEVCONTAINER FIX] Explicit hook exports to fix Vite re-export resolution
8
8
  // When Vite processes `export * from './index'` -> `export * from './hooks'`,
9
9
  // it doesn't apply .web extension priority for nested re-exports.
10
- // This explicit export ensures useParams is available from @idealyst/navigation.
10
+ // This explicit export ensures hooks are available from @idealyst/navigation.
11
11
  export { useParams } from './hooks/useParams.web';
12
+ export { useCurrentPath } from './hooks/useCurrentPath.web';
13
+ export { useNavigationState } from './hooks/useNavigationState.web';
14
+
15
+ // Explicit Linking export for web
16
+ export { Linking } from './linking/index.web';
12
17
 
13
18
  // Re-export Outlet from React Router for web (no-op on native)
14
19
  export { Outlet } from './router/index.web';
@@ -0,0 +1,18 @@
1
+ import { Linking as RNLinking } from 'react-native';
2
+
3
+ export const Linking = {
4
+ /**
5
+ * Open a URL. On native, uses React Native's Linking API.
6
+ * @param url - The URL to open
7
+ * @param external - Ignored on native (always opens externally)
8
+ * @returns Promise that resolves when the URL is opened
9
+ */
10
+ open: async (url: string, external: boolean = true): Promise<void> => {
11
+ const canOpen = await RNLinking.canOpenURL(url);
12
+ if (canOpen) {
13
+ await RNLinking.openURL(url);
14
+ } else {
15
+ console.warn(`Cannot open URL: ${url}`);
16
+ }
17
+ },
18
+ };
@@ -0,0 +1,15 @@
1
+ export const Linking = {
2
+ /**
3
+ * Open a URL. On web, uses window.open.
4
+ * @param url - The URL to open
5
+ * @param external - If true, opens in a new tab. If false, navigates in current tab.
6
+ * @returns Promise that resolves immediately (web is synchronous)
7
+ */
8
+ open: async (url: string, external: boolean = true): Promise<void> => {
9
+ if (external) {
10
+ window.open(url, '_blank', 'noopener,noreferrer');
11
+ } else {
12
+ window.location.href = url;
13
+ }
14
+ },
15
+ };
@@ -0,0 +1 @@
1
+ export { Linking } from './Linking.native';
@@ -0,0 +1 @@
1
+ export { Linking } from './Linking.native';
@@ -0,0 +1 @@
1
+ export { Linking } from './Linking.web';