@absolutejs/absolute 0.20.0-beta.55 → 0.20.0-beta.56

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/cli/index.js CHANGED
@@ -1358,7 +1358,7 @@ import { existsSync as existsSync3, readFileSync as readFileSync7 } from "fs";
1358
1358
  import { extname, join as join7, relative, resolve as resolve4 } from "path";
1359
1359
  import { fileURLToPath } from "url";
1360
1360
  import ts from "typescript";
1361
- var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
1361
+ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
1362
1362
  const value = JSON.parse(readFileSync7(path, "utf8"));
1363
1363
  if (!object2(value))
1364
1364
  throw new TypeError(`${path} must contain an object.`);
@@ -1578,6 +1578,11 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
1578
1578
  }), resolveAbsoluteDeviceCapabilityPlan = (projectRoot, provider = "capacitor") => {
1579
1579
  const allProviders = loadAbsoluteDeviceCapabilityProviders(projectRoot, provider);
1580
1580
  const capabilities = discoverAbsoluteDeviceCapabilities(projectRoot, allProviders);
1581
+ for (const capability of ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES) {
1582
+ if (allProviders[capability] && !capabilities.includes(capability))
1583
+ capabilities.push(capability);
1584
+ }
1585
+ capabilities.sort();
1581
1586
  const providers = {};
1582
1587
  for (const name of capabilities) {
1583
1588
  const capabilityProvider = allProviders[name];
@@ -1593,6 +1598,10 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
1593
1598
  };
1594
1599
  };
