@capgo/capacitor-native-navigation 8.0.9

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.
Files changed (36) hide show
  1. package/CapgoNativeNavigation.podspec +17 -0
  2. package/LICENSE +373 -0
  3. package/Package.swift +28 -0
  4. package/README.md +858 -0
  5. package/android/build.gradle +61 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/app/capgo/nativenavigation/NativeNavigation.java +8 -0
  8. package/android/src/main/java/app/capgo/nativenavigation/NativeNavigationPlugin.java +1322 -0
  9. package/android/src/main/res/.gitkeep +0 -0
  10. package/dist/docs.json +1369 -0
  11. package/dist/esm/components.d.ts +1 -0
  12. package/dist/esm/components.js +159 -0
  13. package/dist/esm/components.js.map +1 -0
  14. package/dist/esm/definitions.d.ts +470 -0
  15. package/dist/esm/definitions.js +2 -0
  16. package/dist/esm/definitions.js.map +1 -0
  17. package/dist/esm/index.d.ts +19 -0
  18. package/dist/esm/index.js +40 -0
  19. package/dist/esm/index.js.map +1 -0
  20. package/dist/esm/plugin.d.ts +2 -0
  21. package/dist/esm/plugin.js +2 -0
  22. package/dist/esm/plugin.js.map +1 -0
  23. package/dist/esm/web.d.ts +17 -0
  24. package/dist/esm/web.js +90 -0
  25. package/dist/esm/web.js.map +1 -0
  26. package/dist/plugin.cjs.js +310 -0
  27. package/dist/plugin.cjs.js.map +1 -0
  28. package/dist/plugin.js +313 -0
  29. package/dist/plugin.js.map +1 -0
  30. package/docs/demo-navigation.webp +0 -0
  31. package/docs/demo-options.webp +0 -0
  32. package/docs/demo-svg-icons.webp +0 -0
  33. package/ios/Sources/NativeNavigationPlugin/NativeNavigation.swift +7 -0
  34. package/ios/Sources/NativeNavigationPlugin/NativeNavigationPlugin.swift +1580 -0
  35. package/ios/Tests/NativeNavigationPluginTests/NativeNavigationTests.swift +19 -0
  36. package/package.json +91 -0
