react-native-minimal-webview 1.2.1 → 1.3.1

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.
Files changed (96) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/expo/modules/minimalwebview/Asks.kt +5 -11
  3. package/android/src/main/java/expo/modules/minimalwebview/Hooks.kt +17 -11
  4. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebView.kt +67 -120
  5. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewClients.kt +23 -32
  6. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewModule.kt +8 -18
  7. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewNavigation.kt +30 -49
  8. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewScripts.kt +48 -36
  9. package/android/src/main/java/expo/modules/minimalwebview/NavigationRules.kt +19 -20
  10. package/android/src/main/java/expo/modules/minimalwebview/PlatformSettings.kt +30 -40
  11. package/android/src/main/java/expo/modules/minimalwebview/PullToRefresh.kt +14 -18
  12. package/android/src/main/java/expo/modules/minimalwebview/requests/Downloads.kt +12 -23
  13. package/android/src/main/java/expo/modules/minimalwebview/requests/FileUpload.kt +0 -1
  14. package/android/src/main/java/expo/modules/minimalwebview/requests/FullscreenVideo.kt +1 -4
  15. package/android/src/main/java/expo/modules/minimalwebview/requests/Permissions.kt +34 -24
  16. package/build/WebView.d.ts +8 -1
  17. package/build/WebView.d.ts.map +1 -1
  18. package/build/WebView.js +30 -80
  19. package/build/WebView.js.map +1 -1
  20. package/build/bridge/createBridge.d.ts +1 -5
  21. package/build/bridge/createBridge.d.ts.map +1 -1
  22. package/build/bridge/createBridge.js +3 -15
  23. package/build/bridge/createBridge.js.map +1 -1
  24. package/build/bridge/endpoint.d.ts +1 -2
  25. package/build/bridge/endpoint.d.ts.map +1 -1
  26. package/build/bridge/endpoint.js +5 -6
  27. package/build/bridge/endpoint.js.map +1 -1
  28. package/build/bridge/matchesOrigin.d.ts +11 -0
  29. package/build/bridge/matchesOrigin.d.ts.map +1 -0
  30. package/build/bridge/matchesOrigin.js +26 -0
  31. package/build/bridge/matchesOrigin.js.map +1 -0
  32. package/build/bridge/origins.d.ts +2 -13
  33. package/build/bridge/origins.d.ts.map +1 -1
  34. package/build/bridge/origins.js +1 -30
  35. package/build/bridge/origins.js.map +1 -1
  36. package/build/bridge/pageClient.generated.d.ts +1 -1
  37. package/build/bridge/pageClient.generated.d.ts.map +1 -1
  38. package/build/bridge/pageClient.generated.js +2 -2
  39. package/build/bridge/pageClient.generated.js.map +1 -1
  40. package/build/bridge/protocol.d.ts +3 -5
  41. package/build/bridge/protocol.d.ts.map +1 -1
  42. package/build/bridge/protocol.js +12 -14
  43. package/build/bridge/protocol.js.map +1 -1
  44. package/build/index.d.ts +1 -1
  45. package/build/index.js +1 -1
  46. package/build/navigationRules.d.ts +0 -5
  47. package/build/navigationRules.d.ts.map +1 -1
  48. package/build/navigationRules.js +3 -12
  49. package/build/navigationRules.js.map +1 -1
  50. package/build/reactNativeWebViewDefaults.d.ts +0 -4
  51. package/build/reactNativeWebViewDefaults.d.ts.map +1 -1
  52. package/build/reactNativeWebViewDefaults.js +0 -4
  53. package/build/reactNativeWebViewDefaults.js.map +1 -1
  54. package/build/reactNativeWebViewMessages.d.ts.map +1 -1
  55. package/build/reactNativeWebViewMessages.js +0 -1
  56. package/build/reactNativeWebViewMessages.js.map +1 -1
  57. package/build/refStore.d.ts +0 -2
  58. package/build/refStore.d.ts.map +1 -1
  59. package/build/refStore.js +0 -6
  60. package/build/refStore.js.map +1 -1
  61. package/build/types.d.ts +33 -16
  62. package/build/types.d.ts.map +1 -1
  63. package/ios/Asks.swift +6 -9
  64. package/ios/DelegateProxy.swift +6 -20
  65. package/ios/DownloadName.swift +0 -2
  66. package/ios/Downloads.swift +0 -2
  67. package/ios/Hooks.swift +6 -7
  68. package/ios/Loads.swift +37 -19
  69. package/ios/MinimalWebView+Dialogs.swift +2 -6
  70. package/ios/MinimalWebView+Navigation.swift +25 -57
  71. package/ios/MinimalWebView+Scripts.swift +4 -16
  72. package/ios/MinimalWebView.podspec +1 -2
  73. package/ios/MinimalWebView.swift +58 -144
  74. package/ios/MinimalWebViewModule.swift +1 -18
  75. package/ios/NavigationRules.swift +2 -9
  76. package/ios/OriginRules.swift +4 -13
  77. package/ios/PlatformSettings.swift +19 -38
  78. package/ios/ReadAccess.swift +0 -2
  79. package/ios/Records.swift +18 -0
  80. package/ios/Recovery.swift +2 -8
  81. package/ios/SharedCookies.swift +10 -25
  82. package/package.json +4 -4
  83. package/src/WebView.tsx +45 -95
  84. package/src/bridge/createBridge.ts +5 -20
  85. package/src/bridge/endpoint.ts +6 -9
  86. package/src/bridge/matchesOrigin.ts +27 -0
  87. package/src/bridge/origins.ts +2 -30
  88. package/src/bridge/pageClient.generated.ts +2 -2
  89. package/src/bridge/pageClient.ts +1 -7
  90. package/src/bridge/protocol.ts +16 -18
  91. package/src/index.ts +1 -1
  92. package/src/navigationRules.ts +6 -12
  93. package/src/reactNativeWebViewDefaults.ts +0 -4
  94. package/src/reactNativeWebViewMessages.ts +0 -1
  95. package/src/refStore.ts +0 -7
  96. package/src/types.ts +33 -16
