@shopify/react-native-skia 0.1.154 → 0.1.156

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/android/cpp/jni/JniLoad.cpp +5 -5
  2. package/android/cpp/jni/JniPlatformContext.cpp +107 -119
  3. package/android/cpp/jni/JniSkiaManager.cpp +18 -20
  4. package/android/cpp/jni/include/JniPlatformContext.h +41 -45
  5. package/android/cpp/jni/include/JniSkiaBaseView.h +52 -55
  6. package/android/cpp/jni/include/JniSkiaDrawView.h +72 -77
  7. package/android/cpp/jni/include/JniSkiaManager.h +51 -53
  8. package/android/cpp/jni/include/JniSkiaPictureView.h +74 -78
  9. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +36 -45
  10. package/android/cpp/rnskia-android/RNSkAndroidView.h +87 -92
  11. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +62 -65
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +20 -17
  13. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +257 -313
  14. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +107 -110
  15. package/cpp/api/JsiSkApi.h +66 -62
  16. package/cpp/api/JsiSkCanvas.h +38 -30
  17. package/cpp/api/JsiSkColor.h +58 -56
  18. package/cpp/api/JsiSkColorFilter.h +5 -3
  19. package/cpp/api/JsiSkColorFilterFactory.h +23 -21
  20. package/cpp/api/JsiSkContourMeasure.h +74 -85
  21. package/cpp/api/JsiSkContourMeasureIter.h +68 -75
  22. package/cpp/api/JsiSkData.h +16 -22
  23. package/cpp/api/JsiSkDataFactory.h +86 -79
  24. package/cpp/api/JsiSkFont.h +286 -311
  25. package/cpp/api/JsiSkHostObjects.h +15 -16
  26. package/cpp/api/JsiSkImage.h +107 -103
  27. package/cpp/api/JsiSkImageFactory.h +34 -36
  28. package/cpp/api/JsiSkImageFilter.h +5 -3
  29. package/cpp/api/JsiSkImageFilterFactory.h +71 -68
  30. package/cpp/api/JsiSkImageInfo.h +41 -38
  31. package/cpp/api/JsiSkMaskFilter.h +5 -3
  32. package/cpp/api/JsiSkMaskFilterFactory.h +2 -3
  33. package/cpp/api/JsiSkMatrix.h +26 -36
  34. package/cpp/api/JsiSkPaint.h +20 -13
  35. package/cpp/api/JsiSkPath.h +70 -85
  36. package/cpp/api/JsiSkPathEffect.h +5 -3
  37. package/cpp/api/JsiSkPathEffectFactory.h +33 -28
  38. package/cpp/api/JsiSkPathFactory.h +68 -67
  39. package/cpp/api/JsiSkPicture.h +28 -22
  40. package/cpp/api/JsiSkPictureFactory.h +13 -12
  41. package/cpp/api/JsiSkPictureRecorder.h +21 -19
  42. package/cpp/api/JsiSkPoint.h +6 -8
  43. package/cpp/api/JsiSkRRect.h +11 -7
  44. package/cpp/api/JsiSkRSXform.h +82 -85
  45. package/cpp/api/JsiSkRect.h +9 -9
  46. package/cpp/api/JsiSkRuntimeEffect.h +182 -186
  47. package/cpp/api/JsiSkRuntimeEffectFactory.h +10 -11
  48. package/cpp/api/JsiSkRuntimeShaderBuilder.h +64 -61
  49. package/cpp/api/JsiSkSVG.h +4 -5
  50. package/cpp/api/JsiSkSVGFactory.h +28 -27
  51. package/cpp/api/JsiSkShader.h +3 -2
  52. package/cpp/api/JsiSkShaderFactory.h +37 -25
  53. package/cpp/api/JsiSkSurface.h +44 -40
  54. package/cpp/api/JsiSkSurfaceFactory.h +22 -22
  55. package/cpp/api/JsiSkTextBlob.h +28 -31
  56. package/cpp/api/JsiSkTextBlobFactory.h +88 -87
  57. package/cpp/api/JsiSkTypeface.h +6 -5
  58. package/cpp/api/JsiSkTypefaceFactory.h +22 -21
  59. package/cpp/api/JsiSkVertices.h +137 -124
  60. package/cpp/api/third_party/CSSColorParser.cpp +161 -174
  61. package/cpp/api/third_party/CSSColorParser.h +172 -96
  62. package/cpp/jsi/JsiHostObject.cpp +11 -9
  63. package/cpp/jsi/JsiHostObject.h +31 -24
  64. package/cpp/jsi/JsiSimpleValueWrapper.h +74 -83
  65. package/cpp/jsi/JsiValueWrapper.h +52 -54
  66. package/cpp/rnskia/RNSkAnimation.h +26 -29
  67. package/cpp/rnskia/RNSkDispatchQueue.cpp +50 -61
  68. package/cpp/rnskia/RNSkDispatchQueue.h +3 -1
  69. package/cpp/rnskia/RNSkInfoParameter.h +12 -12
  70. package/cpp/rnskia/RNSkJsView.cpp +82 -81
  71. package/cpp/rnskia/RNSkJsView.h +45 -41
  72. package/cpp/rnskia/RNSkJsiViewApi.h +99 -89
  73. package/cpp/rnskia/RNSkManager.cpp +8 -7
  74. package/cpp/rnskia/RNSkManager.h +8 -6
  75. package/cpp/rnskia/RNSkPictureView.h +44 -37
  76. package/cpp/rnskia/RNSkPlatformContext.h +39 -28
  77. package/cpp/rnskia/RNSkValueApi.h +33 -34
  78. package/cpp/rnskia/RNSkView.h +108 -93
  79. package/cpp/rnskia/values/RNSkClockValue.h +63 -64
  80. package/cpp/rnskia/values/RNSkComputedValue.h +32 -30
  81. package/cpp/rnskia/values/RNSkReadonlyValue.h +60 -59
  82. package/cpp/rnskia/values/RNSkValue.h +38 -40
  83. package/cpp/utils/RNSkLog.h +9 -7
  84. package/cpp/utils/RNSkMeasureTime.h +7 -7
  85. package/cpp/utils/RNSkTimingInfo.h +27 -24
  86. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +8 -9
  87. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +24 -23
  88. package/ios/RNSkia-iOS/RNSkiOSView.h +16 -13
  89. package/ios/RNSkia-iOS/SkiaUIView.h +9 -8
  90. package/lib/commonjs/dom/nodes/JsiSkDOM.js +6 -0
  91. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  92. package/lib/commonjs/dom/nodes/LayerNode.js +43 -0
  93. package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -0
  94. package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
  95. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  96. package/lib/commonjs/dom/types/NodeType.js +1 -0
  97. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  98. package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
  99. package/lib/commonjs/renderer/HostComponents.js +3 -0
  100. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  101. package/lib/commonjs/renderer/components/Group.js +19 -4
  102. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  103. package/lib/commonjs/renderer/components/Paint.js +6 -1
  104. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  105. package/lib/commonjs/views/SkiaPictureView.js +3 -2
  106. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  107. package/lib/commonjs/views/SkiaView.js +6 -3
  108. package/lib/commonjs/views/SkiaView.js.map +1 -1
  109. package/lib/module/dom/nodes/JsiSkDOM.js +5 -0
  110. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  111. package/lib/module/dom/nodes/LayerNode.js +32 -0
  112. package/lib/module/dom/nodes/LayerNode.js.map +1 -0
  113. package/lib/module/dom/nodes/RenderNode.js +1 -1
  114. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  115. package/lib/module/dom/types/NodeType.js +1 -0
  116. package/lib/module/dom/types/NodeType.js.map +1 -1
  117. package/lib/module/dom/types/SkDOM.js.map +1 -1
  118. package/lib/module/renderer/HostComponents.js +3 -0
  119. package/lib/module/renderer/HostComponents.js.map +1 -1
  120. package/lib/module/renderer/components/Group.js +16 -3
  121. package/lib/module/renderer/components/Group.js.map +1 -1
  122. package/lib/module/renderer/components/Paint.js +7 -1
  123. package/lib/module/renderer/components/Paint.js.map +1 -1
  124. package/lib/module/views/SkiaPictureView.js +2 -2
  125. package/lib/module/views/SkiaPictureView.js.map +1 -1
  126. package/lib/module/views/SkiaView.js +4 -2
  127. package/lib/module/views/SkiaView.js.map +1 -1
  128. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
  129. package/lib/typescript/src/dom/nodes/LayerNode.d.ts +8 -0
  130. package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
  131. package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -0
  132. package/lib/typescript/src/renderer/HostComponents.d.ts +2 -1
  133. package/lib/typescript/src/renderer/components/Group.d.ts +5 -1
  134. package/lib/typescript/src/views/SkiaView.d.ts +3 -0
  135. package/libs/android/arm64-v8a/libskottie.a +0 -0
  136. package/libs/android/arm64-v8a/libsksg.a +0 -0
  137. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  138. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  139. package/libs/android/x86/libskottie.a +0 -0
  140. package/libs/android/x86/libsksg.a +0 -0
  141. package/libs/android/x86_64/libskottie.a +0 -0
  142. package/libs/android/x86_64/libsksg.a +0 -0
  143. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  144. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  145. package/libs/ios/libskottie.xcframework/Info.plist +42 -0
  146. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  147. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  148. package/libs/ios/libsksg.xcframework/Info.plist +42 -0
  149. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  150. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  151. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  152. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  153. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  154. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  155. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  156. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  157. package/package.json +3 -1
  158. package/src/dom/nodes/JsiSkDOM.ts +5 -0
  159. package/src/dom/nodes/LayerNode.ts +35 -0
  160. package/src/dom/nodes/RenderNode.ts +4 -3
  161. package/src/dom/types/NodeType.ts +1 -0
  162. package/src/dom/types/SkDOM.ts +1 -0
  163. package/src/renderer/HostComponents.ts +3 -0
  164. package/src/renderer/components/Group.tsx +16 -3
  165. package/src/renderer/components/Paint.tsx +7 -1
  166. package/src/views/SkiaPictureView.tsx +2 -3
  167. package/src/views/SkiaView.tsx +2 -2
