@absolutejs/absolute 0.20.0-beta.45 → 0.20.0-beta.46

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.
@@ -1,12 +1,29 @@
1
1
  // src/mobile/shellExpoDevices.ts
2
- import { createWebDeviceAdapter } from "@absolutejs/devices/web";
3
- import { installDeviceAdapter } from "@absolutejs/devices/runtime";
2
+ import { installExpoWebViewDeviceAdapter } from "@absolutejs/devices-expo/bridge";
4
3
  var bridge = () => {
5
4
  const value = Reflect.get(globalThis, "__absoluteExpoBridge");
6
5
  if (typeof value !== "object" || value === null || typeof Reflect.get(value, "request") !== "function") {
7
6
  return;
8
7
  }
9
8
  return {
9
+ on: (event, listener) => {
10
+ const on = Reflect.get(value, "on");
11
+ if (typeof on !== "function")
12
+ return () => {
13
+ return;
14
+ };
15
+ const subscription = Reflect.apply(on, value, [
16
+ event,
17
+ listener
18
+ ]);
19
+ if (typeof subscription !== "function")
20
+ return () => {
21
+ return;
22
+ };
23
+ return async () => {
24
+ await Reflect.apply(subscription, undefined, []);
25
+ };
26
+ },
10
27
  request: (method, params) => Promise.resolve(Reflect.apply(Reflect.get(value, "request"), value, [
11
28
  method,
12
29
  params
@@ -53,45 +70,7 @@ var createAbsoluteExpoBridgeFetch = () => async (input, init) => {
53
70
  status: result.status
54
71
  });
55
72
  };
56
- var installAbsoluteExpoWebDeviceAdapter = () => {
57
- const web = createWebDeviceAdapter();
58
- return installDeviceAdapter({
59
- ...web,
60
- haptics: {
61
- capability: async () => bridge() ? {
62
- available: true,
63
- fidelity: "native",
64
- native: true
65
- } : {
66
- available: false,
67
- message: "The Expo WebView bridge is unavailable.",
68
- reason: "unavailable"
69
- },
70
- impact: async (style) => {
71
- await requireBridge().request("devices.haptics.impact", {
72
- style
73
- });
74
- },
75
- notification: async (style) => {
76
- await requireBridge().request("devices.haptics.impact", {
77
- style
78
- });
79
- },
80
- selectionChanged: async () => {
81
- await requireBridge().request("devices.haptics.impact", {
82
- style: "selection"
83
- });
84
- },
85
- vibrate: async (durationMs) => {
86
- await requireBridge().request("devices.haptics.impact", {
87
- durationMs,
88
- style: "vibrate"
89
- });
90
- }
91
- },
92
- runtime: "expo"
93
- });
94
- };
73
+ var installAbsoluteExpoWebDeviceAdapter = (capabilities = []) => installExpoWebViewDeviceAdapter(requireBridge(), capabilities);
95
74
 
96
75
  // src/mobile/shellExpoAuth.ts
97
76
  import {
@@ -1,12 +1,29 @@
1
1
  // src/mobile/shellExpoDevices.ts
2
- import { createWebDeviceAdapter } from "@absolutejs/devices/web";
3
- import { installDeviceAdapter } from "@absolutejs/devices/runtime";
2
+ import { installExpoWebViewDeviceAdapter } from "@absolutejs/devices-expo/bridge";
4
3
  var bridge = () => {
5
4
  const value = Reflect.get(globalThis, "__absoluteExpoBridge");
6
5
  if (typeof value !== "object" || value === null || typeof Reflect.get(value, "request") !== "function") {
7
6
  return;
8
7
  }
9
8
  return {
9
+ on: (event, listener) => {
10
+ const on = Reflect.get(value, "on");
11
+ if (typeof on !== "function")
12
+ return () => {
13
+ return;
14
+ };
15
+ const subscription = Reflect.apply(on, value, [
16
+ event,
17
+ listener
18
+ ]);
19
+ if (typeof subscription !== "function")
20
+ return () => {
21
+ return;
22
+ };
23
+ return async () => {
24
+ await Reflect.apply(subscription, undefined, []);
25
+ };
26
+ },
10
27
  request: (method, params) => Promise.resolve(Reflect.apply(Reflect.get(value, "request"), value, [
11
28
  method,
12
29
  params
@@ -53,45 +70,7 @@ var createAbsoluteExpoBridgeFetch = () => async (input, init) => {
53
70
  status: result.status
54
71
  });
55
72
  };
56
- var installAbsoluteExpoWebDeviceAdapter = () => {
57
- const web = createWebDeviceAdapter();
58
- return installDeviceAdapter({
59
- ...web,
60
- haptics: {
61
- capability: async () => bridge() ? {
62
- available: true,
63
- fidelity: "native",
64
- native: true
65
- } : {
66
- available: false,
67
- message: "The Expo WebView bridge is unavailable.",
68
- reason: "unavailable"
69
- },
70
- impact: async (style) => {
71
- await requireBridge().request("devices.haptics.impact", {
72
- style
73
- });
74
- },
75
- notification: async (style) => {
76
- await requireBridge().request("devices.haptics.impact", {
77
- style
78
- });
79
- },
80
- selectionChanged: async () => {
81
- await requireBridge().request("devices.haptics.impact", {
82
- style: "selection"
83
- });
84
- },
85
- vibrate: async (durationMs) => {
86
- await requireBridge().request("devices.haptics.impact", {
87
- durationMs,
88
- style: "vibrate"
89
- });
90
- }
91
- },
92
- runtime: "expo"
93
- });
94
- };
73
+ var installAbsoluteExpoWebDeviceAdapter = (capabilities = []) => installExpoWebViewDeviceAdapter(requireBridge(), capabilities);
95
74
  export {
96
75
  createAbsoluteExpoBridgeFetch,
97
76
  installAbsoluteExpoWebDeviceAdapter
@@ -1,6 +1,7 @@
1
1
  export type AbsoluteDeviceCapabilityProvider = {
2
2
  factory: string;
3
3
  module: string;
4
+ plugins?: string[];
4
5
  native?: {
5
6
  android?: {
6
7
  permissions: string[];
@@ -21,6 +22,7 @@ export type AbsoluteDeviceCapabilityPlan = {
21
22
  providers: Record<string, AbsoluteDeviceCapabilityProvider>;
22
23
  requiredPackages: string[];
23
24
  };
25
+ export type AbsoluteDeviceProvider = 'capacitor' | 'expo';
24
26
  export declare const absoluteDeviceNativeRequirements: (plan: AbsoluteDeviceCapabilityPlan) => {
25
27
  androidPermissions: string[];
26
28
  iosPrivacyAccessedApis: {
@@ -31,7 +33,7 @@ export declare const absoluteDeviceNativeRequirements: (plan: AbsoluteDeviceCapa
31
33
  iosSystemBars: boolean;
32
34
  iosUsageDescriptions: AbsoluteIosUsageDescription[];
33
35
  };
34
- export declare const loadAbsoluteDeviceCapabilityProviders: (projectRoot: string) => {
36
+ export declare const loadAbsoluteDeviceCapabilityProviders: (projectRoot: string, provider?: AbsoluteDeviceProvider) => {
35
37
  [k: string]: AbsoluteDeviceCapabilityProvider;
36
38
  };
37
39
  export declare const assertAbsoluteDeviceCapabilityPackages: (projectRoot: string, plan: AbsoluteDeviceCapabilityPlan) => void;
@@ -43,4 +45,4 @@ export declare const missingAbsoluteDeviceCapabilityPackages: (plan: AbsoluteDev
43
45
  /** Framework-agnostic capability discovery used by web/PWA builds. This does
44
46
  * not load a native provider manifest, so Web Push never requires Capacitor. */
45
47
  export declare const projectImportsAbsoluteDeviceCapability: (projectRoot: string, capability: string) => boolean;
46
- export declare const resolveAbsoluteDeviceCapabilityPlan: (projectRoot: string) => AbsoluteDeviceCapabilityPlan;
48
+ export declare const resolveAbsoluteDeviceCapabilityPlan: (projectRoot: string, provider?: AbsoluteDeviceProvider) => AbsoluteDeviceCapabilityPlan;
@@ -1,6 +1,6 @@
1
1
  export declare const ABSOLUTE_EXPO_BRIDGE_FORMAT: 3;
2
2
  export declare const ABSOLUTE_EXPO_BRIDGE_MAX_BYTES: number;
3
- export declare const ABSOLUTE_EXPO_BRIDGE_METHODS: readonly ["devices.haptics.impact", "http.fetch", "auth.signIn", "auth.signOut", "auth.status", "sync.store.begin", "sync.store.deleteNamespace", "sync.store.end", "sync.store.schema", "sync.tx.deleteCollection", "sync.tx.deleteMutation", "sync.tx.getCollection", "sync.tx.getInstallationId", "sync.tx.getMutation", "sync.tx.listCollections", "sync.tx.listMutations", "sync.tx.putCollection", "sync.tx.putMutation", "sync.tx.setInstallationId", "sync.socket.close", "sync.socket.open", "sync.socket.sendChunk"];
3
+ export declare const ABSOLUTE_EXPO_BRIDGE_METHODS: readonly ["devices.platform.getInfo", "devices.lifecycle.getState", "devices.links.getLaunchUrl", "devices.links.openExternal", "devices.network.getStatus", "devices.storage.clear", "devices.storage.get", "devices.storage.keys", "devices.storage.remove", "devices.storage.set", "devices.back.capability", "devices.clipboard.capability", "devices.clipboard.readText", "devices.clipboard.writeText", "devices.share.capability", "devices.share.share", "devices.haptics.capability", "devices.haptics.impact", "devices.haptics.notification", "devices.haptics.selectionChanged", "devices.haptics.vibrate", "devices.keyboard.capability", "devices.keyboard.dismiss", "devices.keyboard.getState", "devices.systemBars.capability", "devices.systemBars.setAppearance", "devices.systemBars.setVisible", "devices.camera.capability", "devices.camera.queryPermission", "devices.camera.requestPermission", "devices.camera.takePhoto", "devices.photos.capability", "devices.photos.pick", "devices.location.capability", "devices.location.current", "devices.location.queryPermission", "devices.location.requestPermission", "devices.location.watch.start", "devices.location.watch.stop", "devices.localNotifications.capability", "devices.localNotifications.queryPermission", "devices.localNotifications.requestPermission", "devices.localNotifications.schedule", "devices.localNotifications.pending", "devices.localNotifications.cancel", "devices.pushNotifications.capability", "devices.pushNotifications.queryPermission", "devices.pushNotifications.requestPermission", "devices.pushNotifications.enable", "devices.pushNotifications.disable", "devices.documents.capability", "devices.documents.pick", "devices.transfer.read", "devices.transfer.close", "devices.upload.begin", "devices.upload.write", "devices.documents.export", "devices.documents.open", "http.fetch", "auth.signIn", "auth.signOut", "auth.status", "sync.store.begin", "sync.store.deleteNamespace", "sync.store.end", "sync.store.schema", "sync.tx.deleteCollection", "sync.tx.deleteMutation", "sync.tx.getCollection", "sync.tx.getInstallationId", "sync.tx.getMutation", "sync.tx.listCollections", "sync.tx.listMutations", "sync.tx.putCollection", "sync.tx.putMutation", "sync.tx.setInstallationId", "sync.socket.close", "sync.socket.open", "sync.socket.sendChunk"];
4
4
  export type AbsoluteExpoBridgeMethod = (typeof ABSOLUTE_EXPO_BRIDGE_METHODS)[number];
5
5
  export type AbsoluteExpoBridgeRequest = {
6
6
  format: typeof ABSOLUTE_EXPO_BRIDGE_FORMAT;
@@ -64,7 +64,7 @@ export declare const parseAbsoluteExpoBridgeMessage: (source: string) => {
64
64
  format: 3;
65
65
  id: string;
66
66
  kind: "request";
67
- method: "devices.haptics.impact" | "http.fetch" | "auth.signIn" | "auth.signOut" | "auth.status" | "sync.store.begin" | "sync.store.deleteNamespace" | "sync.store.end" | "sync.store.schema" | "sync.tx.deleteCollection" | "sync.tx.deleteMutation" | "sync.tx.getCollection" | "sync.tx.getInstallationId" | "sync.tx.getMutation" | "sync.tx.listCollections" | "sync.tx.listMutations" | "sync.tx.putCollection" | "sync.tx.putMutation" | "sync.tx.setInstallationId" | "sync.socket.close" | "sync.socket.open" | "sync.socket.sendChunk";
67
+ method: "devices.platform.getInfo" | "devices.lifecycle.getState" | "devices.links.getLaunchUrl" | "devices.links.openExternal" | "devices.network.getStatus" | "devices.storage.clear" | "devices.storage.get" | "devices.storage.keys" | "devices.storage.remove" | "devices.storage.set" | "devices.back.capability" | "devices.clipboard.capability" | "devices.clipboard.readText" | "devices.clipboard.writeText" | "devices.share.capability" | "devices.share.share" | "devices.haptics.capability" | "devices.haptics.impact" | "devices.haptics.notification" | "devices.haptics.selectionChanged" | "devices.haptics.vibrate" | "devices.keyboard.capability" | "devices.keyboard.dismiss" | "devices.keyboard.getState" | "devices.systemBars.capability" | "devices.systemBars.setAppearance" | "devices.systemBars.setVisible" | "devices.camera.capability" | "devices.camera.queryPermission" | "devices.camera.requestPermission" | "devices.camera.takePhoto" | "devices.photos.capability" | "devices.photos.pick" | "devices.location.capability" | "devices.location.current" | "devices.location.queryPermission" | "devices.location.requestPermission" | "devices.location.watch.start" | "devices.location.watch.stop" | "devices.localNotifications.capability" | "devices.localNotifications.queryPermission" | "devices.localNotifications.requestPermission" | "devices.localNotifications.schedule" | "devices.localNotifications.pending" | "devices.localNotifications.cancel" | "devices.pushNotifications.capability" | "devices.pushNotifications.queryPermission" | "devices.pushNotifications.requestPermission" | "devices.pushNotifications.enable" | "devices.pushNotifications.disable" | "devices.documents.capability" | "devices.documents.pick" | "devices.transfer.read" | "devices.transfer.close" | "devices.upload.begin" | "devices.upload.write" | "devices.documents.export" | "devices.documents.open" | "http.fetch" | "auth.signIn" | "auth.signOut" | "auth.status" | "sync.store.begin" | "sync.store.deleteNamespace" | "sync.store.end" | "sync.store.schema" | "sync.tx.deleteCollection" | "sync.tx.deleteMutation" | "sync.tx.getCollection" | "sync.tx.getInstallationId" | "sync.tx.getMutation" | "sync.tx.listCollections" | "sync.tx.listMutations" | "sync.tx.putCollection" | "sync.tx.putMutation" | "sync.tx.setInstallationId" | "sync.socket.close" | "sync.socket.open" | "sync.socket.sendChunk";
68
68
  params: Record<string, unknown>;
69
69
  path: string;
70
70
  } | {
@@ -1,3 +1,3 @@
1
- /** Installs only capabilities implemented by the versioned Expo WebView bridge. */
2
1
  export declare const createAbsoluteExpoBridgeFetch: () => (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
3
- export declare const installAbsoluteExpoWebDeviceAdapter: () => () => void;
2
+ /** Installs the provider-neutral adapter backed by the generated native host. */
3
+ export declare const installAbsoluteExpoWebDeviceAdapter: (capabilities?: readonly string[]) => () => void;
package/package.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "@absolutejs/auth": "0.75.0",
11
11
  "@absolutejs/devices": "0.7.0",
12
12
  "@absolutejs/devices-capacitor": "0.8.0",
13
+ "@absolutejs/devices-expo": "0.0.2",
13
14
  "@absolutejs/http": "0.0.1",
14
15
  "@absolutejs/pwa": "0.14.0",
15
16
  "@capacitor/browser": "8.0.4",
@@ -507,7 +508,7 @@
507
508
  ]
508
509
  }
509
510
  },
510
- "version": "0.20.0-beta.45",
511
+ "version": "0.20.0-beta.46",
511
512
  "workspaces": [
512
513
  "tests/fixtures/*",
513
514
  "tests/fixtures/_packages/*"