@@ -1,25 +1,14 @@
1
+ import type { OriginForms } from './matchesOrigin';
1
2
  /**
2
3
  * An origin rule (`http(s)://host[:port]`, `http(s)://*.host[:port]`) or a `location.origin`, parsed; null for anything
3
- * else, `*` included. OriginRules.swift matches the same way: both run src/__tests__/vectors/origin-rules.json.
4
+ * else, `*` included.
4
5
  */
5
6
  export declare const parseOrigin: (text: string) => {
6
7
  scheme: string;
7
8
  wildcard: boolean;
8
9
  hostPort: string;
9
10
  } | null;
10
- /** Origin rules in `location.origin` form, for `matchesOrigin`: exact origins, and wildcards as prefix and suffix. */
11
- export type OriginForms = {
12
- any: boolean;
13
- exact: string[];
14
- wild: [string, string][];
15
- };
16
- /** `rules` in the form `matchesOrigin` compares; a rule `parseOrigin` rejects is left out, so it matches nothing. */
17
11
  export declare const originForms: (rules: string[]) => OriginForms;
18
- /**
19
- * Whether `origin`, as `location.origin` serializes it, matches `forms`. Only `===`, indexing and `length`, no
20
- * built-in method: it runs at document start in frames whose built-ins another same-origin frame may have patched.
21
- */
22
- export declare function matchesOrigin(forms: OriginForms, origin: string): boolean;
23
12
  /**
24
13
  * A page-side expression true where `location.origin` matches `origins`, or null when they include `*`. Throws an
25
14
  * `Error` starting with `what` for a rule that is neither `*` nor what `parseOrigin` takes.
@@ -1 +1 @@
1
- {"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../src/bridge/origins.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM;;;;QAWvC,CAAC;AAEF,sHAAsH;AACtH,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAAE,CAAC;AAEtF,qHAAqH;AACrH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,KAAG,WAS7C,CAAC;AAOF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAY/D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAS1E"}
1
+ {"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../src/bridge/origins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM;;;;QAWvC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,KAAG,WAS7C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAS1E"}
@@ -1,9 +1,7 @@
1
- // The origin rules in RN: parser, the guard that createBridge and injectedScripts put around page code, and the
2
- // matcher whose text build-page-client.mts cuts out as MATCHES_ORIGIN for that guard.
3
1
  import { MATCHES_ORIGIN } from './pageClient.generated';
4
2
  /**
5
3
  * An origin rule (`http(s)://host[:port]`, `http(s)://*.host[:port]`) or a `location.origin`, parsed; null for anything
6
- * else, `*` included. OriginRules.swift matches the same way: both run src/__tests__/vectors/origin-rules.json.
4
+ * else, `*` included.
7
5
  */