@@ -24,111 +24,187 @@
24
24
 
25
25
  #pragma once
26
26
 
27
+ #include <algorithm>
28
+ #include <cmath>
27
29
  #include <cstdint>
28
- #include <vector>
29
30
  #include <sstream>
30
- #include <algorithm>
31
31
  #include <string>
32
- #include <cmath>
32
+ #include <vector>
33
33
 
34
34
  namespace CSSColorParser {
35
35
 
36
- struct Color {
37
- inline Color() {
38
- }
39
- inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_)
40
- : r(r_), g(g_), b(b_), a(a_ > 1 ? 1 : a_ < 0 ? 0 : a_) {
41
- }
42
- unsigned char r = 0, g = 0, b = 0;
43
- float a = -1.0f;
44
- };
36
+ struct Color {
37
+ inline Color() {}
38
+ inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_)
39
+ : r(r_), g(g_), b(b_), a(a_ > 1 ? 1
40
+ : a_ < 0 ? 0
41
+ : a_) {}
42
+ unsigned char r = 0, g = 0, b = 0;
43
+ float a = -1.0f;
44
+ };
45
45
 
46
- struct NamedColor { const char *const name; const Color color; };
46
+ struct NamedColor {
47
+ const char *const name;
48
+ const Color color;
49
+ };
47
50
 
