@ng-native/device 0.22.2 → 0.24.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/accessibility.d.ts +7 -0
- package/dist/accessibility.js +14 -2
- package/dist/accessibility.js.map +1 -1
- package/dist/app-lifecycle.d.ts +49 -0
- package/dist/app-lifecycle.js +67 -0
- package/dist/app-lifecycle.js.map +1 -0
- package/dist/app-state.d.ts +2 -0
- package/dist/app-state.js +2 -0
- package/dist/app-state.js.map +1 -1
- package/dist/app-windows.d.ts +321 -0
- package/dist/app-windows.js +526 -0
- package/dist/app-windows.js.map +1 -0
- package/dist/color-scheme.d.ts +5 -0
- package/dist/color-scheme.js +16 -0
- package/dist/color-scheme.js.map +1 -1
- package/dist/conditions.d.ts +11 -3
- package/dist/conditions.js +42 -9
- package/dist/conditions.js.map +1 -1
- package/dist/control-size.d.ts +6 -0
- package/dist/control-size.js +2 -0
- package/dist/control-size.js.map +1 -0
- package/dist/deep-links.d.ts +3 -1
- package/dist/deep-links.js +3 -1
- package/dist/deep-links.js.map +1 -1
- package/dist/desktop-options.d.ts +73 -0
- package/dist/desktop-options.js +182 -0
- package/dist/desktop-options.js.map +1 -0
- package/dist/desktop-permissions.d.ts +30 -0
- package/dist/desktop-permissions.js +169 -0
- package/dist/desktop-permissions.js.map +1 -0
- package/dist/dev-menu.d.ts +2 -2
- package/dist/dev-menu.js +3 -5
- package/dist/dev-menu.js.map +1 -1
- package/dist/dialogs.d.ts +9 -7
- package/dist/dialogs.js +15 -10
- package/dist/dialogs.js.map +1 -1
- package/dist/direction.d.ts +2 -0
- package/dist/direction.js +2 -0
- package/dist/direction.js.map +1 -1
- package/dist/dock.d.ts +48 -0
- package/dist/dock.js +70 -0
- package/dist/dock.js.map +1 -0
- package/dist/drag-and-drop.d.ts +67 -0
- package/dist/drag-and-drop.js +74 -0
- package/dist/drag-and-drop.js.map +1 -0
- package/dist/expo-view-name.d.ts +16 -0
- package/dist/expo-view-name.js +22 -0
- package/dist/expo-view-name.js.map +1 -0
- package/dist/hardware-back.d.ts +3 -10
- package/dist/hardware-back.js +4 -1
- package/dist/hardware-back.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction-observer.d.ts +117 -0
- package/dist/interaction-observer.js +241 -0
- package/dist/interaction-observer.js.map +1 -0
- package/dist/keyboard.d.ts +2 -8
- package/dist/keyboard.js +3 -0
- package/dist/keyboard.js.map +1 -1
- package/dist/layout-animation.d.ts +3 -1
- package/dist/layout-animation.js +3 -1
- package/dist/layout-animation.js.map +1 -1
- package/dist/menu-model.d.ts +108 -0
- package/dist/menu-model.js +259 -0
- package/dist/menu-model.js.map +1 -0
- package/dist/menu-template.d.ts +19 -0
- package/dist/menu-template.js +31 -0
- package/dist/menu-template.js.map +1 -0
- package/dist/menus.d.ts +225 -0
- package/dist/menus.js +341 -0
- package/dist/menus.js.map +1 -0
- package/dist/navigation-bar.d.ts +2 -12
- package/dist/navigation-bar.js +4 -1
- package/dist/navigation-bar.js.map +1 -1
- package/dist/os-support.d.ts +42 -0
- package/dist/os-support.js +207 -0
- package/dist/os-support.js.map +1 -0
- package/dist/os.d.ts +26 -5
- package/dist/os.js +35 -7
- package/dist/os.js.map +1 -1
- package/dist/own-host.d.ts +27 -0
- package/dist/own-host.js +79 -0
- package/dist/own-host.js.map +1 -0
- package/dist/processes.d.ts +116 -0
- package/dist/processes.js +177 -0
- package/dist/processes.js.map +1 -0
- package/dist/react-native.d.ts +19 -0
- package/dist/react-native.js.map +1 -1
- package/dist/safe-area.d.ts +12 -1
- package/dist/safe-area.js +16 -2
- package/dist/safe-area.js.map +1 -1
- package/dist/screen.d.ts +2 -0
- package/dist/screen.js +2 -0
- package/dist/screen.js.map +1 -1
- package/dist/sharing.d.ts +3 -1
- package/dist/sharing.js +8 -1
- package/dist/sharing.js.map +1 -1
- package/dist/shell.d.ts +33 -0
- package/dist/shell.js +73 -0
- package/dist/shell.js.map +1 -0
- package/dist/shortcut.d.ts +49 -0
- package/dist/shortcut.js +92 -0
- package/dist/shortcut.js.map +1 -0
- package/dist/sidebar-selection.d.ts +8 -0
- package/dist/sidebar-selection.js +9 -0
- package/dist/sidebar-selection.js.map +1 -0
- package/dist/spawn-rules.d.ts +108 -0
- package/dist/spawn-rules.js +313 -0
- package/dist/spawn-rules.js.map +1 -0
- package/dist/split-views.d.ts +7 -0
- package/dist/split-views.js +21 -0
- package/dist/split-views.js.map +1 -0
- package/dist/status-bar.d.ts +2 -12
- package/dist/status-bar.js +3 -0
- package/dist/status-bar.js.map +1 -1
- package/dist/tray.d.ts +63 -0
- package/dist/tray.js +76 -0
- package/dist/tray.js.map +1 -0
- package/dist/undo-stack.d.ts +64 -0
- package/dist/undo-stack.js +110 -0
- package/dist/undo-stack.js.map +1 -0
- package/dist/vibration.d.ts +3 -14
- package/dist/vibration.js +4 -1
- package/dist/vibration.js.map +1 -1
- package/dist/window-navigator.d.ts +25 -0
- package/dist/window-navigator.js +7 -0
- package/dist/window-navigator.js.map +1 -0
- package/dist/window-restore.d.ts +45 -0
- package/dist/window-restore.js +66 -0
- package/dist/window-restore.js.map +1 -0
- package/package.json +10 -2
package/dist/navigation-bar.js
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* `expo-navigation-bar`. Without it, and on iOS, which has no navigation bar, every claim is kept
|
|
11
11
|
* but changes nothing.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { injectOs } from "./os.js";
|
|
14
|
+
import { DestroyRef, InjectionToken, Service, computed, inject, untracked, signal, } from '@angular/core';
|
|
14
15
|
import { ColorScheme } from "./color-scheme.js";
|
|
15
16
|
import { mergeClaims } from "./merge-claims.js";
|
|
16
17
|
import { reactNative } from "./react-native.js";
|
|
@@ -43,6 +44,8 @@ export class NavigationBar {
|
|
|
43
44
|
/** Overridden in a test to watch the bar without one on screen. */
|
|
44
45
|
static SOURCE = new InjectionToken('angular-native.navigationBarSource', { factory: navigationBarSource });
|
|
45
46
|
source = inject(NavigationBar.SOURCE);
|
|
47
|
+
/** Whether there is a navigation bar to style: on Android alone. */
|
|
48
|
+
available = signal(injectOs() === 'android').asReadonly();
|
|
46
49
|
/** This app, among the apps claiming the bar: its scheme is what an `auto` style it claims follows. */
|
|
47
50
|
owner = { scheme: inject(ColorScheme) };
|
|
48
51
|
/** Every app's claims on this bar: the window is the runtime's, not an app's. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-bar.js","sourceRoot":"","sources":["../src/navigation-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;;AAmCjF,MAAM,IAAI,GAAwB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;AAE9E,MAAM,UAAU,mBAAmB;IACjC,yDAAyD;IACzD,IAAI,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAClE,MAAM,OAAO,GAAI,UAA+D,CAAC,IAAI,EAAE,OAAO,CAAC;IAC/F,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC,mBAAmB,CAAoC,CAAC;IACjF,+FAA+F;IAC/F,qEAAqE;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAChC,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,CAAC","sourcesContent":["/**\n * Android's navigation bar: the colour of its buttons, and whether it is there at all.\n *\n * The same stack of claims as `StatusBar`, so a video player can hide the bar while it is open and\n * the screen behind gets the bar back when it closes. `style: 'auto'` follows `ColorScheme`, a\n * theme the app sets included, and a fixed style holds through a scheme change.\n *\n * Driven through `expo-navigation-bar`'s native module, reached by name so nothing here imports the\n * package. Expo Go carries it; a development build has it once the app installs\n * `expo-navigation-bar`. Without it, and on iOS, which has no navigation bar, every claim is kept\n * but changes nothing.\n */\nimport {\n DestroyRef,\n InjectionToken,\n Service,\n computed,\n inject,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { ColorScheme, type Scheme } from './color-scheme.ts';\nimport { mergeClaims } from './merge-claims.ts';\nimport { reactNative } from './react-native.ts';\nimport { WindowClaims, onWindowFront, sharedBySource } from './window-claims.ts';\n\n/**\n * The colour of the bar's buttons. `dark` is dark buttons, for a light screen behind them, and\n * `light` light ones, as `StatusBarStyle` names its text. `auto` is dark buttons in the light\n * colour scheme and light ones in the dark one, and follows `ColorScheme`.\n */\nexport type NavigationBarStyle = 'light' | 'dark' | 'auto';\n\n/** What a claim asks for. Anything absent is left as whatever the claim underneath said. */\nexport interface NavigationBarState {\n readonly style?: NavigationBarStyle;\n /** Hide the bar until a swipe from the edge of the screen shows it for a moment. */\n readonly hidden?: boolean;\n}\n\n/** Where the bar actually is. A fake stands in for the platform in tests. */\nexport interface NavigationBarSource {\n setStyle(style: Exclude<NavigationBarStyle, 'auto'>): void;\n setHidden(hidden: boolean): void;\n /**\n * react-native-screens shows or hides the bar each time a screen appears, from that screen's own\n * `navigationBarHidden`, once any screen has set one. So a hidden claim rides on every screen too.\n */\n readonly screensSetBar?: boolean;\n /** Calls `listener` when a window comes to the front, to be given the whole bar again. */\n onWindowFront?(listener: () => void): () => void;\n}\n\n/** `expo-navigation-bar`'s native module, as much of it as this uses. */\ninterface NativeNavigationBar {\n setStyle?(style: 'light' | 'dark'): Promise<void>;\n setHidden?(hidden: boolean): Promise<void>;\n}\n\nconst NONE: NavigationBarSource = { setStyle: () => {}, setHidden: () => {} };\n\nexport function navigationBarSource(): NavigationBarSource {\n // Copies: with no bar to share, each app claims its own.\n if (reactNative()?.Platform?.OS !== 'android') return { ...NONE };\n const modules = (globalThis as { expo?: { modules?: Record<string, unknown> } }).expo?.modules;\n const native = modules?.['ExpoNavigationBar'] as NativeNavigationBar | undefined;\n // Without the module a claim changes nothing, so it does not ride on the screens either, where\n // react-native-screens would hide the bar the next time one appears.\n if (!native) return { ...NONE };\n // One per module, so every app the runtime mounts claims the same bar.\n return sharedBySource(navigationBarSource, native, () => ({\n setStyle: (style) => void native.setStyle?.(style)?.catch(() => {}),\n setHidden: (hidden) => void native.setHidden?.(hidden)?.catch(() => {}),\n screensSetBar: true,\n onWindowFront,\n }));\n}\n\n/**\n * A stack, not a setter, for the same reason as `StatusBar`'s: whatever hid the bar has to give it\n * back to whatever was there before. `push` returns the function that drops the claim.\n */\n@Service()\nexport class NavigationBar {\n /** Overridden in a test to watch the bar without one on screen. */\n static readonly SOURCE = new InjectionToken<NavigationBarSource>(\n 'angular-native.navigationBarSource',\n { factory: navigationBarSource },\n );\n\n private readonly source = inject(NavigationBar.SOURCE);\n /** This app, among the apps claiming the bar: its scheme is what an `auto` style it claims follows. */\n private readonly owner: Owner = { scheme: inject(ColorScheme) };\n /** Every app's claims on this bar: the window is the runtime's, not an app's. */\n private readonly window = sharedBySource(\n NavigationBarWindow,\n this.source,\n () => new NavigationBarWindow(this.source),\n );\n\n /** What is actually showing: every claim in order, later ones winning per property. */\n readonly state: Signal<NavigationBarState> = this.window.state;\n\n /**\n * What a screen with no `navigationBarHidden` of its own carries, so the claim still holds when\n * it appears. Empty but on Android. The router passes it on.\n */\n readonly forScreens: Signal<{ readonly hidden?: boolean }> = computed(() =>\n this.source.screensSetBar ? { hidden: this.state().hidden } : {},\n );\n\n constructor() {\n // Straight from the source, as `StatusBar` does, so the buttons change in the same turn as the\n // scheme.\n const stop = inject(ColorScheme.SOURCE).subscribe((scheme) =>\n this.window.schemeChanged(this.owner, scheme),\n );\n inject(DestroyRef).onDestroy(() => {\n stop();\n // An app that goes takes its claims with it, and leaves the bar to the apps still here.\n this.window.claims.drop(this.owner);\n this.window.apply();\n });\n }\n\n /** The base claim, for an app that sets the bar once at startup. */\n set(state: NavigationBarState): void {\n this.window.claims.setBase(this.owner, state);\n this.window.apply();\n }\n\n /** A claim on top of whatever is there. Call the returned function to drop it. */\n push(state: NavigationBarState): () => void {\n const drop = this.window.claims.push(this.owner, { ...state });\n this.window.apply();\n return () => {\n drop();\n this.window.apply();\n };\n }\n}\n\ninterface Owner {\n readonly scheme: ColorScheme;\n}\n\n/** The bar, as every app on one source claims it. */\nclass NavigationBarWindow {\n readonly claims = new WindowClaims<NavigationBarState, Owner>();\n readonly state: Signal<NavigationBarState> = computed(() =>\n mergeClaims(this.claims.all().map((claim) => claim.value)),\n );\n\n /** The properties a claim has had the platform change, which no claim names any more. */\n private readonly changed = new Set<keyof NavigationBarState>();\n\n /** Whether a claim has ever set the style, after which an unclaimed bar follows the scheme. */\n private styled = false;\n\n private readonly source: NavigationBarSource;\n\n constructor(source: NavigationBarSource) {\n this.source = source;\n // Lives as long as the source, which is the runtime's.\n source.onWindowFront?.(() => this.apply(true));\n }\n\n /**\n * Android puts the buttons back to the new scheme's own on a scheme change, so a fixed style is\n * sent again too. A bar no style claim names any more is `auto`, once one has named a style, and\n * follows the scheme the listener heard.\n */\n schemeChanged(owner: Owner, scheme: Scheme): void {\n const claimed = untracked(() => this.styleOwner());\n if (claimed && claimed.owner !== owner) return;\n const style = claimed?.style ?? (this.styled ? 'auto' : undefined);\n if (style !== undefined) this.source.setStyle(resolve(style, scheme));\n }\n\n /**\n * Push the merged state at the platform. A property the last claim to name it has dropped goes\n * back, once: the style to `auto`, which then keeps following the scheme, and the bar to shown.\n * A window come to the front is given what is claimed, and an `auto` style once one was named.\n */\n apply(front = false): void {\n const { style, hidden } = untracked(this.state);\n if (this.changes('style', style) || (front && this.styled)) {\n this.styled = true;\n this.source.setStyle(\n resolve(\n style ?? 'auto',\n untracked(() => this.scheme()),\n ),\n );\n }\n if (this.changes('hidden', hidden)) this.source.setHidden(hidden ?? false);\n }\n\n /** The scheme of the app whose style is in force, or of the app that claimed last. */\n private scheme(): Scheme {\n const owner = this.styleOwner()?.owner ?? this.claims.owners().at(-1);\n return owner?.scheme.current() ?? 'light';\n }\n\n /** The style in force and the app whose claim it is. */\n private styleOwner(): { style: NavigationBarStyle; owner: Owner } | undefined {\n const claim = this.claims.last((state) => state.style !== undefined);\n return claim && { style: claim.value.style!, owner: claim.owner };\n }\n\n private changes(property: keyof NavigationBarState, 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 buttons on the light scheme's light background, light ones on the dark one's. */\nfunction resolve(style: NavigationBarStyle, scheme: Scheme): 'light' | 'dark' {\n if (style !== 'auto') return style;\n return scheme === 'dark' ? 'light' : 'dark';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigation-bar.js","sourceRoot":"","sources":["../src/navigation-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EAET,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;;AAmCjF,MAAM,IAAI,GAAwB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC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AK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACpE,CAAC;IAEO,OAAO,CAAC,QAAkC,EAAE,KAAc;QAChE,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;CACF;AAED,yFAAyF;AACzF,SAAS,OAAO,CAAC,KAAyB,EAAE,MAAc;IACxD,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 * Android's navigation bar: the colour of its buttons, and whether it is there at all.\n *\n * The same stack of claims as `StatusBar`, so a video player can hide the bar while it is open and\n * the screen behind gets the bar back when it closes. `style: 'auto'` follows `ColorScheme`, a\n * theme the app sets included, and a fixed style holds through a scheme change.\n *\n * Driven through `expo-navigation-bar`'s native module, reached by name so nothing here imports the\n * package. Expo Go carries it; a development build has it once the app installs\n * `expo-navigation-bar`. Without it, and on iOS, which has no navigation bar, every claim is kept\n * but changes nothing.\n */\nimport { injectOs } from './os.ts';\nimport {\n DestroyRef,\n InjectionToken,\n Service,\n computed,\n inject,\n untracked,\n type Signal,\n signal,\n} from '@angular/core';\nimport { ColorScheme, type Scheme } from './color-scheme.ts';\nimport { mergeClaims } from './merge-claims.ts';\nimport { reactNative } from './react-native.ts';\nimport { WindowClaims, onWindowFront, sharedBySource } from './window-claims.ts';\n\n/**\n * The colour of the bar's buttons. `dark` is dark buttons, for a light screen behind them, and\n * `light` light ones, as `StatusBarStyle` names its text. `auto` is dark buttons in the light\n * colour scheme and light ones in the dark one, and follows `ColorScheme`.\n */\nexport type NavigationBarStyle = 'light' | 'dark' | 'auto';\n\n/** What a claim asks for. Anything absent is left as whatever the claim underneath said. */\nexport interface NavigationBarState {\n readonly style?: NavigationBarStyle;\n /** Hide the bar until a swipe from the edge of the screen shows it for a moment. */\n readonly hidden?: boolean;\n}\n\n/** Where the bar actually is. A fake stands in for the platform in tests. */\nexport interface NavigationBarSource {\n setStyle(style: Exclude<NavigationBarStyle, 'auto'>): void;\n setHidden(hidden: boolean): void;\n /**\n * react-native-screens shows or hides the bar each time a screen appears, from that screen's own\n * `navigationBarHidden`, once any screen has set one. So a hidden claim rides on every screen too.\n */\n readonly screensSetBar?: boolean;\n /** Calls `listener` when a window comes to the front, to be given the whole bar again. */\n onWindowFront?(listener: () => void): () => void;\n}\n\n/** `expo-navigation-bar`'s native module, as much of it as this uses. */\ninterface NativeNavigationBar {\n setStyle?(style: 'light' | 'dark'): Promise<void>;\n setHidden?(hidden: boolean): Promise<void>;\n}\n\nconst NONE: NavigationBarSource = { setStyle: () => {}, setHidden: () => {} };\n\nexport function navigationBarSource(): NavigationBarSource {\n // Copies: with no bar to share, each app claims its own.\n if (reactNative()?.Platform?.OS !== 'android') return { ...NONE };\n const modules = (globalThis as { expo?: { modules?: Record<string, unknown> } }).expo?.modules;\n const native = modules?.['ExpoNavigationBar'] as NativeNavigationBar | undefined;\n // Without the module a claim changes nothing, so it does not ride on the screens either, where\n // react-native-screens would hide the bar the next time one appears.\n if (!native) return { ...NONE };\n // One per module, so every app the runtime mounts claims the same bar.\n return sharedBySource(navigationBarSource, native, () => ({\n setStyle: (style) => void native.setStyle?.(style)?.catch(() => {}),\n setHidden: (hidden) => void native.setHidden?.(hidden)?.catch(() => {}),\n screensSetBar: true,\n onWindowFront,\n }));\n}\n\n/**\n * A stack, not a setter, for the same reason as `StatusBar`'s: whatever hid the bar has to give it\n * back to whatever was there before. `push` returns the function that drops the claim.\n */\n@Service()\nexport class NavigationBar {\n /** Overridden in a test to watch the bar without one on screen. */\n static readonly SOURCE = new InjectionToken<NavigationBarSource>(\n 'angular-native.navigationBarSource',\n { factory: navigationBarSource },\n );\n\n private readonly source = inject(NavigationBar.SOURCE);\n\n /** Whether there is a navigation bar to style: on Android alone. */\n readonly available: Signal<boolean> = signal(injectOs() === 'android').asReadonly();\n /** This app, among the apps claiming the bar: its scheme is what an `auto` style it claims follows. */\n private readonly owner: Owner = { scheme: inject(ColorScheme) };\n /** Every app's claims on this bar: the window is the runtime's, not an app's. */\n private readonly window = sharedBySource(\n NavigationBarWindow,\n this.source,\n () => new NavigationBarWindow(this.source),\n );\n\n /** What is actually showing: every claim in order, later ones winning per property. */\n readonly state: Signal<NavigationBarState> = this.window.state;\n\n /**\n * What a screen with no `navigationBarHidden` of its own carries, so the claim still holds when\n * it appears. Empty but on Android. The router passes it on.\n */\n readonly forScreens: Signal<{ readonly hidden?: boolean }> = computed(() =>\n this.source.screensSetBar ? { hidden: this.state().hidden } : {},\n );\n\n constructor() {\n // Straight from the source, as `StatusBar` does, so the buttons change in the same turn as the\n // scheme.\n const stop = inject(ColorScheme.SOURCE).subscribe((scheme) =>\n this.window.schemeChanged(this.owner, scheme),\n );\n inject(DestroyRef).onDestroy(() => {\n stop();\n // An app that goes takes its claims with it, and leaves the bar to the apps still here.\n this.window.claims.drop(this.owner);\n this.window.apply();\n });\n }\n\n /** The base claim, for an app that sets the bar once at startup. */\n set(state: NavigationBarState): void {\n this.window.claims.setBase(this.owner, state);\n this.window.apply();\n }\n\n /** A claim on top of whatever is there. Call the returned function to drop it. */\n push(state: NavigationBarState): () => void {\n const drop = this.window.claims.push(this.owner, { ...state });\n this.window.apply();\n return () => {\n drop();\n this.window.apply();\n };\n }\n}\n\ninterface Owner {\n readonly scheme: ColorScheme;\n}\n\n/** The bar, as every app on one source claims it. */\nclass NavigationBarWindow {\n readonly claims = new WindowClaims<NavigationBarState, Owner>();\n readonly state: Signal<NavigationBarState> = computed(() =>\n mergeClaims(this.claims.all().map((claim) => claim.value)),\n );\n\n /** The properties a claim has had the platform change, which no claim names any more. */\n private readonly changed = new Set<keyof NavigationBarState>();\n\n /** Whether a claim has ever set the style, after which an unclaimed bar follows the scheme. */\n private styled = false;\n\n private readonly source: NavigationBarSource;\n\n constructor(source: NavigationBarSource) {\n this.source = source;\n // Lives as long as the source, which is the runtime's.\n source.onWindowFront?.(() => this.apply(true));\n }\n\n /**\n * Android puts the buttons back to the new scheme's own on a scheme change, so a fixed style is\n * sent again too. A bar no style claim names any more is `auto`, once one has named a style, and\n * follows the scheme the listener heard.\n */\n schemeChanged(owner: Owner, scheme: Scheme): void {\n const claimed = untracked(() => this.styleOwner());\n if (claimed && claimed.owner !== owner) return;\n const style = claimed?.style ?? (this.styled ? 'auto' : undefined);\n if (style !== undefined) this.source.setStyle(resolve(style, scheme));\n }\n\n /**\n * Push the merged state at the platform. A property the last claim to name it has dropped goes\n * back, once: the style to `auto`, which then keeps following the scheme, and the bar to shown.\n * A window come to the front is given what is claimed, and an `auto` style once one was named.\n */\n apply(front = false): void {\n const { style, hidden } = untracked(this.state);\n if (this.changes('style', style) || (front && this.styled)) {\n this.styled = true;\n this.source.setStyle(\n resolve(\n style ?? 'auto',\n untracked(() => this.scheme()),\n ),\n );\n }\n if (this.changes('hidden', hidden)) this.source.setHidden(hidden ?? false);\n }\n\n /** The scheme of the app whose style is in force, or of the app that claimed last. */\n private scheme(): Scheme {\n const owner = this.styleOwner()?.owner ?? this.claims.owners().at(-1);\n return owner?.scheme.current() ?? 'light';\n }\n\n /** The style in force and the app whose claim it is. */\n private styleOwner(): { style: NavigationBarStyle; owner: Owner } | undefined {\n const claim = this.claims.last((state) => state.style !== undefined);\n return claim && { style: claim.value.style!, owner: claim.owner };\n }\n\n private changes(property: keyof NavigationBarState, 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 buttons on the light scheme's light background, light ones on the dark one's. */\nfunction resolve(style: NavigationBarStyle, scheme: Scheme): 'light' | 'dark' {\n if (style !== 'auto') return style;\n return scheme === 'dark' ? 'light' : 'dark';\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What each desktop API and each macOS-only input does on each OS: the one source the support
|
|
3
|
+
* table on the documentation site is drawn from, and that `os-support.test.ts` holds the code to.
|
|
4
|
+
*
|
|
5
|
+
* A cell is `yes`; `absent`, where `available()` is false and every call is inert; `ignored`, where
|
|
6
|
+
* the input has no effect; `inert`, where an element draws nothing and calls nothing; or a few
|
|
7
|
+
* words on what the OS does instead. It has no imports, so a build script can read it.
|
|
8
|
+
*/
|
|
9
|
+
/** The OSes the table has a column for, iPadOS and iPhone apart. */
|
|
10
|
+
export type SupportOs = 'macos' | 'ipados' | 'iphone' | 'android' | 'web';
|
|
11
|
+
export interface OsSupportRow {
|
|
12
|
+
/** The row's name in the table, as Markdown. */
|
|
13
|
+
readonly feature: string;
|
|
14
|
+
/**
|
|
15
|
+
* What the row covers: exported classes and functions, inputs by name, and events as
|
|
16
|
+
* `(dblclick)`. Every one exists.
|
|
17
|
+
*/
|
|
18
|
+
readonly covers: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* The services whose `available()` follows the row, each with the host module it is made from:
|
|
21
|
+
* true where the row is not `absent` and the module is there, false where it is `absent`.
|
|
22
|
+
*/
|
|
23
|
+
readonly services?: Readonly<Record<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Services with no host module of their own, whose `available()` follows the row: absent where the
|
|
26
|
+
* row says `absent`, which `every-service.test.ts` checks call by call.
|
|
27
|
+
*/
|
|
28
|
+
readonly inert?: readonly string[];
|
|
29
|
+
/** The services have no `available()`, such as a view: where absent, the row says only that. */
|
|
30
|
+
readonly withoutAvailable?: true;
|
|
31
|
+
readonly on: Readonly<Record<SupportOs, string>>;
|
|
32
|
+
}
|
|
33
|
+
export declare const SUPPORT_OSES: Readonly<Record<SupportOs, string>>;
|
|
34
|
+
export declare const OS_SUPPORT: readonly OsSupportRow[];
|
|
35
|
+
/** The row a service's `available()` follows, or undefined where the table has none for it. */
|
|
36
|
+
export declare function supportRowOf(service: string): OsSupportRow | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* One line for a service's documentation page, drawn from its row: where it is available, with
|
|
39
|
+
* the row's words where it is not a plain `yes`, and where it is absent. The documentation site
|
|
40
|
+
* writes it under `<!-- platforms: Service -->`, so the page cannot disagree with the table.
|
|
41
|
+
*/
|
|
42
|
+
export declare function platformsLine(service: string): string | undefined;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What each desktop API and each macOS-only input does on each OS: the one source the support
|
|
3
|
+
* table on the documentation site is drawn from, and that `os-support.test.ts` holds the code to.
|
|
4
|
+
*
|
|
5
|
+
* A cell is `yes`; `absent`, where `available()` is false and every call is inert; `ignored`, where
|
|
6
|
+
* the input has no effect; `inert`, where an element draws nothing and calls nothing; or a few
|
|
7
|
+
* words on what the OS does instead. It has no imports, so a build script can read it.
|
|
8
|
+
*/
|
|
9
|
+
export const SUPPORT_OSES = {
|
|
10
|
+
macos: 'macOS',
|
|
11
|
+
ipados: 'iPadOS',
|
|
12
|
+
iphone: 'iPhone',
|
|
13
|
+
android: 'Android',
|
|
14
|
+
web: 'Web host',
|
|
15
|
+
};
|
|
16
|
+
const row = (feature, covers, [macos, ipados, iphone, android, web], services, inert) => ({
|
|
17
|
+
feature,
|
|
18
|
+
covers,
|
|
19
|
+
on: { macos, ipados, iphone, android, web },
|
|
20
|
+
...(services && { services }),
|
|
21
|
+
...(inert && { inert }),
|
|
22
|
+
});
|
|
23
|
+
const MAC_ONLY = ['yes', 'absent', 'absent', 'absent', 'absent'];
|
|
24
|
+
/**
|
|
25
|
+
* An Expo-backed service whose `available()` is whether its module is there: the Expo module on
|
|
26
|
+
* iPadOS, iPhone and Android, the desktop host's module on macOS, and nothing on the web, where
|
|
27
|
+
* the Expo module is not written for it.
|
|
28
|
+
*/
|
|
29
|
+
const EXPO_MODULE = ['yes', 'yes', 'yes', 'yes', 'absent'];
|
|
30
|
+
const expoRow = (service, hostModule, cells = EXPO_MODULE) => row(`\`${service}\``, [], cells, { [service]: hostModule });
|
|
31
|
+
export const OS_SUPPORT = [
|
|
32
|
+
row('`AppWindows.open`, `provideMainWindow`', ['AppWindows', 'CURRENT_WINDOW', 'provideMainWindow', 'provideRestorableWindows'], ['yes', 'scenes, with `ios.multipleWindows`', 'absent', 'absent', 'absent'], { AppWindows: 'NgNativeWindows' }),
|
|
33
|
+
row('`titleBar`, window size options', ['titleBar', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'resizable', 'fullScreen'], ['yes', 'ignored', 'ignored', 'ignored', 'ignored']),
|
|
34
|
+
row('`<menu-bar>`', ['MenuBar', 'MenuGroup', 'MenuItem', 'MenuSeparator', 'Menus'], ['menu bar', 'menu bar', 'inert', 'inert', 'inert']),
|
|
35
|
+
row('`[shortcut]`, menu item shortcuts', ['Shortcut'], ['yes', 'yes', 'hardware keyboard', 'hardware keyboard, Keyboard Shortcuts helper', 'yes']),
|
|
36
|
+
row('`[contextMenu]`', ['ContextMenu'], ['yes', 'long press or secondary click', 'long press', 'long press or right-click', 'inert']),
|
|
37
|
+
row('`<tray-icon>`, `Dock`', ['TrayIcon', 'Tray', 'Dock'], MAC_ONLY, {
|
|
38
|
+
Tray: 'NgNativeTray',
|
|
39
|
+
Dock: 'NgNativeDock',
|
|
40
|
+
}),
|
|
41
|
+
row('`<split-view>`, `<sidebar>`', ['SplitView', 'Sidebar', 'SidebarSection', 'SidebarItem', 'SidebarItemPath'], [
|
|
42
|
+
'yes',
|
|
43
|
+
'UISplitViewController, a stack at compact widths',
|
|
44
|
+
'stack root',
|
|
45
|
+
'list pane from 840dp, a stack below',
|
|
46
|
+
'two columns',
|
|
47
|
+
]),
|
|
48
|
+
row('`Processes`, `Processes.env`', ['Processes'], MAC_ONLY, {
|
|
49
|
+
Processes: 'NgNativeProcesses',
|
|
50
|
+
}),
|
|
51
|
+
row('`Shell`', ['Shell'], MAC_ONLY, { Shell: 'NgNativeShell' }),
|
|
52
|
+
row('`FileSystem.paths.home`, `desktop`, `downloads`', ['home', 'desktop', 'downloads'], MAC_ONLY),
|
|
53
|
+
row('`UndoStack`', ['UndoStack'], ['yes', 'yes', 'yes', 'absent', 'absent'], {
|
|
54
|
+
UndoStack: 'NgNativeUndo',
|
|
55
|
+
}),
|
|
56
|
+
row('`Printing.print({ window })`, File > Print...', [], MAC_ONLY),
|
|
57
|
+
row('`Updates.checkForAppUpdate()`, `appUpdateAvailable`', ['appUpdateAvailable'], ['`dmg` builds', 'absent', 'absent', 'absent', 'absent']),
|
|
58
|
+
row('Drag and drop: `(fileDrop)`, `[dragItem]`', ['FileDrop', 'DragItem', '(fileDrop)', '(fileDragEnter)', '(fileDragLeave)', 'dragItem'], ['yes', 'yes', 'absent', 'absent', 'absent']),
|
|
59
|
+
row('`(mouseenter)`, `(mouseleave)`, `(mousemove)`, `(mouseover)`, `(mouseout)`', ['(mouseenter)', '(mouseleave)', '(mousemove)', '(mouseover)', '(mouseout)'], ['yes', 'trackpad or mouse', 'ignored', 'mouse', 'yes']),
|
|
60
|
+
row('`(dblclick)`, `(contextmenu)`, `(wheel)`', ['(dblclick)', '(contextmenu)', '(wheel)'], ['yes', 'ignored', 'ignored', 'ignored', 'ignored']),
|
|
61
|
+
row('`<native-button>`', ['NativeButton'], ['AppKit button', 'UIKit button', 'UIKit button', 'drawn', 'HTML button']),
|
|
62
|
+
row('`controlSize`', ['controlSize'], ['yes', '`<native-button>`', '`<native-button>`', 'ignored', 'ignored']),
|
|
63
|
+
row('`anchor` on `<modal>`', ['anchor'], ['popover', 'popover', 'ignored', 'ignored', 'ignored']),
|
|
64
|
+
row('`accessibilityLevel`, `aria-level`', ['accessibilityLevel'], ['macOS 26 and later', 'ignored', 'ignored', 'ignored', 'yes']),
|
|
65
|
+
row('`<refresh-control>`', ['RefreshControl'], ['inert', 'yes', 'yes', 'yes', 'inert']),
|
|
66
|
+
row('`<keyboard-dock>`, `<keyboard-avoiding-view>`', ['KeyboardDock', 'KeyboardAvoidingView'], ['plain view', 'yes', 'yes', 'yes', 'plain view']),
|
|
67
|
+
row('`<input-accessory-view>`', ['InputAccessoryView'], ['plain view', 'yes', 'yes', 'plain view', 'docked at the bottom']),
|
|
68
|
+
row('`<expo-glass>`, `<expo-glass-container>`', [], ['yes', 'iOS 26 and later', 'iOS 26 and later', 'plain view', 'plain view']),
|
|
69
|
+
row('Community `slider`, `picker`, `masked-view`', [], ['absent: `ui-slider`, `ui-picker`', 'yes', 'yes', 'yes', 'plain view']),
|
|
70
|
+
row('`HardwareBack`, `NavigationBar`', ['HardwareBack', 'NavigationBar'], ['absent', 'absent', 'absent', 'yes', 'absent'], undefined, ['HardwareBack', 'NavigationBar']),
|
|
71
|
+
row('`StatusBar`, `Keyboard`', ['StatusBar', 'Keyboard'], ['absent', 'yes', 'yes', 'yes', 'absent'], undefined, ['StatusBar', 'Keyboard']),
|
|
72
|
+
row('`Vibration`', ['Vibration'], ['absent', 'yes', 'yes', 'yes', 'yes'], undefined, [
|
|
73
|
+
'Vibration',
|
|
74
|
+
]),
|
|
75
|
+
row('`BackgroundTask`, `Brightness`, `DeviceOrientation`', [], ['absent', 'yes', 'yes', 'yes', 'absent'], undefined, ['BackgroundTask', 'Brightness', 'DeviceOrientation']),
|
|
76
|
+
expoRow('AppInfo', 'NgNativeApplication'),
|
|
77
|
+
expoRow('Battery', 'NgNativeBattery'),
|
|
78
|
+
expoRow('Browser', 'NgNativeWebBrowser'),
|
|
79
|
+
expoRow('Calendar', 'NgNativeCalendar'),
|
|
80
|
+
expoRow('Clipboard', 'NgNativeClipboard'),
|
|
81
|
+
expoRow('Crypto', 'NgNativeCrypto'),
|
|
82
|
+
expoRow('DocumentPicker', 'NgNativeDocumentPicker'),
|
|
83
|
+
expoRow('FileSystem', 'NgNativeFileSystem'),
|
|
84
|
+
expoRow('Fonts', 'NgNativeFont'),
|
|
85
|
+
expoRow('Haptics', 'NgNativeHaptics'),
|
|
86
|
+
expoRow('ImageEditor', 'NgNativeImageManipulator'),
|
|
87
|
+
expoRow('ImagePicker', 'NgNativeImagePicker'),
|
|
88
|
+
expoRow('KeepAwake', 'NgNativeKeepAwake'),
|
|
89
|
+
expoRow('Locale', 'NgNativeLocalization'),
|
|
90
|
+
expoRow('Location', 'NgNativeLocation'),
|
|
91
|
+
expoRow('MediaLibrary', 'NgNativeMediaLibrary'),
|
|
92
|
+
expoRow('Network', 'NgNativeNetwork'),
|
|
93
|
+
expoRow('Notifications', 'NgNativeNotifications'),
|
|
94
|
+
expoRow('Printing', 'NgNativePrint'),
|
|
95
|
+
expoRow('SplashScreen', 'NgNativeSplashScreen'),
|
|
96
|
+
expoRow('TextRecognition', 'NgNativeTextRecognition', ['yes', 'yes', 'yes', 'absent', 'absent']),
|
|
97
|
+
expoRow('Updates', 'NgNativeUpdates'),
|
|
98
|
+
expoRow('AddressSearch', 'NgNativeAddressSearch'),
|
|
99
|
+
expoRow('AppleSignIn', 'NgNativeAppleAuthentication', [
|
|
100
|
+
'signed with the Sign in with Apple entitlement',
|
|
101
|
+
'yes',
|
|
102
|
+
'yes',
|
|
103
|
+
'absent',
|
|
104
|
+
'absent',
|
|
105
|
+
]),
|
|
106
|
+
expoRow('Biometrics', 'NgNativeLocalAuthentication'),
|
|
107
|
+
{ ...expoRow('Camera', 'NgNativeCamera'), withoutAvailable: true },
|
|
108
|
+
{
|
|
109
|
+
...expoRow('MapView', 'NgNativeMaps', [
|
|
110
|
+
'yes',
|
|
111
|
+
'iPadOS 17 and later, marker taps from 18',
|
|
112
|
+
'iOS 17 and later, marker taps from 18',
|
|
113
|
+
'yes',
|
|
114
|
+
'absent',
|
|
115
|
+
]),
|
|
116
|
+
withoutAvailable: true,
|
|
117
|
+
},
|
|
118
|
+
expoRow('LanguageModel', 'NgNativeLocalLlm', [
|
|
119
|
+
'macOS 26 and later, with Apple Intelligence on',
|
|
120
|
+
'iPadOS 26 and later, with Apple Intelligence on',
|
|
121
|
+
'iOS 26 and later, with Apple Intelligence on',
|
|
122
|
+
'Gemini Nano, on the phones that ship it',
|
|
123
|
+
'absent',
|
|
124
|
+
]),
|
|
125
|
+
expoRow('ScreenCapture', 'NgNativeScreenCapture', [
|
|
126
|
+
'`prevent` and `allow`, no screenshot count',
|
|
127
|
+
'yes',
|
|
128
|
+
'yes',
|
|
129
|
+
'yes',
|
|
130
|
+
'absent',
|
|
131
|
+
]),
|
|
132
|
+
expoRow('StoreReview', 'NgNativeStoreReview', [
|
|
133
|
+
'yes',
|
|
134
|
+
'yes',
|
|
135
|
+
'yes',
|
|
136
|
+
'with the Play Store',
|
|
137
|
+
'absent',
|
|
138
|
+
]),
|
|
139
|
+
expoRow('Tracking', 'NgNativeTrackingTransparency'),
|
|
140
|
+
expoRow('Watch', 'WatchConnectivity', ['absent', 'no watch to pair', 'yes', 'absent', 'absent']),
|
|
141
|
+
expoRow('Foldable', 'ExpoHinge', [
|
|
142
|
+
'absent',
|
|
143
|
+
'when a hinge is reported',
|
|
144
|
+
'when a hinge is reported',
|
|
145
|
+
'when a hinge is reported',
|
|
146
|
+
'absent',
|
|
147
|
+
]),
|
|
148
|
+
row('`Accelerometer`, `Gyroscope`, `Magnetometer`, `DeviceMotion`, `Barometer`', [], ['absent', 'yes', 'yes', 'yes', 'absent'], {
|
|
149
|
+
Accelerometer: 'expo-sensors',
|
|
150
|
+
Gyroscope: 'expo-sensors',
|
|
151
|
+
Magnetometer: 'expo-sensors',
|
|
152
|
+
DeviceMotion: 'expo-sensors',
|
|
153
|
+
Barometer: 'expo-sensors',
|
|
154
|
+
}),
|
|
155
|
+
row('`LightSensor`', [], ['absent', 'absent', 'absent', 'yes', 'absent'], {
|
|
156
|
+
LightSensor: 'expo-sensors',
|
|
157
|
+
}),
|
|
158
|
+
{ ...row('`assets()`', [], EXPO_MODULE, { assets: 'NgNativeAsset' }), withoutAvailable: true },
|
|
159
|
+
{
|
|
160
|
+
...row('`database()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], { database: 'NgNativeSqlite' }),
|
|
161
|
+
withoutAvailable: true,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
...row('`videoPlayer()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], {
|
|
165
|
+
videoPlayer: 'NgNativeVideo',
|
|
166
|
+
}),
|
|
167
|
+
withoutAvailable: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
...row('`audioPlayer()`, `audioRecorder()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], {
|
|
171
|
+
audioPlayer: 'NgNativeAudio',
|
|
172
|
+
audioRecorder: 'NgNativeAudio',
|
|
173
|
+
}),
|
|
174
|
+
withoutAvailable: true,
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
/** The row a service's `available()` follows, or undefined where the table has none for it. */
|
|
178
|
+
export function supportRowOf(service) {
|
|
179
|
+
// Own keys only: `constructor` is on every object, and names no service.
|
|
180
|
+
return OS_SUPPORT.find((one) => (one.services && Object.hasOwn(one.services, service)) || one.inert?.includes(service));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* One line for a service's documentation page, drawn from its row: where it is available, with
|
|
184
|
+
* the row's words where it is not a plain `yes`, and where it is absent. The documentation site
|
|
185
|
+
* writes it under `<!-- platforms: Service -->`, so the page cannot disagree with the table.
|
|
186
|
+
*/
|
|
187
|
+
export function platformsLine(service) {
|
|
188
|
+
const row = supportRowOf(service);
|
|
189
|
+
if (!row)
|
|
190
|
+
return undefined;
|
|
191
|
+
const oses = Object.keys(SUPPORT_OSES);
|
|
192
|
+
const present = oses
|
|
193
|
+
.filter((os) => row.on[os] !== 'absent')
|
|
194
|
+
.map((os) => (row.on[os] === 'yes' ? SUPPORT_OSES[os] : `${SUPPORT_OSES[os]} (${row.on[os]})`));
|
|
195
|
+
const absent = oses.filter((os) => row.on[os] === 'absent').map((os) => SUPPORT_OSES[os]);
|
|
196
|
+
const list = (names) => names.length < 2 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
|
|
197
|
+
const parts = [];
|
|
198
|
+
if (present.length)
|
|
199
|
+
parts.push(`Available on ${list(present)}.`);
|
|
200
|
+
if (absent.length) {
|
|
201
|
+
parts.push(row.withoutAvailable
|
|
202
|
+
? `Absent on ${list(absent)}.`
|
|
203
|
+
: `Absent on ${list(absent)}, where \`available()\` is false.`);
|
|
204
|
+
}
|
|
205
|
+
return `**Platforms.** ${parts.join(' ')}`;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=os-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os-support.js","sourceRoot":"","sources":["../src/os-support.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,MAAM,CAAC,MAAM,YAAY,GAAwC;IAC/D,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,UAAU;CAChB,CAAC;AAEF,MAAM,GAAG,GAAG,CACV,OAAe,EACf,MAAyB,EACzB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAoD,EACxF,QAA2C,EAC3C,KAAyB,EACX,EAAE,CAAC,CAAC;IAClB,OAAO;IACP,MAAM;IACN,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE;IAC3C,GAAG,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC7B,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AAEpE,MAAM,OAAO,GAAG,CACd,OAAe,EACf,UAAkB,EA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AAE,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1F,MAAM,IAAI,GAAG,CAAC,KAAwB,EAAE,EAAE,CACxC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CACR,GAAG,CAAC,gBAAgB;YAClB,CAAC,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,GAAG;YAC9B,CAAC,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,mCAAmC,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,kBAAkB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * What each desktop API and each macOS-only input does on each OS: the one source the support\n * table on the documentation site is drawn from, and that `os-support.test.ts` holds the code to.\n *\n * A cell is `yes`; `absent`, where `available()` is false and every call is inert; `ignored`, where\n * the input has no effect; `inert`, where an element draws nothing and calls nothing; or a few\n * words on what the OS does instead. It has no imports, so a build script can read it.\n */\n\n/** The OSes the table has a column for, iPadOS and iPhone apart. */\nexport type SupportOs = 'macos' | 'ipados' | 'iphone' | 'android' | 'web';\n\nexport interface OsSupportRow {\n /** The row's name in the table, as Markdown. */\n readonly feature: string;\n /**\n * What the row covers: exported classes and functions, inputs by name, and events as\n * `(dblclick)`. Every one exists.\n */\n readonly covers: readonly string[];\n /**\n * The services whose `available()` follows the row, each with the host module it is made from:\n * true where the row is not `absent` and the module is there, false where it is `absent`.\n */\n readonly services?: Readonly<Record<string, string>>;\n /**\n * Services with no host module of their own, whose `available()` follows the row: absent where the\n * row says `absent`, which `every-service.test.ts` checks call by call.\n */\n readonly inert?: readonly string[];\n /** The services have no `available()`, such as a view: where absent, the row says only that. */\n readonly withoutAvailable?: true;\n readonly on: Readonly<Record<SupportOs, string>>;\n}\n\nexport const SUPPORT_OSES: Readonly<Record<SupportOs, string>> = {\n macos: 'macOS',\n ipados: 'iPadOS',\n iphone: 'iPhone',\n android: 'Android',\n web: 'Web host',\n};\n\nconst row = (\n feature: string,\n covers: readonly string[],\n [macos, ipados, iphone, android, web]: readonly [string, string, string, string, string],\n services?: Readonly<Record<string, string>>,\n inert?: readonly string[],\n): OsSupportRow => ({\n feature,\n covers,\n on: { macos, ipados, iphone, android, web },\n ...(services && { services }),\n ...(inert && { inert }),\n});\n\nconst MAC_ONLY = ['yes', 'absent', 'absent', 'absent', 'absent'] as const;\n\n/**\n * An Expo-backed service whose `available()` is whether its module is there: the Expo module on\n * iPadOS, iPhone and Android, the desktop host's module on macOS, and nothing on the web, where\n * the Expo module is not written for it.\n */\nconst EXPO_MODULE = ['yes', 'yes', 'yes', 'yes', 'absent'] as const;\n\nconst expoRow = (\n service: string,\n hostModule: string,\n cells: readonly [string, string, string, string, string] = EXPO_MODULE,\n): OsSupportRow => row(`\\`${service}\\``, [], cells, { [service]: hostModule });\n\nexport const OS_SUPPORT: readonly OsSupportRow[] = [\n row(\n '`AppWindows.open`, `provideMainWindow`',\n ['AppWindows', 'CURRENT_WINDOW', 'provideMainWindow', 'provideRestorableWindows'],\n ['yes', 'scenes, with `ios.multipleWindows`', 'absent', 'absent', 'absent'],\n { AppWindows: 'NgNativeWindows' },\n ),\n row(\n '`titleBar`, window size options',\n ['titleBar', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'resizable', 'fullScreen'],\n ['yes', 'ignored', 'ignored', 'ignored', 'ignored'],\n ),\n row(\n '`<menu-bar>`',\n ['MenuBar', 'MenuGroup', 'MenuItem', 'MenuSeparator', 'Menus'],\n ['menu bar', 'menu bar', 'inert', 'inert', 'inert'],\n ),\n row(\n '`[shortcut]`, menu item shortcuts',\n ['Shortcut'],\n ['yes', 'yes', 'hardware keyboard', 'hardware keyboard, Keyboard Shortcuts helper', 'yes'],\n ),\n row(\n '`[contextMenu]`',\n ['ContextMenu'],\n ['yes', 'long press or secondary click', 'long press', 'long press or right-click', 'inert'],\n ),\n row('`<tray-icon>`, `Dock`', ['TrayIcon', 'Tray', 'Dock'], MAC_ONLY, {\n Tray: 'NgNativeTray',\n Dock: 'NgNativeDock',\n }),\n row(\n '`<split-view>`, `<sidebar>`',\n ['SplitView', 'Sidebar', 'SidebarSection', 'SidebarItem', 'SidebarItemPath'],\n [\n 'yes',\n 'UISplitViewController, a stack at compact widths',\n 'stack root',\n 'list pane from 840dp, a stack below',\n 'two columns',\n ],\n ),\n row('`Processes`, `Processes.env`', ['Processes'], MAC_ONLY, {\n Processes: 'NgNativeProcesses',\n }),\n row('`Shell`', ['Shell'], MAC_ONLY, { Shell: 'NgNativeShell' }),\n row(\n '`FileSystem.paths.home`, `desktop`, `downloads`',\n ['home', 'desktop', 'downloads'],\n MAC_ONLY,\n ),\n row('`UndoStack`', ['UndoStack'], ['yes', 'yes', 'yes', 'absent', 'absent'], {\n UndoStack: 'NgNativeUndo',\n }),\n row('`Printing.print({ window })`, File > Print...', [], MAC_ONLY),\n row(\n '`Updates.checkForAppUpdate()`, `appUpdateAvailable`',\n ['appUpdateAvailable'],\n ['`dmg` builds', 'absent', 'absent', 'absent', 'absent'],\n ),\n row(\n 'Drag and drop: `(fileDrop)`, `[dragItem]`',\n ['FileDrop', 'DragItem', '(fileDrop)', '(fileDragEnter)', '(fileDragLeave)', 'dragItem'],\n ['yes', 'yes', 'absent', 'absent', 'absent'],\n ),\n row(\n '`(mouseenter)`, `(mouseleave)`, `(mousemove)`, `(mouseover)`, `(mouseout)`',\n ['(mouseenter)', '(mouseleave)', '(mousemove)', '(mouseover)', '(mouseout)'],\n ['yes', 'trackpad or mouse', 'ignored', 'mouse', 'yes'],\n ),\n row(\n '`(dblclick)`, `(contextmenu)`, `(wheel)`',\n ['(dblclick)', '(contextmenu)', '(wheel)'],\n ['yes', 'ignored', 'ignored', 'ignored', 'ignored'],\n ),\n row(\n '`<native-button>`',\n ['NativeButton'],\n ['AppKit button', 'UIKit button', 'UIKit button', 'drawn', 'HTML button'],\n ),\n row(\n '`controlSize`',\n ['controlSize'],\n ['yes', '`<native-button>`', '`<native-button>`', 'ignored', 'ignored'],\n ),\n row('`anchor` on `<modal>`', ['anchor'], ['popover', 'popover', 'ignored', 'ignored', 'ignored']),\n row(\n '`accessibilityLevel`, `aria-level`',\n ['accessibilityLevel'],\n ['macOS 26 and later', 'ignored', 'ignored', 'ignored', 'yes'],\n ),\n row('`<refresh-control>`', ['RefreshControl'], ['inert', 'yes', 'yes', 'yes', 'inert']),\n row(\n '`<keyboard-dock>`, `<keyboard-avoiding-view>`',\n ['KeyboardDock', 'KeyboardAvoidingView'],\n ['plain view', 'yes', 'yes', 'yes', 'plain view'],\n ),\n row(\n '`<input-accessory-view>`',\n ['InputAccessoryView'],\n ['plain view', 'yes', 'yes', 'plain view', 'docked at the bottom'],\n ),\n row(\n '`<expo-glass>`, `<expo-glass-container>`',\n [],\n ['yes', 'iOS 26 and later', 'iOS 26 and later', 'plain view', 'plain view'],\n ),\n row(\n 'Community `slider`, `picker`, `masked-view`',\n [],\n ['absent: `ui-slider`, `ui-picker`', 'yes', 'yes', 'yes', 'plain view'],\n ),\n row(\n '`HardwareBack`, `NavigationBar`',\n ['HardwareBack', 'NavigationBar'],\n ['absent', 'absent', 'absent', 'yes', 'absent'],\n undefined,\n ['HardwareBack', 'NavigationBar'],\n ),\n row(\n '`StatusBar`, `Keyboard`',\n ['StatusBar', 'Keyboard'],\n ['absent', 'yes', 'yes', 'yes', 'absent'],\n undefined,\n ['StatusBar', 'Keyboard'],\n ),\n row('`Vibration`', ['Vibration'], ['absent', 'yes', 'yes', 'yes', 'yes'], undefined, [\n 'Vibration',\n ]),\n row(\n '`BackgroundTask`, `Brightness`, `DeviceOrientation`',\n [],\n ['absent', 'yes', 'yes', 'yes', 'absent'],\n undefined,\n ['BackgroundTask', 'Brightness', 'DeviceOrientation'],\n ),\n expoRow('AppInfo', 'NgNativeApplication'),\n expoRow('Battery', 'NgNativeBattery'),\n expoRow('Browser', 'NgNativeWebBrowser'),\n expoRow('Calendar', 'NgNativeCalendar'),\n expoRow('Clipboard', 'NgNativeClipboard'),\n expoRow('Crypto', 'NgNativeCrypto'),\n expoRow('DocumentPicker', 'NgNativeDocumentPicker'),\n expoRow('FileSystem', 'NgNativeFileSystem'),\n expoRow('Fonts', 'NgNativeFont'),\n expoRow('Haptics', 'NgNativeHaptics'),\n expoRow('ImageEditor', 'NgNativeImageManipulator'),\n expoRow('ImagePicker', 'NgNativeImagePicker'),\n expoRow('KeepAwake', 'NgNativeKeepAwake'),\n expoRow('Locale', 'NgNativeLocalization'),\n expoRow('Location', 'NgNativeLocation'),\n expoRow('MediaLibrary', 'NgNativeMediaLibrary'),\n expoRow('Network', 'NgNativeNetwork'),\n expoRow('Notifications', 'NgNativeNotifications'),\n expoRow('Printing', 'NgNativePrint'),\n expoRow('SplashScreen', 'NgNativeSplashScreen'),\n expoRow('TextRecognition', 'NgNativeTextRecognition', ['yes', 'yes', 'yes', 'absent', 'absent']),\n expoRow('Updates', 'NgNativeUpdates'),\n expoRow('AddressSearch', 'NgNativeAddressSearch'),\n expoRow('AppleSignIn', 'NgNativeAppleAuthentication', [\n 'signed with the Sign in with Apple entitlement',\n 'yes',\n 'yes',\n 'absent',\n 'absent',\n ]),\n expoRow('Biometrics', 'NgNativeLocalAuthentication'),\n { ...expoRow('Camera', 'NgNativeCamera'), withoutAvailable: true },\n {\n ...expoRow('MapView', 'NgNativeMaps', [\n 'yes',\n 'iPadOS 17 and later, marker taps from 18',\n 'iOS 17 and later, marker taps from 18',\n 'yes',\n 'absent',\n ]),\n withoutAvailable: true,\n },\n expoRow('LanguageModel', 'NgNativeLocalLlm', [\n 'macOS 26 and later, with Apple Intelligence on',\n 'iPadOS 26 and later, with Apple Intelligence on',\n 'iOS 26 and later, with Apple Intelligence on',\n 'Gemini Nano, on the phones that ship it',\n 'absent',\n ]),\n expoRow('ScreenCapture', 'NgNativeScreenCapture', [\n '`prevent` and `allow`, no screenshot count',\n 'yes',\n 'yes',\n 'yes',\n 'absent',\n ]),\n expoRow('StoreReview', 'NgNativeStoreReview', [\n 'yes',\n 'yes',\n 'yes',\n 'with the Play Store',\n 'absent',\n ]),\n expoRow('Tracking', 'NgNativeTrackingTransparency'),\n expoRow('Watch', 'WatchConnectivity', ['absent', 'no watch to pair', 'yes', 'absent', 'absent']),\n expoRow('Foldable', 'ExpoHinge', [\n 'absent',\n 'when a hinge is reported',\n 'when a hinge is reported',\n 'when a hinge is reported',\n 'absent',\n ]),\n row(\n '`Accelerometer`, `Gyroscope`, `Magnetometer`, `DeviceMotion`, `Barometer`',\n [],\n ['absent', 'yes', 'yes', 'yes', 'absent'],\n {\n Accelerometer: 'expo-sensors',\n Gyroscope: 'expo-sensors',\n Magnetometer: 'expo-sensors',\n DeviceMotion: 'expo-sensors',\n Barometer: 'expo-sensors',\n },\n ),\n row('`LightSensor`', [], ['absent', 'absent', 'absent', 'yes', 'absent'], {\n LightSensor: 'expo-sensors',\n }),\n { ...row('`assets()`', [], EXPO_MODULE, { assets: 'NgNativeAsset' }), withoutAvailable: true },\n {\n ...row('`database()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], { database: 'NgNativeSqlite' }),\n withoutAvailable: true,\n },\n {\n ...row('`videoPlayer()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], {\n videoPlayer: 'NgNativeVideo',\n }),\n withoutAvailable: true,\n },\n {\n ...row('`audioPlayer()`, `audioRecorder()`', [], ['yes', 'yes', 'yes', 'yes', 'yes'], {\n audioPlayer: 'NgNativeAudio',\n audioRecorder: 'NgNativeAudio',\n }),\n withoutAvailable: true,\n },\n];\n\n/** The row a service's `available()` follows, or undefined where the table has none for it. */\nexport function supportRowOf(service: string): OsSupportRow | undefined {\n // Own keys only: `constructor` is on every object, and names no service.\n return OS_SUPPORT.find(\n (one) => (one.services && Object.hasOwn(one.services, service)) || one.inert?.includes(service),\n );\n}\n\n/**\n * One line for a service's documentation page, drawn from its row: where it is available, with\n * the row's words where it is not a plain `yes`, and where it is absent. The documentation site\n * writes it under `<!-- platforms: Service -->`, so the page cannot disagree with the table.\n */\nexport function platformsLine(service: string): string | undefined {\n const row = supportRowOf(service);\n if (!row) return undefined;\n const oses = Object.keys(SUPPORT_OSES) as SupportOs[];\n const present = oses\n .filter((os) => row.on[os] !== 'absent')\n .map((os) => (row.on[os] === 'yes' ? SUPPORT_OSES[os] : `${SUPPORT_OSES[os]} (${row.on[os]})`));\n const absent = oses.filter((os) => row.on[os] === 'absent').map((os) => SUPPORT_OSES[os]);\n const list = (names: readonly string[]) =>\n names.length < 2 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;\n const parts = [];\n if (present.length) parts.push(`Available on ${list(present)}.`);\n if (absent.length) {\n parts.push(\n row.withoutAvailable\n ? `Absent on ${list(absent)}.`\n : `Absent on ${list(absent)}, where \\`available()\\` is false.`,\n );\n }\n return `**Platforms.** ${parts.join(' ')}`;\n}\n"]}
|
package/dist/os.d.ts
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
/**
|
|
3
|
-
* The operating system the app runs on: `Platform.OS` on a device,
|
|
4
|
-
* which provides it. Off a device, in a test in Node, it is the platform the engine
|
|
5
|
-
* iOS unless `registerPlatformComponents` said otherwise.
|
|
3
|
+
* The operating system the app runs on: `Platform.OS` on a device, `'macos'` on a Mac, and `'web'`
|
|
4
|
+
* in the web host, which provides it. Off a device, in a test in Node, it is the platform the engine
|
|
5
|
+
* renders as, iOS unless `registerPlatformComponents` said otherwise.
|
|
6
6
|
*
|
|
7
7
|
* For a feature that depends on the platform, beside `OS_VERSION`, whose number is the API level
|
|
8
|
-
* on Android: a check for iOS 26 needs both
|
|
8
|
+
* on Android and the macOS major on a Mac: a check for iOS 26 needs both, or it matches macOS 26
|
|
9
|
+
* too. A test provides the OS it wants.
|
|
9
10
|
*/
|
|
10
|
-
export declare const OS: InjectionToken<"android" | "
|
|
11
|
+
export declare const OS: InjectionToken<"ios" | "android" | "macos" | "web">;
|
|
12
|
+
/** The OS as React Native, or off a device the engine, reports it: what `OS` answers unprovided. */
|
|
13
|
+
export declare function platformOs(): 'ios' | 'android' | 'macos' | 'web';
|
|
14
|
+
/**
|
|
15
|
+
* The `OS` a service is made under: the one provided, or, in an injector with no root to make it
|
|
16
|
+
* in, the platform's own.
|
|
17
|
+
*/
|
|
18
|
+
export declare const injectOs: () => "ios" | "android" | "macos" | "web";
|
|
19
|
+
/** Whether `os` is a phone and tablet OS, with a status bar and a software keyboard. */
|
|
20
|
+
export declare const isPhoneOs: (os: string) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the app runs on a desktop OS: macOS today. Worked out from `OS`, so the two cannot
|
|
23
|
+
* disagree, and a test that provides `OS` gets the answer that goes with it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DESKTOP: InjectionToken<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the app runs on one of Apple's OSes: iOS (iPadOS included) or macOS. For a check that
|
|
28
|
+
* Apple's OSes share, written as `inject(APPLE)` rather than `OS === 'ios'`, which a Mac fails.
|
|
29
|
+
* Worked out from `OS`, as `DESKTOP` is.
|
|
30
|
+
*/
|
|
31
|
+
export declare const APPLE: InjectionToken<boolean>;
|
package/dist/os.js
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
1
|
+
import { InjectionToken, inject } from '@angular/core';
|
|
2
2
|
import { nativePlatform } from '@ng-native/fabric';
|
|
3
3
|
import { reactNative } from "./react-native.js";
|
|
4
4
|
/**
|
|
5
|
-
* The operating system the app runs on: `Platform.OS` on a device,
|
|
6
|
-
* which provides it. Off a device, in a test in Node, it is the platform the engine
|
|
7
|
-
* iOS unless `registerPlatformComponents` said otherwise.
|
|
5
|
+
* The operating system the app runs on: `Platform.OS` on a device, `'macos'` on a Mac, and `'web'`
|
|
6
|
+
* in the web host, which provides it. Off a device, in a test in Node, it is the platform the engine
|
|
7
|
+
* renders as, iOS unless `registerPlatformComponents` said otherwise.
|
|
8
8
|
*
|
|
9
9
|
* For a feature that depends on the platform, beside `OS_VERSION`, whose number is the API level
|
|
10
|
-
* on Android: a check for iOS 26 needs both
|
|
10
|
+
* on Android and the macOS major on a Mac: a check for iOS 26 needs both, or it matches macOS 26
|
|
11
|
+
* too. A test provides the OS it wants.
|
|
11
12
|
*/
|
|
12
13
|
export const OS = new InjectionToken('angular-native.os', {
|
|
14
|
+
factory: platformOs,
|
|
15
|
+
});
|
|
16
|
+
/** The OS as React Native, or off a device the engine, reports it: what `OS` answers unprovided. */
|
|
17
|
+
export function platformOs() {
|
|
18
|
+
const os = reactNative()?.Platform?.OS ?? nativePlatform();
|
|
19
|
+
return os === 'android' || os === 'macos' || os === 'web' ? os : 'ios';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `OS` a service is made under: the one provided, or, in an injector with no root to make it
|
|
23
|
+
* in, the platform's own.
|
|
24
|
+
*/
|
|
25
|
+
export const injectOs = () => inject(OS, { optional: true }) ?? platformOs();
|
|
26
|
+
/** Whether `os` is a phone and tablet OS, with a status bar and a software keyboard. */
|
|
27
|
+
export const isPhoneOs = (os) => os === 'ios' || os === 'android';
|
|
28
|
+
/**
|
|
29
|
+
* Whether the app runs on a desktop OS: macOS today. Worked out from `OS`, so the two cannot
|
|
30
|
+
* disagree, and a test that provides `OS` gets the answer that goes with it.
|
|
31
|
+
*/
|
|
32
|
+
export const DESKTOP = new InjectionToken('angular-native.desktop', {
|
|
33
|
+
factory: () => inject(OS) === 'macos',
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Whether the app runs on one of Apple's OSes: iOS (iPadOS included) or macOS. For a check that
|
|
37
|
+
* Apple's OSes share, written as `inject(APPLE)` rather than `OS === 'ios'`, which a Mac fails.
|
|
38
|
+
* Worked out from `OS`, as `DESKTOP` is.
|
|
39
|
+
*/
|
|
40
|
+
export const APPLE = new InjectionToken('angular-native.apple', {
|
|
13
41
|
factory: () => {
|
|
14
|
-
const os =
|
|
15
|
-
return os === '
|
|
42
|
+
const os = inject(OS);
|
|
43
|
+
return os === 'ios' || os === 'macos';
|
|
16
44
|
},
|
|
17
45
|
});
|
|
18
46
|
//# sourceMappingURL=os.js.map
|
package/dist/os.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"os.js","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"os.js","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,cAAc,CAAsC,mBAAmB,EAAE;IAC7F,OAAO,EAAE,UAAU;CACpB,CAAC,CAAC;AAEH,oGAAoG;AACpG,MAAM,UAAU,UAAU;IACxB,MAAM,EAAE,GAAG,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,cAAc,EAAE,CAAC;IAC3D,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAwC,EAAE,CAChE,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC;AAEjD,wFAAwF;AACxF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,SAAS,CAAC;AAEnF;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,cAAc,CAAU,wBAAwB,EAAE;IAC3E,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO;CACtC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,cAAc,CAAU,sBAAsB,EAAE;IACvE,OAAO,EAAE,GAAG,EAAE;QACZ,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,OAAO,CAAC;IACxC,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { InjectionToken, inject } from '@angular/core';\nimport { nativePlatform } from '@ng-native/fabric';\nimport { reactNative } from './react-native.ts';\n\n/**\n * The operating system the app runs on: `Platform.OS` on a device, `'macos'` on a Mac, and `'web'`\n * in the web host, which provides it. Off a device, in a test in Node, it is the platform the engine\n * renders as, iOS unless `registerPlatformComponents` said otherwise.\n *\n * For a feature that depends on the platform, beside `OS_VERSION`, whose number is the API level\n * on Android and the macOS major on a Mac: a check for iOS 26 needs both, or it matches macOS 26\n * too. A test provides the OS it wants.\n */\nexport const OS = new InjectionToken<'ios' | 'android' | 'macos' | 'web'>('angular-native.os', {\n factory: platformOs,\n});\n\n/** The OS as React Native, or off a device the engine, reports it: what `OS` answers unprovided. */\nexport function platformOs(): 'ios' | 'android' | 'macos' | 'web' {\n const os = reactNative()?.Platform?.OS ?? nativePlatform();\n return os === 'android' || os === 'macos' || os === 'web' ? os : 'ios';\n}\n\n/**\n * The `OS` a service is made under: the one provided, or, in an injector with no root to make it\n * in, the platform's own.\n */\nexport const injectOs = (): 'ios' | 'android' | 'macos' | 'web' =>\n inject(OS, { optional: true }) ?? platformOs();\n\n/** Whether `os` is a phone and tablet OS, with a status bar and a software keyboard. */\nexport const isPhoneOs = (os: string): boolean => os === 'ios' || os === 'android';\n\n/**\n * Whether the app runs on a desktop OS: macOS today. Worked out from `OS`, so the two cannot\n * disagree, and a test that provides `OS` gets the answer that goes with it.\n */\nexport const DESKTOP = new InjectionToken<boolean>('angular-native.desktop', {\n factory: () => inject(OS) === 'macos',\n});\n\n/**\n * Whether the app runs on one of Apple's OSes: iOS (iPadOS included) or macOS. For a check that\n * Apple's OSes share, written as `inject(APPLE)` rather than `OS === 'ios'`, which a Mac fails.\n * Worked out from `OS`, as `DESKTOP` is.\n */\nexport const APPLE = new InjectionToken<boolean>('angular-native.apple', {\n factory: () => {\n const os = inject(OS);\n return os === 'ios' || os === 'macos';\n },\n});\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inputs of a component or a directive, by the names a template writes (an alias where there
|
|
3
|
+
* is one), inherited ones included. Empty for a class that is neither.
|
|
4
|
+
*
|
|
5
|
+
* A component's come from the public `reflectComponentType`. Angular has no public mirror of a
|
|
6
|
+
* directive, which is what most host primitives are, so a directive's are read from its exported
|
|
7
|
+
* `ɵgetDirectiveDef`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hostInputNames(type: unknown): ReadonlySet<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Mark `node` as owned, and take off any prop Angular wrote there from a static attribute that
|
|
12
|
+
* one of `type`'s inputs already consumed. Angular writes a static attribute to the element as
|
|
13
|
+
* well as feeding it to the input of the same name, so `<switch thumbColor="#fff">` leaves a
|
|
14
|
+
* stray `thumbColor` prop next to the `thumbTintColor` the input produces, and
|
|
15
|
+
* `<native-header title="Settings">` a `title` prop. A host binding puts back any that native
|
|
16
|
+
* does read.
|
|
17
|
+
*
|
|
18
|
+
* Walking the *node's* props rather than the inputs is not a detail. This runs for every element
|
|
19
|
+
* on screen, a primitive declares some forty-five inputs, and at this point the node usually has
|
|
20
|
+
* no props at all: bindings have not run yet, so only static attributes are there. The other way
|
|
21
|
+
* round it was forty-five `delete`s per element on an object that had none of them, which is both
|
|
22
|
+
* wasted work and the way to push an object into dictionary mode.
|
|
23
|
+
*
|
|
24
|
+
* Never throws: a node with no props bag yet (a host that has not put one there) and a class that
|
|
25
|
+
* is neither a component nor a directive are claimed and otherwise left alone.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ownHost<T>(node: T, type?: unknown): T;
|
package/dist/own-host.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claiming a host node, and taking off the attributes its inputs consumed.
|
|
3
|
+
*
|
|
4
|
+
* Internal: it lives here because `@ng-native/components` and `@ng-native/router` both own host
|
|
5
|
+
* nodes and cannot import each other.
|
|
6
|
+
*/
|
|
7
|
+
import { isDevMode, reflectComponentType, ɵgetDirectiveDef } from '@angular/core';
|
|
8
|
+
import { claimHost } from '@ng-native/fabric';
|
|
9
|
+
const NONE = { names: new Set(), consumes: false };
|
|
10
|
+
/** Per class, as the inputs of a class do not change, except under a hot reload (see below). */
|
|
11
|
+
const cache = new WeakMap();
|
|
12
|
+
/**
|
|
13
|
+
* The inputs of a component or a directive, by the names a template writes (an alias where there
|
|
14
|
+
* is one), inherited ones included. Empty for a class that is neither.
|
|
15
|
+
*
|
|
16
|
+
* A component's come from the public `reflectComponentType`. Angular has no public mirror of a
|
|
17
|
+
* directive, which is what most host primitives are, so a directive's are read from its exported
|
|
18
|
+
* `ɵgetDirectiveDef`.
|
|
19
|
+
*/
|
|
20
|
+
export function hostInputNames(type) {
|
|
21
|
+
return inputsOf(type).names;
|
|
22
|
+
}
|
|
23
|
+
function inputsOf(type) {
|
|
24
|
+
if (typeof type !== 'function')
|
|
25
|
+
return NONE;
|
|
26
|
+
const cached = cache.get(type);
|
|
27
|
+
if (cached)
|
|
28
|
+
return cached;
|
|
29
|
+
const mirror = reflectComponentType(type);
|
|
30
|
+
if (mirror) {
|
|
31
|
+
const inputs = {
|
|
32
|
+
names: new Set(mirror.inputs.map((input) => input.templateName)),
|
|
33
|
+
consumes: true,
|
|
34
|
+
};
|
|
35
|
+
// A hot reload replaces a component's definition in place, under the same class, so in
|
|
36
|
+
// development a component's inputs are read again for each host.
|
|
37
|
+
if (!isDevMode())
|
|
38
|
+
cache.set(type, inputs);
|
|
39
|
+
return inputs;
|
|
40
|
+
}
|
|
41
|
+
const def = ɵgetDirectiveDef(type);
|
|
42
|
+
const inputs = def
|
|
43
|
+
? { names: new Set(Object.keys(def.inputs)), consumes: def.selectors.length > 0 }
|
|
44
|
+
: NONE;
|
|
45
|
+
cache.set(type, inputs);
|
|
46
|
+
return inputs;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Mark `node` as owned, and take off any prop Angular wrote there from a static attribute that
|
|
50
|
+
* one of `type`'s inputs already consumed. Angular writes a static attribute to the element as
|
|
51
|
+
* well as feeding it to the input of the same name, so `<switch thumbColor="#fff">` leaves a
|
|
52
|
+
* stray `thumbColor` prop next to the `thumbTintColor` the input produces, and
|
|
53
|
+
* `<native-header title="Settings">` a `title` prop. A host binding puts back any that native
|
|
54
|
+
* does read.
|
|
55
|
+
*
|
|
56
|
+
* Walking the *node's* props rather than the inputs is not a detail. This runs for every element
|
|
57
|
+
* on screen, a primitive declares some forty-five inputs, and at this point the node usually has
|
|
58
|
+
* no props at all: bindings have not run yet, so only static attributes are there. The other way
|
|
59
|
+
* round it was forty-five `delete`s per element on an object that had none of them, which is both
|
|
60
|
+
* wasted work and the way to push an object into dictionary mode.
|
|
61
|
+
*
|
|
62
|
+
* Never throws: a node with no props bag yet (a host that has not put one there) and a class that
|
|
63
|
+
* is neither a component nor a directive are claimed and otherwise left alone.
|
|
64
|
+
*/
|
|
65
|
+
export function ownHost(node, type) {
|
|
66
|
+
claimHost(node);
|
|
67
|
+
const props = node.props;
|
|
68
|
+
if (!props)
|
|
69
|
+
return node;
|
|
70
|
+
const { names, consumes } = inputsOf(type);
|
|
71
|
+
if (!consumes)
|
|
72
|
+
return node;
|
|
73
|
+
for (const name of Object.keys(props)) {
|
|
74
|
+
if (names.has(name))
|
|
75
|
+
delete props[name];
|
|
76
|
+
}
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=own-host.js.map
|