@idealyst/navigation 1.0.83 → 1.0.85

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/CLAUDE.md DELETED
@@ -1,417 +0,0 @@
1
- # @idealyst/navigation - LLM Documentation
2
-
3
- This file provides comprehensive navigation documentation for LLMs working with the @idealyst/navigation library.
4
-
5
- ## Library Overview
6
-
7
- @idealyst/navigation is a cross-platform navigation library with:
8
- - Unified API for React and React Native
9
- - Built on React Navigation (Native) and React Router (Web)
10
- - 4 layout types: stack, tab, drawer, modal
11
- - Theme system integration
12
- - Complete working examples for quick start
13
-
14
- ## Quick Start with Examples
15
-
16
- The fastest way to get started is using pre-built example routers:
17
-
18
- ```tsx
19
- import { NavigatorProvider } from '@idealyst/navigation';
20
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
21
-
22
- // Instant working app with header, sidebar, and component examples
23
- <NavigatorProvider route={ExampleStackRouter} />
24
- ```
25
-
26
- ## Core Components
27
-
28
- ### NavigatorProvider
29
- Root provider that wraps the entire app:
30
-
31
- ```tsx
32
- <NavigatorProvider route={routeConfig}>
33
- {/* App content handled by router */}
34
- </NavigatorProvider>
35
- ```
36
-
37
- ### useNavigator Hook
38
- Access navigation from any component:
39
-
40
- ```tsx
41
- import { useNavigator } from '@idealyst/navigation';
42
-
43
- const navigator = useNavigator();
44
- navigator.navigate({ path: "/profile", vars: { id: "123" } });
45
- ```
46
-
47
- ## Route Configuration
48
-
49
- Define app navigation structure with `RouteParam`:
50
-
51
- ```tsx
52
- const AppRouter: RouteParam = {
53
- path: "/",
54
- component: HomeScreen,
55
- layout: { type: "stack" }, // "stack" | "tab" | "drawer" | "modal"
56
- routes: [
57
- { path: "profile", component: ProfileScreen },
58
- { path: "settings", component: SettingsScreen },
59
- ],
60
- };
61
- ```
62
-
63
- ## Layout Types
64
-
65
- ### Stack Layout
66
- Linear navigation (most common):
67
- ```tsx
68
- layout: { type: "stack" }
69
- ```
70
- - **Use for**: Most mobile apps, hierarchical navigation
71
- - **Platform**: Native stack (RN), browser history (Web)
72
-
73
- ### Tab Layout
74
- Section-based navigation:
75
- ```tsx
76
- layout: { type: "tab" }
77
- ```
78
- - **Use for**: Main app sections, content browsing
79
- - **Platform**: Bottom tabs (RN), top/side tabs (Web)
80
-
81
- ### Drawer Layout
82
- Side menu navigation:
83
- ```tsx
84
- layout: { type: "drawer" }
85
- ```
86
- - **Use for**: Desktop apps, admin panels
87
- - **Platform**: Gesture drawer (RN), sidebar (Web)
88
-
89
- ### Modal Layout
90
- Overlay navigation:
91
- ```tsx
92
- layout: { type: "modal" }
93
- ```
94
- - **Use for**: Forms, dialogs, temporary content
95
- - **Platform**: Modal presentation (RN), overlay (Web)
96
-
97
- ## Navigation Patterns
98
-
99
- ### Basic Navigation
100
- ```tsx
101
- const navigator = useNavigator();
102
- navigator.navigate({ path: "/settings", vars: {} });
103
- ```
104
-
105
- ### With Parameters
106
- ```tsx
107
- navigator.navigate({
108
- path: "/user/:id",
109
- vars: { id: "123" }
110
- });
111
- ```
112
-
113
- ### Nested Routes
114
- ```tsx
115
- const router: RouteParam = {
116
- path: "/",
117
- component: HomeScreen,
118
- layout: { type: "stack" },
119
- routes: [
120
- {
121
- path: "dashboard",
122
- component: DashboardScreen,
123
- layout: { type: "tab" },
124
- routes: [
125
- { path: "analytics", component: AnalyticsScreen },
126
- { path: "reports", component: ReportsScreen },
127
- ],
128
- },
129
- ],
130
- };
131
- ```
132
-
133
- ## GeneralLayout Component
134
-
135
- Flexible layout with header and sidebar:
136
-
137
- ```tsx
138
- import { GeneralLayout } from '@idealyst/navigation';
139
-
140
- <GeneralLayout
141
- header={{
142
- enabled: true,
143
- content: <Text>My App</Text>,
144
- }}
145
- sidebar={{
146
- enabled: true,
147
- collapsible: true,
148
- position: 'left',
149
- content: <NavigationMenu />,
150
- }}
151
- >
152
- {children}
153
- </GeneralLayout>
154
- ```
155
-
156
- ### Header Configuration
157
- - `enabled`: Show/hide header
158
- - `height`: Header height (pixels)
159
- - `content`: Header content (React component)
160
- - `style`: Custom styles
161
-
162
- ### Sidebar Configuration
163
- - `enabled`: Show/hide sidebar
164
- - `collapsible`: Allow collapse/expand
165
- - `position`: 'left' or 'right'
166
- - `initiallyExpanded`: Initial state
167
- - `expandedWidth`/`collapsedWidth`: Sidebar widths
168
- - `content`: Sidebar content (React component)
169
-
170
- ## Example Routers (Quick Start)
171
-
172
- ### ExampleStackRouter
173
- Desktop/web app with header and sidebar:
174
- ```tsx
175
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
176
- <NavigatorProvider route={ExampleStackRouter} />
177
- ```
178
-
179
- **Features**: Header, collapsible sidebar, theme controls, all component examples
180
-
181
- ### ExampleTabRouter
182
- Mobile app with tab navigation:
183
- ```tsx
184
- import { ExampleTabRouter } from '@idealyst/navigation/examples';
185
- <NavigatorProvider route={ExampleTabRouter} />
186
- ```
187
-
188
- **Features**: Tab navigation, component examples, theme controls
189
-
190
- ### ExampleDrawerRouter
191
- Desktop app with drawer menu:
192
- ```tsx
193
- import { ExampleDrawerRouter } from '@idealyst/navigation/examples';
194
- <NavigatorProvider route={ExampleDrawerRouter} />
195
- ```
196
-
197
- **Features**: Slide-out drawer, organized navigation, component examples
198
-
199
- ## Theme Integration
200
-
201
- All navigation components integrate with @idealyst/theme:
202
-
203
- ```tsx
204
- // Theme switching works automatically
205
- import { UnistylesRuntime } from 'react-native-unistyles';
206
- UnistylesRuntime.setTheme('dark');
207
- UnistylesRuntime.setTheme('lightHighContrast');
208
- ```
209
-
210
- ### Theme Utilities
211
- ```tsx
212
- import {
213
- getNextTheme,
214
- getThemeDisplayName,
215
- isHighContrastTheme
216
- } from '@idealyst/navigation/examples/unistyles';
217
- ```
218
-
219
- ## Custom Layouts
220
-
221
- Create custom layout components:
222
-
223
- ```tsx
224
- const CustomLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
225
- <GeneralLayout
226
- header={{ content: <CustomHeader /> }}
227
- sidebar={{ content: <CustomSidebar /> }}
228
- >
229
- {children}
230
- </GeneralLayout>
231
- );
232
-
233
- const router: RouteParam = {
234
- layout: { type: "stack", component: CustomLayout },
235
- // ...
236
- };
237
- ```
238
-
239
- ## Common Patterns
240
-
241
- ### Dashboard Layout
242
- ```tsx
243
- <GeneralLayout
244
- header={{
245
- content: (
246
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
247
- <Text size="large" weight="bold">Dashboard</Text>
248
- <UserMenu />
249
- </View>
250
- ),
251
- }}
252
- sidebar={{
253
- enabled: true,
254
- collapsible: true,
255
- content: <NavigationMenu />,
256
- }}
257
- >
258
- {children}
259
- </GeneralLayout>
260
- ```
261
-
262
- ### Mobile App Structure
263
- ```tsx
264
- const MobileRouter: RouteParam = {
265
- path: "/",
266
- component: HomeScreen,
267
- layout: { type: "tab" },
268
- routes: [
269
- { path: "feed", component: FeedScreen },
270
- { path: "search", component: SearchScreen },
271
- { path: "profile", component: ProfileScreen },
272
- ],
273
- };
274
- ```
275
-
276
- ### Admin Interface
277
- ```tsx
278
- const AdminRouter: RouteParam = {
279
- path: "/admin",
280
- component: AdminDashboard,
281
- layout: {
282
- type: "drawer",
283
- component: AdminLayout,
284
- },
285
- routes: [
286
- { path: "users", component: UserManagement },
287
- { path: "settings", component: AdminSettings },
288
- ],
289
- };
290
- ```
291
-
292
- ## Route Guards and Conditional Navigation
293
-
294
- ```tsx
295
- const ProtectedRoute: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
296
- const { user } = useAuth();
297
- return user ? <>{children}</> : <LoginScreen />;
298
- };
299
-
300
- const router: RouteParam = {
301
- path: "/dashboard",
302
- component: ProtectedRoute,
303
- routes: [
304
- // Protected routes here
305
- ],
306
- };
307
- ```
308
-
309
- ## Platform Differences
310
-
311
- ### React Native
312
- - Uses React Navigation internally
313
- - Native animations and gestures
314
- - Hardware back button support
315
- - Bottom tab navigation
316
-
317
- ### Web
318
- - Uses React Router internally
319
- - Browser URL integration
320
- - Keyboard navigation
321
- - Top tab or sidebar navigation
322
-
323
- The API remains identical across platforms.
324
-
325
- ## Best Practices for LLMs
326
-
327
- 1. **Start with examples** - Use ExampleStackRouter, ExampleTabRouter, or ExampleDrawerRouter
328
- 2. **Choose appropriate layouts** - Stack for mobile, tabs for sections, drawer for desktop
329
- 3. **Use GeneralLayout** for header/sidebar layouts
330
- 4. **Keep routes shallow** - Avoid deeply nested structures
331
- 5. **Leverage theme integration** - Components automatically adapt to theme changes
332
- 6. **Test cross-platform** - Verify navigation works on both React and React Native
333
-
334
- ## File-Based Documentation Access
335
-
336
- Complete documentation is available as markdown files:
337
-
338
- ```bash
339
- # Main overview
340
- README.md
341
-
342
- # Component-specific documentation
343
- src/context/README.md # Navigation context and providers
344
- src/routing/README.md # Core routing system
345
- src/layouts/GeneralLayout/README.md # Layout component
346
- src/examples/README.md # Example routers and quick start
347
-
348
- # LLM-optimized reference
349
- CLAUDE.md # This file
350
- ```
351
-
352
- ## Import Patterns
353
-
354
- ```tsx
355
- // Core navigation
356
- import { NavigatorProvider, useNavigator } from '@idealyst/navigation';
357
-
358
- // Layout components
359
- import { GeneralLayout } from '@idealyst/navigation';
360
-
361
- // Example routers (quick start)
362
- import {
363
- ExampleStackRouter,
364
- ExampleTabRouter,
365
- ExampleDrawerRouter
366
- } from '@idealyst/navigation/examples';
367
-
368
- // Theme utilities
369
- import { getNextTheme } from '@idealyst/navigation/examples/unistyles';
370
- ```
371
-
372
- ## TypeScript Support
373
-
374
- Full type safety for navigation:
375
-
376
- ```tsx
377
- // Route configuration is typed
378
- const router: RouteParam = {
379
- path: "/users/:id",
380
- component: UserScreen,
381
- // TypeScript validates structure
382
- };
383
-
384
- // Navigation is type-safe
385
- type NavigateParams = {
386
- path: string;
387
- vars: Record<string, string>;
388
- };
389
- ```
390
-
391
- ## Quick Reference
392
-
393
- ### Essential Imports
394
- ```tsx
395
- import { NavigatorProvider, useNavigator } from '@idealyst/navigation';
396
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
397
- ```
398
-
399
- ### Minimal Setup
400
- ```tsx
401
- <NavigatorProvider route={ExampleStackRouter} />
402
- ```
403
-
404
- ### Navigation Usage
405
- ```tsx
406
- const navigator = useNavigator();
407
- navigator.navigate({ path: "/route", vars: {} });
408
- ```
409
-
410
- ### Custom Layout
411
- ```tsx
412
- <GeneralLayout header={{...}} sidebar={{...}}>
413
- {children}
414
- </GeneralLayout>
415
- ```
416
-
417
- This provides everything needed to build sophisticated cross-platform navigation experiences with minimal code.
@@ -1,166 +0,0 @@
1
- # LLM Documentation Access Guide - Navigation
2
-
3
- This guide explains exactly how LLMs can access @idealyst/navigation documentation in real-world scenarios.
4
-
5
- ## Scenario 1: Working in a Project with the Package Installed
6
-
7
- When helping a developer who has `@idealyst/navigation` installed in their project:
8
-
9
- ### Quick Overview
10
- ```bash
11
- # Read the main documentation file
12
- cat node_modules/@idealyst/navigation/CLAUDE.md
13
- ```
14
- This gives you everything in one file - all components, layouts, examples, and patterns.
15
-
16
- ### Specific Component Details
17
- ```bash
18
- # Navigation context and providers
19
- cat node_modules/@idealyst/navigation/src/context/README.md
20
-
21
- # Core routing system
22
- cat node_modules/@idealyst/navigation/src/routing/README.md
23
-
24
- # GeneralLayout component
25
- cat node_modules/@idealyst/navigation/src/layouts/GeneralLayout/README.md
26
-
27
- # Example routers and quick start
28
- cat node_modules/@idealyst/navigation/src/examples/README.md
29
- ```
30
-
31
- ### Component Discovery
32
- ```bash
33
- # See all available documentation
34
- ls node_modules/@idealyst/navigation/src/*/README.md
35
-
36
- # Will show:
37
- # node_modules/@idealyst/navigation/src/context/README.md
38
- # node_modules/@idealyst/navigation/src/routing/README.md
39
- # node_modules/@idealyst/navigation/src/layouts/GeneralLayout/README.md
40
- # node_modules/@idealyst/navigation/src/examples/README.md
41
- ```
42
-
43
- ## Scenario 2: Repository/GitHub Access
44
-
45
- When working with the source repository or GitHub:
46
-
47
- ### Main Documentation
48
- - `packages/navigation/README.md` - Complete overview with examples
49
- - `packages/navigation/CLAUDE.md` - LLM-optimized quick reference
50
-
51
- ### Component Documentation
52
- - `packages/navigation/src/context/README.md` - Navigation context system
53
- - `packages/navigation/src/routing/README.md` - Core routing engine
54
- - `packages/navigation/src/layouts/GeneralLayout/README.md` - Layout component
55
- - `packages/navigation/src/examples/README.md` - Example routers
56
-
57
- ## Scenario 3: Package Manager Info
58
-
59
- ```bash
60
- # View package information
61
- npm info @idealyst/navigation
62
-
63
- # View package README
64
- npm docs @idealyst/navigation
65
-
66
- # Download and examine (if needed)
67
- npm pack @idealyst/navigation
68
- tar -tf idealyst-navigation-*.tgz | grep README
69
- ```
70
-
71
- ## Recommended LLM Workflow
72
-
73
- ### Step 1: Quick Reference
74
- Start with `CLAUDE.md` for:
75
- - All navigation components and patterns
76
- - Layout types (stack, tab, drawer, modal)
77
- - Example router usage
78
- - Quick setup instructions
79
-
80
- ### Step 2: Specific Component Help
81
- When user asks about specific navigation features:
82
- 1. Read relevant README.md file for complete details
83
- 2. Use the detailed API reference, examples, and best practices
84
-
85
- ### Step 3: Example Router Discovery
86
- When user asks "how do I create navigation":
87
- 1. Point to example routers in `src/examples/README.md`
88
- 2. Show ExampleStackRouter, ExampleTabRouter, ExampleDrawerRouter
89
- 3. Explain customization approaches
90
-
91
- ## File Locations Summary
92
-
93
- ```
94
- @idealyst/navigation/
95
- ├── README.md # Complete overview + examples
96
- ├── CLAUDE.md # LLM quick reference (START HERE)
97
- ├── LLM-ACCESS-GUIDE.md # This access guide
98
- ├── src/
99
- │ ├── context/README.md # Navigation context & providers
100
- │ ├── routing/README.md # Core routing system
101
- │ ├── layouts/
102
- │ │ └── GeneralLayout/README.md # Layout component docs
103
- │ └── examples/README.md # Example routers & quick start
104
- ```
105
-
106
- ## Pro Tips for LLMs
107
-
108
- 1. **Always start with `CLAUDE.md`** - it has everything you need for 90% of navigation questions
109
- 2. **Example routers are key** - ExampleStackRouter, ExampleTabRouter, ExampleDrawerRouter provide working starting points
110
- 3. **Layout types matter** - stack (mobile), tab (sections), drawer (desktop), modal (overlays)
111
- 4. **GeneralLayout is powerful** - flexible header/sidebar component for custom layouts
112
- 5. **Theme integration is automatic** - all navigation components work with @idealyst/theme
113
-
114
- ## Quick Command Reference
115
-
116
- ```bash
117
- # Essential reads for any LLM session
118
- cat CLAUDE.md # Complete navigation reference
119
- cat README.md # Overview + example implementations
120
-
121
- # Specific component help
122
- cat src/context/README.md # Navigation context
123
- cat src/routing/README.md # Routing system
124
- cat src/layouts/GeneralLayout/README.md # Layout component
125
- cat src/examples/README.md # Example routers
126
-
127
- # Discovery
128
- ls src/*/README.md # List all component docs
129
- ```
130
-
131
- ## Navigation-Specific Guidance
132
-
133
- ### For "How do I set up navigation?" questions:
134
- 1. Start with `src/examples/README.md`
135
- 2. Show ExampleStackRouter for desktop/web apps
136
- 3. Show ExampleTabRouter for mobile apps
137
- 4. Show ExampleDrawerRouter for complex desktop interfaces
138
-
139
- ### For "How do I customize navigation?" questions:
140
- 1. Read `src/routing/README.md` for route configuration
141
- 2. Read `src/layouts/GeneralLayout/README.md` for layout customization
142
- 3. Show example router customization patterns
143
-
144
- ### For "How does cross-platform navigation work?" questions:
145
- 1. Reference `src/routing/README.md` platform differences section
146
- 2. Explain React Navigation (Native) vs React Router (Web) integration
147
- 3. Show unified API examples
148
-
149
- ### For "What layout should I use?" questions:
150
- - **Stack**: Most mobile apps, hierarchical navigation
151
- - **Tab**: Main app sections, content browsing
152
- - **Drawer**: Desktop apps, admin panels, many sections
153
- - **Modal**: Forms, dialogs, temporary content
154
-
155
- ## Common User Questions and File References
156
-
157
- | User Question | Primary Reference | Secondary References |
158
- |---------------|------------------|---------------------|
159
- | "How do I set up navigation?" | `src/examples/README.md` | `CLAUDE.md`, `README.md` |
160
- | "What's the difference between layout types?" | `src/routing/README.md` | `CLAUDE.md` |
161
- | "How do I create a header and sidebar?" | `src/layouts/GeneralLayout/README.md` | `src/examples/README.md` |
162
- | "How do I navigate between screens?" | `src/context/README.md` | `CLAUDE.md` |
163
- | "Can you show me a working example?" | `src/examples/README.md` | `README.md` |
164
- | "How does this work on mobile vs web?" | `src/routing/README.md` | `src/context/README.md` |
165
-
166
- This approach ensures LLMs have clear, practical access to all navigation documentation while understanding the quick-start nature of the example routers.