@@ -0,0 +1 @@
1
+ export declare function defineNativeNavigationElements(): void;
@@ -0,0 +1,159 @@
1
+ const parseBoolean = (value, defaultValue = false) => {
2
+ if (value === null) {
3
+ return defaultValue;
4
+ }
5
+ return value === '' || value === 'true' || value === '1';
6
+ };
7
+ const normalizeAttribute = (value) => (value ? value : undefined);
8
+ const typedAttribute = (element, name) => normalizeAttribute(element.getAttribute(name));
9
+ const parseJsonAttribute = (element, name, fallback) => {
10
+ const value = element.getAttribute(name);
11
+ if (!value) {
12
+ return fallback;
13
+ }
14
+ try {
15
+ return JSON.parse(value);
16
+ }
17
+ catch (_a) {
18
+ return fallback;
19
+ }
20
+ };
21
+ const getNativeNavigation = async () => (await import('./index')).NativeNavigation;
22
+ export function defineNativeNavigationElements() {
23
+ if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined') {
24
+ return;
25
+ }
26
+ class CapNativeNavigationProvider extends HTMLElement {
27
+ static get observedAttributes() {
28
+ return ['enabled', 'platform-style', 'content-inset-mode', 'animation-duration', 'colors'];
29
+ }
30
+ connectedCallback() {
31
+ void this.sync();
32
+ }
33
+ attributeChangedCallback() {
34
+ if (this.isConnected) {
35
+ void this.sync();
36
+ }
37
+ }
38
+ async sync() {
39
+ var _a, _b;
40
+ const duration = this.getAttribute('animation-duration');
41
+ const options = {
42
+ enabled: parseBoolean(this.getAttribute('enabled'), true),
43
+ platformStyle: (_a = typedAttribute(this, 'platform-style')) !== null && _a !== void 0 ? _a : 'auto',
44
+ contentInsetMode: (_b = typedAttribute(this, 'content-inset-mode')) !== null && _b !== void 0 ? _b : 'css',
45
+ colors: parseJsonAttribute(this, 'colors', undefined),
46
+ };
47
+ if (duration) {
48
+ options.animationDuration = Number(duration);
49
+ }
50
+ const NativeNavigation = await getNativeNavigation();
51
+ await NativeNavigation.configure(options);
52
+ }
53
+ }
54
+ class CapNativeNavbar extends HTMLElement {
55
+ static get observedAttributes() {
56
+ return [
57
+ 'hidden',
58
+ 'title',
59
+ 'subtitle',
60
+ 'large',
61
+ 'transparent',
62
+ 'blur-effect',
63
+ 'back-button',
64
+ 'back-title',
65
+ 'left-items',
66
+ 'right-items',
67
+ 'colors',
68
+ 'animated',
69
+ ];
70
+ }
71
+ connectedCallback() {
72
+ void this.sync();
73
+ }
74
+ attributeChangedCallback() {
75
+ if (this.isConnected) {
76
+ void this.sync();
77
+ }
78
+ }
79
+ async sync() {
80
+ var _a, _b;
81
+ const options = {
82
+ hidden: parseBoolean(this.getAttribute('hidden')),
83
+ title: (_a = this.getAttribute('title')) !== null && _a !== void 0 ? _a : undefined,
84
+ subtitle: (_b = this.getAttribute('subtitle')) !== null && _b !== void 0 ? _b : undefined,
85
+ large: parseBoolean(this.getAttribute('large')),
86
+ transparent: parseBoolean(this.getAttribute('transparent')),
87
+ blurEffect: typedAttribute(this, 'blur-effect'),
88
+ backButton: {
89
+ visible: parseBoolean(this.getAttribute('back-button')),
90
+ title: normalizeAttribute(this.getAttribute('back-title')),
91
+ },
92
+ leftItems: parseJsonAttribute(this, 'left-items', []),
93
+ rightItems: parseJsonAttribute(this, 'right-items', []),
94
+ colors: parseJsonAttribute(this, 'colors', undefined),
95
+ animated: parseBoolean(this.getAttribute('animated')),
96
+ };
97
+ const NativeNavigation = await getNativeNavigation();
98
+ await NativeNavigation.setNavbar(options);
99
+ }
100
+ }
101
+ class CapNativeTabbar extends HTMLElement {
102
+ static get observedAttributes() {
103
+ return [
104
+ 'hidden',
105
+ 'tabs',
106
+ 'selected-id',
107
+ 'labels',
108
+ 'label-visibility-mode',
109
+ 'icons',
110
+ 'colors',
111
+ 'blur-effect',
112
+ 'disable-indicator',
113
+ 'indicator-color',
114
+ 'ripple-color',
115
+ 'badge-background-color',
116
+ 'badge-text-color',
117
+ 'animated',
118
+ ];
119
+ }
120
+ connectedCallback() {
121
+ void this.sync();
122
+ }
123
+ attributeChangedCallback() {
124
+ if (this.isConnected) {
125
+ void this.sync();
126
+ }
127
+ }
128
+ async sync() {
129
+ const options = {
130
+ hidden: parseBoolean(this.getAttribute('hidden')),
131
+ tabs: parseJsonAttribute(this, 'tabs', []),
132
+ selectedId: normalizeAttribute(this.getAttribute('selected-id')),
133
+ labels: parseBoolean(this.getAttribute('labels'), true),
134
+ labelVisibilityMode: typedAttribute(this, 'label-visibility-mode'),
135
+ icons: parseBoolean(this.getAttribute('icons'), true),
136
+ colors: parseJsonAttribute(this, 'colors', undefined),
137
+ blurEffect: typedAttribute(this, 'blur-effect'),
138
+ disableIndicator: parseBoolean(this.getAttribute('disable-indicator')),
139
+ indicatorColor: normalizeAttribute(this.getAttribute('indicator-color')),
140
+ rippleColor: normalizeAttribute(this.getAttribute('ripple-color')),
141
+ badgeBackgroundColor: normalizeAttribute(this.getAttribute('badge-background-color')),
142
+ badgeTextColor: normalizeAttribute(this.getAttribute('badge-text-color')),
143
+ animated: parseBoolean(this.getAttribute('animated')),
144
+ };
145
+ const NativeNavigation = await getNativeNavigation();
146
+ await NativeNavigation.setTabbar(options);
147
+ }
148
+ }
149
+ if (!customElements.get('cap-native-navigation-provider')) {
150
+ customElements.define('cap-native-navigation-provider', CapNativeNavigationProvider);
151
+ }
152
+ if (!customElements.get('cap-native-navbar')) {
153
+ customElements.define('cap-native-navbar', CapNativeNavbar);
154
+ }
155
+ if (!customElements.get('cap-native-tabbar')) {
156
+ customElements.define('cap-native-tabbar', CapNativeTabbar);
157
+ }
158
+ }
159
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,YAAY,GAAG,KAAK,EAAW,EAAE;IAC3E,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,KAAoB,EAAsB,EAAE,CAAC,CAAC,KA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D,CAAC;YAEF,MAAM,gBAAgB,GAAG,MAAM,mBAAmB,EAAE,CAAC;YACrD,MAAM,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;KACF;IAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,gCAAgC,CAAC,EAAE,CAAC;QAC1D,cAAc,CAAC,MAAM,CAAC,gCAAgC,EAAE,2BAA2B,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC7C,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC7C,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC","sourcesContent":["import type {\n NativeNavigationConfigureOptions,\n NativeNavigationNavbarOptions,\n NativeNavigationTabbarOptions,\n} from './definitions';\n\nconst parseBoolean = (value: string | null, defaultValue = false): boolean => {\n if (value === null) {\n return defaultValue;\n }\n return value === '' || value === 'true' || value === '1';\n};\n\nconst normalizeAttribute = (value: string | null): string | undefined => (value ? value : undefined);\n\nconst typedAttribute = <T extends string>(element: Element, name: string): T | undefined =>\n normalizeAttribute(element.getAttribute(name)) as T | undefined;\n\nconst parseJsonAttribute = <T>(element: Element, name: string, fallback: T): T => {\n const value = element.getAttribute(name);\n if (!value) {\n return fallback;\n }\n\n try {\n return JSON.parse(value) as T;\n } catch {\n return fallback;\n }\n};\n\nconst getNativeNavigation = async () => (await import('./index')).NativeNavigation;\n\nexport function defineNativeNavigationElements(): void {\n if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined') {\n return;\n }\n\n class CapNativeNavigationProvider extends HTMLElement {\n static get observedAttributes(): string[] {\n return ['enabled', 'platform-style', 'content-inset-mode', 'animation-duration', 'colors'];\n }\n\n connectedCallback(): void {\n void this.sync();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n void this.sync();\n }\n }\n\n private async sync(): Promise<void> {\n const duration = this.getAttribute('animation-duration');\n const options: NativeNavigationConfigureOptions = {\n enabled: parseBoolean(this.getAttribute('enabled'), true),\n platformStyle:\n typedAttribute<NonNullable<NativeNavigationConfigureOptions['platformStyle']>>(this, 'platform-style') ??\n 'auto',\n contentInsetMode:\n typedAttribute<NonNullable<NativeNavigationConfigureOptions['contentInsetMode']>>(\n this,\n 'content-inset-mode',\n ) ?? 'css',\n colors: parseJsonAttribute(this, 'colors', undefined as NativeNavigationConfigureOptions['colors']),\n };\n\n if (duration) {\n options.animationDuration = Number(duration);\n }\n\n const NativeNavigation = await getNativeNavigation();\n await NativeNavigation.configure(options);\n }\n }\n\n class CapNativeNavbar extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\n 'hidden',\n 'title',\n 'subtitle',\n 'large',\n 'transparent',\n 'blur-effect',\n 'back-button',\n 'back-title',\n 'left-items',\n 'right-items',\n 'colors',\n 'animated',\n ];\n }\n\n connectedCallback(): void {\n void this.sync();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n void this.sync();\n }\n }\n\n private async sync(): Promise<void> {\n const options: NativeNavigationNavbarOptions = {\n hidden: parseBoolean(this.getAttribute('hidden')),\n title: this.getAttribute('title') ?? undefined,\n subtitle: this.getAttribute('subtitle') ?? undefined,\n large: parseBoolean(this.getAttribute('large')),\n transparent: parseBoolean(this.getAttribute('transparent')),\n blurEffect: typedAttribute<NonNullable<NativeNavigationNavbarOptions['blurEffect']>>(this, 'blur-effect'),\n backButton: {\n visible: parseBoolean(this.getAttribute('back-button')),\n title: normalizeAttribute(this.getAttribute('back-title')),\n },\n leftItems: parseJsonAttribute(this, 'left-items', []),\n rightItems: parseJsonAttribute(this, 'right-items', []),\n colors: parseJsonAttribute(this, 'colors', undefined as NativeNavigationNavbarOptions['colors']),\n animated: parseBoolean(this.getAttribute('animated')),\n };\n\n const NativeNavigation = await getNativeNavigation();\n await NativeNavigation.setNavbar(options);\n }\n }\n\n class CapNativeTabbar extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\n 'hidden',\n 'tabs',\n 'selected-id',\n 'labels',\n 'label-visibility-mode',\n 'icons',\n 'colors',\n 'blur-effect',\n 'disable-indicator',\n 'indicator-color',\n 'ripple-color',\n 'badge-background-color',\n 'badge-text-color',\n 'animated',\n ];\n }\n\n connectedCallback(): void {\n void this.sync();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n void this.sync();\n }\n }\n\n private async sync(): Promise<void> {\n const options: NativeNavigationTabbarOptions = {\n hidden: parseBoolean(this.getAttribute('hidden')),\n tabs: parseJsonAttribute(this, 'tabs', []),\n selectedId: normalizeAttribute(this.getAttribute('selected-id')),\n labels: parseBoolean(this.getAttribute('labels'), true),\n labelVisibilityMode: typedAttribute<NonNullable<NativeNavigationTabbarOptions['labelVisibilityMode']>>(\n this,\n 'label-visibility-mode',\n ),\n icons: parseBoolean(this.getAttribute('icons'), true),\n colors: parseJsonAttribute(this, 'colors', undefined as NativeNavigationTabbarOptions['colors']),\n blurEffect: typedAttribute<NonNullable<NativeNavigationTabbarOptions['blurEffect']>>(this, 'blur-effect'),\n disableIndicator: parseBoolean(this.getAttribute('disable-indicator')),\n indicatorColor: normalizeAttribute(this.getAttribute('indicator-color')),\n rippleColor: normalizeAttribute(this.getAttribute('ripple-color')),\n badgeBackgroundColor: normalizeAttribute(this.getAttribute('badge-background-color')),\n badgeTextColor: normalizeAttribute(this.getAttribute('badge-text-color')),\n animated: parseBoolean(this.getAttribute('animated')),\n };\n\n const NativeNavigation = await getNativeNavigation();\n await NativeNavigation.setTabbar(options);\n }\n }\n\n if (!customElements.get('cap-native-navigation-provider')) {\n customElements.define('cap-native-navigation-provider', CapNativeNavigationProvider);\n }\n if (!customElements.get('cap-native-navbar')) {\n customElements.define('cap-native-navbar', CapNativeNavbar);\n }\n if (!customElements.get('cap-native-tabbar')) {\n customElements.define('cap-native-tabbar', CapNativeTabbar);\n }\n}\n"]}
@@ -0,0 +1,470 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * Platform rendering preference for the native bars.
4
+ */
5
+ export type NativeNavigationPlatformStyle = 'auto' | 'ios' | 'android';
6
+ /**
7
+ * How the plugin exposes native bar sizes to web content.
8
+ */
9
+ export type NativeNavigationContentInsetMode = 'css' | 'none';
10
+ /**
11
+ * Navigation animation direction.
12
+ */
13
+ export type NativeNavigationTransitionDirection = 'forward' | 'back' | 'root' | 'tab' | 'zoom' | 'none';
14
+ /**
15
+ * Native material/blur effect preference.
16
+ */
17
+ export type NativeNavigationBlurEffect = 'none' | 'systemDefault' | 'extraLight' | 'light' | 'dark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
18
+ /**
19
+ * Native tab label visibility behavior.
20
+ */
21
+ export type NativeNavigationTabLabelVisibilityMode = 'auto' | 'selected' | 'labeled' | 'unlabeled';
22
+ /**
23
+ * A rectangle in WebView viewport coordinates, expressed in native points/dp.
24
+ */
25
+ export interface NativeNavigationRect {
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ }
31
+ /**
32
+ * A serializable icon descriptor. Framework nodes are intentionally not accepted
33
+ * because icons are rendered by native UI.
34
+ */
35
+ export interface NativeNavigationIcon {
36
+ /**
37
+ * Cross-platform asset path or URL fallback.
38
+ */
39
+ src?: string;
40
+ /**
41
+ * Cross-platform inline SVG markup. The native renderers support common icon
42
+ * shapes such as path, line, polyline, polygon, circle, and rect. SVG icons
43
+ * are rendered as template images by default so native tint colors still
44
+ * apply.
45
+ */
46
+ svg?: string;
47
+ /**
48
+ * Preferred rendered icon width in native points/dp. Defaults to `24`.
49
+ */
50
+ width?: number;
51
+ /**
52
+ * Preferred rendered icon height in native points/dp. Defaults to `24`.
53
+ */
54
+ height?: number;
55
+ /**
56
+ * When `true`, native tint colors are applied to the rendered SVG/image.
57
+ * Defaults to `true`.
58
+ */
59
+ template?: boolean;
60
+ /**
61
+ * iOS-specific SF Symbol, bundled image name, or inline SVG.
62
+ */
63
+ ios?: {
64
+ /**
65
+ * SF Symbol name, for example `house.fill`.
66
+ */
67
+ sfSymbol?: string;
68
+ /**
69
+ * Bundled image name from the app asset catalog.
70
+ */
71
+ image?: string;
72
+ /**
73
+ * iOS-specific inline SVG markup.
74
+ */
75
+ svg?: string;
76
+ };
77
+ /**
78
+ * Android-specific drawable resource, asset name, or inline SVG.
79
+ */
80
+ android?: {
81
+ /**
82
+ * Drawable resource name without the `R.drawable.` prefix.
83
+ */
84
+ resource?: string;
85
+ /**
86
+ * Bundled image asset name.
87
+ */
88
+ image?: string;
89
+ /**
90
+ * Android-specific inline SVG markup.
91
+ */
92
+ svg?: string;
93
+ };
94
+ }
95
+ /**
96
+ * Native bar colors. Use CSS-style hex strings (`#RRGGBB` or `#AARRGGBB`).
97
+ */
98
+ export interface NativeNavigationColors {
99
+ /**
100
+ * When `true`, Android 12+ derives unspecified bar colors from Material You
101
+ * system palettes. Explicit color fields still win.
102
+ */
103
+ dynamic?: boolean;
104
+ /**
105
+ * Tint color for active buttons/items.
106
+ */
107
+ tint?: string;
108
+ /**
109
+ * Color for inactive tab items.
110
+ */
111
+ inactiveTint?: string;
112
+ /**
113
+ * Optional background tint. Ignored on iOS 26+ so UIKit can preserve the
114
+ * system Liquid Glass navigation appearance.
115
+ */
116
+ background?: string;
117
+ /**
118
+ * Title and label text color where the native platform supports it.
119
+ */
120
+ foreground?: string;
121
+ /**
122
+ * Badge background color for native tab badges.
123
+ */
124
+ badgeBackground?: string;
125
+ /**
126
+ * Badge text color for native tab badges.
127
+ */
128
+ badgeText?: string;
129
+ /**
130
+ * Active tab indicator color on Android.
131
+ */
132
+ indicator?: string;
133
+ /**
134
+ * Tab press ripple color on Android.
135
+ */
136
+ ripple?: string;
137
+ }
138
+ /**
139
+ * Global plugin configuration.
140
+ */
141
+ export interface NativeNavigationConfigureOptions {
142
+ /**
143
+ * Enables or disables the native chrome host.
144
+ */
145
+ enabled?: boolean;
146
+ /**
147
+ * Native style preference. `auto` uses the current platform.
148
+ */
149
+ platformStyle?: NativeNavigationPlatformStyle;
150
+ /**
151
+ * When `css`, the plugin writes CSS variables on `document.documentElement`.
152
+ */
153
+ contentInsetMode?: NativeNavigationContentInsetMode;
154
+ /**
155
+ * Default native transition duration in milliseconds.
156
+ */
157
+ animationDuration?: number;
158
+ /**
159
+ * Shared color hints for native bars.
160
+ */
161
+ colors?: NativeNavigationColors;
162
+ }
163
+ /**
164
+ * A button shown in the native navbar.
165
+ */
166
+ export interface NativeNavigationBarButton {
167
+ /**
168
+ * Stable id returned in `navbarItemTap`.
169
+ */
170
+ id: string;
171
+ /**
172
+ * Visible text label.
173
+ */
174
+ title?: string;
175
+ /**
176
+ * Native icon descriptor.
177
+ */
178
+ icon?: NativeNavigationIcon;
179
+ /**
180
+ * Whether the action is enabled. Defaults to `true`.
181
+ */
182
+ enabled?: boolean;
183
+ }
184
+ /**
185
+ * Native back button configuration.
186
+ */
187
+ export interface NativeNavigationBackButton {
188
+ /**
189
+ * Show the native back affordance.
190
+ */
191
+ visible?: boolean;
192
+ /**
193
+ * Optional back title.
194
+ */
195
+ title?: string;
196
+ }
197
+ /**
198
+ * Native navbar state.
199
+ */
200
+ export interface NativeNavigationNavbarOptions {
201
+ /**
202
+ * Hide the native navbar.
203
+ */
204
+ hidden?: boolean;
205
+ /**
206
+ * Main title.
207
+ */
208
+ title?: string;
209
+ /**
210
+ * Secondary title where supported by the platform.
211
+ */
212
+ subtitle?: string;
213
+ /**
214
+ * Prefer a large iOS title style.
215
+ */
216
+ large?: boolean;
217
+ /**
218
+ * Prefer transparent/scroll-edge style.
219
+ */
220
+ transparent?: boolean;
221
+ /**
222
+ * iOS blur/material effect for the navbar background when glass is not
223
+ * available. Defaults to `systemChromeMaterial` for transparent bars.
224
+ */
225
+ blurEffect?: NativeNavigationBlurEffect;
226
+ /**
227
+ * Back button state.
228
+ */
229
+ backButton?: NativeNavigationBackButton;
230
+ /**
231
+ * Left-side action buttons.
232
+ */
233
+ leftItems?: NativeNavigationBarButton[];
234
+ /**
235
+ * Right-side action buttons.
236
+ */
237
+ rightItems?: NativeNavigationBarButton[];
238
+ /**
239
+ * Navbar color hints.
240
+ */
241
+ colors?: NativeNavigationColors;
242
+ /**
243
+ * Animate native navbar changes.
244
+ */
245
+ animated?: boolean;
246
+ }
247
+ /**
248
+ * A native tab item.
249
+ */
250
+ export interface NativeNavigationTab {
251
+ /**
252
+ * Stable tab id returned in `tabSelect`.
253
+ */
254
+ id: string;
255
+ /**
256
+ * Visible tab label.
257
+ */
258
+ title?: string;
259
+ /**
260
+ * Native icon descriptor.
261
+ */
262
+ icon?: NativeNavigationIcon;
263
+ /**
264
+ * Optional selected-state icon.
265
+ */
266
+ selectedIcon?: NativeNavigationIcon;
267
+ /**
268
+ * Optional badge. Numeric badges are supported on both platforms; text badge
269
+ * support depends on platform capabilities.
270
+ */
271
+ badge?: string | number;
272
+ /**
273
+ * Whether the tab is enabled. Defaults to `true`.
274
+ */
275
+ enabled?: boolean;
276
+ }
277
+ /**
278
+ * Native tabbar state.
279
+ */
280
+ export interface NativeNavigationTabbarOptions {
281
+ /**
282
+ * Hide the native tabbar.
283
+ */
284
+ hidden?: boolean;
285
+ /**
286
+ * Tab definitions.
287
+ */
288
+ tabs?: NativeNavigationTab[];
289
+ /**
290
+ * Currently selected tab id.
291
+ */
292
+ selectedId?: string;
293
+ /**
294
+ * Show text labels. Defaults to `true`.
295
+ */
296
+ labels?: boolean;
297
+ /**
298
+ * Native label visibility mode. Overrides `labels` when provided.
299
+ */
300
+ labelVisibilityMode?: NativeNavigationTabLabelVisibilityMode;
301
+ /**
302
+ * Show icons. Defaults to `true`.
303
+ */
304
+ icons?: boolean;
305
+ /**
306
+ * Tabbar color hints.
307
+ */
308
+ colors?: NativeNavigationColors;
309
+ /**
310
+ * iOS blur/material effect for the tabbar background when glass is not
311
+ * available.
312
+ */
313
+ blurEffect?: NativeNavigationBlurEffect;
314
+ /**
315
+ * Disable the Android active tab indicator.
316
+ */
317
+ disableIndicator?: boolean;
318
+ /**
319
+ * Active tab indicator color on Android. `colors.indicator` is also
320
+ * supported.
321
+ */
322
+ indicatorColor?: string;
323
+ /**
324
+ * Tab press ripple color on Android. `colors.ripple` is also supported.
325
+ */
326
+ rippleColor?: string;
327
+ /**
328
+ * Badge background color. `colors.badgeBackground` is also supported.
329
+ */
330
+ badgeBackgroundColor?: string;
331
+ /**
332
+ * Badge text color. `colors.badgeText` is also supported.
333
+ */
334
+ badgeTextColor?: string;
335
+ /**
336
+ * Animate native tabbar changes.
337
+ */
338
+ animated?: boolean;
339
+ }
340
+ /**
341
+ * Insets exposed to web content.
342
+ */
343
+ export interface NativeNavigationInsets {
344
+ top: number;
345
+ right: number;
346
+ bottom: number;
347
+ left: number;
348
+ navbarHeight: number;
349
+ tabbarHeight: number;
350
+ }
351
+ /**
352
+ * Returned by methods that may change safe content bounds.
353
+ */
354
+ export interface NativeNavigationInsetsResult {
355
+ insets: NativeNavigationInsets;
356
+ }
357
+ /**
358
+ * Begin a native transition transaction before JS changes route content.
359
+ */
360
+ export interface NativeNavigationBeginTransitionOptions {
361
+ id?: string;
362
+ direction?: NativeNavigationTransitionDirection;
363
+ duration?: number;
364
+ /**
365
+ * Source rectangle for `zoom` transitions. Use viewport coordinates such as
366
+ * those returned by `Element.getBoundingClientRect()`.
367
+ */
368
+ sourceRect?: NativeNavigationRect;
369
+ /**
370
+ * Destination rectangle for shared-element-style `zoom` transitions.
371
+ */
372
+ targetRect?: NativeNavigationRect;
373
+ /**
374
+ * Corner radius used while animating a `zoom` transition.
375
+ */
376
+ cornerRadius?: number;
377
+ }
378
+ /**
379
+ * Finish a native transition transaction after JS has changed route content.
380
+ */
381
+ export interface NativeNavigationFinishTransitionOptions {
382
+ id?: string;
383
+ direction?: NativeNavigationTransitionDirection;
384
+ duration?: number;
385
+ /**
386
+ * Source rectangle for `zoom` transitions when no active source was recorded.
387
+ */
388
+ sourceRect?: NativeNavigationRect;
389
+ /**
390
+ * Destination rectangle for shared-element-style `zoom` transitions.
391
+ */
392
+ targetRect?: NativeNavigationRect;
393
+ /**
394
+ * Corner radius used while animating a `zoom` transition.
395
+ */
396
+ cornerRadius?: number;
397
+ }
398
+ /**
399
+ * Native transition result.
400
+ */
401
+ export interface NativeNavigationTransitionResult {
402
+ id: string;
403
+ direction: NativeNavigationTransitionDirection;
404
+ duration: number;
405
+ }
406
+ /**
407
+ * Plugin version payload.
408
+ */
409
+ export interface PluginVersionResult {
410
+ /**
411
+ * Version identifier returned by the platform implementation.
412
+ */
413
+ version: string;
414
+ }
415
+ export interface NativeNavigationBackEvent {
416
+ source: 'navbar';
417
+ }
418
+ export interface NativeNavigationBarItemTapEvent {
419
+ id: string;
420
+ title?: string;
421
+ placement: 'left' | 'right';
422
+ }
423
+ export interface NativeNavigationTabSelectEvent {
424
+ id: string;
425
+ index: number;
426
+ title?: string;
427
+ }
428
+ export interface NativeNavigationSafeAreaChangedEvent {
429
+ insets: NativeNavigationInsets;
430
+ }
431
+ export interface NativeNavigationTransitionEvent {
432
+ id: string;
433
+ direction: NativeNavigationTransitionDirection;
434
+ duration: number;
435
+ }
436
+ /**
437
+ * Framework-agnostic native navigation chrome API.
438
+ */
439
+ export interface NativeNavigationPlugin {
440
+ /**
441
+ * Configure the native chrome host and content inset behavior.
442
+ */
443
+ configure(options?: NativeNavigationConfigureOptions): Promise<NativeNavigationInsetsResult>;
444
+ /**
445
+ * Render or update the native navbar.
446
+ */
447
+ setNavbar(options: NativeNavigationNavbarOptions): Promise<NativeNavigationInsetsResult>;
448
+ /**
449
+ * Render or update the native tabbar.
450
+ */
451
+ setTabbar(options: NativeNavigationTabbarOptions): Promise<NativeNavigationInsetsResult>;
452
+ /**
453
+ * Capture the current WebView and prepare a native transition.
454
+ */
455
+ beginTransition(options?: NativeNavigationBeginTransitionOptions): Promise<NativeNavigationTransitionResult>;
456
+ /**
457
+ * Animate from the captured WebView snapshot to the current live WebView.
458
+ */
459
+ finishTransition(options?: NativeNavigationFinishTransitionOptions): Promise<NativeNavigationTransitionResult>;
460
+ /**
461
+ * Returns the platform implementation version marker.
462
+ */
463
+ getPluginVersion(): Promise<PluginVersionResult>;
464
+ addListener(eventName: 'navbarBack', listenerFunc: (event: NativeNavigationBackEvent) => void): Promise<PluginListenerHandle>;
465
+ addListener(eventName: 'navbarItemTap', listenerFunc: (event: NativeNavigationBarItemTapEvent) => void): Promise<PluginListenerHandle>;
466
+ addListener(eventName: 'tabSelect', listenerFunc: (event: NativeNavigationTabSelectEvent) => void): Promise<PluginListenerHandle>;
467
+ addListener(eventName: 'safeAreaChanged', listenerFunc: (event: NativeNavigationSafeAreaChangedEvent) => void): Promise<PluginListenerHandle>;
468
+ addListener(eventName: 'transitionStart', listenerFunc: (event: NativeNavigationTransitionEvent) => void): Promise<PluginListenerHandle>;
469
+ addListener(eventName: 'transitionEnd', listenerFunc: (event: NativeNavigationTransitionEvent) => void): Promise<PluginListenerHandle>;
470
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map