48
- const NamedColor namedColors[] = {
49
- { "transparent", { 0, 0, 0, 0 } }, { "aliceblue", { 240, 248, 255, 1 } },
50
- { "antiquewhite", { 250, 235, 215, 1 } }, { "aqua", { 0, 255, 255, 1 } },
51
- { "aquamarine", { 127, 255, 212, 1 } }, { "azure", { 240, 255, 255, 1 } },
52
- { "beige", { 245, 245, 220, 1 } }, { "bisque", { 255, 228, 196, 1 } },
53
- { "black", { 0, 0, 0, 1 } }, { "blanchedalmond", { 255, 235, 205, 1 } },
54
- { "blue", { 0, 0, 255, 1 } }, { "blueviolet", { 138, 43, 226, 1 } },
55
- { "brown", { 165, 42, 42, 1 } }, { "burlywood", { 222, 184, 135, 1 } },
56
- { "cadetblue", { 95, 158, 160, 1 } }, { "chartreuse", { 127, 255, 0, 1 } },
57
- { "chocolate", { 210, 105, 30, 1 } }, { "coral", { 255, 127, 80, 1 } },
58
- { "cornflowerblue", { 100, 149, 237, 1 } }, { "cornsilk", { 255, 248, 220, 1 } },
59
- { "crimson", { 220, 20, 60, 1 } }, { "cyan", { 0, 255, 255, 1 } },
60
- { "darkblue", { 0, 0, 139, 1 } }, { "darkcyan", { 0, 139, 139, 1 } },
61
- { "darkgoldenrod", { 184, 134, 11, 1 } }, { "darkgray", { 169, 169, 169, 1 } },
62
- { "darkgreen", { 0, 100, 0, 1 } }, { "darkgrey", { 169, 169, 169, 1 } },
63
- { "darkkhaki", { 189, 183, 107, 1 } }, { "darkmagenta", { 139, 0, 139, 1 } },
64
- { "darkolivegreen", { 85, 107, 47, 1 } }, { "darkorange", { 255, 140, 0, 1 } },
65
- { "darkorchid", { 153, 50, 204, 1 } }, { "darkred", { 139, 0, 0, 1 } },
66
- { "darksalmon", { 233, 150, 122, 1 } }, { "darkseagreen", { 143, 188, 143, 1 } },
67
- { "darkslateblue", { 72, 61, 139, 1 } }, { "darkslategray", { 47, 79, 79, 1 } },
68
- { "darkslategrey", { 47, 79, 79, 1 } }, { "darkturquoise", { 0, 206, 209, 1 } },
69
- { "darkviolet", { 148, 0, 211, 1 } }, { "deeppink", { 255, 20, 147, 1 } },
70
- { "deepskyblue", { 0, 191, 255, 1 } }, { "dimgray", { 105, 105, 105, 1 } },
71
- { "dimgrey", { 105, 105, 105, 1 } }, { "dodgerblue", { 30, 144, 255, 1 } },
72
- { "firebrick", { 178, 34, 34, 1 } }, { "floralwhite", { 255, 250, 240, 1 } },
73
- { "forestgreen", { 34, 139, 34, 1 } }, { "fuchsia", { 255, 0, 255, 1 } },
74
- { "gainsboro", { 220, 220, 220, 1 } }, { "ghostwhite", { 248, 248, 255, 1 } },
75
- { "gold", { 255, 215, 0, 1 } }, { "goldenrod", { 218, 165, 32, 1 } },
76
- { "gray", { 128, 128, 128, 1 } }, { "green", { 0, 128, 0, 1 } },
77
- { "greenyellow", { 173, 255, 47, 1 } }, { "grey", { 128, 128, 128, 1 } },
78
- { "honeydew", { 240, 255, 240, 1 } }, { "hotpink", { 255, 105, 180, 1 } },
79
- { "indianred", { 205, 92, 92, 1 } }, { "indigo", { 75, 0, 130, 1 } },
80
- { "ivory", { 255, 255, 240, 1 } }, { "khaki", { 240, 230, 140, 1 } },
81
- { "lavender", { 230, 230, 250, 1 } }, { "lavenderblush", { 255, 240, 245, 1 } },
82
- { "lawngreen", { 124, 252, 0, 1 } }, { "lemonchiffon", { 255, 250, 205, 1 } },
83
- { "lightblue", { 173, 216, 230, 1 } }, { "lightcoral", { 240, 128, 128, 1 } },
84
- { "lightcyan", { 224, 255, 255, 1 } }, { "lightgoldenrodyellow", { 250, 250, 210, 1 } },
85
- { "lightgray", { 211, 211, 211, 1 } }, { "lightgreen", { 144, 238, 144, 1 } },
86
- { "lightgrey", { 211, 211, 211, 1 } }, { "lightpink", { 255, 182, 193, 1 } },
87
- { "lightsalmon", { 255, 160, 122, 1 } }, { "lightseagreen", { 32, 178, 170, 1 } },
88
- { "lightskyblue", { 135, 206, 250, 1 } }, { "lightslategray", { 119, 136, 153, 1 } },
89
- { "lightslategrey", { 119, 136, 153, 1 } }, { "lightsteelblue", { 176, 196, 222, 1 } },
90
- { "lightyellow", { 255, 255, 224, 1 } }, { "lime", { 0, 255, 0, 1 } },
91
- { "limegreen", { 50, 205, 50, 1 } }, { "linen", { 250, 240, 230, 1 } },
92
- { "magenta", { 255, 0, 255, 1 } }, { "maroon", { 128, 0, 0, 1 } },
93
- { "mediumaquamarine", { 102, 205, 170, 1 } }, { "mediumblue", { 0, 0, 205, 1 } },
94
- { "mediumorchid", { 186, 85, 211, 1 } }, { "mediumpurple", { 147, 112, 219, 1 } },
95
- { "mediumseagreen", { 60, 179, 113, 1 } }, { "mediumslateblue", { 123, 104, 238, 1 } },
96
- { "mediumspringgreen", { 0, 250, 154, 1 } }, { "mediumturquoise", { 72, 209, 204, 1 } },
97
- { "mediumvioletred", { 199, 21, 133, 1 } }, { "midnightblue", { 25, 25, 112, 1 } },
98
- { "mintcream", { 245, 255, 250, 1 } }, { "mistyrose", { 255, 228, 225, 1 } },
99
- { "moccasin", { 255, 228, 181, 1 } }, { "navajowhite", { 255, 222, 173, 1 } },
100
- { "navy", { 0, 0, 128, 1 } }, { "oldlace", { 253, 245, 230, 1 } },
101
- { "olive", { 128, 128, 0, 1 } }, { "olivedrab", { 107, 142, 35, 1 } },
102
- { "orange", { 255, 165, 0, 1 } }, { "orangered", { 255, 69, 0, 1 } },
103
- { "orchid", { 218, 112, 214, 1 } }, { "palegoldenrod", { 238, 232, 170, 1 } },
104
- { "palegreen", { 152, 251, 152, 1 } }, { "paleturquoise", { 175, 238, 238, 1 } },
105
- { "palevioletred", { 219, 112, 147, 1 } }, { "papayawhip", { 255, 239, 213, 1 } },
106
- { "peachpuff", { 255, 218, 185, 1 } }, { "peru", { 205, 133, 63, 1 } },
107
- { "pink", { 255, 192, 203, 1 } }, { "plum", { 221, 160, 221, 1 } },
108
- { "powderblue", { 176, 224, 230, 1 } }, { "purple", { 128, 0, 128, 1 } },
109
- { "red", { 255, 0, 0, 1 } }, { "rosybrown", { 188, 143, 143, 1 } },
110
- { "royalblue", { 65, 105, 225, 1 } }, { "saddlebrown", { 139, 69, 19, 1 } },
111
- { "salmon", { 250, 128, 114, 1 } }, { "sandybrown", { 244, 164, 96, 1 } },
112
- { "seagreen", { 46, 139, 87, 1 } }, { "seashell", { 255, 245, 238, 1 } },
113
- { "sienna", { 160, 82, 45, 1 } }, { "silver", { 192, 192, 192, 1 } },
114
- { "skyblue", { 135, 206, 235, 1 } }, { "slateblue", { 106, 90, 205, 1 } },
115
- { "slategray", { 112, 128, 144, 1 } }, { "slategrey", { 112, 128, 144, 1 } },
116
- { "snow", { 255, 250, 250, 1 } }, { "springgreen", { 0, 255, 127, 1 } },
117
- { "steelblue", { 70, 130, 180, 1 } }, { "tan", { 210, 180, 140, 1 } },
118
- { "teal", { 0, 128, 128, 1 } }, { "thistle", { 216, 191, 216, 1 } },
119
- { "tomato", { 255, 99, 71, 1 } }, { "turquoise", { 64, 224, 208, 1 } },
120
- { "violet", { 238, 130, 238, 1 } }, { "wheat", { 245, 222, 179, 1 } },
121
- { "white", { 255, 255, 255, 1 } }, { "whitesmoke", { 245, 245, 245, 1 } },
122
- { "yellow", { 255, 255, 0, 1 } }, { "yellowgreen", { 154, 205, 50, 1 } }
123
- };
51
+ const NamedColor namedColors[] = {{"transparent", {0, 0, 0, 0}},
52
+ {"aliceblue", {240, 248, 255, 1}},
53
+ {"antiquewhite", {250, 235, 215, 1}},
54
+ {"aqua", {0, 255, 255, 1}},
55
+ {"aquamarine", {127, 255, 212, 1}},
56
+ {"azure", {240, 255, 255, 1}},
57
+ {"beige", {245, 245, 220, 1}},
58
+ {"bisque", {255, 228, 196, 1}},
59
+ {"black", {0, 0, 0, 1}},
60
+ {"blanchedalmond", {255, 235, 205, 1}},
61
+ {"blue", {0, 0, 255, 1}},
62
+ {"blueviolet", {138, 43, 226, 1}},
63
+ {"brown", {165, 42, 42, 1}},
64
+ {"burlywood", {222, 184, 135, 1}},
65
+ {"cadetblue", {95, 158, 160, 1}},
66
+ {"chartreuse", {127, 255, 0, 1}},
67
+ {"chocolate", {210, 105, 30, 1}},
68
+ {"coral", {255, 127, 80, 1}},
69
+ {"cornflowerblue", {100, 149, 237, 1}},
70
+ {"cornsilk", {255, 248, 220, 1}},
71
+ {"crimson", {220, 20, 60, 1}},
72
+ {"cyan", {0, 255, 255, 1}},
73
+ {"darkblue", {0, 0, 139, 1}},
74
+ {"darkcyan", {0, 139, 139, 1}},
75
+ {"darkgoldenrod", {184, 134, 11, 1}},
76
+ {"darkgray", {169, 169, 169, 1}},
77
+ {"darkgreen", {0, 100, 0, 1}},
78
+ {"darkgrey", {169, 169, 169, 1}},
79
+ {"darkkhaki", {189, 183, 107, 1}},
80
+ {"darkmagenta", {139, 0, 139, 1}},
81
+ {"darkolivegreen", {85, 107, 47, 1}},
82
+ {"darkorange", {255, 140, 0, 1}},
83
+ {"darkorchid", {153, 50, 204, 1}},
84
+ {"darkred", {139, 0, 0, 1}},
85
+ {"darksalmon", {233, 150, 122, 1}},
86
+ {"darkseagreen", {143, 188, 143, 1}},
87
+ {"darkslateblue", {72, 61, 139, 1}},
88
+ {"darkslategray", {47, 79, 79, 1}},
89
+ {"darkslategrey", {47, 79, 79, 1}},
90
+ {"darkturquoise", {0, 206, 209, 1}},
91
+ {"darkviolet", {148, 0, 211, 1}},
92
+ {"deeppink", {255, 20, 147, 1}},
93
+ {"deepskyblue", {0, 191, 255, 1}},
94
+ {"dimgray", {105, 105, 105, 1}},
95
+ {"dimgrey", {105, 105, 105, 1}},
96
+ {"dodgerblue", {30, 144, 255, 1}},
97
+ {"firebrick", {178, 34, 34, 1}},
98
+ {"floralwhite", {255, 250, 240, 1}},
99
+ {"forestgreen", {34, 139, 34, 1}},
100
+ {"fuchsia", {255, 0, 255, 1}},
101
+ {"gainsboro", {220, 220, 220, 1}},
102
+ {"ghostwhite", {248, 248, 255, 1}},
103
+ {"gold", {255, 215, 0, 1}},
104
+ {"goldenrod", {218, 165, 32, 1}},
105
+ {"gray", {128, 128, 128, 1}},
106
+ {"green", {0, 128, 0, 1}},
107
+ {"greenyellow", {173, 255, 47, 1}},
108
+ {"grey", {128, 128, 128, 1}},
109
+ {"honeydew", {240, 255, 240, 1}},
110
+ {"hotpink", {255, 105, 180, 1}},
111
+ {"indianred", {205, 92, 92, 1}},
112
+ {"indigo", {75, 0, 130, 1}},
113
+ {"ivory", {255, 255, 240, 1}},
114
+ {"khaki", {240, 230, 140, 1}},
115
+ {"lavender", {230, 230, 250, 1}},
116
+ {"lavenderblush", {255, 240, 245, 1}},
117
+ {"lawngreen", {124, 252, 0, 1}},
118
+ {"lemonchiffon", {255, 250, 205, 1}},
119
+ {"lightblue", {173, 216, 230, 1}},
120
+ {"lightcoral", {240, 128, 128, 1}},
121
+ {"lightcyan", {224, 255, 255, 1}},
122
+ {"lightgoldenrodyellow", {250, 250, 210, 1}},
123
+ {"lightgray", {211, 211, 211, 1}},
124
+ {"lightgreen", {144, 238, 144, 1}},
125
+ {"lightgrey", {211, 211, 211, 1}},
126
+ {"lightpink", {255, 182, 193, 1}},
127
+ {"lightsalmon", {255, 160, 122, 1}},
128
+ {"lightseagreen", {32, 178, 170, 1}},
129
+ {"lightskyblue", {135, 206, 250, 1}},
130
+ {"lightslategray", {119, 136, 153, 1}},
131
+ {"lightslategrey", {119, 136, 153, 1}},
132
+ {"lightsteelblue", {176, 196, 222, 1}},
133
+ {"lightyellow", {255, 255, 224, 1}},
134
+ {"lime", {0, 255, 0, 1}},
135
+ {"limegreen", {50, 205, 50, 1}},
136
+ {"linen", {250, 240, 230, 1}},
137
+ {"magenta", {255, 0, 255, 1}},
138
+ {"maroon", {128, 0, 0, 1}},
139
+ {"mediumaquamarine", {102, 205, 170, 1}},
140
+ {"mediumblue", {0, 0, 205, 1}},
141
+ {"mediumorchid", {186, 85, 211, 1}},
142
+ {"mediumpurple", {147, 112, 219, 1}},
143
+ {"mediumseagreen", {60, 179, 113, 1}},
144
+ {"mediumslateblue", {123, 104, 238, 1}},
145
+ {"mediumspringgreen", {0, 250, 154, 1}},
146
+ {"mediumturquoise", {72, 209, 204, 1}},
147
+ {"mediumvioletred", {199, 21, 133, 1}},
148
+ {"midnightblue", {25, 25, 112, 1}},
149
+ {"mintcream", {245, 255, 250, 1}},
150
+ {"mistyrose", {255, 228, 225, 1}},
151
+ {"moccasin", {255, 228, 181, 1}},
152
+ {"navajowhite", {255, 222, 173, 1}},
153
+ {"navy", {0, 0, 128, 1}},
154
+ {"oldlace", {253, 245, 230, 1}},
155
+ {"olive", {128, 128, 0, 1}},
156
+ {"olivedrab", {107, 142, 35, 1}},
157
+ {"orange", {255, 165, 0, 1}},
158
+ {"orangered", {255, 69, 0, 1}},
159
+ {"orchid", {218, 112, 214, 1}},
160
+ {"palegoldenrod", {238, 232, 170, 1}},
161
+ {"palegreen", {152, 251, 152, 1}},
162
+ {"paleturquoise", {175, 238, 238, 1}},
163
+ {"palevioletred", {219, 112, 147, 1}},
164
+ {"papayawhip", {255, 239, 213, 1}},
165
+ {"peachpuff", {255, 218, 185, 1}},
166
+ {"peru", {205, 133, 63, 1}},
167
+ {"pink", {255, 192, 203, 1}},
168
+ {"plum", {221, 160, 221, 1}},
169
+ {"powderblue", {176, 224, 230, 1}},
170
+ {"purple", {128, 0, 128, 1}},
171
+ {"red", {255, 0, 0, 1}},
172
+ {"rosybrown", {188, 143, 143, 1}},
173
+ {"royalblue", {65, 105, 225, 1}},
174
+ {"saddlebrown", {139, 69, 19, 1}},
175
+ {"salmon", {250, 128, 114, 1}},
176
+ {"sandybrown", {244, 164, 96, 1}},
177
+ {"seagreen", {46, 139, 87, 1}},
178
+ {"seashell", {255, 245, 238, 1}},
179
+ {"sienna", {160, 82, 45, 1}},
180
+ {"silver", {192, 192, 192, 1}},
181
+ {"skyblue", {135, 206, 235, 1}},
182
+ {"slateblue", {106, 90, 205, 1}},
183
+ {"slategray", {112, 128, 144, 1}},
184
+ {"slategrey", {112, 128, 144, 1}},
185
+ {"snow", {255, 250, 250, 1}},
186
+ {"springgreen", {0, 255, 127, 1}},
187
+ {"steelblue", {70, 130, 180, 1}},
188
+ {"tan", {210, 180, 140, 1}},
189
+ {"teal", {0, 128, 128, 1}},
190
+ {"thistle", {216, 191, 216, 1}},
191
+ {"tomato", {255, 99, 71, 1}},
192
+ {"turquoise", {64, 224, 208, 1}},
193
+ {"violet", {238, 130, 238, 1}},
194
+ {"wheat", {245, 222, 179, 1}},
195
+ {"white", {255, 255, 255, 1}},
196
+ {"whitesmoke", {245, 245, 245, 1}},
197
+ {"yellow", {255, 255, 0, 1}},
198
+ {"yellowgreen", {154, 205, 50, 1}}};
124
199
 
