@ng-native/device 0.9.0 → 0.11.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.
- package/dist/deep-links.d.ts +7 -0
- package/dist/deep-links.js +14 -1
- package/dist/deep-links.js.map +1 -1
- package/dist/dialogs.js +1 -1
- package/dist/dialogs.js.map +1 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js.map +1 -1
- package/dist/status-bar.d.ts +8 -3
- package/dist/status-bar.js +21 -9
- package/dist/status-bar.js.map +1 -1
- package/package.json +2 -2
package/dist/deep-links.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface DeepLinkSource {
|
|
|
8
8
|
launchUrl(): Promise<string | null>;
|
|
9
9
|
subscribe(listener: (url: string) => void): () => void;
|
|
10
10
|
open(url: string): void;
|
|
11
|
+
/** Optional, so a source written before there was one is still a source. */
|
|
12
|
+
openSettings?(): void;
|
|
11
13
|
}
|
|
12
14
|
export declare function deepLinkSource(): DeepLinkSource;
|
|
13
15
|
export declare function pathOf(url: string | null): string | null;
|
|
@@ -37,6 +39,11 @@ export declare class DeepLinks {
|
|
|
37
39
|
private deliver;
|
|
38
40
|
/** Hand a url to whatever else on the device handles it: a browser, Maps, another app. */
|
|
39
41
|
open(url: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Open the app's own page in the system settings, where a person turns on a permission the
|
|
44
|
+
* platform no longer asks for. Android has no url for that page, so `open()` cannot reach it.
|
|
45
|
+
*/
|
|
46
|
+
openSettings(): void;
|
|
40
47
|
static ɵfac: i0.ɵɵFactoryDeclaration<DeepLinks, never>;
|
|
41
48
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
42
49
|
}
|
package/dist/deep-links.js
CHANGED
|
@@ -7,7 +7,12 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
export function deepLinkSource() {
|
|
8
8
|
const native = reactNative();
|
|
9
9
|
if (!native) {
|
|
10
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
launchUrl: () => Promise.resolve(null),
|
|
12
|
+
subscribe: () => () => { },
|
|
13
|
+
open: () => { },
|
|
14
|
+
openSettings: () => { },
|
|
15
|
+
};
|
|
11
16
|
}
|
|
12
17
|
return {
|
|
13
18
|
launchUrl: () => native.Linking.getInitialURL(),
|
|
@@ -16,6 +21,7 @@ export function deepLinkSource() {
|
|
|
16
21
|
return () => subscription.remove();
|
|
17
22
|
},
|
|
18
23
|
open: (url) => void native.Linking.openURL(url).catch(() => { }),
|
|
24
|
+
openSettings: () => void native.Linking.openSettings().catch(() => { }),
|
|
19
25
|
};
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
@@ -139,6 +145,13 @@ export class DeepLinks {
|
|
|
139
145
|
open(url) {
|
|
140
146
|
this.source.open(url);
|
|
141
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Open the app's own page in the system settings, where a person turns on a permission the
|
|
150
|
+
* platform no longer asks for. Android has no url for that page, so `open()` cannot reach it.
|
|
151
|
+
*/
|
|
152
|
+
openSettings() {
|
|
153
|
+
this.source.openSettings?.();
|
|
154
|
+
}
|
|
142
155
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: DeepLinks, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
143
156
|
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.2.0", ngImport: i0, type: DeepLinks });
|
|
144
157
|
}
|
package/dist/deep-links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-links.js","sourceRoot":"","sources":["../src/deep-links.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;;AAShD,MAAM,UAAU,cAAc;IAC5B,MAAM,MAA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AAI,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpC,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAC,QAAgC,EAAE,IAAY;QAC5D,IAAI,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,4FAA4F;YAC5F,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBACrD,IAAI,MAAM;oBAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;;oBACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,SAAS,EAAE,CAAC;gBACnB,IAAI,SAAS,KAAK,KAAK;oBAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;;oBACzC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;IAED,0FAA0F;IAC1F,IAAI,CAAC,GAAW;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;uGAhEU,SAAS;wGAAT,SAAS;;2FAAT,SAAS;kBADrB,OAAO","sourcesContent":["/**\n * Links that arrive from outside the app: a `canary://` url, a universal link, a notification.\n */\nimport { ErrorHandler, InjectionToken, Injector, Service, inject } from '@angular/core';\nimport { reactNative } from './react-native.ts';\n\nexport interface DeepLinkSource {\n /** The url the app was launched with. A promise, and nothing says it settles before mount. */\n launchUrl(): Promise<string | null>;\n subscribe(listener: (url: string) => void): () => void;\n open(url: string): void;\n}\n\nexport function deepLinkSource(): DeepLinkSource {\n const native = reactNative();\n if (!native) {\n return { launchUrl: () => Promise.resolve(null), subscribe: () => () => {}, open: () => {} };\n }\n\n return {\n launchUrl: () => native.Linking.getInitialURL(),\n subscribe: (listener) => {\n const subscription = native.Linking.addEventListener('url', ({ url }) => listener(url));\n return () => subscription.remove();\n },\n open: (url) => void native.Linking.openURL(url).catch(() => {}),\n };\n}\n\n/**\n * The path a url means to this app: everything after the scheme and host.\n *\n * Prefixes are app configuration and every app's are different, but stripping one is not: what a\n * router can navigate to is a path. `canary://primitives` and `https://example.com/primitives`\n * both mean `/primitives` - which takes noticing that only the second one has a host.\n *\n * Expo Go is the exception worth handling here rather than in every app: it serves every project\n * from one development url, puts the app's own path after `/--`, and has a host like a web url\n * rather than a path like an app's own scheme.\n *\n * The development client is the other. `expo run:ios` launches the app through\n * `<scheme>://expo-development-client/?url=...`, which is Expo telling its own launcher which\n * bundle to load and means nothing to the app. Left alone it reaches the router as a path, matches\n * no route, and the app shows a blank screen on every launch during development - which looks\n * exactly like a bug in the app.\n */\n\n/** Expo's own launch hosts. Not paths: instructions to the launcher, which the app never routes. */\nconst EXPO_INTERNAL = new Set(['expo-development-client']);\n\n/** Whether the first segment names one of Expo's launchers rather than something in the app. */\nfunction isLauncher(rest: string): boolean {\n return EXPO_INTERNAL.has(rest.split(/[/?#]/, 1)[0] ?? '');\n}\n\n/** Schemes that carry a host to skip before the path starts. */\nconst HAS_HOST = new Set(['http', 'https', 'exp', 'exps']);\n\nexport function pathOf(url: string | null): string | null {\n if (!url) return null;\n const scheme = /^([a-z][a-z0-9+.-]*):\\/\\//i.exec(url);\n const rest = scheme ? url.slice(scheme[0].length) : url;\n\n const expoGo = rest.indexOf('/--/');\n if (expoGo !== -1) return rest.slice(expoGo + 3);\n if (isLauncher(rest)) return null;\n\n // A url with a host has one to skip. A custom scheme does not: `canary://settings` names a\n // path, not a machine, and treating the two alike is how it quietly becomes `/`.\n if (HAS_HOST.has(scheme?.[1]?.toLowerCase() ?? '')) {\n // The host ends at the path, or at a query or fragment when there is no path.\n const end = rest.search(/[/?#]/);\n if (end === -1) return '/';\n return rest[end] === '/' ? rest.slice(end) : `/${rest.slice(end)}`;\n }\n return rest.startsWith('/') ? rest : `/${rest}`;\n}\n\n/**\n * The launch url is delivered whichever way is true at the time: as the initial url if it is\n * known before anything asks, and as an ordinary link if the app is already up. Both happen -\n * the promise races the first navigation and neither order is guaranteed - and a link that\n * arrives late is still a link, so nothing is dropped either way.\n */\n@Service()\nexport class DeepLinks {\n /** Overridden in a test to deliver a link with no platform under it. */\n static readonly SOURCE = new InjectionToken<DeepLinkSource>('angular-native.deepLinkSource', {\n factory: deepLinkSource,\n });\n\n private readonly source = inject(DeepLinks.SOURCE);\n private readonly injector = inject(Injector);\n private launch: string | null = null;\n private readonly listeners = new Set<(path: string) => void>();\n\n constructor() {\n void this.source.launchUrl().then((url) => {\n const path = pathOf(url);\n if (!path || path === '/') return;\n if (this.listeners.size) this.listeners.forEach((listener) => this.deliver(listener, path));\n else this.launch = path;\n });\n }\n\n /** The path the app was launched with, if it is known yet. */\n initialUrl(): string | null {\n return this.launch;\n }\n\n /** Links that arrive while the app is running, as paths. Returns an unsubscribe. */\n subscribe(listener: (path: string) => void): () => void {\n // Each subscription is its own entry, so the same function subscribed twice stops once.\n const subscription = (path: string) => listener(path);\n this.listeners.add(subscription);\n const unsubscribe = this.source.subscribe((url) => {\n const path = pathOf(url);\n if (path) listener(path);\n });\n return () => {\n this.listeners.delete(subscription);\n unsubscribe();\n };\n }\n\n /**\n * One listener throwing is reported, and does not keep the launch url from the rest. The\n * `ErrorHandler` is looked up when that happens rather than when this is made: an app's handler\n * that injects the router reaches `DeepLinks` through the location, and would be a cycle at boot.\n */\n private deliver(listener: (path: string) => void, path: string): void {\n try {\n listener(path);\n } catch (error) {\n // A handler that rethrows, as some apps' do, would otherwise stop the listeners after this.\n try {\n const errors = this.injector.get(ErrorHandler, null);\n if (errors) errors.handleError(error);\n else console.error(error);\n } catch (reporting) {\n if (reporting === error) console.error(error);\n else console.error(error, reporting);\n }\n }\n }\n\n /** Hand a url to whatever else on the device handles it: a browser, Maps, another app. */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C,GAAW;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,YAAY;QACV,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;IAC/B,CAAC;uGAxEU,SAAS;wGAAT,SAAS;;2FAAT,SAAS;kBADrB,OAAO","sourcesContent":["/**\n * Links that arrive from outside the app: a `canary://` url, a universal link, a notification.\n */\nimport { ErrorHandler, InjectionToken, Injector, Service, inject } from '@angular/core';\nimport { reactNative } from './react-native.ts';\n\nexport interface DeepLinkSource {\n /** The url the app was launched with. A promise, and nothing says it settles before mount. */\n launchUrl(): Promise<string | null>;\n subscribe(listener: (url: string) => void): () => void;\n open(url: string): void;\n /** Optional, so a source written before there was one is still a source. */\n openSettings?(): void;\n}\n\nexport function deepLinkSource(): DeepLinkSource {\n const native = reactNative();\n if (!native) {\n return {\n launchUrl: () => Promise.resolve(null),\n subscribe: () => () => {},\n open: () => {},\n openSettings: () => {},\n };\n }\n\n return {\n launchUrl: () => native.Linking.getInitialURL(),\n subscribe: (listener) => {\n const subscription = native.Linking.addEventListener('url', ({ url }) => listener(url));\n return () => subscription.remove();\n },\n open: (url) => void native.Linking.openURL(url).catch(() => {}),\n openSettings: () => void native.Linking.openSettings().catch(() => {}),\n };\n}\n\n/**\n * The path a url means to this app: everything after the scheme and host.\n *\n * Prefixes are app configuration and every app's are different, but stripping one is not: what a\n * router can navigate to is a path. `canary://primitives` and `https://example.com/primitives`\n * both mean `/primitives` - which takes noticing that only the second one has a host.\n *\n * Expo Go is the exception worth handling here rather than in every app: it serves every project\n * from one development url, puts the app's own path after `/--`, and has a host like a web url\n * rather than a path like an app's own scheme.\n *\n * The development client is the other. `expo run:ios` launches the app through\n * `<scheme>://expo-development-client/?url=...`, which is Expo telling its own launcher which\n * bundle to load and means nothing to the app. Left alone it reaches the router as a path, matches\n * no route, and the app shows a blank screen on every launch during development - which looks\n * exactly like a bug in the app.\n */\n\n/** Expo's own launch hosts. Not paths: instructions to the launcher, which the app never routes. */\nconst EXPO_INTERNAL = new Set(['expo-development-client']);\n\n/** Whether the first segment names one of Expo's launchers rather than something in the app. */\nfunction isLauncher(rest: string): boolean {\n return EXPO_INTERNAL.has(rest.split(/[/?#]/, 1)[0] ?? '');\n}\n\n/** Schemes that carry a host to skip before the path starts. */\nconst HAS_HOST = new Set(['http', 'https', 'exp', 'exps']);\n\nexport function pathOf(url: string | null): string | null {\n if (!url) return null;\n const scheme = /^([a-z][a-z0-9+.-]*):\\/\\//i.exec(url);\n const rest = scheme ? url.slice(scheme[0].length) : url;\n\n const expoGo = rest.indexOf('/--/');\n if (expoGo !== -1) return rest.slice(expoGo + 3);\n if (isLauncher(rest)) return null;\n\n // A url with a host has one to skip. A custom scheme does not: `canary://settings` names a\n // path, not a machine, and treating the two alike is how it quietly becomes `/`.\n if (HAS_HOST.has(scheme?.[1]?.toLowerCase() ?? '')) {\n // The host ends at the path, or at a query or fragment when there is no path.\n const end = rest.search(/[/?#]/);\n if (end === -1) return '/';\n return rest[end] === '/' ? rest.slice(end) : `/${rest.slice(end)}`;\n }\n return rest.startsWith('/') ? rest : `/${rest}`;\n}\n\n/**\n * The launch url is delivered whichever way is true at the time: as the initial url if it is\n * known before anything asks, and as an ordinary link if the app is already up. Both happen -\n * the promise races the first navigation and neither order is guaranteed - and a link that\n * arrives late is still a link, so nothing is dropped either way.\n */\n@Service()\nexport class DeepLinks {\n /** Overridden in a test to deliver a link with no platform under it. */\n static readonly SOURCE = new InjectionToken<DeepLinkSource>('angular-native.deepLinkSource', {\n factory: deepLinkSource,\n });\n\n private readonly source = inject(DeepLinks.SOURCE);\n private readonly injector = inject(Injector);\n private launch: string | null = null;\n private readonly listeners = new Set<(path: string) => void>();\n\n constructor() {\n void this.source.launchUrl().then((url) => {\n const path = pathOf(url);\n if (!path || path === '/') return;\n if (this.listeners.size) this.listeners.forEach((listener) => this.deliver(listener, path));\n else this.launch = path;\n });\n }\n\n /** The path the app was launched with, if it is known yet. */\n initialUrl(): string | null {\n return this.launch;\n }\n\n /** Links that arrive while the app is running, as paths. Returns an unsubscribe. */\n subscribe(listener: (path: string) => void): () => void {\n // Each subscription is its own entry, so the same function subscribed twice stops once.\n const subscription = (path: string) => listener(path);\n this.listeners.add(subscription);\n const unsubscribe = this.source.subscribe((url) => {\n const path = pathOf(url);\n if (path) listener(path);\n });\n return () => {\n this.listeners.delete(subscription);\n unsubscribe();\n };\n }\n\n /**\n * One listener throwing is reported, and does not keep the launch url from the rest. The\n * `ErrorHandler` is looked up when that happens rather than when this is made: an app's handler\n * that injects the router reaches `DeepLinks` through the location, and would be a cycle at boot.\n */\n private deliver(listener: (path: string) => void, path: string): void {\n try {\n listener(path);\n } catch (error) {\n // A handler that rethrows, as some apps' do, would otherwise stop the listeners after this.\n try {\n const errors = this.injector.get(ErrorHandler, null);\n if (errors) errors.handleError(error);\n else console.error(error);\n } catch (reporting) {\n if (reporting === error) console.error(error);\n else console.error(error, reporting);\n }\n }\n }\n\n /** Hand a url to whatever else on the device handles it: a browser, Maps, another app. */\n open(url: string): void {\n this.source.open(url);\n }\n\n /**\n * Open the app's own page in the system settings, where a person turns on a permission the\n * platform no longer asks for. Android has no url for that page, so `open()` cannot reach it.\n */\n openSettings(): void {\n this.source.openSettings?.();\n }\n}\n"]}
|
package/dist/dialogs.js
CHANGED
|
@@ -92,7 +92,7 @@ export class Dialogs {
|
|
|
92
92
|
options: labels,
|
|
93
93
|
cancelButtonIndex: cancelIndex,
|
|
94
94
|
...(destructiveAt >= 0 ? { destructiveButtonIndex: destructiveAt } : {}),
|
|
95
|
-
}, (index) => resolve(index === cancelIndex
|
|
95
|
+
}, (index) => resolve(index === cancelIndex ? null : index));
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
/*
|
package/dist/dialogs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs.js","sourceRoot":"","sources":["../src/dialogs.ts"],"names":[],"m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EACP;oBACE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;oBAClE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE;iBAC1D,EACD,SAAS,EACT,YAAY,CACb;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,GAAG,IAAI,MAAM,CAAC,cAAc;YAC9B,CAAC,CAAC;gBACE,WAAW,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CACjC,MAAM,CAAC,cAAe,CAAC,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC;aACvE;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,YAAY;YAChC,CAAC,CAAC;gBACE,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CACvB,MAAM,CAAC,YAAa,CAAC,IAAI,CACvB,OAAO,EACP,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAa,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAa,CAAC,KAAK,CAC9D;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The platform's own dialogs: an alert, a confirmation, a prompt, an action sheet, a toast.\n *\n * All of these are callback APIs, and the reason to wrap them is that **a dialog is a question**.\n * `Alert.alert` hands its answer to one of several `onPress` callbacks, so asking something and\n * acting on the answer means splitting one thought across three functions. A promise puts it back\n * together, and `await` at the call site reads like what it is.\n *\n * The platform split is the other half. An action sheet is iOS's way of offering a short list of\n * choices and Android's is a dialog; a toast is Android's way of saying something small and iOS\n * has none. `choose` and `notify` pick per platform, so an app writes the intent rather than the\n * platform - and the one thing neither can do is fail silently on the platform it is not for.\n */\n\nimport { InjectionToken, Service, inject } from '@angular/core';\nimport { reactNative, type ReactNative } from './react-native.ts';\n\n/** One choice in a dialog or an action sheet. */\nexport interface Choice {\n readonly label: string;\n /** `cancel` is dismissal; `destructive` is the one the platform paints red. */\n readonly style?: 'default' | 'cancel' | 'destructive';\n}\n\nexport interface NativeDialogs {\n readonly platform: 'ios' | 'android' | string;\n alert(\n title: string,\n message: string | undefined,\n buttons: readonly { text: string; style?: string; onPress?: () => void }[],\n ): void;\n prompt?(\n title: string,\n message: string | undefined,\n onResult: (value: string | null) => void,\n defaultValue?: string,\n ): void;\n actionSheet?(\n options: {\n title?: string;\n options: string[];\n cancelButtonIndex: number;\n destructiveButtonIndex?: number;\n },\n onSelect: (index: number) => void,\n ): void;\n toast?(message: string, long: boolean): void;\n}\n\n/**\n * `inject(Dialogs).confirm('Delete this?', { destructive: true })`.\n *\n * A dialog is a question, so every method here resolves to the answer rather than handing it to\n * one of several callbacks.\n */\n@Service()\nexport class Dialogs {\n /** Overridden in a test to answer a dialog without one being shown. */\n static readonly SOURCE = new InjectionToken<NativeDialogs | null>('angular-native.dialogSource', {\n factory: () => dialogSource(reactNative()),\n });\n\n private readonly native = inject(Dialogs.SOURCE);\n\n /** Say something, and wait until it has been read. Resolves when the dialog is dismissed. */\n tell(title: string, message?: string, dismiss = 'OK'): Promise<void> {\n return new Promise((resolve) => {\n if (!this.native) return resolve();\n this.native.alert(title, message, [{ text: dismiss, onPress: () => resolve() }]);\n });\n }\n\n /**\n * Ask something with two answers. Resolves to whether they agreed.\n *\n * `destructive` paints the confirm button as the platform paints a delete, and puts cancel where\n * the platform puts it - which on iOS is the *right*, so a confirmation dialog does not train\n * people to tap the wrong thing.\n */\n confirm(\n title: string,\n options: { message?: string; confirm?: string; cancel?: string; destructive?: boolean } = {},\n ): Promise<boolean> {\n const { message, confirm = 'OK', cancel = 'Cancel', destructive = false } = options;\n return new Promise((resolve) => {\n if (!this.native) return resolve(false);\n this.native.alert(title, message, [\n { text: cancel, style: 'cancel', onPress: () => resolve(false) },\n {\n text: confirm,\n style: destructive ? 'destructive' : 'default',\n onPress: () => resolve(true),\n },\n ]);\n });\n }\n\n /**\n * Ask for a line of text. Resolves to null if they cancelled.\n *\n * iOS only: `Alert.prompt` has no Android equivalent, and inventing one out of a modal and a\n * text input would be a dialog that looks nothing like the platform's. On Android this resolves\n * to null so a caller can fall back to a screen of its own.\n */\n ask(title: string, options: { message?: string; value?: string } = {}): Promise<string | null> {\n return new Promise((resolve) => {\n if (!this.native?.prompt) return resolve(null);\n this.native.prompt(title, options.message, resolve, options.value);\n });\n }\n\n /**\n * Offer a short list of choices. Resolves to the index chosen, or null if dismissed.\n *\n * An action sheet on iOS and a dialog on Android, because that is what each platform means by\n * this. A `cancel` choice is where the platform puts cancel rather than in the list.\n */\n choose(title: string, choices: readonly Choice[]): Promise<number | null> {\n const cancelAt = choices.findIndex((choice) => choice.style === 'cancel');\n const destructiveAt = choices.findIndex((choice) => choice.style === 'destructive');\n\n return new Promise((resolve) => {\n if (!this.native) return resolve(null);\n\n if (this.native.actionSheet) {\n // iOS wants cancel last and named by index; a list with none gets one, because an action\n // sheet with no way out is one the user has to guess at.\n const labels = choices.map((choice) => choice.label);\n const cancelIndex = cancelAt >= 0 ? cancelAt : labels.push('Cancel') - 1;\n this.native.actionSheet(\n {\n title,\n options: labels,\n cancelButtonIndex: cancelIndex,\n ...(destructiveAt >= 0 ? { destructiveButtonIndex: destructiveAt } : {}),\n },\n (index) => resolve(index === cancelIndex && cancelAt < 0 ? null : index),\n );\n return;\n }\n\n /*\n * Android's alert is put up `cancelable: false` by React Native, so a press outside does\n * nothing and neither does the back button. Without a cancel among the choices there is no\n * way at all to decline - the user has to pick something - so one is appended, exactly as\n * the iOS branch above does for the same reason.\n *\n * Android's dialog holds three buttons: a negative, a neutral and a positive. Anything past\n * that is dropped by the platform without a word, and a choice the user cannot see is worse\n * than a list that refused to open, so it says so.\n */\n const buttons = choices.map((choice, index) => ({\n text: choice.label,\n style: choice.style,\n onPress: () => resolve(choice.style === 'cancel' ? null : index),\n }));\n if (cancelAt < 0) {\n buttons.push({ text: 'Cancel', style: 'cancel', onPress: () => resolve(null) });\n }\n if (buttons.length > 3) {\n console.error(\n `[angular-native] Dialogs.choose was given ${choices.length} choices and Android shows ` +\n 'at most three buttons, counting the cancel. The rest will not appear. Use a ' +\n '`ui-select` or an `action-sheet`-shaped list for anything longer.',\n );\n }\n this.native.alert(title, undefined, buttons);\n });\n }\n\n /**\n * Say something small and transient.\n *\n * A toast on Android. iOS has no such thing and never has, so this does nothing there rather\n * than putting up a modal alert for something that did not warrant interrupting anyone - and an\n * app that must be seen should use `tell`.\n */\n notify(message: string, options: { long?: boolean } = {}): void {\n this.native?.toast?.(message, options.long ?? false);\n }\n}\n\n/**\n * The platform's dialogs, from React Native's own modules.\n *\n * `Alert.prompt` and `ActionSheetIOS` are iOS-only and `ToastAndroid` is Android-only; each is\n * left absent rather than shimmed, which is what lets `ask`, `choose` and `notify` above decide\n * what to do about it.\n *\n * Which platform it is has to be asked outright, because React Native's own modules do not answer\n * it. `react-native` exports `ActionSheetIOS` on Android too - the object is there and so is\n * `showActionSheetWithOptions`; only the TurboModule underneath is null, and the invariant that\n * catches that throws out of the promise `choose` returns, so a press did nothing at all and said\n * nothing about it. `Alert.prompt` is worse: it exists on Android and its body is one\n * `Platform.OS === 'ios'` check, so it returns having called no callback and the promise `ask`\n * returns never settles. `ToastAndroid` is the mirror image on iOS. Presence is not capability\n * here; only the platform name is.\n */\nexport function dialogSource(\n native: Pick<ReactNative, 'Platform' | 'Alert' | 'ActionSheetIOS' | 'ToastAndroid'> | null,\n): NativeDialogs | null {\n if (!native) return null;\n\n const ios = native.Platform.OS === 'ios';\n const android = native.Platform.OS === 'android';\n\n return {\n platform: native.Platform.OS,\n alert: (title, message, buttons) => native.Alert.alert(title, message, [...buttons]),\n // Buttons rather than a callback: given a callback, `Alert.prompt` answers OK alone, and the\n // Cancel the native alert adds calls nothing, so a cancelled `ask` never settled.\n ...(ios && native.Alert.prompt\n ? {\n prompt: (title, message, onResult, defaultValue) =>\n native.Alert.prompt!(\n title,\n message,\n [\n { text: 'Cancel', style: 'cancel', onPress: () => onResult(null) },\n { text: 'OK', onPress: (value) => onResult(value ?? '') },\n ],\n undefined,\n defaultValue,\n ),\n }\n : {}),\n ...(ios && native.ActionSheetIOS\n ? {\n actionSheet: (options, onSelect) =>\n native.ActionSheetIOS!.showActionSheetWithOptions(options, onSelect),\n }\n : {}),\n ...(android && native.ToastAndroid\n ? {\n toast: (message, long) =>\n native.ToastAndroid!.show(\n message,\n long ? native.ToastAndroid!.LONG : native.ToastAndroid!.SHORT,\n ),\n }\n : {}),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dialogs.js","sourceRoot":"","sources":["../src/dialogs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;;AAkClE;;;;;GAKG;AAEH,MAAM,OAAO,OAAO;IAClB,uEAAuE;IACvE,MAAM,CAAU,MAAM,GAAG,IAAI,cAAc,CAAuB,6BAA6B,EAAE;QAC/F,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;KAC3C,CAAC,CAAC;IAEc,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,6FAA6F;IAC7F,IAAI,CAAC,KAAa,EAAE,OAAgB,EAAE,OAAO,GAAG,IAAI;QAClD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,MAAM;gBAAE,OAAO,OAAO,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAA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,CAAC,MAAM,CAAC,YAAa,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAa,CAAC,KAAK,CAC9D;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The platform's own dialogs: an alert, a confirmation, a prompt, an action sheet, a toast.\n *\n * All of these are callback APIs, and the reason to wrap them is that **a dialog is a question**.\n * `Alert.alert` hands its answer to one of several `onPress` callbacks, so asking something and\n * acting on the answer means splitting one thought across three functions. A promise puts it back\n * together, and `await` at the call site reads like what it is.\n *\n * The platform split is the other half. An action sheet is iOS's way of offering a short list of\n * choices and Android's is a dialog; a toast is Android's way of saying something small and iOS\n * has none. `choose` and `notify` pick per platform, so an app writes the intent rather than the\n * platform - and the one thing neither can do is fail silently on the platform it is not for.\n */\n\nimport { InjectionToken, Service, inject } from '@angular/core';\nimport { reactNative, type ReactNative } from './react-native.ts';\n\n/** One choice in a dialog or an action sheet. */\nexport interface Choice {\n readonly label: string;\n /** `cancel` is dismissal; `destructive` is the one the platform paints red. */\n readonly style?: 'default' | 'cancel' | 'destructive';\n}\n\nexport interface NativeDialogs {\n readonly platform: 'ios' | 'android' | string;\n alert(\n title: string,\n message: string | undefined,\n buttons: readonly { text: string; style?: string; onPress?: () => void }[],\n ): void;\n prompt?(\n title: string,\n message: string | undefined,\n onResult: (value: string | null) => void,\n defaultValue?: string,\n ): void;\n actionSheet?(\n options: {\n title?: string;\n options: string[];\n cancelButtonIndex: number;\n destructiveButtonIndex?: number;\n },\n onSelect: (index: number) => void,\n ): void;\n toast?(message: string, long: boolean): void;\n}\n\n/**\n * `inject(Dialogs).confirm('Delete this?', { destructive: true })`.\n *\n * A dialog is a question, so every method here resolves to the answer rather than handing it to\n * one of several callbacks.\n */\n@Service()\nexport class Dialogs {\n /** Overridden in a test to answer a dialog without one being shown. */\n static readonly SOURCE = new InjectionToken<NativeDialogs | null>('angular-native.dialogSource', {\n factory: () => dialogSource(reactNative()),\n });\n\n private readonly native = inject(Dialogs.SOURCE);\n\n /** Say something, and wait until it has been read. Resolves when the dialog is dismissed. */\n tell(title: string, message?: string, dismiss = 'OK'): Promise<void> {\n return new Promise((resolve) => {\n if (!this.native) return resolve();\n this.native.alert(title, message, [{ text: dismiss, onPress: () => resolve() }]);\n });\n }\n\n /**\n * Ask something with two answers. Resolves to whether they agreed.\n *\n * `destructive` paints the confirm button as the platform paints a delete, and puts cancel where\n * the platform puts it - which on iOS is the *right*, so a confirmation dialog does not train\n * people to tap the wrong thing.\n */\n confirm(\n title: string,\n options: { message?: string; confirm?: string; cancel?: string; destructive?: boolean } = {},\n ): Promise<boolean> {\n const { message, confirm = 'OK', cancel = 'Cancel', destructive = false } = options;\n return new Promise((resolve) => {\n if (!this.native) return resolve(false);\n this.native.alert(title, message, [\n { text: cancel, style: 'cancel', onPress: () => resolve(false) },\n {\n text: confirm,\n style: destructive ? 'destructive' : 'default',\n onPress: () => resolve(true),\n },\n ]);\n });\n }\n\n /**\n * Ask for a line of text. Resolves to null if they cancelled.\n *\n * iOS only: `Alert.prompt` has no Android equivalent, and inventing one out of a modal and a\n * text input would be a dialog that looks nothing like the platform's. On Android this resolves\n * to null so a caller can fall back to a screen of its own.\n */\n ask(title: string, options: { message?: string; value?: string } = {}): Promise<string | null> {\n return new Promise((resolve) => {\n if (!this.native?.prompt) return resolve(null);\n this.native.prompt(title, options.message, resolve, options.value);\n });\n }\n\n /**\n * Offer a short list of choices. Resolves to the index chosen, or null if dismissed.\n *\n * An action sheet on iOS and a dialog on Android, because that is what each platform means by\n * this. A `cancel` choice is where the platform puts cancel rather than in the list.\n */\n choose(title: string, choices: readonly Choice[]): Promise<number | null> {\n const cancelAt = choices.findIndex((choice) => choice.style === 'cancel');\n const destructiveAt = choices.findIndex((choice) => choice.style === 'destructive');\n\n return new Promise((resolve) => {\n if (!this.native) return resolve(null);\n\n if (this.native.actionSheet) {\n // iOS wants cancel last and named by index; a list with none gets one, because an action\n // sheet with no way out is one the user has to guess at.\n const labels = choices.map((choice) => choice.label);\n const cancelIndex = cancelAt >= 0 ? cancelAt : labels.push('Cancel') - 1;\n this.native.actionSheet(\n {\n title,\n options: labels,\n cancelButtonIndex: cancelIndex,\n ...(destructiveAt >= 0 ? { destructiveButtonIndex: destructiveAt } : {}),\n },\n (index) => resolve(index === cancelIndex ? null : index),\n );\n return;\n }\n\n /*\n * Android's alert is put up `cancelable: false` by React Native, so a press outside does\n * nothing and neither does the back button. Without a cancel among the choices there is no\n * way at all to decline - the user has to pick something - so one is appended, exactly as\n * the iOS branch above does for the same reason.\n *\n * Android's dialog holds three buttons: a negative, a neutral and a positive. Anything past\n * that is dropped by the platform without a word, and a choice the user cannot see is worse\n * than a list that refused to open, so it says so.\n */\n const buttons = choices.map((choice, index) => ({\n text: choice.label,\n style: choice.style,\n onPress: () => resolve(choice.style === 'cancel' ? null : index),\n }));\n if (cancelAt < 0) {\n buttons.push({ text: 'Cancel', style: 'cancel', onPress: () => resolve(null) });\n }\n if (buttons.length > 3) {\n console.error(\n `[angular-native] Dialogs.choose was given ${choices.length} choices and Android shows ` +\n 'at most three buttons, counting the cancel. The rest will not appear. Use a ' +\n '`ui-select` or an `action-sheet`-shaped list for anything longer.',\n );\n }\n this.native.alert(title, undefined, buttons);\n });\n }\n\n /**\n * Say something small and transient.\n *\n * A toast on Android. iOS has no such thing and never has, so this does nothing there rather\n * than putting up a modal alert for something that did not warrant interrupting anyone - and an\n * app that must be seen should use `tell`.\n */\n notify(message: string, options: { long?: boolean } = {}): void {\n this.native?.toast?.(message, options.long ?? false);\n }\n}\n\n/**\n * The platform's dialogs, from React Native's own modules.\n *\n * `Alert.prompt` and `ActionSheetIOS` are iOS-only and `ToastAndroid` is Android-only; each is\n * left absent rather than shimmed, which is what lets `ask`, `choose` and `notify` above decide\n * what to do about it.\n *\n * Which platform it is has to be asked outright, because React Native's own modules do not answer\n * it. `react-native` exports `ActionSheetIOS` on Android too - the object is there and so is\n * `showActionSheetWithOptions`; only the TurboModule underneath is null, and the invariant that\n * catches that throws out of the promise `choose` returns, so a press did nothing at all and said\n * nothing about it. `Alert.prompt` is worse: it exists on Android and its body is one\n * `Platform.OS === 'ios'` check, so it returns having called no callback and the promise `ask`\n * returns never settles. `ToastAndroid` is the mirror image on iOS. Presence is not capability\n * here; only the platform name is.\n */\nexport function dialogSource(\n native: Pick<ReactNative, 'Platform' | 'Alert' | 'ActionSheetIOS' | 'ToastAndroid'> | null,\n): NativeDialogs | null {\n if (!native) return null;\n\n const ios = native.Platform.OS === 'ios';\n const android = native.Platform.OS === 'android';\n\n return {\n platform: native.Platform.OS,\n alert: (title, message, buttons) => native.Alert.alert(title, message, [...buttons]),\n // Buttons rather than a callback: given a callback, `Alert.prompt` answers OK alone, and the\n // Cancel the native alert adds calls nothing, so a cancelled `ask` never settled.\n ...(ios && native.Alert.prompt\n ? {\n prompt: (title, message, onResult, defaultValue) =>\n native.Alert.prompt!(\n title,\n message,\n [\n { text: 'Cancel', style: 'cancel', onPress: () => onResult(null) },\n { text: 'OK', onPress: (value) => onResult(value ?? '') },\n ],\n undefined,\n defaultValue,\n ),\n }\n : {}),\n ...(ios && native.ActionSheetIOS\n ? {\n actionSheet: (options, onSelect) =>\n native.ActionSheetIOS!.showActionSheetWithOptions(options, onSelect),\n }\n : {}),\n ...(android && native.ToastAndroid\n ? {\n toast: (message, long) =>\n native.ToastAndroid!.show(\n message,\n long ? native.ToastAndroid!.LONG : native.ToastAndroid!.SHORT,\n ),\n }\n : {}),\n };\n}\n"]}
|
package/dist/react-native.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export interface ReactNative {
|
|
|
149
149
|
Linking: {
|
|
150
150
|
getInitialURL(): Promise<string | null>;
|
|
151
151
|
openURL(url: string): Promise<unknown>;
|
|
152
|
+
openSettings(): Promise<void>;
|
|
152
153
|
addEventListener(event: 'url', handler: (event: {
|
|
153
154
|
url: string;
|
|
154
155
|
}) => void): {
|
package/dist/react-native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgJH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW;IACzB,IAAK,UAAkD,CAAC,qBAAqB,KAAK,SAAS,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;IACD,+FAA+F;IAC/F,8EAA8E;IAC9E,aAAa;IACb,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC,cAAc,CAAgB,CAAC;IACjF,OAAO,CAAC,KAAK,CACX,uFAAuF;QACrF,+DAA+D,CAClE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * React Native's own modules, fetched when a service is first constructed rather than when this\n * file is loaded.\n *\n * The distinction matters more than it looks. React Native ships its JavaScript as Flow, which\n * Node cannot parse, so a static `import ... from 'react-native'` anywhere in this package would\n * make the package unimportable by the test suite - and by `@ng-native/components`, which\n * the suite imports constantly. A call inside a factory is only ever executed on a device, where\n * `react-native` is the most ordinary import there is.\n *\n * ponytail: a `require` in a codebase that otherwise has none. The alternative is the shape\n * `@ng-native/expo` uses - a file per service outside `src`, importing the module and\n * declaring the service - which is right there because Expo's packages are optional peer\n * dependencies an app may not have installed. React Native is not optional, so the seam buys\n * nothing but files.\n */\n\n/** The subset of React Native this package reaches for, described so `require` has a type. */\nexport interface ReactNative {\n AccessibilityInfo: {\n isScreenReaderEnabled(): Promise<boolean>;\n isReduceMotionEnabled(): Promise<boolean>;\n isBoldTextEnabled(): Promise<boolean>;\n announceForAccessibility(announcement: string): void;\n addEventListener(\n event: 'screenReaderChanged' | 'reduceMotionChanged' | 'boldTextChanged',\n handler: (value: boolean) => void,\n ): { remove(): void };\n };\n AppState: {\n currentState: string | null;\n addEventListener(event: 'change', handler: (state: string) => void): { remove(): void };\n };\n Appearance: {\n getColorScheme(): 'light' | 'dark' | null | undefined;\n addChangeListener(handler: (preferences: { colorScheme?: string | null }) => void): {\n remove(): void;\n };\n setColorScheme?(scheme: 'light' | 'dark' | 'unspecified'): void;\n };\n BackHandler: {\n addEventListener(event: 'hardwareBackPress', handler: () => boolean): { remove(): void };\n };\n Dimensions: {\n get(dimension: 'window' | 'screen'): { width: number; height: number };\n addEventListener(\n event: 'change',\n handler: (sizes: {\n window: { width: number; height: number };\n screen: { width: number; height: number };\n }) => void,\n ): { remove(): void };\n };\n I18nManager: {\n /** Whether the app is laid out right to left. Fixed for the lifetime of the process. */\n isRTL: boolean;\n };\n Keyboard: {\n dismiss(): void;\n addListener(\n event:\n | 'keyboardDidShow'\n | 'keyboardDidHide'\n | 'keyboardWillShow'\n | 'keyboardWillHide'\n | 'keyboardWillChangeFrame',\n handler: (event: NativeKeyboardEvent) => void,\n ): { remove(): void };\n };\n StyleSheet: {\n /** The thinnest line the screen can draw, in points. `1 / PixelRatio.get()`, near enough. */\n hairlineWidth: number;\n };\n ActionSheetIOS?: {\n showActionSheetWithOptions(\n options: {\n title?: string;\n options: string[];\n cancelButtonIndex: number;\n destructiveButtonIndex?: number;\n },\n callback: (index: number) => void,\n ): void;\n };\n Alert: {\n alert(\n title: string,\n message?: string,\n buttons?: { text?: string; style?: string; onPress?: () => void }[],\n options?: object,\n ): void;\n /** iOS only. Absent on Android, where there is no such dialog. */\n prompt?(\n title: string,\n message?: string,\n callbackOrButtons?:\n | ((value: string) => void)\n | { text?: string; style?: string; onPress?: (value?: string) => void }[],\n type?: string,\n defaultValue?: string,\n ): void;\n };\n PixelRatio: {\n get(): number;\n /** The user's text size setting, as a multiplier. One is the default. */\n getFontScale(): number;\n };\n /** `Version` is a string on iOS, `'26.5'`, and the API level, a number, on Android. */\n Platform: { OS: string; Version?: string | number };\n Share: {\n share(\n content: { message?: string; url?: string; title?: string },\n options?: object,\n ): Promise<{ action: string; activityType?: string | null }>;\n };\n ToastAndroid?: {\n show(message: string, duration: number): void;\n SHORT: number;\n LONG: number;\n };\n Vibration: {\n vibrate(pattern?: number | number[], repeat?: boolean): void;\n cancel(): void;\n };\n DevSettings?: {\n addMenuItem(title: string, handler: () => unknown): void;\n reload(reason?: string): void;\n };\n LayoutAnimation: {\n configureNext(config: object, onDone?: () => void, onFail?: () => void): void;\n };\n PermissionsAndroid?: {\n check(permission: string): Promise<boolean>;\n request(permission: string, rationale?: object): Promise<string>;\n };\n StatusBar: {\n /** Android reports the bar's height in dp; iOS leaves it undefined. */\n currentHeight?: number;\n setBarStyle(style: string, animated?: boolean): void;\n setHidden(hidden: boolean, animation?: string): void;\n setBackgroundColor(color: string, animated?: boolean): void;\n setTranslucent(translucent: boolean): void;\n };\n Linking: {\n getInitialURL(): Promise<string | null>;\n openURL(url: string): Promise<unknown>;\n openSettings(): Promise<void>;\n addEventListener(event: 'url', handler: (event: { url: string }) => void): { remove(): void };\n };\n}\n\n/** What RN hands a keyboard listener. */\nexport interface NativeKeyboardEvent {\n readonly endCoordinates: { readonly height: number; readonly screenY: number };\n readonly duration?: number;\n /** One of `LayoutEasing`'s names; usually `'keyboard'` on iOS, and always on Android, with a zero duration. */\n readonly easing?: string;\n}\n\n/**\n * `null` off a device, where each capability falls back to doing nothing - the same as an\n * optional injection token nobody provided.\n *\n * The engine's presence is what tells the two apart. In Node and in a browser there is no\n * `nativeFabricUIManager`; on a device there is one, and a missing `require` would mean the bundler\n * stopped emitting CommonJS under us. That is worth saying out loud rather than quietly rendering\n * an app whose keyboard never moves.\n *\n * `require` alone cannot tell them apart: a browser bundle can have one. Rolldown gives a `vite\n * build` its own `require` for an external module, which passes `typeof require === 'function'`\n * and throws when called.\n */\nexport function reactNative(): ReactNative | null {\n if ((globalThis as { nativeFabricUIManager?: unknown }).nativeFabricUIManager === undefined) {\n return null;\n }\n // `require` has a type only where the app's tsconfig loads Node's or React Native's types, and\n // a browser app's loads neither. `@ts-expect-error` would fail where it does.\n // @ts-ignore\n if (typeof require === 'function') return require('react-native') as ReactNative;\n console.error(\n '[angular-native] react-native could not be required, so every platform capability is ' +\n 'inert. The bundle is not CommonJS; check the Metro transform.',\n );\n return null;\n}\n"]}
|
package/dist/status-bar.d.ts
CHANGED
|
@@ -65,14 +65,19 @@ export declare class StatusBar {
|
|
|
65
65
|
set(state: StatusBarState): void;
|
|
66
66
|
/** A claim on top of whatever is there. Call the returned function to drop it. */
|
|
67
67
|
push(state: StatusBarState): () => void;
|
|
68
|
+
/** The properties a claim has had the platform change, which no claim names any more. */
|
|
69
|
+
private readonly changed;
|
|
68
70
|
/**
|
|
69
71
|
* Push the merged state at the platform.
|
|
70
72
|
*
|
|
71
|
-
* Written whole rather than diffed: the platform's own setters are the cheap part
|
|
72
|
-
*
|
|
73
|
-
*
|
|
73
|
+
* Written whole rather than diffed: the platform's own setters are the cheap part. A property
|
|
74
|
+
* the last claim to name it has dropped goes back to the platform's own, once. Not the
|
|
75
|
+
* background color, whose own the theme decides. Read untracked, so an effect that sets the bar
|
|
76
|
+
* does not also subscribe to it and run again on every later claim.
|
|
74
77
|
*/
|
|
75
78
|
private apply;
|
|
79
|
+
/** Whether to tell the platform: a claim names `property`, or the last one to has dropped. */
|
|
80
|
+
private changes;
|
|
76
81
|
static ɵfac: i0.ɵɵFactoryDeclaration<StatusBar, never>;
|
|
77
82
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
78
83
|
}
|
package/dist/status-bar.js
CHANGED
|
@@ -88,24 +88,36 @@ export class StatusBar {
|
|
|
88
88
|
this.apply();
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
+
/** The properties a claim has had the platform change, which no claim names any more. */
|
|
92
|
+
changed = new Set();
|
|
91
93
|
/**
|
|
92
94
|
* Push the merged state at the platform.
|
|
93
95
|
*
|
|
94
|
-
* Written whole rather than diffed: the platform's own setters are the cheap part
|
|
95
|
-
*
|
|
96
|
-
*
|
|
96
|
+
* Written whole rather than diffed: the platform's own setters are the cheap part. A property
|
|
97
|
+
* the last claim to name it has dropped goes back to the platform's own, once. Not the
|
|
98
|
+
* background color, whose own the theme decides. Read untracked, so an effect that sets the bar
|
|
99
|
+
* does not also subscribe to it and run again on every later claim.
|
|
97
100
|
*/
|
|
98
101
|
apply() {
|
|
99
102
|
const { style, hidden, animated, backgroundColor, translucent } = untracked(this.state);
|
|
100
|
-
if (style
|
|
101
|
-
this.source.setStyle(resolve(style, untracked(this.scheme.current)), animated);
|
|
103
|
+
if (this.changes('style', style)) {
|
|
104
|
+
this.source.setStyle(resolve(style ?? 'default', untracked(this.scheme.current)), animated);
|
|
105
|
+
}
|
|
106
|
+
if (this.changes('hidden', hidden)) {
|
|
107
|
+
this.source.setHidden(hidden ?? false, animated ? 'fade' : undefined);
|
|
102
108
|
}
|
|
103
|
-
if (hidden !== undefined)
|
|
104
|
-
this.source.setHidden(hidden, animated ? 'fade' : undefined);
|
|
105
109
|
if (backgroundColor !== undefined)
|
|
106
110
|
this.source.setBackgroundColor(backgroundColor, animated);
|
|
107
|
-
if (translucent
|
|
108
|
-
this.source.setTranslucent(translucent);
|
|
111
|
+
if (this.changes('translucent', translucent)) {
|
|
112
|
+
this.source.setTranslucent(translucent ?? false);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Whether to tell the platform: a claim names `property`, or the last one to has dropped. */
|
|
116
|
+
changes(property, value) {
|
|
117
|
+
if (value === undefined)
|
|
118
|
+
return this.changed.delete(property);
|
|
119
|
+
this.changed.add(property);
|
|
120
|
+
return true;
|
|
109
121
|
}
|
|
110
122
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: StatusBar, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
111
123
|
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.2.0", ngImport: i0, type: StatusBar });
|
package/dist/status-bar.js.map
CHANGED
|
@@ -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SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACvF,IAAI,eAAe,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC7F,IAAI,WAAW,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACzE,CAAC;uGAjEU,SAAS;wGAAT,SAAS;;2FAAT,SAAS;kBADrB,OAAO;;AAqER,sFAAsF;AACtF,SAAS,OAAO,CAAC,KAAqB,EAAE,MAAc;IACpD,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * The status bar: what colour its text is, whether it is there at all, and how tall it is.\n *\n * React Native only offers this as a component. `<StatusBar />` applies its style by *rendering*,\n * and does it through a stack of entries so that a screen pushed on top can change the bar and\n * the screen underneath gets its own back when that one leaves. None of the rendering survives\n * without React - but the statics underneath do, and the stack is exactly what a navigation-driven\n * app needs, so it is the part worth keeping.\n *\n * `expo-status-bar` is the same statics with a React component around them, so nothing here needs\n * that package installed.\n */\nimport {\n DestroyRef,\n InjectionToken,\n Service,\n computed,\n inject,\n signal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { ColorScheme, type Scheme } from './color-scheme.ts';\nimport { reactNative } from './react-native.ts';\n\n/**\n * Dark text for a light bar, light text for a dark one. `default` is whatever the OS picks, which on\n * Android is light text whatever the scheme. `auto` is dark text in the light color scheme and\n * light text in the dark one, and follows `ColorScheme`, an in-app theme switch included.\n */\nexport type StatusBarStyle = 'default' | 'light' | 'dark' | 'auto';\n\n/** A style the platform takes: `auto` is resolved against the color scheme before it gets there. */\nexport type PlatformStatusBarStyle = Exclude<StatusBarStyle, 'auto'>;\n\n/** What a claim asks for. Anything absent is left as whatever the claim underneath said. */\nexport interface StatusBarState {\n readonly style?: StatusBarStyle;\n readonly hidden?: boolean;\n readonly animated?: boolean;\n /** Android only: the bar's own background. iOS has no such thing. */\n readonly backgroundColor?: string;\n /** Android only: whether content draws underneath the bar. */\n readonly translucent?: boolean;\n}\n\n/** Where the bar actually is. A fake stands in for the platform in tests. */\nexport interface StatusBarSource {\n setStyle(style: PlatformStatusBarStyle, animated?: boolean): void;\n setHidden(hidden: boolean, animation?: 'none' | 'fade' | 'slide'): void;\n setBackgroundColor(color: string, animated?: boolean): void;\n setTranslucent(translucent: boolean): void;\n /** Android reports one; iOS does not, where the safe-area inset is the number that matters. */\n readonly height: number | undefined;\n}\n\n/** RN spells the styles for its own platforms; `light` means light *content*, as CSS would. */\nconst BAR_STYLES = { default: 'default', light: 'light-content', dark: 'dark-content' } as const;\n\nexport function statusBarSource(): StatusBarSource {\n const native = reactNative();\n if (!native) {\n return {\n setStyle: () => {},\n setHidden: () => {},\n setBackgroundColor: () => {},\n setTranslucent: () => {},\n height: undefined,\n };\n }\n\n const { StatusBar } = native;\n return {\n setStyle: (style, animated) => StatusBar.setBarStyle(BAR_STYLES[style], animated),\n setHidden: (hidden, animation) => StatusBar.setHidden(hidden, animation),\n setBackgroundColor: (color, animated) => StatusBar.setBackgroundColor(color, animated),\n setTranslucent: (translucent) => StatusBar.setTranslucent(translucent),\n get height() {\n return StatusBar.currentHeight;\n },\n };\n}\n\n/**\n * A stack, not a setter.\n *\n * A modal that makes the bar light has to put back whatever the screen behind it asked for when\n * it is dismissed, and nothing else in an app remembers what that was. `push` returns the\n * function that drops the claim, so a screen can hand it straight to `DestroyRef.onDestroy`.\n */\n@Service()\nexport class StatusBar {\n /** Overridden in a test to watch the bar without one on screen. */\n static readonly SOURCE = new InjectionToken<StatusBarSource>('angular-native.statusBarSource', {\n factory: statusBarSource,\n });\n\n private readonly source = inject(StatusBar.SOURCE);\n private readonly scheme = inject(ColorScheme);\n private readonly stack = signal<readonly StatusBarState[]>([{}]);\n\n /** What is actually showing: every claim in order, later ones winning per property. */\n readonly state: Signal<StatusBarState> = computed(() =>\n this.stack().reduce((merged, entry) => ({ ...merged, ...entry }), {}),\n );\n\n /**\n * How tall it is, in points. Android reports it; iOS does not, and on iOS the number a layout\n * wants is the safe-area top inset, which `SafeArea` has.\n */\n readonly height: Signal<number> = signal(this.source.height ?? 0).asReadonly();\n\n constructor() {\n // Straight from the source rather than through an effect, so an `auto` bar changes in the same\n // turn as the scheme. The scheme is the listener's own: `ColorScheme.current` may not have\n // heard yet.\n const stop = inject(ColorScheme.SOURCE).subscribe((scheme) => {\n const { style, animated } = untracked(this.state);\n if (style === 'auto') this.source.setStyle(resolve(style, scheme), animated);\n });\n inject(DestroyRef).onDestroy(stop);\n }\n\n /** The base claim, for an app that sets the bar once at startup. */\n set(state: StatusBarState): void {\n this.stack.update((entries) => [state, ...entries.slice(1)]);\n this.apply();\n }\n\n /** A claim on top of whatever is there. Call the returned function to drop it. */\n push(state: StatusBarState): () => void {\n const entry = { ...state };\n this.stack.update((entries) => [...entries, entry]);\n this.apply();\n\n return () => {\n this.stack.update((entries) => entries.filter((one) => one !== entry));\n this.apply();\n };\n }\n\n /**\n * Push the merged state at the platform.\n *\n * Written whole rather than diffed: the platform's own setters are the cheap part, and a diff\n * would have to know which properties a *dropped* claim had been holding. Read untracked, so an\n * effect that sets the bar does not also subscribe to it and run again on every later claim.\n */\n private apply(): void {\n const { style, hidden, animated, backgroundColor, translucent } = untracked(this.state);\n if (style !== undefined) {\n this.source.setStyle(resolve(style, untracked(this.scheme.current)), animated);\n }\n if (hidden !== undefined) this.source.setHidden(hidden, animated ? 'fade' : undefined);\n if (backgroundColor !== undefined) this.source.setBackgroundColor(backgroundColor, animated);\n if (translucent !== undefined) this.source.setTranslucent(translucent);\n }\n}\n\n/** Dark text on the light scheme's light background, light text on the dark one's. */\nfunction resolve(style: StatusBarStyle, scheme: Scheme): PlatformStatusBarStyle {\n if (style !== 'auto') return style;\n return scheme === 'dark' ? 'light' : 'dark';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"status-bar.js","sourceRoot":"","sources":["../src/status-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;;AAiChD,+FAA+F;AAC/F,MAAM,UAAU,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAW,CAAC;AAEjG,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;YAClB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;YAC5B,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;YACxB,MAAM,EAAE,SAAS;SAClB,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,OAAO;QACL,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;QACjF,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;QACxE,kBAAkB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,kBAAkB,CAAC,K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AAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9F,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,IAAI,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,eAAe,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC7F,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,8FAA8F;IACtF,OAAO,CAAC,QAA4C,EAAE,KAAc;QAC1E,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;uGAhFU,SAAS;wGAAT,SAAS;;2FAAT,SAAS;kBADrB,OAAO;;AAoFR,sFAAsF;AACtF,SAAS,OAAO,CAAC,KAAqB,EAAE,MAAc;IACpD,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * The status bar: what colour its text is, whether it is there at all, and how tall it is.\n *\n * React Native only offers this as a component. `<StatusBar />` applies its style by *rendering*,\n * and does it through a stack of entries so that a screen pushed on top can change the bar and\n * the screen underneath gets its own back when that one leaves. None of the rendering survives\n * without React - but the statics underneath do, and the stack is exactly what a navigation-driven\n * app needs, so it is the part worth keeping.\n *\n * `expo-status-bar` is the same statics with a React component around them, so nothing here needs\n * that package installed.\n */\nimport {\n DestroyRef,\n InjectionToken,\n Service,\n computed,\n inject,\n signal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { ColorScheme, type Scheme } from './color-scheme.ts';\nimport { reactNative } from './react-native.ts';\n\n/**\n * Dark text for a light bar, light text for a dark one. `default` is whatever the OS picks, which on\n * Android is light text whatever the scheme. `auto` is dark text in the light color scheme and\n * light text in the dark one, and follows `ColorScheme`, an in-app theme switch included.\n */\nexport type StatusBarStyle = 'default' | 'light' | 'dark' | 'auto';\n\n/** A style the platform takes: `auto` is resolved against the color scheme before it gets there. */\nexport type PlatformStatusBarStyle = Exclude<StatusBarStyle, 'auto'>;\n\n/** What a claim asks for. Anything absent is left as whatever the claim underneath said. */\nexport interface StatusBarState {\n readonly style?: StatusBarStyle;\n readonly hidden?: boolean;\n readonly animated?: boolean;\n /** Android only: the bar's own background. iOS has no such thing. */\n readonly backgroundColor?: string;\n /** Android only: whether content draws underneath the bar. */\n readonly translucent?: boolean;\n}\n\n/** Where the bar actually is. A fake stands in for the platform in tests. */\nexport interface StatusBarSource {\n setStyle(style: PlatformStatusBarStyle, animated?: boolean): void;\n setHidden(hidden: boolean, animation?: 'none' | 'fade' | 'slide'): void;\n setBackgroundColor(color: string, animated?: boolean): void;\n setTranslucent(translucent: boolean): void;\n /** Android reports one; iOS does not, where the safe-area inset is the number that matters. */\n readonly height: number | undefined;\n}\n\n/** RN spells the styles for its own platforms; `light` means light *content*, as CSS would. */\nconst BAR_STYLES = { default: 'default', light: 'light-content', dark: 'dark-content' } as const;\n\nexport function statusBarSource(): StatusBarSource {\n const native = reactNative();\n if (!native) {\n return {\n setStyle: () => {},\n setHidden: () => {},\n setBackgroundColor: () => {},\n setTranslucent: () => {},\n height: undefined,\n };\n }\n\n const { StatusBar } = native;\n return {\n setStyle: (style, animated) => StatusBar.setBarStyle(BAR_STYLES[style], animated),\n setHidden: (hidden, animation) => StatusBar.setHidden(hidden, animation),\n setBackgroundColor: (color, animated) => StatusBar.setBackgroundColor(color, animated),\n setTranslucent: (translucent) => StatusBar.setTranslucent(translucent),\n get height() {\n return StatusBar.currentHeight;\n },\n };\n}\n\n/**\n * A stack, not a setter.\n *\n * A modal that makes the bar light has to put back whatever the screen behind it asked for when\n * it is dismissed, and nothing else in an app remembers what that was. `push` returns the\n * function that drops the claim, so a screen can hand it straight to `DestroyRef.onDestroy`.\n */\n@Service()\nexport class StatusBar {\n /** Overridden in a test to watch the bar without one on screen. */\n static readonly SOURCE = new InjectionToken<StatusBarSource>('angular-native.statusBarSource', {\n factory: statusBarSource,\n });\n\n private readonly source = inject(StatusBar.SOURCE);\n private readonly scheme = inject(ColorScheme);\n private readonly stack = signal<readonly StatusBarState[]>([{}]);\n\n /** What is actually showing: every claim in order, later ones winning per property. */\n readonly state: Signal<StatusBarState> = computed(() =>\n this.stack().reduce((merged, entry) => ({ ...merged, ...entry }), {}),\n );\n\n /**\n * How tall it is, in points. Android reports it; iOS does not, and on iOS the number a layout\n * wants is the safe-area top inset, which `SafeArea` has.\n */\n readonly height: Signal<number> = signal(this.source.height ?? 0).asReadonly();\n\n constructor() {\n // Straight from the source rather than through an effect, so an `auto` bar changes in the same\n // turn as the scheme. The scheme is the listener's own: `ColorScheme.current` may not have\n // heard yet.\n const stop = inject(ColorScheme.SOURCE).subscribe((scheme) => {\n const { style, animated } = untracked(this.state);\n if (style === 'auto') this.source.setStyle(resolve(style, scheme), animated);\n });\n inject(DestroyRef).onDestroy(stop);\n }\n\n /** The base claim, for an app that sets the bar once at startup. */\n set(state: StatusBarState): void {\n this.stack.update((entries) => [state, ...entries.slice(1)]);\n this.apply();\n }\n\n /** A claim on top of whatever is there. Call the returned function to drop it. */\n push(state: StatusBarState): () => void {\n const entry = { ...state };\n this.stack.update((entries) => [...entries, entry]);\n this.apply();\n\n return () => {\n this.stack.update((entries) => entries.filter((one) => one !== entry));\n this.apply();\n };\n }\n\n /** The properties a claim has had the platform change, which no claim names any more. */\n private readonly changed = new Set<'style' | 'hidden' | 'translucent'>();\n\n /**\n * Push the merged state at the platform.\n *\n * Written whole rather than diffed: the platform's own setters are the cheap part. A property\n * the last claim to name it has dropped goes back to the platform's own, once. Not the\n * background color, whose own the theme decides. Read untracked, so an effect that sets the bar\n * does not also subscribe to it and run again on every later claim.\n */\n private apply(): void {\n const { style, hidden, animated, backgroundColor, translucent } = untracked(this.state);\n if (this.changes('style', style)) {\n this.source.setStyle(resolve(style ?? 'default', untracked(this.scheme.current)), animated);\n }\n if (this.changes('hidden', hidden)) {\n this.source.setHidden(hidden ?? false, animated ? 'fade' : undefined);\n }\n if (backgroundColor !== undefined) this.source.setBackgroundColor(backgroundColor, animated);\n if (this.changes('translucent', translucent)) {\n this.source.setTranslucent(translucent ?? false);\n }\n }\n\n /** Whether to tell the platform: a claim names `property`, or the last one to has dropped. */\n private changes(property: 'style' | 'hidden' | 'translucent', value: unknown): boolean {\n if (value === undefined) return this.changed.delete(property);\n this.changed.add(property);\n return true;\n }\n}\n\n/** Dark text on the light scheme's light background, light text on the dark one's. */\nfunction resolve(style: StatusBarStyle, scheme: Scheme): PlatformStatusBarStyle {\n if (style !== 'auto') return style;\n return scheme === 'dark' ? 'light' : 'dark';\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/device",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Angular Native device services: keyboard, screen, color scheme, app state, accessibility, hardware back and deep links.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "dist/index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ng-native/fabric": "0.
|
|
20
|
+
"@ng-native/fabric": "0.11.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@angular/core": "^22.0.0",
|