@ng-native/device 0.22.1 → 0.23.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 +2 -0
- package/dist/color-scheme.js +2 -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
|
@@ -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,EAC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B,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACjF,CAAC,CAAC,IAAI,CAAC;IACT,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,OAAO,CAAI,IAAO,EAAE,IAAc;IAChD,SAAS,CAAC,IAAkB,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAI,IAA4C,CAAC,KAAK,CAAC;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Claiming a host node, and taking off the attributes its inputs consumed.\n *\n * Internal: it lives here because `@ng-native/components` and `@ng-native/router` both own host\n * nodes and cannot import each other.\n */\nimport { isDevMode, reflectComponentType, ɵgetDirectiveDef, type Type } from '@angular/core';\nimport { claimHost, type EngineNode } from '@ng-native/fabric';\n\n/** A class's inputs, by the names a template writes. */\ninterface HostInputs {\n readonly names: ReadonlySet<string>;\n /**\n * Whether a static attribute by one of those names was consumed by them. Not for a directive\n * with no selector: it is only ever a `hostDirectives` entry, which exposes the inputs its host\n * lists and no others, so an attribute named after the rest was not consumed.\n */\n readonly consumes: boolean;\n}\n\nconst NONE: HostInputs = { names: new Set(), consumes: false };\n\n/** Per class, as the inputs of a class do not change, except under a hot reload (see below). */\nconst cache = new WeakMap<object, HostInputs>();\n\n/**\n * The inputs of a component or a directive, by the names a template writes (an alias where there\n * is one), inherited ones included. Empty for a class that is neither.\n *\n * A component's come from the public `reflectComponentType`. Angular has no public mirror of a\n * directive, which is what most host primitives are, so a directive's are read from its exported\n * `ɵgetDirectiveDef`.\n */\nexport function hostInputNames(type: unknown): ReadonlySet<string> {\n return inputsOf(type).names;\n}\n\nfunction inputsOf(type: unknown): HostInputs {\n if (typeof type !== 'function') return NONE;\n const cached = cache.get(type);\n if (cached) return cached;\n const mirror = reflectComponentType(type as Type<unknown>);\n if (mirror) {\n const inputs = {\n names: new Set(mirror.inputs.map((input) => input.templateName)),\n consumes: true,\n };\n // A hot reload replaces a component's definition in place, under the same class, so in\n // development a component's inputs are read again for each host.\n if (!isDevMode()) cache.set(type, inputs);\n return inputs;\n }\n const def = ɵgetDirectiveDef(type);\n const inputs = def\n ? { names: new Set(Object.keys(def.inputs)), consumes: def.selectors.length > 0 }\n : NONE;\n cache.set(type, inputs);\n return inputs;\n}\n\n/**\n * Mark `node` as owned, and take off any prop Angular wrote there from a static attribute that\n * one of `type`'s inputs already consumed. Angular writes a static attribute to the element as\n * well as feeding it to the input of the same name, so `<switch thumbColor=\"#fff\">` leaves a\n * stray `thumbColor` prop next to the `thumbTintColor` the input produces, and\n * `<native-header title=\"Settings\">` a `title` prop. A host binding puts back any that native\n * does read.\n *\n * Walking the *node's* props rather than the inputs is not a detail. This runs for every element\n * on screen, a primitive declares some forty-five inputs, and at this point the node usually has\n * no props at all: bindings have not run yet, so only static attributes are there. The other way\n * round it was forty-five `delete`s per element on an object that had none of them, which is both\n * wasted work and the way to push an object into dictionary mode.\n *\n * Never throws: a node with no props bag yet (a host that has not put one there) and a class that\n * is neither a component nor a directive are claimed and otherwise left alone.\n */\nexport function ownHost<T>(node: T, type?: unknown): T {\n claimHost(node as EngineNode);\n const props = (node as { props?: Record<string, unknown> }).props;\n if (!props) return node;\n const { names, consumes } = inputsOf(type);\n if (!consumes) return node;\n for (const name of Object.keys(props)) {\n if (names.has(name)) delete props[name];\n }\n return node;\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Processes`: the app's environment on a desktop OS, and the programs it declares, run with
|
|
3
|
+
* `spawn`. Absent on iOS, Android and the web, which give an app neither.
|
|
4
|
+
*
|
|
5
|
+
* The host contract, on the `NgNativeProcesses` module:
|
|
6
|
+
*
|
|
7
|
+
* - `getConstants()` answers `env` (the environment, already filtered to `capabilities.env`),
|
|
8
|
+
* `envNames` (`capabilities.env` itself), `spawn` (the declared spawn capabilities) and `resolved` (where each declared bare name was
|
|
9
|
+
* pinned at startup, or null where it is absent).
|
|
10
|
+
* - `spawn(program, args, cwd, env)` runs the program, never through a shell, after checking the
|
|
11
|
+
* call against the declaration again, and answers a handle; it rejects an undeclared call.
|
|
12
|
+
* - `write(handle, data)`, `closeStdin(handle)` and `kill(handle, signal)`.
|
|
13
|
+
* - `{ type: 'stdout' | 'stderr', handle, data }` and `{ type: 'exit', handle, code, signal }`
|
|
14
|
+
* arrive on `ngNativeProcesses`.
|
|
15
|
+
*/
|
|
16
|
+
import { InjectionToken, type Signal } from '@angular/core';
|
|
17
|
+
import { type SpawnCapability } from './spawn-rules.ts';
|
|
18
|
+
import * as i0 from "@angular/core";
|
|
19
|
+
/** How a spawned program ended: its exit code, or the signal that stopped it. */
|
|
20
|
+
export interface ProcessExit {
|
|
21
|
+
readonly code: number | null;
|
|
22
|
+
readonly signal: string | null;
|
|
23
|
+
}
|
|
24
|
+
/** What the host reports about a spawned program. */
|
|
25
|
+
export type ProcessEvent = {
|
|
26
|
+
readonly type: 'stdout' | 'stderr';
|
|
27
|
+
readonly handle: number;
|
|
28
|
+
readonly data: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: 'exit';
|
|
31
|
+
readonly handle: number;
|
|
32
|
+
readonly code: number | null;
|
|
33
|
+
readonly signal: string | null;
|
|
34
|
+
};
|
|
35
|
+
/** What the desktop host's module reports, and what a test fakes. */
|
|
36
|
+
export interface NativeProcesses {
|
|
37
|
+
/** The environment variables the app was started with, filtered to those it declares. */
|
|
38
|
+
readonly env: Readonly<Record<string, string>>;
|
|
39
|
+
/** The variables `capabilities.env` declares: all a spawned program may be given. */
|
|
40
|
+
readonly envNames?: readonly string[];
|
|
41
|
+
/** The declared spawn capabilities. None declared, nothing may be spawned. */
|
|
42
|
+
readonly spawnCapabilities?: readonly SpawnCapability[];
|
|
43
|
+
/** Where each declared bare program name was pinned at startup, or null where it is absent. */
|
|
44
|
+
readonly resolved?: Readonly<Record<string, string | null>>;
|
|
45
|
+
spawn?(program: string, args: readonly string[], cwd: string | null, env: Readonly<Record<string, string>>): Promise<number>;
|
|
46
|
+
write?(handle: number, data: string): void;
|
|
47
|
+
closeStdin?(handle: number): void;
|
|
48
|
+
kill?(handle: number, signal: string): void;
|
|
49
|
+
subscribe?(listener: (event: ProcessEvent) => void): () => void;
|
|
50
|
+
}
|
|
51
|
+
/** A program `spawn` started. */
|
|
52
|
+
export interface ChildProcess {
|
|
53
|
+
/** Settles once the program has ended. */
|
|
54
|
+
readonly exit: Promise<ProcessExit>;
|
|
55
|
+
/** Hear what the program writes to standard output. Answers the function that stops it. */
|
|
56
|
+
onStdout(listener: (chunk: string) => void): () => void;
|
|
57
|
+
/** Hear what the program writes to standard error. */
|
|
58
|
+
onStderr(listener: (chunk: string) => void): () => void;
|
|
59
|
+
/** Write to the program's standard input. */
|
|
60
|
+
write(data: string): void;
|
|
61
|
+
/** Close the program's standard input. */
|
|
62
|
+
end(): void;
|
|
63
|
+
/** Stop the program. `SIGTERM` unless it says. */
|
|
64
|
+
kill(signal?: 'SIGTERM' | 'SIGINT' | 'SIGKILL' | 'SIGHUP'): void;
|
|
65
|
+
}
|
|
66
|
+
/** What `spawn` takes beside the program and its arguments. */
|
|
67
|
+
export interface SpawnOptions {
|
|
68
|
+
/** The working directory. The app's own when unset. */
|
|
69
|
+
readonly cwd?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The program's environment. Only the variables the app declares in `capabilities.env` are
|
|
72
|
+
* passed; the rest are left out. Unset, it gets `Processes.env`.
|
|
73
|
+
*/
|
|
74
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
75
|
+
}
|
|
76
|
+
/** A spawn the app did not declare: a misconfiguration, so it throws rather than doing nothing. */
|
|
77
|
+
export declare class UndeclaredCapabilityError extends Error {
|
|
78
|
+
readonly name = "UndeclaredCapabilityError";
|
|
79
|
+
}
|
|
80
|
+
export declare class Processes {
|
|
81
|
+
/** Overridden in a test to start the app with an environment, and to fake programs. */
|
|
82
|
+
static readonly SOURCE: InjectionToken<NativeProcesses | null>;
|
|
83
|
+
private readonly native;
|
|
84
|
+
private readonly capabilities;
|
|
85
|
+
private readonly running;
|
|
86
|
+
/**
|
|
87
|
+
* What the host said of a program before its spawn resolved with the handle: its reader threads
|
|
88
|
+
* can queue a short program's output and exit ahead of that answer.
|
|
89
|
+
*/
|
|
90
|
+
private readonly early;
|
|
91
|
+
/** Spawns waiting on the host, while which an unknown handle's events are kept. */
|
|
92
|
+
private spawning;
|
|
93
|
+
/** Held events not yet replayed, by handle: live ones queue behind them, in order. */
|
|
94
|
+
private readonly replaying;
|
|
95
|
+
private readonly unsubscribe;
|
|
96
|
+
/** Whether the OS gives the app processes: a desktop OS with the desktop host's module. */
|
|
97
|
+
readonly available: Signal<boolean>;
|
|
98
|
+
/** The environment variables, as the app was started with them. Empty where absent. */
|
|
99
|
+
readonly env: Readonly<Record<string, string>>;
|
|
100
|
+
/**
|
|
101
|
+
* Run `program` with `args`, never through a shell. The call has to match a capability the app
|
|
102
|
+
* declares in app.json; one that does not throws `UndeclaredCapabilityError`. Resolves to null
|
|
103
|
+
* where processes are absent.
|
|
104
|
+
*
|
|
105
|
+
* const git = await processes.spawn('git', ['status', '--porcelain'], { cwd: repo });
|
|
106
|
+
* git?.onStdout((chunk) => output.update((text) => text + chunk));
|
|
107
|
+
* const { code } = (await git?.exit) ?? { code: null };
|
|
108
|
+
*/
|
|
109
|
+
spawn(program: string, args?: readonly string[], options?: SpawnOptions): Promise<ChildProcess | null>;
|
|
110
|
+
private child;
|
|
111
|
+
private heard;
|
|
112
|
+
/** Stop hearing the host, as the app goes. */
|
|
113
|
+
ngOnDestroy(): void;
|
|
114
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Processes, never>;
|
|
115
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
116
|
+
}
|