@thelacanians/vue-native-navigation 0.1.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,376 @@
1
+ import * as _vue_runtime_core from '@vue/runtime-core';
2
+ import { Component, ShallowRef, Ref, ComputedRef } from '@vue/runtime-core';
3
+
4
+ interface RouteConfig {
5
+ name: string;
6
+ component: Component;
7
+ options?: RouteOptions;
8
+ }
9
+ interface RouteOptions {
10
+ title?: string;
11
+ headerShown?: boolean;
12
+ animation?: 'push' | 'modal' | 'fade' | 'none';
13
+ tabBarLabel?: string;
14
+ tabBarIcon?: string;
15
+ }
16
+ /**
17
+ * @deprecated Use RouteOptions instead.
18
+ */
19
+ type NavigationOptions = RouteOptions;
20
+ interface RouteEntry {
21
+ config: RouteConfig;
22
+ params: Record<string, any>;
23
+ key: number;
24
+ }
25
+ interface RouteLocation {
26
+ name: string;
27
+ params: Record<string, any>;
28
+ options: RouteOptions;
29
+ }
30
+ interface RouterInstance {
31
+ /** The currently visible route entry (shallowRef). */
32
+ currentRoute: ShallowRef<RouteEntry>;
33
+ /** Full navigation stack (ref). */
34
+ stack: Ref<RouteEntry[]>;
35
+ /** Push a new route onto the stack. */
36
+ navigate(name: string, params?: Record<string, any>): void;
37
+ /** Alias for navigate — preferred name in new API. */
38
+ push(name: string, params?: Record<string, any>): void;
39
+ /** Pop the current route off the stack. */
40
+ goBack(): void;
41
+ /** Alias for goBack — preferred name in new API. */
42
+ pop(): void;
43
+ /** Replace the current route without adding to the stack. */
44
+ replace(name: string, params?: Record<string, any>): void;
45
+ /** Reset the stack to a single route. */
46
+ reset(name: string, params?: Record<string, any>): void;
47
+ /** Whether there is a previous route to go back to. */
48
+ canGoBack: ComputedRef<boolean>;
49
+ /** Install into a Vue app (app.use(router)). */
50
+ install(app: any): void;
51
+ }
52
+ interface TabBarItem {
53
+ name: string;
54
+ label?: string;
55
+ icon?: string;
56
+ }
57
+ declare function createRouter(routes: RouteConfig[]): RouterInstance;
58
+ declare function useRouter(): RouterInstance;
59
+ /**
60
+ * Returns a ComputedRef<RouteLocation> for the nearest enclosing route screen.
61
+ * When used inside RouterView, each screen gets its own route context.
62
+ * Falls back to the global router's currentRoute if no per-screen context exists.
63
+ */
64
+ declare function useRoute(): ComputedRef<RouteLocation>;
65
+ /**
66
+ * Renders the router's navigation stack.
67
+ *
68
+ * All routes in the history are mounted simultaneously (so back navigation
69
+ * is instant — no remounting). Only the top screen is fully visible; screens
70
+ * below it are slid off to the right via `transform: [{ translateX: 1000 }]`.
71
+ *
72
+ * The top screen slides in from the right on push and slides back out to the
73
+ * right on pop, giving the standard iOS "slide" push/pop feel.
74
+ *
75
+ * Per-screen route context is provided via RouteProvider so that useRoute()
76
+ * inside each screen component returns the correct route.
77
+ *
78
+ * @example
79
+ * <RouterView />
80
+ */
81
+ declare const RouterView: _vue_runtime_core.DefineComponent<{}, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
82
+ [key: string]: any;
83
+ }>, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {}, string, _vue_runtime_core.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
84
+ /**
85
+ * A navigation header bar with a centered title and an optional back button.
86
+ * Renders as a 44pt tall UIKit-style navigation bar at the top of a screen.
87
+ *
88
+ * @example
89
+ * const router = useRouter()
90
+ * const canGoBack = router.canGoBack
91
+ *
92
+ * <VNavigationBar
93
+ * title="Settings"
94
+ * :show-back="canGoBack"
95
+ * @back="router.pop()"
96
+ * />
97
+ */
98
+ declare const VNavigationBar: _vue_runtime_core.DefineComponent<_vue_runtime_core.ExtractPropTypes<{
99
+ /** Screen title, rendered centered in the bar. */
100
+ title: {
101
+ type: StringConstructor;
102
+ default: string;
103
+ };
104
+ /** Whether to show the back chevron + backTitle on the left. */
105
+ showBack: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
109
+ /** Text shown next to the back chevron. Defaults to "Back". */
110
+ backTitle: {
111
+ type: StringConstructor;
112
+ default: string;
113
+ };
114
+ /** Background colour of the bar. */
115
+ backgroundColor: {
116
+ type: StringConstructor;
117
+ default: string;
118
+ };
119
+ /** Colour used for the back button text. */
120
+ tintColor: {
121
+ type: StringConstructor;
122
+ default: string;
123
+ };
124
+ /** Colour of the title text. */
125
+ titleColor: {
126
+ type: StringConstructor;
127
+ default: string;
128
+ };
129
+ }>, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
130
+ [key: string]: any;
131
+ }>, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, "back"[], "back", _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
132
+ /** Screen title, rendered centered in the bar. */
133
+ title: {
134
+ type: StringConstructor;
135
+ default: string;
136
+ };
137
+ /** Whether to show the back chevron + backTitle on the left. */
138
+ showBack: {
139
+ type: BooleanConstructor;
140
+ default: boolean;
141
+ };
142
+ /** Text shown next to the back chevron. Defaults to "Back". */
143
+ backTitle: {
144
+ type: StringConstructor;
145
+ default: string;
146
+ };
147
+ /** Background colour of the bar. */
148
+ backgroundColor: {
149
+ type: StringConstructor;
150
+ default: string;
151
+ };
152
+ /** Colour used for the back button text. */
153
+ tintColor: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ /** Colour of the title text. */
158
+ titleColor: {
159
+ type: StringConstructor;
160
+ default: string;
161
+ };
162
+ }>> & Readonly<{
163
+ onBack?: ((...args: any[]) => any) | undefined;
164
+ }>, {
165
+ title: string;
166
+ showBack: boolean;
167
+ backTitle: string;
168
+ backgroundColor: string;
169
+ tintColor: string;
170
+ titleColor: string;
171
+ }, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
172
+ /**
173
+ * A bottom tab bar that lets users switch between top-level sections.
174
+ * Uses v-model (modelValue / update:modelValue) to track the active tab name.
175
+ *
176
+ * @example
177
+ * const activeTab = ref('home')
178
+ *
179
+ * <VTabBar
180
+ * :tabs="[
181
+ * { name: 'home', label: 'Home', icon: '🏠' },
182
+ * { name: 'settings', label: 'Settings', icon: '⚙️' },
183
+ * ]"
184
+ * v-model="activeTab"
185
+ * />
186
+ */
187
+ declare const VTabBar: _vue_runtime_core.DefineComponent<_vue_runtime_core.ExtractPropTypes<{
188
+ /** Array of tab descriptors. */
189
+ tabs: {
190
+ type: () => TabBarItem[];
191
+ required: true;
192
+ };
193
+ /** Name of the currently active tab (v-model). */
194
+ modelValue: {
195
+ type: StringConstructor;
196
+ default: string;
197
+ };
198
+ /** Text / icon colour for the active tab. */
199
+ activeColor: {
200
+ type: StringConstructor;
201
+ default: string;
202
+ };
203
+ /** Text / icon colour for inactive tabs. */
204
+ inactiveColor: {
205
+ type: StringConstructor;
206
+ default: string;
207
+ };
208
+ /** Background colour of the tab bar. */
209
+ backgroundColor: {
210
+ type: StringConstructor;
211
+ default: string;
212
+ };
213
+ }>, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
214
+ [key: string]: any;
215
+ }>, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
216
+ /** Array of tab descriptors. */
217
+ tabs: {
218
+ type: () => TabBarItem[];
219
+ required: true;
220
+ };
221
+ /** Name of the currently active tab (v-model). */
222
+ modelValue: {
223
+ type: StringConstructor;
224
+ default: string;
225
+ };
226
+ /** Text / icon colour for the active tab. */
227
+ activeColor: {
228
+ type: StringConstructor;
229
+ default: string;
230
+ };
231
+ /** Text / icon colour for inactive tabs. */
232
+ inactiveColor: {
233
+ type: StringConstructor;
234
+ default: string;
235
+ };
236
+ /** Background colour of the tab bar. */
237
+ backgroundColor: {
238
+ type: StringConstructor;
239
+ default: string;
240
+ };
241
+ }>> & Readonly<{
242
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
243
+ }>, {
244
+ backgroundColor: string;
245
+ modelValue: string;
246
+ activeColor: string;
247
+ inactiveColor: string;
248
+ }, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
249
+ interface TabScreenConfig {
250
+ name: string;
251
+ label?: string;
252
+ icon?: string;
253
+ component: Component;
254
+ }
255
+ /**
256
+ * Create a self-contained tab-based navigator.
257
+ *
258
+ * Returns a `TabNavigator` component and a reactive `activeTab` ref.
259
+ * Each screen is declared using `TabScreen` props passed directly to
260
+ * `TabNavigator` via the `screens` prop, keeping the setup ergonomic
261
+ * without requiring render-function slot tricks.
262
+ *
263
+ * @example
264
+ * const { TabNavigator } = createTabNavigator()
265
+ *
266
+ * // In your render / template:
267
+ * <TabNavigator
268
+ * :screens="[
269
+ * { name: 'home', label: 'Home', icon: '🏠', component: HomeView },
270
+ * { name: 'settings', label: 'Settings', icon: '⚙️', component: SettingsView },
271
+ * ]"
272
+ * />
273
+ */
274
+ declare function createTabNavigator(): {
275
+ TabNavigator: _vue_runtime_core.DefineComponent<_vue_runtime_core.ExtractPropTypes<{
276
+ /** Ordered list of tab screen descriptors. */
277
+ screens: {
278
+ type: () => TabScreenConfig[];
279
+ required: true;
280
+ };
281
+ /** Which tab is shown first. Defaults to the first screen. */
282
+ initialTab: {
283
+ type: StringConstructor;
284
+ default: string;
285
+ };
286
+ /** Active tab icon / label colour. */
287
+ activeColor: {
288
+ type: StringConstructor;
289
+ default: string;
290
+ };
291
+ /** Inactive tab icon / label colour. */
292
+ inactiveColor: {
293
+ type: StringConstructor;
294
+ default: string;
295
+ };
296
+ /** Background colour of the tab bar. */
297
+ tabBarBackgroundColor: {
298
+ type: StringConstructor;
299
+ default: string;
300
+ };
301
+ }>, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
302
+ [key: string]: any;
303
+ }> | null, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {}, string, _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
304
+ /** Ordered list of tab screen descriptors. */
305
+ screens: {
306
+ type: () => TabScreenConfig[];
307
+ required: true;
308
+ };
309
+ /** Which tab is shown first. Defaults to the first screen. */
310
+ initialTab: {
311
+ type: StringConstructor;
312
+ default: string;
313
+ };
314
+ /** Active tab icon / label colour. */
315
+ activeColor: {
316
+ type: StringConstructor;
317
+ default: string;
318
+ };
319
+ /** Inactive tab icon / label colour. */
320
+ inactiveColor: {
321
+ type: StringConstructor;
322
+ default: string;
323
+ };
324
+ /** Background colour of the tab bar. */
325
+ tabBarBackgroundColor: {
326
+ type: StringConstructor;
327
+ default: string;
328
+ };
329
+ }>> & Readonly<{}>, {
330
+ activeColor: string;
331
+ inactiveColor: string;
332
+ initialTab: string;
333
+ tabBarBackgroundColor: string;
334
+ }, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
335
+ TabScreen: _vue_runtime_core.DefineComponent<_vue_runtime_core.ExtractPropTypes<{
336
+ name: {
337
+ type: StringConstructor;
338
+ required: true;
339
+ };
340
+ label: {
341
+ type: StringConstructor;
342
+ default: undefined;
343
+ };
344
+ icon: {
345
+ type: StringConstructor;
346
+ default: undefined;
347
+ };
348
+ component: {
349
+ type: () => Component;
350
+ required: true;
351
+ };
352
+ }>, () => null, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {}, string, _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
353
+ name: {
354
+ type: StringConstructor;
355
+ required: true;
356
+ };
357
+ label: {
358
+ type: StringConstructor;
359
+ default: undefined;
360
+ };
361
+ icon: {
362
+ type: StringConstructor;
363
+ default: undefined;
364
+ };
365
+ component: {
366
+ type: () => Component;
367
+ required: true;
368
+ };
369
+ }>> & Readonly<{}>, {
370
+ label: string;
371
+ icon: string;
372
+ }, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
373
+ activeTab: Ref<string, string>;
374
+ };
375
+
376
+ export { type NavigationOptions, type RouteConfig, type RouteEntry, type RouteLocation, type RouteOptions, type RouterInstance, RouterView, type TabBarItem, type TabScreenConfig, VNavigationBar, VTabBar, createRouter, createTabNavigator, useRoute, useRouter };