@ng-native/desktop 0.24.0 → 0.26.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/bin/package.mjs +65 -9
- package/bin/prebuilt.mjs +25 -4
- package/native/CMakeLists.txt +51 -4
- package/native/appkit/CMakeLists.txt +16 -2
- package/native/appkit/appkit-backend.mm +28 -3
- package/native/appkit/cg-canvas.h +5 -0
- package/native/appkit/cg-canvas.mm +21 -6
- package/native/appkit/desktop-expo.h +6 -0
- package/native/appkit/desktop-expo.mm +5 -0
- package/native/appkit/host-view.mm +32 -0
- package/native/appkit/image-request.h +2 -10
- package/native/appkit/image-request.mm +0 -22
- package/native/appkit/image-view.mm +121 -4
- package/native/appkit/main.mm +130 -185
- package/native/appkit/scroll-view.mm +57 -16
- package/native/appkit/scrollers.h +22 -2
- package/native/appkit/scrollers.mm +221 -2
- package/native/appkit/split-view.h +4 -0
- package/native/appkit/split-view.mm +60 -12
- package/native/appkit/system-access.mm +3 -0
- package/native/appkit/system.mm +33 -48
- package/native/appkit/text-layout.h +6 -0
- package/native/appkit/text-layout.mm +147 -24
- package/native/appkit/view-effects.h +27 -0
- package/native/appkit/view-effects.mm +90 -0
- package/native/cmake/react-native.cmake +9 -0
- package/native/cmake/runtime-dependencies.cmake +32 -1
- package/native/core/include/ngn/app-info.h +3 -2
- package/native/core/include/ngn/app-menus.h +5 -11
- package/native/core/include/ngn/default-menu.h +16 -6
- package/native/core/include/ngn/desktop-expo.h +0 -5
- package/native/core/include/ngn/desktop-modules.h +144 -0
- package/native/core/include/ngn/dev-server.h +12 -3
- package/native/core/include/ngn/host-os.h +45 -0
- package/native/core/include/ngn/host-views.h +25 -0
- package/native/core/include/ngn/image-source.h +18 -0
- package/native/core/include/ngn/launch-settings.h +9 -7
- package/native/core/include/ngn/module-registry.h +2 -0
- package/native/core/include/ngn/notifications.h +6 -0
- package/native/core/include/ngn/runtime.h +4 -1
- package/native/core/include/ngn/scrollers.h +5 -0
- package/native/core/include/ngn/spawn-rules.h +3 -2
- package/native/core/include/ngn/split-view.h +12 -0
- package/native/core/include/ngn/system.h +47 -0
- package/native/core/include/ngn/text-measurer.h +11 -0
- package/native/core/include/ngn/undo.h +27 -0
- package/native/core/include/ngn/updates.h +3 -2
- package/native/core/include/ngn/view-filter.h +33 -0
- package/native/core/src/app-menus.cpp +9 -11
- package/native/core/src/default-menu.cpp +6 -2
- package/native/core/src/dev-server-helper.cpp +3 -2
- package/native/core/src/dev-server.cpp +22 -5
- package/native/core/src/host-os.cpp +20 -0
- package/native/core/src/host-views.cpp +25 -0
- package/native/core/src/image-source.cpp +30 -0
- package/native/core/src/launch-settings.cpp +10 -6
- package/native/core/src/module-registry.cpp +9 -0
- package/native/core/src/modules/app-info.cpp +4 -4
- package/native/core/src/modules/app-modules.cpp +4 -2
- package/native/core/src/modules/desktop-expo.cpp +0 -5
- package/native/core/src/modules/desktop-modules.cpp +132 -0
- package/native/core/src/modules/notifications.cpp +4 -4
- package/native/core/src/runtime.cpp +2 -0
- package/native/core/src/scrollers.cpp +11 -0
- package/native/core/src/spawn-rules.cpp +1 -4
- package/native/core/src/split-view.cpp +10 -0
- package/native/core/src/system.cpp +52 -0
- package/native/core/src/text-layout-manager.cpp +13 -0
- package/native/core/src/undo-stacks.cpp +71 -0
- package/native/core/src/view-filter.cpp +114 -0
- package/native/scripts/build-hermes.sh +19 -7
- package/native/scripts/build-icu.sh +36 -0
- package/native/scripts/build-lock.sh +21 -0
- package/native/scripts/build.sh +46 -7
- package/native/scripts/fetch-hermes.sh +70 -0
- package/native/scripts/fetch.sh +24 -2
- package/native/scripts/hermes-built.sh +5 -4
- package/native/scripts/hermes-target.sh +18 -0
- package/native/scripts/icu-filter.json +22 -0
- package/native/scripts/make-prebuilt.mjs +13 -6
- package/native/scripts/prebuilt-host-cache.mjs +1 -1
- package/native/shim/openssl/sha.h +108 -3
- package/native/shim/text-platform/react/renderer/textlayoutmanager/TextLayoutManager.h +52 -0
- package/package.json +2 -2
- package/prebuilt.json +6 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// The part of OpenSSL's <openssl/sha.h> React Native's DevServerHelper calls
|
|
2
|
-
// SHA-256
|
|
1
|
+
// The part of OpenSSL's <openssl/sha.h> React Native's DevServerHelper calls: over the system's
|
|
2
|
+
// SHA-256 on Apple platforms (CommonCrypto), and elsewhere a portable SHA-256 (FIPS 180-4), since
|
|
3
|
+
// one device-id hash is no reason to link a crypto library. See cmake/runtime-dependencies.cmake.
|
|
3
4
|
#pragma once
|
|
4
5
|
|
|
5
6
|
#if defined(__APPLE__)
|
|
@@ -18,5 +19,109 @@ inline int SHA256_Final(unsigned char *digest, SHA256_CTX *context) {
|
|
|
18
19
|
return CC_SHA256_Final(digest, context);
|
|
19
20
|
}
|
|
20
21
|
#else
|
|
21
|
-
#
|
|
22
|
+
#include <cstddef>
|
|
23
|
+
#include <cstdint>
|
|
24
|
+
#include <cstring>
|
|
25
|
+
|
|
26
|
+
#define SHA256_DIGEST_LENGTH 32
|
|
27
|
+
|
|
28
|
+
struct SHA256_CTX {
|
|
29
|
+
uint32_t state[8];
|
|
30
|
+
uint64_t length; // in bytes
|
|
31
|
+
unsigned char block[64];
|
|
32
|
+
size_t used;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
namespace ngn::sha256 {
|
|
36
|
+
|
|
37
|
+
inline uint32_t rotr(uint32_t x, int n) {
|
|
38
|
+
return (x >> n) | (x << (32 - n));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
inline void compress(uint32_t state[8], const unsigned char *block) {
|
|
42
|
+
static constexpr uint32_t k[64] = {
|
|
43
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
44
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
45
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
46
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
47
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
48
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
49
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
50
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
|
|
51
|
+
uint32_t w[64];
|
|
52
|
+
for (int i = 0; i < 16; i++) {
|
|
53
|
+
w[i] = (uint32_t(block[4 * i]) << 24) | (uint32_t(block[4 * i + 1]) << 16) |
|
|
54
|
+
(uint32_t(block[4 * i + 2]) << 8) | uint32_t(block[4 * i + 3]);
|
|
55
|
+
}
|
|
56
|
+
for (int i = 16; i < 64; i++) {
|
|
57
|
+
uint32_t s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >> 3);
|
|
58
|
+
uint32_t s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >> 10);
|
|
59
|
+
w[i] = w[i - 16] + s0 + w[i - 7] + s1;
|
|
60
|
+
}
|
|
61
|
+
uint32_t v[8];
|
|
62
|
+
std::memcpy(v, state, sizeof v);
|
|
63
|
+
for (int i = 0; i < 64; i++) {
|
|
64
|
+
uint32_t t1 = v[7] + (rotr(v[4], 6) ^ rotr(v[4], 11) ^ rotr(v[4], 25)) +
|
|
65
|
+
((v[4] & v[5]) ^ (~v[4] & v[6])) + k[i] + w[i];
|
|
66
|
+
uint32_t t2 = (rotr(v[0], 2) ^ rotr(v[0], 13) ^ rotr(v[0], 22)) +
|
|
67
|
+
((v[0] & v[1]) ^ (v[0] & v[2]) ^ (v[1] & v[2]));
|
|
68
|
+
std::memmove(v + 1, v, 7 * sizeof v[0]);
|
|
69
|
+
v[4] += t1;
|
|
70
|
+
v[0] = t1 + t2;
|
|
71
|
+
}
|
|
72
|
+
for (int i = 0; i < 8; i++) {
|
|
73
|
+
state[i] += v[i];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
} // namespace ngn::sha256
|
|
78
|
+
|
|
79
|
+
inline int SHA256_Init(SHA256_CTX *context) {
|
|
80
|
+
static constexpr uint32_t initial[8] = {
|
|
81
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
|
82
|
+
std::memcpy(context->state, initial, sizeof initial);
|
|
83
|
+
context->length = 0;
|
|
84
|
+
context->used = 0;
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
inline int SHA256_Update(SHA256_CTX *context, const void *data, size_t length) {
|
|
89
|
+
auto bytes = static_cast<const unsigned char *>(data);
|
|
90
|
+
context->length += length;
|
|
91
|
+
while (length > 0) {
|
|
92
|
+
size_t n = sizeof context->block - context->used;
|
|
93
|
+
if (n > length) {
|
|
94
|
+
n = length;
|
|
95
|
+
}
|
|
96
|
+
std::memcpy(context->block + context->used, bytes, n);
|
|
97
|
+
context->used += n;
|
|
98
|
+
bytes += n;
|
|
99
|
+
length -= n;
|
|
100
|
+
if (context->used == sizeof context->block) {
|
|
101
|
+
ngn::sha256::compress(context->state, context->block);
|
|
102
|
+
context->used = 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
inline int SHA256_Final(unsigned char *digest, SHA256_CTX *context) {
|
|
109
|
+
uint64_t bits = context->length * 8;
|
|
110
|
+
// A 1 bit, zeros up to 8 bytes short of a block, then the message's length in bits, big-endian.
|
|
111
|
+
static constexpr unsigned char padding[64] = {0x80};
|
|
112
|
+
size_t pad = context->used < 56 ? 56 - context->used : 120 - context->used;
|
|
113
|
+
SHA256_Update(context, padding, pad);
|
|
114
|
+
unsigned char length[8];
|
|
115
|
+
for (int i = 0; i < 8; i++) {
|
|
116
|
+
length[i] = static_cast<unsigned char>(bits >> (56 - 8 * i));
|
|
117
|
+
}
|
|
118
|
+
SHA256_Update(context, length, sizeof length);
|
|
119
|
+
for (int i = 0; i < 8; i++) {
|
|
120
|
+
digest[4 * i] = static_cast<unsigned char>(context->state[i] >> 24);
|
|
121
|
+
digest[4 * i + 1] = static_cast<unsigned char>(context->state[i] >> 16);
|
|
122
|
+
digest[4 * i + 2] = static_cast<unsigned char>(context->state[i] >> 8);
|
|
123
|
+
digest[4 * i + 3] = static_cast<unsigned char>(context->state[i]);
|
|
124
|
+
}
|
|
125
|
+
return 1;
|
|
126
|
+
}
|
|
22
127
|
#endif
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// React Native's cxx TextLayoutManager header (textlayoutmanager/platform/cxx), with measureLines
|
|
9
|
+
// added: React Native reads a text's baseline (`align-items: baseline`) and sends onTextLayout
|
|
10
|
+
// only when the class declares it (TextLayoutManagerExtended::supportsLineMeasurement). The core
|
|
11
|
+
// implements both over a backend's TextMeasurer (src/text-layout-manager.cpp). Keep it in step with
|
|
12
|
+
// React Native's header when React Native is upgraded.
|
|
13
|
+
#pragma once
|
|
14
|
+
|
|
15
|
+
#include <react/renderer/attributedstring/AttributedStringBox.h>
|
|
16
|
+
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
|
17
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
18
|
+
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>
|
|
19
|
+
#include <react/renderer/textlayoutmanager/TextMeasureCache.h>
|
|
20
|
+
#include <react/utils/ContextContainer.h>
|
|
21
|
+
#include <memory>
|
|
22
|
+
|
|
23
|
+
namespace facebook::react {
|
|
24
|
+
|
|
25
|
+
class TextLayoutManager {
|
|
26
|
+
public:
|
|
27
|
+
explicit TextLayoutManager(const std::shared_ptr<const ContextContainer> &contextContainer);
|
|
28
|
+
virtual ~TextLayoutManager() = default;
|
|
29
|
+
|
|
30
|
+
TextLayoutManager(const TextLayoutManager &) = delete;
|
|
31
|
+
TextLayoutManager &operator=(const TextLayoutManager &) = delete;
|
|
32
|
+
TextLayoutManager(TextLayoutManager &&) = delete;
|
|
33
|
+
TextLayoutManager &operator=(TextLayoutManager &&) = delete;
|
|
34
|
+
|
|
35
|
+
virtual TextMeasurement measure(
|
|
36
|
+
const AttributedStringBox &attributedStringBox,
|
|
37
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
38
|
+
const TextLayoutContext &layoutContext,
|
|
39
|
+
const LayoutConstraints &layoutConstraints) const;
|
|
40
|
+
|
|
41
|
+
// The lines `attributedStringBox` lays out in, `size` big.
|
|
42
|
+
LinesMeasurements measureLines(
|
|
43
|
+
const AttributedStringBox &attributedStringBox,
|
|
44
|
+
const ParagraphAttributes ¶graphAttributes,
|
|
45
|
+
const Size &size) const;
|
|
46
|
+
|
|
47
|
+
protected:
|
|
48
|
+
std::shared_ptr<const ContextContainer> contextContainer_;
|
|
49
|
+
TextMeasureCache textMeasureCache_;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace facebook::react
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/desktop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "The macOS desktop host for Angular Native: React Native's C++ core and Hermes, mounting into AppKit views, and the ng-native-desktop command that builds and launches it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ng-native-desktop": "./bin/ng-native-desktop.mjs"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ng-native/device": "0.
|
|
19
|
+
"@ng-native/device": "0.26.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react-native": "~0.88.0"
|
package/prebuilt.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
{
|
|
5
5
|
"reactNative": "0.88.0",
|
|
6
6
|
"flavour": "debug",
|
|
7
|
-
"url": "https://github.com/ng-native/ng-native/releases/download/v0.
|
|
8
|
-
"sha256": "
|
|
7
|
+
"url": "https://github.com/ng-native/ng-native/releases/download/v0.26.0/ng-native-desktop-host-0.26.0-rn-0.88.0-macos-universal-debug.tar.gz",
|
|
8
|
+
"sha256": "ff2af29a2d7046f7d5d0e4176c3f9c8e2be05e2bda57ea15c29cede2c0b494de",
|
|
9
9
|
"libraries": {
|
|
10
10
|
"react-native-screens": "4.30.0",
|
|
11
11
|
"react-native-safe-area-context": "5.10.1",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"react-native-worklets": "0.13.0",
|
|
14
14
|
"react-native-reanimated": "4.7.1"
|
|
15
15
|
},
|
|
16
|
-
"inputs": "
|
|
16
|
+
"inputs": "a511221639ad9e0f0ce29a96aa32839dd251f5cfae6f74e8c8cf819ce25898c9"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"reactNative": "0.88.0",
|
|
20
20
|
"flavour": "release",
|
|
21
|
-
"url": "https://github.com/ng-native/ng-native/releases/download/v0.
|
|
22
|
-
"sha256": "
|
|
21
|
+
"url": "https://github.com/ng-native/ng-native/releases/download/v0.26.0/ng-native-desktop-host-0.26.0-rn-0.88.0-macos-universal.tar.gz",
|
|
22
|
+
"sha256": "ade1562cdc5409e4099eb38640f8d52b20be7254d115e2d069896d2f2d78f518",
|
|
23
23
|
"libraries": {
|
|
24
24
|
"react-native-screens": "4.30.0",
|
|
25
25
|
"react-native-safe-area-context": "5.10.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-native-worklets": "0.13.0",
|
|
28
28
|
"react-native-reanimated": "4.7.1"
|
|
29
29
|
},
|
|
30
|
-
"inputs": "
|
|
30
|
+
"inputs": "689a371456085b1c3a8af2c7ab254db1db115e13063f1d0b81da6c6e23908080"
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
}
|