8
6
  export const parseOrigin = (text) => {
9
7
  const m = /^(https?):\/\/(\*\.(?!\[))?([a-z0-9_-]+(?:\.[a-z0-9_-]+)*|\[[0-9a-f:.]+\])(?::(\d{1,5}))?$/.exec(text.toLowerCase());
@@ -15,7 +13,6 @@ export const parseOrigin = (text) => {
15
13
  const portSuffix = isDefaultPort ? '' : `:${+port}`;
16
14
  return { scheme, wildcard: !!wildcard, hostPort: `${host}${portSuffix}` };
17
15
  };
18
- /** `rules` in the form `matchesOrigin` compares; a rule `parseOrigin` rejects is left out, so it matches nothing. */
19
16
  export const originForms = (rules) => {
20
17
  const forms = { any: rules.includes('*'), exact: [], wild: [] };
21
18
  for (const rule of rules) {
@@ -29,32 +26,6 @@ export const originForms = (rules) => {
29
26
  }
30
27
  return forms;
31
28
  };
32
- function hasAt(text, part, at) {
33
- for (let k = 0; k < part.length; k++)
34
- if (text[at + k] !== part[k])
35
- return false;
36
- return true;
37
- }
38
- /**
39
- * Whether `origin`, as `location.origin` serializes it, matches `forms`. Only `===`, indexing and `length`, no
40
- * built-in method: it runs at document start in frames whose built-ins another same-origin frame may have patched.
41
- */
42
- export function matchesOrigin(forms, origin) {
43
- if (forms.any)
44
- return true;
45
- for (let i = 0; i < forms.exact.length; i++)
46
- if (forms.exact[i] === origin)
47
- return true;
48
- for (let i = 0; i < forms.wild.length; i++) {
49
- const prefix = forms.wild[i][0];
50
- const suffix = forms.wild[i][1];
51
- const start = origin.length - suffix.length;
52
- // At least one character of subdomain between the two.
53
- if (start > prefix.length && hasAt(origin, prefix, 0) && hasAt(origin, suffix, start))
54
- return true;
55
- }
56
- return false;
57
- }
58
29
  /**
59
30
  * A page-side expression true where `location.origin` matches `origins`, or null when they include `*`. Throws an
60
31
  * `Error` starting with `what` for a rule that is neither `*` nor what `parseOrigin` takes.
@@ -1 +1 @@
1
- {"version":3,"file":"origins.js","sourceRoot":"","sources":["../../src/bridge/origins.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,sFAAsF;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IAC1C,MAAM,CAAC,GACL,4FAA4F,CAAC,IAAI,CAC/F,IAAI,CAAC,WAAW,EAAE,CACnB,CAAC;IACJ,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,0DAA0D;IAC1D,MAAM,aAAa,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtF,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAK,EAAE,CAAC;IACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,UAAU,EAAE,EAAE,CAAC;AAC5E,CAAC,CAAC;AAKF,qHAAqH;AACrH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAe,EAAe,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CAAC,CAAC;;YACjE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAiB;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7E,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,8DAA8D,CACjG,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC;AAC7F,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const PAGE_CLIENT = "function (w, timeoutMs) {\nconst codedError = ({ code, message }) => Object.assign(new Error(message), { code });\nfunction createEndpoint(send, timeoutMs, idPrefix) {\n const handlers = new Map();\n const listeners = new Map();\n const pending = new Map();\n let nextId = 0;\n return {\n pending,\n call(method, params, options) {\n const ms = options?.timeoutMs ?? timeoutMs;\n if (!(ms >= 0))\n return Promise.reject(new RangeError(`${method}: timeoutMs must be 0 or more, not ${ms}`));\n const id = `${idPrefix}${++nextId}`;\n return new Promise((resolve, reject) => {\n const timer = ms > 0 && ms < Infinity\n ? setTimeout(() => {\n pending.delete(id);\n reject(codedError({ code: 'timeout', message: `${method} timed out after ${ms} ms` }));\n }, Math.min(ms, 2 ** 31 - 1))\n : undefined;\n pending.set(id, { resolve, reject, timer });\n try {\n send({ id, kind: 'call', method, params });\n }\n catch (error) {\n clearTimeout(timer);\n pending.delete(id);\n throw error;\n }\n });\n },\n emit(event, payload) {\n send({ kind: 'event', method: event, params: payload });\n },\n handle(method, handler) {\n handlers.set(method, handler);\n return () => {\n if (handlers.get(method) === handler)\n handlers.delete(method);\n };\n },\n on(event, listener) {\n const set = listeners.get(event) ?? new Set();\n listeners.set(event, set.add(listener));\n return () => set.delete(listener);\n },\n rejectPending(code, message, only) {\n for (const [id, call] of pending) {\n if (only && !only(id))\n continue;\n clearTimeout(call.timer);\n call.reject(codedError({ code, message }));\n pending.delete(id);\n }\n },\n async receive(message, reply, sender) {\n switch (message.kind) {\n case 'call': {\n const { id, method } = message;\n const fail = (code, text) => reply({ id, kind: 'error', error: { code, message: text } });\n const handler = handlers.get(method);\n if (!handler)\n return fail('not_found', `no handler for ${method}`);\n try {\n reply({ id, kind: 'result', value: await handler(message.params, sender) });\n }\n catch (error) {\n fail('handler_error', error instanceof Error ? error.message : String(error));\n }\n return;\n }\n case 'event':\n listeners.get(message.method)?.forEach((listener) => {\n try {\n listener(message.params, sender);\n }\n catch (error) {\n void Promise.reject(error);\n }\n });\n return;\n case 'result':\n case 'error': {\n const call = pending.get(message.id);\n if (!call)\n return;\n pending.delete(message.id);\n clearTimeout(call.timer);\n if (message.kind === 'result')\n call.resolve(message.value);\n else\n call.reject(codedError(message.error));\n }\n }\n },\n };\n}\nfunction installPageClient(w, timeoutMs) {\n if (w.nativeBridge || w !== w.top)\n return;\n const doc = Math.random().toString(36).slice(2, 10);\n const ios = w.webkit?.messageHandlers?.nativeBridge;\n const android = w.nativeBridgeTransport;\n const send = (message) => {\n const text = JSON.stringify({ ...message, doc });\n (ios ?? android)?.postMessage(text);\n };\n const endpoint = createEndpoint(send, timeoutMs, 'p');\n const receive = async (text) => {\n const message = JSON.parse(text);\n if (message.doc === doc)\n await endpoint.receive(message, send);\n };\n if (android)\n android.onmessage = (event) => void receive(event.data);\n w.nativeBridge = Object.freeze({\n call: endpoint.call,\n emit: endpoint.emit,\n handle: endpoint.handle,\n on: endpoint.on,\n __receive: receive,\n });\n if (w.document.readyState === 'loading') {\n w.document.addEventListener('DOMContentLoaded', () => send({ kind: 'ready' }), {\n once: true,\n });\n }\n else {\n send({ kind: 'ready' });\n }\n w.addEventListener('pageshow', (event) => {\n if (!event.persisted)\n return;\n endpoint.rejectPending('navigated', 'the page was left before the call was answered');\n send({ kind: 'ready' });\n });\n}\nreturn installPageClient(w, timeoutMs);\n}";
1
+ export declare const PAGE_CLIENT = "function (w, timeoutMs) {\nconst codedError = ({ code, message }) => Object.assign(new Error(message), { code });\nconst reportUnhandled = (error) => void Promise.reject(error);\nfunction createEndpoint(send, timeoutMs, idPrefix) {\n const handlers = new Map();\n const listeners = new Map();\n const pending = new Map();\n let nextId = 0;\n return {\n pending,\n call(method, params, options) {\n const ms = options?.timeoutMs ?? timeoutMs;\n if (!(ms >= 0))\n return Promise.reject(new RangeError(`${method}: timeoutMs must be 0 or more, not ${ms}`));\n const id = `${idPrefix}${++nextId}`;\n return new Promise((resolve, reject) => {\n const timer = ms > 0 && ms < Infinity\n ? setTimeout(() => {\n pending.delete(id);\n reject(codedError({ code: 'timeout', message: `${method} timed out after ${ms} ms` }));\n }, Math.min(ms, 2 ** 31 - 1))\n : undefined;\n pending.set(id, { resolve, reject, timer });\n try {\n send({ id, kind: 'call', method, params });\n }\n catch (error) {\n clearTimeout(timer);\n pending.delete(id);\n throw error;\n }\n });\n },\n emit(event, payload) {\n send({ kind: 'event', event, params: payload });\n },\n handle(method, handler) {\n handlers.set(method, handler);\n return () => {\n if (handlers.get(method) === handler)\n handlers.delete(method);\n };\n },\n on(event, listener) {\n const set = listeners.get(event) ?? new Set();\n listeners.set(event, set.add(listener));\n return () => set.delete(listener);\n },\n rejectPending(code, message, only) {\n for (const [id, call] of pending) {\n if (only && !only(id))\n continue;\n clearTimeout(call.timer);\n call.reject(codedError({ code, message }));\n pending.delete(id);\n }\n },\n async receive(message, reply, sender) {\n switch (message.kind) {\n case 'call': {\n const { id, method } = message;\n const fail = (code, text) => reply({ id, kind: 'error', error: { code, message: text } });\n const handler = handlers.get(method);\n if (!handler)\n return fail('not_found', `no handler for ${method}`);\n try {\n reply({ id, kind: 'result', value: await handler(message.params, sender) });\n }\n catch (error) {\n fail('handler_error', error instanceof Error ? error.message : String(error));\n }\n return;\n }\n case 'event':\n listeners.get(message.event)?.forEach((listener) => {\n try {\n listener(message.params, sender);\n }\n catch (error) {\n reportUnhandled(error);\n }\n });\n return;\n case 'result':\n case 'error': {\n const call = pending.get(message.id);\n if (!call)\n return;\n pending.delete(message.id);\n clearTimeout(call.timer);\n if (message.kind === 'result')\n call.resolve(message.value);\n else\n call.reject(codedError(message.error));\n }\n }\n },\n };\n}\nfunction installPageClient(w, timeoutMs) {\n if (w.nativeBridge || w !== w.top)\n return;\n const doc = Math.random().toString(36).slice(2, 10);\n const ios = w.webkit?.messageHandlers?.nativeBridge;\n const android = w.nativeBridgeTransport;\n const send = (message) => {\n const text = JSON.stringify({ ...message, doc });\n (ios ?? android)?.postMessage(text);\n };\n const endpoint = createEndpoint(send, timeoutMs, 'p');\n const receive = async (text) => {\n const message = JSON.parse(text);\n if (message.doc === doc)\n await endpoint.receive(message, send);\n };\n if (android)\n android.onmessage = (event) => void receive(event.data);\n w.nativeBridge = Object.freeze({\n call: endpoint.call,\n emit: endpoint.emit,\n handle: endpoint.handle,\n on: endpoint.on,\n __receive: receive,\n });\n if (w.document.readyState === 'loading') {\n w.document.addEventListener('DOMContentLoaded', () => send({ kind: 'ready' }), {\n once: true,\n });\n }\n else {\n send({ kind: 'ready' });\n }\n w.addEventListener('pageshow', (event) => {\n if (!event.persisted)\n return;\n endpoint.rejectPending('navigated', 'the page was left before the call was answered');\n send({ kind: 'ready' });\n });\n}\nreturn installPageClient(w, timeoutMs);\n}";
2
2
  export declare const MATCHES_ORIGIN = "(() => {\nfunction hasAt(text, part, at) {\n for (let k = 0; k < part.length; k++)\n if (text[at + k] !== part[k])\n return false;\n return true;\n}\nfunction matchesOrigin(forms, origin) {\n if (forms.any)\n return true;\n for (let i = 0; i < forms.exact.length; i++)\n if (forms.exact[i] === origin)\n return true;\n for (let i = 0; i < forms.wild.length; i++) {\n const prefix = forms.wild[i][0];\n const suffix = forms.wild[i][1];\n const start = origin.length - suffix.length;\n if (start > prefix.length && hasAt(origin, prefix, 0) && hasAt(origin, suffix, start))\n return true;\n }\n return false;\n}\nreturn matchesOrigin;\n})()";
3
3
  //# sourceMappingURL=pageClient.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageClient.generated.d.ts","sourceRoot":"","sources":["../../src/bridge/pageClient.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,m2KAC00K,CAAC;AACn2K,eAAO,MAAM,cAAc,yuBAC6sB,CAAC"}
1
+ {"version":3,"file":"pageClient.generated.d.ts","sourceRoot":"","sources":["../../src/bridge/pageClient.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,s5KAC63K,CAAC;AACt5K,eAAO,MAAM,cAAc,yuBAC6sB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Generated by .github/scripts/build-page-client.mts from pageClient.ts, endpoint.ts and origins.ts. Do not edit.
2
- export const PAGE_CLIENT = "function (w, timeoutMs) {\nconst codedError = ({ code, message }) => Object.assign(new Error(message), { code });\nfunction createEndpoint(send, timeoutMs, idPrefix) {\n const handlers = new Map();\n const listeners = new Map();\n const pending = new Map();\n let nextId = 0;\n return {\n pending,\n call(method, params, options) {\n const ms = options?.timeoutMs ?? timeoutMs;\n if (!(ms >= 0))\n return Promise.reject(new RangeError(`${method}: timeoutMs must be 0 or more, not ${ms}`));\n const id = `${idPrefix}${++nextId}`;\n return new Promise((resolve, reject) => {\n const timer = ms > 0 && ms < Infinity\n ? setTimeout(() => {\n pending.delete(id);\n reject(codedError({ code: 'timeout', message: `${method} timed out after ${ms} ms` }));\n }, Math.min(ms, 2 ** 31 - 1))\n : undefined;\n pending.set(id, { resolve, reject, timer });\n try {\n send({ id, kind: 'call', method, params });\n }\n catch (error) {\n clearTimeout(timer);\n pending.delete(id);\n throw error;\n }\n });\n },\n emit(event, payload) {\n send({ kind: 'event', method: event, params: payload });\n },\n handle(method, handler) {\n handlers.set(method, handler);\n return () => {\n if (handlers.get(method) === handler)\n handlers.delete(method);\n };\n },\n on(event, listener) {\n const set = listeners.get(event) ?? new Set();\n listeners.set(event, set.add(listener));\n return () => set.delete(listener);\n },\n rejectPending(code, message, only) {\n for (const [id, call] of pending) {\n if (only && !only(id))\n continue;\n clearTimeout(call.timer);\n call.reject(codedError({ code, message }));\n pending.delete(id);\n }\n },\n async receive(message, reply, sender) {\n switch (message.kind) {\n case 'call': {\n const { id, method } = message;\n const fail = (code, text) => reply({ id, kind: 'error', error: { code, message: text } });\n const handler = handlers.get(method);\n if (!handler)\n return fail('not_found', `no handler for ${method}`);\n try {\n reply({ id, kind: 'result', value: await handler(message.params, sender) });\n }\n catch (error) {\n fail('handler_error', error instanceof Error ? error.message : String(error));\n }\n return;\n }\n case 'event':\n listeners.get(message.method)?.forEach((listener) => {\n try {\n listener(message.params, sender);\n }\n catch (error) {\n void Promise.reject(error);\n }\n });\n return;\n case 'result':\n case 'error': {\n const call = pending.get(message.id);\n if (!call)\n return;\n pending.delete(message.id);\n clearTimeout(call.timer);\n if (message.kind === 'result')\n call.resolve(message.value);\n else\n call.reject(codedError(message.error));\n }\n }\n },\n };\n}\nfunction installPageClient(w, timeoutMs) {\n if (w.nativeBridge || w !== w.top)\n return;\n const doc = Math.random().toString(36).slice(2, 10);\n const ios = w.webkit?.messageHandlers?.nativeBridge;\n const android = w.nativeBridgeTransport;\n const send = (message) => {\n const text = JSON.stringify({ ...message, doc });\n (ios ?? android)?.postMessage(text);\n };\n const endpoint = createEndpoint(send, timeoutMs, 'p');\n const receive = async (text) => {\n const message = JSON.parse(text);\n if (message.doc === doc)\n await endpoint.receive(message, send);\n };\n if (android)\n android.onmessage = (event) => void receive(event.data);\n w.nativeBridge = Object.freeze({\n call: endpoint.call,\n emit: endpoint.emit,\n handle: endpoint.handle,\n on: endpoint.on,\n __receive: receive,\n });\n if (w.document.readyState === 'loading') {\n w.document.addEventListener('DOMContentLoaded', () => send({ kind: 'ready' }), {\n once: true,\n });\n }\n else {\n send({ kind: 'ready' });\n }\n w.addEventListener('pageshow', (event) => {\n if (!event.persisted)\n return;\n endpoint.rejectPending('navigated', 'the page was left before the call was answered');\n send({ kind: 'ready' });\n });\n}\nreturn installPageClient(w, timeoutMs);\n}";
1
+ // Generated by .github/scripts/build-page-client.mts from pageClient.ts, endpoint.ts and matchesOrigin.ts. Do not edit.
2
+ export const PAGE_CLIENT = "function (w, timeoutMs) {\nconst codedError = ({ code, message }) => Object.assign(new Error(message), { code });\nconst reportUnhandled = (error) => void Promise.reject(error);\nfunction createEndpoint(send, timeoutMs, idPrefix) {\n const handlers = new Map();\n const listeners = new Map();\n const pending = new Map();\n let nextId = 0;\n return {\n pending,\n call(method, params, options) {\n const ms = options?.timeoutMs ?? timeoutMs;\n if (!(ms >= 0))\n return Promise.reject(new RangeError(`${method}: timeoutMs must be 0 or more, not ${ms}`));\n const id = `${idPrefix}${++nextId}`;\n return new Promise((resolve, reject) => {\n const timer = ms > 0 && ms < Infinity\n ? setTimeout(() => {\n pending.delete(id);\n reject(codedError({ code: 'timeout', message: `${method} timed out after ${ms} ms` }));\n }, Math.min(ms, 2 ** 31 - 1))\n : undefined;\n pending.set(id, { resolve, reject, timer });\n try {\n send({ id, kind: 'call', method, params });\n }\n catch (error) {\n clearTimeout(timer);\n pending.delete(id);\n throw error;\n }\n });\n },\n emit(event, payload) {\n send({ kind: 'event', event, params: payload });\n },\n handle(method, handler) {\n handlers.set(method, handler);\n return () => {\n if (handlers.get(method) === handler)\n handlers.delete(method);\n };\n },\n on(event, listener) {\n const set = listeners.get(event) ?? new Set();\n listeners.set(event, set.add(listener));\n return () => set.delete(listener);\n },\n rejectPending(code, message, only) {\n for (const [id, call] of pending) {\n if (only && !only(id))\n continue;\n clearTimeout(call.timer);\n call.reject(codedError({ code, message }));\n pending.delete(id);\n }\n },\n async receive(message, reply, sender) {\n switch (message.kind) {\n case 'call': {\n const { id, method } = message;\n const fail = (code, text) => reply({ id, kind: 'error', error: { code, message: text } });\n const handler = handlers.get(method);\n if (!handler)\n return fail('not_found', `no handler for ${method}`);\n try {\n reply({ id, kind: 'result', value: await handler(message.params, sender) });\n }\n catch (error) {\n fail('handler_error', error instanceof Error ? error.message : String(error));\n }\n return;\n }\n case 'event':\n listeners.get(message.event)?.forEach((listener) => {\n try {\n listener(message.params, sender);\n }\n catch (error) {\n reportUnhandled(error);\n }\n });\n return;\n case 'result':\n case 'error': {\n const call = pending.get(message.id);\n if (!call)\n return;\n pending.delete(message.id);\n clearTimeout(call.timer);\n if (message.kind === 'result')\n call.resolve(message.value);\n else\n call.reject(codedError(message.error));\n }\n }\n },\n };\n}\nfunction installPageClient(w, timeoutMs) {\n if (w.nativeBridge || w !== w.top)\n return;\n const doc = Math.random().toString(36).slice(2, 10);\n const ios = w.webkit?.messageHandlers?.nativeBridge;\n const android = w.nativeBridgeTransport;\n const send = (message) => {\n const text = JSON.stringify({ ...message, doc });\n (ios ?? android)?.postMessage(text);\n };\n const endpoint = createEndpoint(send, timeoutMs, 'p');\n const receive = async (text) => {\n const message = JSON.parse(text);\n if (message.doc === doc)\n await endpoint.receive(message, send);\n };\n if (android)\n android.onmessage = (event) => void receive(event.data);\n w.nativeBridge = Object.freeze({\n call: endpoint.call,\n emit: endpoint.emit,\n handle: endpoint.handle,\n on: endpoint.on,\n __receive: receive,\n });\n if (w.document.readyState === 'loading') {\n w.document.addEventListener('DOMContentLoaded', () => send({ kind: 'ready' }), {\n once: true,\n });\n }\n else {\n send({ kind: 'ready' });\n }\n w.addEventListener('pageshow', (event) => {\n if (!event.persisted)\n return;\n endpoint.rejectPending('navigated', 'the page was left before the call was answered');\n send({ kind: 'ready' });\n });\n}\nreturn installPageClient(w, timeoutMs);\n}";
3
3
  export const MATCHES_ORIGIN = "(() => {\nfunction hasAt(text, part, at) {\n for (let k = 0; k < part.length; k++)\n if (text[at + k] !== part[k])\n return false;\n return true;\n}\nfunction matchesOrigin(forms, origin) {\n if (forms.any)\n return true;\n for (let i = 0; i < forms.exact.length; i++)\n if (forms.exact[i] === origin)\n return true;\n for (let i = 0; i < forms.wild.length; i++) {\n const prefix = forms.wild[i][0];\n const suffix = forms.wild[i][1];\n const start = origin.length - suffix.length;\n if (start > prefix.length && hasAt(origin, prefix, 0) && hasAt(origin, suffix, start))\n return true;\n }\n return false;\n}\nreturn matchesOrigin;\n})()";
4
4
  //# sourceMappingURL=pageClient.generated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageClient.generated.js","sourceRoot":"","sources":["../../src/bridge/pageClient.generated.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,MAAM,CAAC,MAAM,WAAW,GACtB,g2KAAg2K,CAAC;AACn2K,MAAM,CAAC,MAAM,cAAc,GACzB,suBAAsuB,CAAC"}
1
+ {"version":3,"file":"pageClient.generated.js","sourceRoot":"","sources":["../../src/bridge/pageClient.generated.ts"],"names":[],"mappings":"AAAA,wHAAwH;AACxH,MAAM,CAAC,MAAM,WAAW,GACtB,m5KAAm5K,CAAC;AACt5K,MAAM,CAAC,MAAM,cAAc,GACzB,suBAAsuB,CAAC"}
@@ -1,4 +1,3 @@
1
- /** The codes a bridge call rejects with: the page may send only these. */
2
1
  declare const ERROR_CODES: readonly ["timeout", "not_found", "handler_error", "navigated", "unavailable"];
3
2
  export type BridgeErrorCode = (typeof ERROR_CODES)[number];
4
3
  /**
@@ -6,13 +5,12 @@ export type BridgeErrorCode = (typeof ERROR_CODES)[number];
6
5
  * events for the page until then (native can't deliver before the page has posted). A page's own calls and their
7
6
  * answers don't wait for it.
8
7
  * `call` / `result` / `error`: a request and its answer, matched by `id`.
9
- * `event`: fire-and-forget, `method` is the event name.
8
+ * `event`: fire-and-forget.
10
9
  *
11
10
  * `doc` is the page document's random token. Each side puts a token on every message (RN the token of the document it
12
11
  * means), and the page drops any message that isn't for it: native delivers to whatever document is current (iOS
13
12
  * checks only the origin), so a message posted as a same-origin navigation commits would otherwise reach the new page.
14
- * It is for correctness, not security: an allowed page can rebind its own client. Messages are built without it;
15
- * `send` adds it.
13
+ * It is for correctness, not security: an allowed page can rebind its own client.
16
14
  */
17
15
  export type BridgeMessage = {
18
16
  doc?: string;
@@ -36,7 +34,7 @@ export type BridgeMessage = {
36
34
  };
37
35
  } | {
38
36
  kind: 'event';
39
- method: string;
37
+ event: string;
40
38
  params?: unknown;
41
39
  });
42
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/bridge/protocol.ts"],"names":[],"mappings":"AAGA,0EAA0E;AAC1E,QAAA,MAAM,WAAW,gFAMwB,CAAC;AAC1C,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,CAC3C;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAChF;IAAE,IAAI,EAAE,OAAO,C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AC,GAAG,MAAM,CAc1F"}
@@ -1,4 +1,3 @@
1
- /** The codes a bridge call rejects with: the page may send only these. */
2
1
  const ERROR_CODES = [
3
2
  'timeout',
4
3
  'not_found',
@@ -21,32 +20,31 @@ export function parseBridgeMessage(raw) {
21
20
  }
22
21
  if (!isObject(value) || typeof value['doc'] !== 'string')
23
22
  return 'missing doc';
24
- return kindProblem(value) ?? value;
23
+ const problem = kindProblem(value);
24
+ if (problem)
25
+ return problem;
26
+ const message = value;
27
+ return message.kind === 'error' && !ERROR_CODES.includes(message.error.code)
28
+ ? { ...message, error: { ...message.error, code: 'handler_error' } }
29
+ : message;
25
30
  }
31
+ const isName = (value) => typeof value === 'string' && value !== '';
26
32
  function kindProblem(value) {
27
33
  const hasId = typeof value['id'] === 'string';
28
- const hasMethod = typeof value['method'] === 'string' && value['method'] !== '';
29
34
  switch (value['kind']) {
30
35
  case 'ready':
31
36
  return null;
32
37
  case 'event':
33
- return hasMethod ? null : 'missing method';
38
+ return isName(value['event']) ? null : 'missing event';
34
39
  case 'call':
35
- return hasId && hasMethod ? null : 'missing id or method';
40
+ return hasId && isName(value['method']) ? null : 'missing id or method';
36
41
  case 'result':
37
42
  return hasId ? null : 'missing id';
38
43
  case 'error':
39
- return !hasId ? 'missing id' : normalizeError(value['error']) ? null : 'malformed error';
44
+ return !hasId ? 'missing id' : isError(value['error']) ? null : 'malformed error';
40
45
  default:
41
46
  return 'unknown kind';
42
47
  }
43
48
  }
44
- /** Whether `error` is `{ code, message }`, both strings; an unlisted code is replaced in place. */
45
- function normalizeError(error) {
46
- if (!isObject(error) || typeof error['code'] !== 'string' || typeof error['message'] !== 'string')
47
- return false;
48
- if (!ERROR_CODES.includes(error['code']))
49
- error['code'] = 'handler_error';
50
- return true;
51
- }
49
+ const isError = (error) => isObject(error) && typeof error['code'] === 'string' && typeof error['message'] === 'string';
52
50
  //# sourceMappingURL=protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["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AAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACpF;YACE,OAAO,cAAc,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACjC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC"}
package/build/index.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * @groupDescription Page requests
15
15
  * File pickers, permission prompts and downloads the page starts.
16
16
  * @groupDescription Native hooks
17
- * Turning native hooks on with the `extensions` prop, and what they send to each extension's `onEvent`.
17
+ * Turning native hooks on with the `extensions` prop, and what they send to each extension's `onEvent` and `onAsk`.
18
18
  * @groupDescription Platform settings
19
19
  * WebKit, UIScrollView and Android WebView settings, set by their platform names through the `ios` and `android` props.
20
20
  * @module react-native-minimal-webview
package/build/index.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * @groupDescription Page requests
15
15
  * File pickers, permission prompts and downloads the page starts.
16
16
  * @groupDescription Native hooks
17
- * Turning native hooks on with the `extensions` prop, and what they send to each extension's `onEvent`.
17
+ * Turning native hooks on with the `extensions` prop, and what they send to each extension's `onEvent` and `onAsk`.
18
18
  * @groupDescription Platform settings
19
19
  * WebKit, UIScrollView and Android WebView settings, set by their platform names through the `ios` and `android` props.
20
20
  * @module react-native-minimal-webview
@@ -12,11 +12,6 @@ import type { NavigationRule } from './types';
12
12
  * @group Navigation
13
13
  */
14
14
  export declare const defaultNavigationRules: readonly NavigationRule[];
15
- /**
16
- * The rules as the core gets them, and a warning for each malformed one. The core skips an unknown key and a
17
- * non-boolean flag, which would widen a rule (`hosts` would match every host), so a malformed rule becomes a `block`
18
- * one. The same array when none is malformed.
19
- */
20
15
  export declare function checkNavigationRules(given: unknown): {
21
16
  checked: NavigationRule[];
22
17
  warnings: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"navigationRules.d.ts","sourceRoot":"","sources":["../src/navigationRules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAO9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,cAAc,EAI1D,CAAC;AA6DH;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG;IACpD,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAkBA"}
1
+ {"version":3,"file":"navigationRules.d.ts","sourceRoot":"","sources":["../src/navigationRules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAO9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,cAAc,EAI1D,CAAC;AA4DH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG;IACpD,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAkBA"}
@@ -19,7 +19,6 @@ export const defaultNavigationRules = freeze([
19
19
  { scheme: ['http', 'https'], action: 'allow' },
20
20
  { mainFrame: true, userInitiated: true, action: 'external' },
21
21
  ]);
22
- /** Each rule field's kind, from its type, so that a field missing here, or not in the type, fails to compile. */
23
22
  const RULE_FIELDS = new Map(Object.entries({
24
23
  scheme: 'list',
25
24
  host: 'list',
@@ -36,17 +35,14 @@ const ACTIONS = Object.keys({
36
35
  external: 0,
37
36
  ask: 0,
38
37
  });
39
- /** A value as a warning shows it. */
40
38
  const shown = (value) => {
41
39
  try {
42
40
  return JSON.stringify(value) ?? String(value);
43
41
  }
44
42
  catch {
45
- // A BigInt, a circular value or a throwing toJSON: the message runs in production too, so it must not throw.
46
43
  return typeof value === 'bigint' ? String(value) : Object.prototype.toString.call(value);
47
44
  }
48
45
  };
49
- /** What a field of each kind takes, as a warning says it, and the check. */
50
46
  const FIELD_KINDS = {
51
47
  list: {
52
48
  takes: 'an array of strings',
@@ -55,24 +51,19 @@ const FIELD_KINDS = {
55
51
  flag: { takes: 'true or false', ok: (value) => typeof value === 'boolean' },
56
52
  action: { takes: `one of ${shown(ACTIONS)}`, ok: (value) => ACTIONS.includes(value) },
57
53
  };
54
+ const REQUIRED_FIELDS_UNSET = { action: undefined };
58
55
  function ruleProblem(rule) {
59
56
  if (typeof rule !== 'object' || rule === null)
60
57
  return `must be an object, not ${shown(rule)}`;
61
- // A missing action is checked as an undefined one; any other field may be undefined (unset).
62
- for (const [key, value] of Object.entries({ action: undefined, ...rule })) {
58
+ for (const [key, value] of Object.entries({ ...REQUIRED_FIELDS_UNSET, ...rule })) {
63
59
  const kind = RULE_FIELDS.get(key);
64
60
  if (!kind)
65
61
  return `unknown key ${shown(key)}`;
66
- if ((value !== undefined || kind === 'action') && !FIELD_KINDS[kind].ok(value))
62
+ if ((value !== undefined || key in REQUIRED_FIELDS_UNSET) && !FIELD_KINDS[kind].ok(value))
67
63
  return `${key} must be ${FIELD_KINDS[kind].takes}, not ${shown(value)}`;
68
64
  }
69
65
  return undefined;
70
66
  }
71
- /**
72
- * The rules as the core gets them, and a warning for each malformed one. The core skips an unknown key and a
73
- * non-boolean flag, which would widen a rule (`hosts` would match every host), so a malformed rule becomes a `block`
74
- * one. The same array when none is malformed.
75
- */
76
67
  export function checkNavigationRules(given) {
77
68
  if (!Array.isArray(given))
78
69
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"navigationRules.js","sourceRoot":"","sources":["../src/navigationRules.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,CAAmB,KAAQ,EAAK,EAAE;IAC/C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAe,CAAC,CAAC,CAAC;IA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AAI,CAAC,CAAC,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAIjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACvB,OAAO;YACL,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,CAAC,0CAA0C,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACpF,CAAC;IACJ,6FAA6F;IAC7F,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAChD,OAAO;QACL,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAa,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACrF,CAAC,CAAC,KAAK,CAAqB;QAC9B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CACxC,OAAO;YACL,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,OAAO,8CAA8C,CAAC;YACnF,CAAC,CAAC,EAAE,CACP;KACF,CAAC;AACJ,CAAC"}
@@ -1,7 +1,3 @@
1
- /**
2
- * react-native-webview's defaults, so that an app migrated from it behaves as before. An app sets any back through
3
- * `ios` or `android`.
4
- */
5
1
  export declare const REACT_NATIVE_WEBVIEW_DEFAULTS: {
6
2
  ios: {
7
3
  scrollView: {
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeWebViewDefaults.d.ts","sourceRoot":"","sources":["../src/reactNativeWebViewDefaults.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAMgB,CAAC"}
1
+ {"version":3,"file":"reactNativeWebViewDefaults.d.ts","sourceRoot":"","sources":["../src/reactNativeWebViewDefaults.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAMgB,CAAC"}
@@ -1,7 +1,3 @@
1
- /**
2
- * react-native-webview's defaults, so that an app migrated from it behaves as before. An app sets any back through
3
- * `ios` or `android`.
4
- */
5
1
  export const REACT_NATIVE_WEBVIEW_DEFAULTS = {
6
2
  ios: { scrollView: { directionalLockEnabled: true } },
7
3
  android: {
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeWebViewDefaults.js","sourceRoot":"","sources":["../src/reactNativeWebViewDefaults.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,GAAG,EAAE,EAAE,UAAU,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE;IACrD,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC/D,OAAO,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;KAC3C;CACuD,CAAC"}
1
+ {"version":3,"file":"reactNativeWebViewDefaults.js","sourceRoot":"","sources":["../src/reactNativeWebViewDefaults.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,GAAG,EAAE,EAAE,UAAU,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE;IACrD,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC/D,OAAO,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;KAC3C;CACuD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeWebViewMessages.d.ts","sourceRoot":"","sources":["../src/reactNativeWebViewMessages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,EAAE,cAQxC,CAAC"}
1
+ {"version":3,"file":"reactNativeWebViewMessages.d.ts","sourceRoot":"","sources":["../src/reactNativeWebViewMessages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,EAAE,cAOxC,CAAC"}
@@ -13,7 +13,6 @@ import { Platform } from 'react-native';
13
13
  * @group Scripts
14
14
  */
15
15
  export const reactNativeWebViewMessages = {
16
- // Runs after the bridge's own script, so `window.nativeBridge` already exists where the bridge is installed.
17
16
  code: `if (window.nativeBridge) {
18
17
  window.ReactNativeWebView = { postMessage: (data) => window.nativeBridge.emit('rnw', String(data)) };
19
18
  window.nativeBridge.on('rnw', (data) =>
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeWebViewMessages.js","sourceRoot":"","sources":["../src/reactNativeWebViewMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAmB;IACxD,6GAA6G;IAC7G,IAAI,EAAE;;;MAGF,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;EACjD;IACA,OAAO,EAAE,CAAC,GAAG,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"reactNativeWebViewMessages.js","sourceRoot":"","sources":["../src/reactNativeWebViewMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAmB;IACxD,IAAI,EAAE;;;MAGF,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;EACjD;IACA,OAAO,EAAE,CAAC,GAAG,CAAC;CACf,CAAC"}
@@ -8,8 +8,6 @@ import type { NavigationState, WebViewRef, WebViewRefObject } from './types';
8
8
  */
9
9
  export declare function createWebViewRef(): WebViewRefObject;
10
10
  /**
11
- * Attaches `handle` to `ref`. A callback or plain ref gets it through `useImperativeHandle`; a `createWebViewRef` ref
12
- * serves it as its own `current`. Any ref object also gets the navigation state through its adapter.
13
11
  * Returns a function that records a new state, passes it to the attached ref and returns the previous state.
14
12
  */
15
13
  export declare function useAttach(ref: Ref<WebViewRef> | undefined, handle: WebViewRef): (state: NavigationState) => NavigationState;
@@ -1 +1 @@
1
- {"version":3,"file":"refStore.d.ts","sourceRoot":"","sources":["../src/refStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAwE7E;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,CAInD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,SAAS,EAChC,MAAM,EAAE,UAAU,GACjB,CAAC,KAAK,EAAE,eAAe,KAAK,eAAe,CAe7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,eAAe,CAAC;AACpF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EACjC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,CAAC,GACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"refStore.d.ts","sourceRoot":"","sources":["../src/refStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAoE7E;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,CAInD;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,SAAS,EAChC,MAAM,EAAE,UAAU,GACjB,CAAC,KAAK,EAAE,eAAe,KAAK,eAAe,CAe7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,eAAe,CAAC;AACpF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EACjC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,CAAC,GACpC,CAAC,CAAC"}
package/build/refStore.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { useImperativeHandle, useLayoutEffect, useMemo, useRef, useSyncExternalStore, } from 'react';
2
- /** An empty `url`, so a stale URL never looks valid while no WebView is mounted. */
3
2
  const INITIAL_STATE = {
4
3
  url: '',
5
4
  pendingUrl: null,
@@ -10,7 +9,6 @@ const INITIAL_STATE = {
10
9
  canGoForward: false,
11
10
  outcome: null,
12
11
  };
13
- /** The navigation object behind each ref object: created by createWebViewRef, or made on first use for a plain ref. */
14
12
  const adapters = new WeakMap();
15
13
  function adapterFor(ref) {
16
14
  let adapter = adapters.get(ref);
@@ -38,7 +36,6 @@ function createAdapter() {
38
36
  };
39
37
  return {
40
38
  nav,
41
- // Last attached wins, like a React ref; an earlier instance's later updates and detach are ignored.
42
39
  attach(handle, initial) {
43
40
  if (__DEV__ && attached) {
44
41
  console.warn('[react-native-minimal-webview] This ref is already attached to a mounted WebView; the new one replaces it. Give each WebView its own ref.');
@@ -70,8 +67,6 @@ export function createWebViewRef() {
70
67
  return adapter.nav;
71
68
  }
72
69
  /**
73
- * Attaches `handle` to `ref`. A callback or plain ref gets it through `useImperativeHandle`; a `createWebViewRef` ref
74
- * serves it as its own `current`. Any ref object also gets the navigation state through its adapter.
75
70
  * Returns a function that records a new state, passes it to the attached ref and returns the previous state.
76
71
  */
77
72
  export function useAttach(ref, handle) {
@@ -96,7 +91,6 @@ export function useWebViewState(ref, select) {
96
91
  const getSnapshot = useMemo(() => (select ? selectFrom(nav.getState, select) : nav.getState), [nav, select]);
97
92
  return useSyncExternalStore(nav.subscribe, getSnapshot);
98
93
  }
99
- /** `select` of the current state, run again only for another state: a snapshot is the same value until a change. */
100
94
  function selectFrom(getState, select) {
101
95
  let last;
102
96
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"refStore.js","sourceRoot":"","sources":["../src/refStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,MAAM,EACN,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAIf,oFAAoF;AACpF,MAAM,aAAa,GAAoB;IACrC,GAAG,EAAE,EAAE;IACP,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,IAAI;CACd,CAAC;AAUF,uHAAuH;AACvH,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAmB,CAAC;AAEhD,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,OAAO;QAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE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