1595
1600
  var init_deviceCapabilities = __esm(() => {
1601
+ ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
1602
+ "keyboard",
1603
+ "systemBars"
1604
+ ];
1596
1605
  ADAPTERS = {
1597
1606
  capacitor: "@absolutejs/devices-capacitor",
1598
1607
  expo: "@absolutejs/devices-expo"
@@ -2093,6 +2102,7 @@ export const createAbsoluteExpoSyncBridge = async (
2093
2102
  import { router, usePathname } from 'expo-router';
2094
2103
  import { useEffect, useRef, useState } from 'react';
2095
2104
  import { ActivityIndicator, BackHandler, Platform, StyleSheet, View } from 'react-native';
2105
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
2096
2106
  import { WebView, type WebViewMessageEvent } from 'react-native-webview';
2097
2107
  import { materializeAbsoluteWebBundle } from './webAssets';
2098
2108
  import { createExpoDevicesBridgeHost } from '@absolutejs/devices-expo/bridge';
@@ -2125,7 +2135,10 @@ const isNativeRoute = (pathname: string) => {
2125
2135
  });
2126
2136
  };
2127
2137
 
2128
- const bridgeBootstrap = (path: string) => {
2138
+ const hostMetricsScript = (safeAreaInsets: { bottom: number; left: number; right: number; top: number }) =>
2139
+ \`globalThis.__absoluteNativeHostMetrics = \${JSON.stringify({ safeAreaInsets })}; dispatchEvent(new CustomEvent('absolute:native-host-metrics', { detail: globalThis.__absoluteNativeHostMetrics })); true;\`;
2140
+
2141
+ const bridgeBootstrap = (path: string, safeAreaInsets: { bottom: number; left: number; right: number; top: number }) => {
2129
2142
  const initialPath = DEV_ORIGIN
2130
2143
  ? 'location.pathname + location.search + location.hash'
2131
2144
  : JSON.stringify(path);
@@ -2134,6 +2147,7 @@ const bridgeBootstrap = (path: string) => {
2134
2147
  const listeners = new Map();
2135
2148
  let sequence = 0;
2136
2149
  let currentPath = \${initialPath};
2150
+ globalThis.__absoluteNativeHostMetrics = \${JSON.stringify({ safeAreaInsets })};
2137
2151
  const send = value => {
2138
2152
  const source = JSON.stringify(value);
2139
2153
  if (new TextEncoder().encode(source).byteLength > 65536) throw new Error('Expo bridge message exceeds 64 KiB.');
@@ -2238,6 +2252,7 @@ const authStatus = async () => {
2238
2252
 
2239
2253
  export function AbsoluteWebHost() {
2240
2254
  const pathname = usePathname() || '/';
2255
+ const safeAreaInsets = useSafeAreaInsets();
2241
2256
  const webView = useRef<WebView>(null);
2242
2257
  const devicesBridge = useRef<{ close(): void | Promise<void>; request(method: string, params: Record<string, unknown>): Promise<unknown> } | undefined>(undefined);
2243
2258
  const syncBridge = useRef<{ close(): void | Promise<void>; request(method: string, params: Record<string, unknown>): Promise<unknown> } | undefined>(undefined);
@@ -2280,6 +2295,9 @@ export function AbsoluteWebHost() {
2280
2295
  }
2281
2296
  void materializeAbsoluteWebBundle().then(uri => setIndexUri(uri + '?absolutePath=' + encodeURIComponent(pathname)));
2282
2297
  }, [pathname]);
2298
+ useEffect(() => {
2299
+ webView.current?.injectJavaScript(hostMetricsScript(safeAreaInsets));
2300
+ }, [safeAreaInsets.bottom, safeAreaInsets.left, safeAreaInsets.right, safeAreaInsets.top]);
2283
2301
  useEffect(() => {
2284
2302
  const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
2285
2303
  if (!canGoBack) return false;
@@ -2363,7 +2381,7 @@ export function AbsoluteWebHost() {
2363
2381
  allowFileAccessFromFileURLs
2364
2382
  allowUniversalAccessFromFileURLs={false}
2365
2383
  allowingReadAccessToURL={indexUri.slice(0, indexUri.lastIndexOf('/') + 1)}
2366
- injectedJavaScriptBeforeContentLoaded={bridgeBootstrap(pathname)}
2384
+ injectedJavaScriptBeforeContentLoaded={bridgeBootstrap(pathname, safeAreaInsets)}
2367
2385
  onMessage={onMessage}
2368
2386
  onNavigationStateChange={state => setCanGoBack(state.canGoBack)}
2369
2387
  onShouldStartLoadWithRequest={request => {
@@ -21350,6 +21368,22 @@ var init_iosTestReport = __esm(() => {
21350
21368
  ["SETUP-05", "Confirm generated iOS project signing and Xcode warnings."],
21351
21369
  ["DEV-01", "Record cold and warm bun dev startup timings."],
21352
21370
  ["DEV-02", "Complete route traversal, HMR, relaunch, and recovery checks."],
21371
+ [
21372
+ "ADAPT-01",
21373
+ "Confirm safe-area variables and platform attributes on React, Angular, Vue, Svelte, HTML, and HTMX pages."
21374
+ ],
21375
+ [
21376
+ "ADAPT-02",
21377
+ "Rotate with the keyboard open and confirm viewport and available-height variables update without double padding."
21378
+ ],
21379
+ [
21380
+ "ADAPT-03",
21381
+ "Go offline and reconnect; confirm the root state and accessibility announcement update."
21382
+ ],
21383
+ [
21384
+ "ADAPT-04",
21385
+ "Confirm automatic system-bar appearance and unchanged author layout."
21386
+ ],
21353
21387
  ...Array.from({ length: 10 }, (_, index) => [
21354
21388
  `DEVICEDEV-${String(index + 1).padStart(2, "0")}`,
21355
21389
  `Complete physical-device development runbook check DEVICEDEV-${String(index + 1).padStart(2, "0")}.`
@@ -21435,6 +21469,22 @@ var init_androidTestReport = __esm(() => {
21435
21469
  ],
21436
21470
  ["DEV-01", "Record cold and warm native startup timings."],
21437
21471
  ["DEV-02", "Complete route traversal, HMR, relaunch, and recovery checks."],
21472
+ [
21473
+ "ADAPT-01",
21474
+ "Confirm safe-area variables and platform attributes on every embedded framework."
21475
+ ],
21476
+ [
21477
+ "ADAPT-02",
21478
+ "Rotate with the keyboard open and confirm viewport and available-height variables update without double padding."
21479
+ ],
21480
+ [
21481
+ "ADAPT-03",
21482
+ "Go offline and reconnect; confirm the root state and accessibility announcement update."
21483
+ ],
21484
+ [
21485
+ "ADAPT-04",
21486
+ "Confirm automatic system-bar appearance and unchanged author layout."
21487
+ ],
21438
21488
  ["CAP-01", "Complete automatic device-capability provisioning checks."],
21439
21489
  [
21440
21490
  "SYSUI-01",
package/dist/index.js CHANGED
@@ -13421,7 +13421,7 @@ import { existsSync as existsSync23, readFileSync as readFileSync17 } from "fs";
13421
13421
  import { extname as extname7, join as join29, relative as relative11, resolve as resolve25 } from "path";
13422
13422
  import { fileURLToPath as fileURLToPath2 } from "url";
13423
13423
  import ts8 from "typescript";
13424
- var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
13424
+ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
13425
13425
  const value = JSON.parse(readFileSync17(path, "utf8"));
13426
13426
  if (!object(value))
13427
13427
  throw new TypeError(`${path} must contain an object.`);
@@ -13652,6 +13652,11 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
13652
13652
  }, resolveAbsoluteDeviceCapabilityPlan = (projectRoot, provider = "capacitor") => {
13653
13653
  const allProviders = loadAbsoluteDeviceCapabilityProviders(projectRoot, provider);
13654
13654
  const capabilities = discoverAbsoluteDeviceCapabilities(projectRoot, allProviders);
13655
+ for (const capability of ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES) {
13656
+ if (allProviders[capability] && !capabilities.includes(capability))
13657
+ capabilities.push(capability);
13658
+ }
13659
+ capabilities.sort();
13655
13660
  const providers = {};
13656
13661
  for (const name of capabilities) {
13657
13662
  const capabilityProvider = allProviders[name];
@@ -13667,6 +13672,10 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ADAPTERS, SOURCE_GLOB, IGNORED_DIRE
13667
13672
  };
13668
13673
  };
13669
13674
  var init_deviceCapabilities = __esm(() => {
13675
+ ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
13676
+ "keyboard",
13677
+ "systemBars"
13678
+ ];
13670
13679
  ADAPTERS = {
13671
13680
  capacitor: "@absolutejs/devices-capacitor",
13672
13681
  expo: "@absolutejs/devices-expo"
@@ -41161,5 +41170,5 @@ export {
41161
41170
  wrapPageHandlerWithStreamingSlots
41162
41171
  };
41163
41172
 
41164
- //# debugId=2FE5D4DBD640F62964756E2164756E21
41173
+ //# debugId=76612B71C292527964756E2164756E21
41165
41174
  //# sourceMappingURL=index.js.map