@unbound-app/api 0.11.0 → 1.1.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 (72) hide show
  1. package/ambient/image-modules.d.ts +58 -0
  2. package/package.json +27 -4
  3. package/src/_internal.d.ts +2775 -139
  4. package/src/{utils.d.ts → _types.d.ts} +10 -0
  5. package/src/assets.d.ts +64 -26
  6. package/src/builtins.d.ts +17 -0
  7. package/src/commands.d.ts +101 -25
  8. package/src/dialogs.d.ts +90 -25
  9. package/src/flux.d.ts +317 -0
  10. package/src/fonts.d.ts +51 -0
  11. package/src/fs.d.ts +15 -24
  12. package/src/global.d.ts +173 -11
  13. package/src/i18n.d.ts +33 -31
  14. package/src/iconPacks.d.ts +43 -0
  15. package/src/index.d.ts +14 -0
  16. package/src/marketplace.d.ts +50 -0
  17. package/src/metro/api.d.ts +8 -0
  18. package/src/metro/common.d.ts +34 -5
  19. package/src/metro/components.d.ts +34 -25
  20. package/src/metro/filters.d.ts +31 -16
  21. package/src/metro/index.d.ts +26079 -83
  22. package/src/metro/stores.d.ts +5 -0
  23. package/src/native.d.ts +77 -5
  24. package/src/patcher.d.ts +214 -57
  25. package/src/plugins.d.ts +55 -0
  26. package/src/settings.d.ts +8 -16
  27. package/src/shims.d.ts +5 -0
  28. package/src/storage.d.ts +80 -224
  29. package/src/sync.d.ts +51 -0
  30. package/src/themes.d.ts +43 -0
  31. package/src/toasts.d.ts +62 -9
  32. package/src/ui.d.ts +650 -0
  33. package/src/updates.d.ts +25 -0
  34. package/src/utils/index.d.ts +53 -0
  35. package/src/utils/react/index.d.ts +82 -0
  36. package/testing/fake-api.ts +256 -0
  37. package/testing/fake-components.ts +183 -0
  38. package/testing/fake-feedback.ts +258 -0
  39. package/testing/fake-fs.ts +54 -0
  40. package/testing/fake-java.ts +513 -0
  41. package/testing/fake-locales.ts +85 -0
  42. package/testing/fake-metro.ts +346 -0
  43. package/testing/fake-native-bridge.ts +98 -0
  44. package/testing/fake-native.ts +211 -0
  45. package/testing/fake-objc.ts +388 -0
  46. package/testing/fake-plugins.ts +176 -0
  47. package/testing/fake-react-native-modules.ts +362 -0
  48. package/testing/fake-react-native.ts +180 -0
  49. package/testing/fake-react.ts +54 -0
  50. package/testing/fake-settings-panel.ts +173 -0
  51. package/testing/fake-settings.ts +428 -0
  52. package/testing/fake-timers.ts +74 -0
  53. package/testing/fake-utils.ts +216 -0
  54. package/testing/icu-format.ts +132 -0
  55. package/testing/icu-parse.ts +277 -0
  56. package/testing/index.ts +42 -0
  57. package/testing/install-addon-globals.ts +260 -0
  58. package/testing/listener-registry.ts +39 -0
  59. package/testing/memory-storage.ts +149 -0
  60. package/testing/plugin-files.ts +155 -0
  61. package/testing/plugin-lifecycle.ts +149 -0
  62. package/testing/plugin-types.ts +34 -0
  63. package/testing/preset.ts +263 -0
  64. package/testing/react-patcher.ts +154 -0
  65. package/testing/react-value.ts +3 -0
  66. package/testing/recorders.ts +183 -0
  67. package/testing/recording-patcher.ts +173 -0
  68. package/testing/render.ts +84 -0
  69. package/testing/session.ts +77 -0
  70. package/testing/test-node.ts +163 -0
  71. package/testing/test-renderer.ts +753 -0
  72. package/testing/unfrozen-elements.ts +49 -0
@@ -0,0 +1,49 @@
1
+ import * as jsxDevRuntime from 'react/jsx-dev-runtime';
2
+ import * as jsxRuntime from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+
5
+ import type { AnyObject } from '../src/patcher';
6
+
7
+ // React freezes each element it creates in development only; on device (production) code may assign to one, as `result.type = ...`.
8
+ function thawed<T>(element: T): T {
9
+ if (typeof element !== 'object' || element === null || !Object.isFrozen(element)) {
10
+ return element;
11
+ }
12
+
13
+ const copy: AnyObject = { ...element };
14
+
15
+ if (typeof copy.props === 'object' && copy.props !== null) {
16
+ copy.props = { ...copy.props };
17
+ }
18
+
19
+ return copy;
20
+ }
21
+
22
+ function thaw<A extends unknown[], R>(create: (...args: A) => R): (...args: A) => R {
23
+ return (...args) => thawed(create(...args));
24
+ }
25
+
26
+ /**
27
+ * @description Builds replacements for the modules that create React elements, whose elements are not frozen, as on device.
28
+ * @returns The replacement modules, by specifier: `react`, `react/jsx-runtime` and `react/jsx-dev-runtime`.
29
+ */
30
+ export function createJsxRuntimes(): Record<string, AnyObject> {
31
+ const react: AnyObject = {
32
+ ...React,
33
+ createElement: thaw(React.createElement),
34
+ cloneElement: thaw(React.cloneElement),
35
+ };
36
+
37
+ return {
38
+ react: { ...react, default: react },
39
+ 'react/jsx-runtime': {
40
+ ...jsxRuntime,
41
+ jsx: thaw(jsxRuntime.jsx),
42
+ jsxs: thaw(jsxRuntime.jsxs),
43
+ },
44
+ 'react/jsx-dev-runtime': {
45
+ ...jsxDevRuntime,
46
+ jsxDEV: thaw(jsxDevRuntime.jsxDEV),
47
+ },
48
+ };
49
+ }