125
- inline bool operator==(const Color& lhs, const Color& rhs) {
126
- return lhs.r == rhs.r && lhs.g == rhs.g && lhs.b == rhs.b && ::fabs(lhs.a - rhs.a) < 0.0001f;
127
- }
200
+ inline bool operator==(const Color &lhs, const Color &rhs) {
201
+ return lhs.r == rhs.r && lhs.g == rhs.g && lhs.b == rhs.b &&
202
+ ::fabs(lhs.a - rhs.a) < 0.0001f;
203
+ }
128
204
 
129
- inline bool operator!=(const Color& lhs, const Color& rhs) {
130
- return !(lhs == rhs);
131
- }
205
+ inline bool operator!=(const Color &lhs, const Color &rhs) {
206
+ return !(lhs == rhs);
207
+ }
132
208
 
133
- Color parse(const std::string& css_str);
209
+ Color parse(const std::string &css_str);
134
210
  } // namespace CSSColorParser
@@ -33,7 +33,7 @@ JsiHostObject::~JsiHostObject() {
33
33
 
34
34
  void JsiHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name,
35
35
  const jsi::Value &value) {
36
-
36
+
37
37
  auto nameVal = name.utf8(rt);
38
38
  auto nameStr = nameVal.c_str();
39
39
 
@@ -56,7 +56,7 @@ jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
56
56
  const jsi::PropNameID &name) {
57
57
  auto nameVal = name.utf8(runtime);
58
58
  auto nameStr = nameVal.c_str();
59
-
59
+
60
60
  // Check the static getters map
61
61
  const JsiPropertyGettersMap &getters = getExportedPropertyGettersMap();
62
62
  auto getter = getters.find(nameStr);
@@ -86,9 +86,10 @@ jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
86
86
  const JsiFunctionMap &funcs = getExportedFunctionMap();
87
87
  auto func = funcs.find(nameStr);
88
88
  if (func != funcs.end()) {
89
- auto dispatcher = std::bind(func->second, (JsiHostObject *)this,
90
- std::placeholders::_1, std::placeholders::_2,
91
- std::placeholders::_3, std::placeholders::_4);
89
+ auto dispatcher =
90
+ std::bind(func->second, reinterpret_cast<JsiHostObject *>(this),
91
+ std::placeholders::_1, std::placeholders::_2,
92
+ std::placeholders::_3, std::placeholders::_4);
92
93
 
93
94
  // Add to cache
94
95
  currentCache->emplace(nameStr, std::make_unique<jsi::Function>(
@@ -115,16 +116,17 @@ jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
115
116
  std::vector<jsi::PropNameID>
116
117
  JsiHostObject::getPropertyNames(jsi::Runtime &runtime) {
117
118
  // statically exported functions
118
- const auto& funcs = getExportedFunctionMap();
119
+ const auto &funcs = getExportedFunctionMap();
119
120
 
120
121
  // Statically exported property getters
121
- const auto& getters = getExportedPropertyGettersMap();
122
+ const auto &getters = getExportedPropertyGettersMap();
122
123
 
123
124
  // Statically exported property setters
124
- const auto& setters = getExportedPropertySettersMap();
125
+ const auto &setters = getExportedPropertySettersMap();
125
126
 
126
127
  std::vector<jsi::PropNameID> propNames;
127
- propNames.reserve(funcs.size() + getters.size() + setters.size() + _funcMap.size() + _propMap.size());
128
+ propNames.reserve(funcs.size() + getters.size() + setters.size() +
129
+ _funcMap.size() + _propMap.size());
128
130
 
129
131
  for (auto it = funcs.cbegin(); it != funcs.cend(); ++it) {
130
132
  propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first));
@@ -3,9 +3,10 @@
3
3
  #include <jsi/jsi.h>
4
4
 
5
5
  #include <functional>
6
- #include <unordered_map>
7
6
  #include <memory>
8
7
  #include <string>
8
+ #include <unordered_map>
9
+ #include <vector>
9
10
 
10
11
  #define STR_CAT_NX(A, B) A##B
11
12
  #define STR_CAT(A, B) STR_CAT_NX(A, B)
@@ -44,7 +45,7 @@
44
45
  */
45
46
  #define JSI_EXPORT_FUNC(CLASS, FUNCTION) \
46
47
  { \
47
- #FUNCTION, (jsi::Value(JsiHostObject::*)( \
48
+ #FUNCTION, (jsi::Value(JsiHostObject::*)( \
48
49
  jsi::Runtime & runtime, const jsi::Value &thisValue, \
49
50
  const jsi::Value *arguments, size_t)) & \
50
51
  CLASS::FUNCTION \
@@ -54,8 +55,8 @@
54
55
  * Creates a JSI export functions statement
55
56
  */
56
57
  #define JSI_EXPORT_FUNCTIONS(...) \
57
- const JsiFunctionMap &getExportedFunctionMap() override { \
58
- static JsiFunctionMap map = {__VA_ARGS__}; \
58
+ const RNJsi::JsiFunctionMap &getExportedFunctionMap() override { \
59
+ static RNJsi::JsiFunctionMap map = {__VA_ARGS__}; \
59
60
  return map; \
60
61
  }
61
62
 
@@ -64,7 +65,7 @@
64
65
  */
65
66
  #define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \
66
67
  { \
67
- #FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \
68
+ #FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \
68
69
  CLASS::STR_CAT(STR_GET, FUNCTION) \
69
70
  }
70
71
 
@@ -72,17 +73,18 @@
72
73
  * Creates a JSI export getters statement
73
74
  */
74
75
  #define JSI_EXPORT_PROPERTY_GETTERS(...) \
75
- const JsiPropertyGettersMap &getExportedPropertyGettersMap() override { \
76
- static JsiPropertyGettersMap map = {__VA_ARGS__}; \
77
- return map; \
78
- }
76
+ const RNJsi::JsiPropertyGettersMap &getExportedPropertyGettersMap() \
77
+ override { \
78
+ static RNJsi::JsiPropertyGettersMap map = {__VA_ARGS__}; \
79
+ return map; \
80
+ }
79
81
 
80
82
  /**
81
83
  * Creates a JSI export setter declaration
82
84
  */
83
85
  #define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \
84
86
  { \
85
- #FUNCTION, \
87
+ #FUNCTION, \
86
88
  (void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
87
89
  CLASS::STR_CAT(STR_SET, FUNCTION) \
88
90
  }
@@ -91,14 +93,15 @@
91
93
  * Creates a JSI export setters statement
92
94
  */
93
95
  #define JSI_EXPORT_PROPERTY_SETTERS(...) \
94
- const JsiPropertySettersMap &getExportedPropertySettersMap() override { \
95
- static JsiPropertySettersMap map = {__VA_ARGS__}; \
96
+ const RNJsi::JsiPropertySettersMap &getExportedPropertySettersMap() \
97
+ override { \
98
+ static RNJsi::JsiPropertySettersMap map = {__VA_ARGS__}; \
96
99
  return map; \
97
100
  }
98
101
 
99
102
  namespace RNJsi {
100
103
 
101
- using namespace facebook;
104
+ namespace jsi = facebook::jsi;
102
105
 
103
106
  using JsPropertyType = struct {
104
107
  std::function<jsi::Value(jsi::Runtime &)> get;
@@ -107,14 +110,18 @@ using JsPropertyType = struct {
107
110
 
108
111
  class JsiHostObject;
109
112
 
110
- using JsiFunctionMap = std::unordered_map<std::string,
111
- jsi::Value (JsiHostObject::*)(jsi::Runtime &, const jsi::Value &, const jsi::Value *, size_t)>;
113
+ using JsiFunctionMap =
114
+ std::unordered_map<std::string, jsi::Value (JsiHostObject::*)(
115
+ jsi::Runtime &, const jsi::Value &,
116
+ const jsi::Value *, size_t)>;
112
117
 
113
- using JsiPropertyGettersMap = std::unordered_map<std::string,
114
- jsi::Value (JsiHostObject::*)(jsi::Runtime &)>;
118
+ using JsiPropertyGettersMap =
119
+ std::unordered_map<std::string,
120
+ jsi::Value (JsiHostObject::*)(jsi::Runtime &)>;
115
121
 
116
- using JsiPropertySettersMap = std::unordered_map<std::string,
117
- void (JsiHostObject::*)(jsi::Runtime &, const jsi::Value &)>;
122
+ using JsiPropertySettersMap =
123
+ std::unordered_map<std::string, void (JsiHostObject::*)(
124
+ jsi::Runtime &, const jsi::Value &)>;
118
125
 
119
126
  using JsiHostFunctionCache =
120
127
  std::unordered_map<std::string, std::unique_ptr<jsi::Function>>;
@@ -134,10 +141,10 @@ protected:
134
141
  /**
135
142
  Override to return map of name/functions
136
143
  */
137
- virtual const JsiFunctionMap &getExportedFunctionMap() {
138
- static const JsiFunctionMap empty;
144
+ virtual const RNJsi::JsiFunctionMap &getExportedFunctionMap() {
145
+ static const RNJsi::JsiFunctionMap empty;
139
146
  return empty;
140
- };
147
+ }
141
148
 
142
149
  /**
143
150
  Override to get property getters map of name/functions
@@ -145,7 +152,7 @@ protected:
145
152
  virtual const JsiPropertyGettersMap &getExportedPropertyGettersMap() {
146
153
  static const JsiPropertyGettersMap empty;
147
154
  return empty;
148
- };
155
+ }
149
156
 
150
157
  /**
151
158
  Override to get property setters map of name/functions
@@ -153,7 +160,7 @@ protected:
153
160
  virtual const JsiPropertySettersMap &getExportedPropertySettersMap() {
154
161
  static const JsiPropertySettersMap empty;
155
162
  return empty;
156
- };
163
+ }
157
164
 
158
165
  /**
159
166
  * Overridden jsi::HostObject set property method