@granite-js/naver-map 1.0.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/GraniteNaverMap.podspec +81 -0
  3. package/android/build.gradle +160 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/builtinProvider/java/run/granite/navermap/builtinProvider/BuiltInGraniteNaverMapProvider.kt +549 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/java/run/granite/navermap/GraniteNaverMapEvents.kt +91 -0
  8. package/android/src/main/java/run/granite/navermap/GraniteNaverMapPackage.kt +16 -0
  9. package/android/src/main/java/run/granite/navermap/GraniteNaverMapProvider.kt +242 -0
  10. package/android/src/main/java/run/granite/navermap/GraniteNaverMapRegistry.kt +116 -0
  11. package/android/src/main/java/run/granite/navermap/GraniteNaverMapView.kt +732 -0
  12. package/android/src/newarch/java/run/granite/navermap/GraniteNaverMapViewManager.kt +446 -0
  13. package/android/src/oldarch/java/run/granite/navermap/GraniteNaverMapViewManager.kt +249 -0
  14. package/dist/module/NaverMapView.js +110 -0
  15. package/dist/module/NaverMapView.js.map +1 -0
  16. package/dist/module/index.js +6 -0
  17. package/dist/module/index.js.map +1 -0
  18. package/dist/module/internals/colorUtils.js +624 -0
  19. package/dist/module/internals/colorUtils.js.map +1 -0
  20. package/dist/module/internals/context.js +8 -0
  21. package/dist/module/internals/context.js.map +1 -0
  22. package/dist/module/internals/id.js +10 -0
  23. package/dist/module/internals/id.js.map +1 -0
  24. package/dist/module/internals/useMapOverlay.js +44 -0
  25. package/dist/module/internals/useMapOverlay.js.map +1 -0
  26. package/dist/module/internals/usePreservedReference.js +36 -0
  27. package/dist/module/internals/usePreservedReference.js.map +1 -0
  28. package/dist/module/overlays/ArrowheadPath.js +37 -0
  29. package/dist/module/overlays/ArrowheadPath.js.map +1 -0
  30. package/dist/module/overlays/Circle.js +35 -0
  31. package/dist/module/overlays/Circle.js.map +1 -0
  32. package/dist/module/overlays/GroundOverlay.js +30 -0
  33. package/dist/module/overlays/GroundOverlay.js.map +1 -0
  34. package/dist/module/overlays/InfoWindow.js +32 -0
  35. package/dist/module/overlays/InfoWindow.js.map +1 -0
  36. package/dist/module/overlays/Marker.js +37 -0
  37. package/dist/module/overlays/Marker.js.map +1 -0
  38. package/dist/module/overlays/Path.js +41 -0
  39. package/dist/module/overlays/Path.js.map +1 -0
  40. package/dist/module/overlays/Polygon.js +51 -0
  41. package/dist/module/overlays/Polygon.js.map +1 -0
  42. package/dist/module/overlays/Polyline.js +60 -0
  43. package/dist/module/overlays/Polyline.js.map +1 -0
  44. package/dist/module/overlays/index.js +11 -0
  45. package/dist/module/overlays/index.js.map +1 -0
  46. package/dist/module/package.json +1 -0
  47. package/dist/module/specs/GraniteNaverMapViewNativeComponent.ts +352 -0
  48. package/dist/module/types/Coord.js +2 -0
  49. package/dist/module/types/Coord.js.map +1 -0
  50. package/dist/module/types/index.js +29 -0
  51. package/dist/module/types/index.js.map +1 -0
  52. package/dist/typescript/NaverMapView.d.ts +41 -0
  53. package/dist/typescript/index.d.ts +3 -0
  54. package/dist/typescript/internals/colorUtils.d.ts +10 -0
  55. package/dist/typescript/internals/context.d.ts +8 -0
  56. package/dist/typescript/internals/id.d.ts +1 -0
  57. package/dist/typescript/internals/useMapOverlay.d.ts +15 -0
  58. package/dist/typescript/internals/usePreservedReference.d.ts +6 -0
  59. package/dist/typescript/overlays/ArrowheadPath.d.ts +11 -0
  60. package/dist/typescript/overlays/Circle.d.ts +10 -0
  61. package/dist/typescript/overlays/GroundOverlay.d.ts +11 -0
  62. package/dist/typescript/overlays/InfoWindow.d.ts +14 -0
  63. package/dist/typescript/overlays/Marker.d.ts +16 -0
  64. package/dist/typescript/overlays/Path.d.ts +15 -0
  65. package/dist/typescript/overlays/Polygon.d.ts +10 -0
  66. package/dist/typescript/overlays/Polyline.d.ts +11 -0
  67. package/dist/typescript/overlays/index.d.ts +16 -0
  68. package/dist/typescript/specs/GraniteNaverMapViewNativeComponent.d.ts +92 -0
  69. package/dist/typescript/types/Coord.d.ts +4 -0
  70. package/dist/typescript/types/index.d.ts +55 -0
  71. package/ios/GraniteNaverMap-Bridging-Header.h +20 -0
  72. package/ios/GraniteNaverMapProvider.swift +312 -0
  73. package/ios/GraniteNaverMapRegistry.swift +91 -0
  74. package/ios/GraniteNaverMapView.h +15 -0
  75. package/ios/GraniteNaverMapView.mm +390 -0
  76. package/ios/GraniteNaverMapViewImpl.swift +496 -0
  77. package/ios/GraniteNaverMapViewManager.m +67 -0
  78. package/ios/GraniteNaverMapViewManager.swift +133 -0
  79. package/ios/GraniteNaverMapViewWrapper.swift +215 -0
  80. package/ios/builtinProvider/BuiltInNaverMapProvider.swift +489 -0
  81. package/ios/builtinProvider/GraniteNaverMapMarkerData.swift +66 -0
  82. package/ios/builtinProvider/NMFMarker+Extension.swift +65 -0
  83. package/ios/builtinProvider/RCTConvert+NMFMapView.h +17 -0
  84. package/ios/builtinProvider/RCTConvert+NMFMapView.m +67 -0
  85. package/package.json +103 -0
  86. package/src/NaverMapView.tsx +168 -0
  87. package/src/index.tsx +3 -0
  88. package/src/internals/colorUtils.ts +697 -0
  89. package/src/internals/context.ts +14 -0
  90. package/src/internals/id.ts +9 -0
  91. package/src/internals/useMapOverlay.ts +59 -0
  92. package/src/internals/usePreservedReference.ts +41 -0
  93. package/src/overlays/ArrowheadPath.ts +71 -0
  94. package/src/overlays/Circle.ts +68 -0
  95. package/src/overlays/GroundOverlay.ts +62 -0
  96. package/src/overlays/InfoWindow.ts +68 -0
  97. package/src/overlays/Marker.ts +83 -0
  98. package/src/overlays/Path.ts +87 -0
  99. package/src/overlays/Polygon.ts +83 -0
  100. package/src/overlays/Polyline.ts +93 -0
  101. package/src/overlays/index.ts +23 -0
  102. package/src/specs/GraniteNaverMapViewNativeComponent.ts +352 -0
  103. package/src/types/Coord.ts +4 -0
  104. package/src/types/index.ts +78 -0
@@ -0,0 +1,697 @@
1
+ function normalizeColor(color: string | number): number | null {
2
+ if (typeof color === 'number') {
3
+ if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) {
4
+ return color;
5
+ }
6
+ return null;
7
+ }
8
+
9
+ if (typeof color !== 'string') {
10
+ return null;
11
+ }
12
+
13
+ const matchers = getMatchers();
14
+ let match;
15
+
16
+ // Ordered based on occurrences on Facebook codebase
17
+ if ((match = matchers.hex6.exec(color))) {
18
+ return parseInt(match[1] + 'ff', 16) >>> 0;
19
+ }
20
+
21
+ const colorFromKeyword = normalizeKeyword(color);
22
+ if (colorFromKeyword != null) {
23
+ return colorFromKeyword;
24
+ }
25
+
26
+ if ((match = matchers.rgba.exec(color) || matchers.rgb.exec(color))) {
27
+ // rgb(R G B / A) / rgba(R G B / A) notation
28
+ if (match[9] !== undefined && match[10] !== undefined && match[11] !== undefined && match[12] !== undefined) {
29
+ return (
30
+ ((parse255(match[9]) << 24) | // r
31
+ (parse255(match[10]) << 16) | // g
32
+ (parse255(match[11]) << 8) | // b
33
+ parse1(match[12])) >>> // a
34
+ 0
35
+ );
36
+ }
37
+ // rgb(R, G, B, A) / rgba(R, G, B, A) notation
38
+ else if (match[5] !== undefined && match[6] !== undefined && match[7] !== undefined && match[8] !== undefined) {
39
+ return (
40
+ ((parse255(match[5]) << 24) | // r
41
+ (parse255(match[6]) << 16) | // g
42
+ (parse255(match[7]) << 8) | // b
43
+ parse1(match[8])) >>> // a
44
+ 0
45
+ );
46
+ }
47
+ // rgb(R, G, B) / rgba(R, G, B) notation
48
+ if (match[2] === undefined || match[3] === undefined || match[4] === undefined) {
49
+ return null;
50
+ }
51
+ return (
52
+ ((parse255(match[2]) << 24) | // r
53
+ (parse255(match[3]) << 16) | // g
54
+ (parse255(match[4]) << 8) | // b
55
+ 0x000000ff) >>> // a
56
+ 0
57
+ );
58
+ }
59
+
60
+ if ((match = matchers.hex3.exec(color))) {
61
+ if (match[1] === undefined || match[2] === undefined || match[3] === undefined) {
62
+ return null;
63
+ }
64
+ return (
65
+ parseInt(
66
+ match[1] +
67
+ match[1] + // r
68
+ match[2] +
69
+ match[2] + // g
70
+ match[3] +
71
+ match[3] + // b
72
+ 'ff', // a
73
+ 16
74
+ ) >>> 0
75
+ );
76
+ }
77
+
78
+ // https://drafts.csswg.org/css-color-4/#hex-notation
79
+ if ((match = matchers.hex8.exec(color))) {
80
+ if (match[1] === undefined) {
81
+ return null;
82
+ }
83
+ return parseInt(match[1], 16) >>> 0;
84
+ }
85
+
86
+ if ((match = matchers.hex4.exec(color))) {
87
+ if (match[1] === undefined || match[2] === undefined || match[3] === undefined || match[4] === undefined) {
88
+ return null;
89
+ }
90
+ return (
91
+ parseInt(
92
+ match[1] +
93
+ match[1] + // r
94
+ match[2] +
95
+ match[2] + // g
96
+ match[3] +
97
+ match[3] + // b
98
+ match[4] +
99
+ match[4], // a
100
+ 16
101
+ ) >>> 0
102
+ );
103
+ }
104
+
105
+ if ((match = matchers.hsl.exec(color))) {
106
+ if (match[1] === undefined || match[2] === undefined || match[3] === undefined) {
107
+ return null;
108
+ }
109
+ return (
110
+ (hslToRgb(
111
+ parse360(match[1]), // h
112
+ parsePercentage(match[2]), // s
113
+ parsePercentage(match[3]) // l
114
+ ) |
115
+ 0x000000ff) >>> // a
116
+ 0
117
+ );
118
+ }
119
+
120
+ if ((match = matchers.hsla.exec(color))) {
121
+ // hsla(H S L / A) notation
122
+ if (match[6] !== undefined && match[7] !== undefined && match[8] !== undefined && match[9] !== undefined) {
123
+ return (
124
+ (hslToRgb(
125
+ parse360(match[6]), // h
126
+ parsePercentage(match[7]), // s
127
+ parsePercentage(match[8]) // l
128
+ ) |
129
+ parse1(match[9])) >>> // a
130
+ 0
131
+ );
132
+ }
133
+
134
+ // hsla(H, S, L, A) notation
135
+ if (match[2] === undefined || match[3] === undefined || match[4] === undefined || match[5] === undefined) {
136
+ return null;
137
+ }
138
+ return (
139
+ (hslToRgb(
140
+ parse360(match[2]), // h
141
+ parsePercentage(match[3]), // s
142
+ parsePercentage(match[4]) // l
143
+ ) |
144
+ parse1(match[5])) >>> // a
145
+ 0
146
+ );
147
+ }
148
+
149
+ if ((match = matchers.hwb.exec(color))) {
150
+ if (match[5] !== undefined && match[6] !== undefined && match[7] !== undefined && match[8] !== undefined) {
151
+ // hwb(H W B / A) notation
152
+ return (
153
+ (hwbToRgb(
154
+ parse360(match[5]), // h
155
+ parsePercentage(match[6]), // w
156
+ parsePercentage(match[7]) // b
157
+ ) |
158
+ parse1(match[8])) >>> // a
159
+ 0
160
+ );
161
+ }
162
+ // hwb(H W B) notation
163
+ if (match[2] === undefined || match[3] === undefined || match[4] === undefined) {
164
+ return null;
165
+ }
166
+ return (
167
+ (hwbToRgb(
168
+ parse360(match[2]), // h
169
+ parsePercentage(match[3]), // w
170
+ parsePercentage(match[4]) // b
171
+ ) |
172
+ 0x000000ff) >>> // a
173
+ 0
174
+ );
175
+ }
176
+
177
+ return null;
178
+ }
179
+
180
+ function hue2rgb(p: number, q: number, t: number): number {
181
+ if (t < 0) {
182
+ t += 1;
183
+ }
184
+ if (t > 1) {
185
+ t -= 1;
186
+ }
187
+ if (t < 1 / 6) {
188
+ return p + (q - p) * 6 * t;
189
+ }
190
+ if (t < 1 / 2) {
191
+ return q;
192
+ }
193
+ if (t < 2 / 3) {
194
+ return p + (q - p) * (2 / 3 - t) * 6;
195
+ }
196
+ return p;
197
+ }
198
+
199
+ function hslToRgb(h: number, s: number, l: number): number {
200
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
201
+ const p = 2 * l - q;
202
+ const r = hue2rgb(p, q, h + 1 / 3);
203
+ const g = hue2rgb(p, q, h);
204
+ const b = hue2rgb(p, q, h - 1 / 3);
205
+
206
+ return (Math.round(r * 255) << 24) | (Math.round(g * 255) << 16) | (Math.round(b * 255) << 8);
207
+ }
208
+
209
+ function hwbToRgb(h: number, w: number, b: number): number {
210
+ if (w + b >= 1) {
211
+ const gray = Math.round((w * 255) / (w + b));
212
+
213
+ return (gray << 24) | (gray << 16) | (gray << 8);
214
+ }
215
+
216
+ const red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w;
217
+ const green = hue2rgb(0, 1, h) * (1 - w - b) + w;
218
+ const blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
219
+
220
+ return (Math.round(red * 255) << 24) | (Math.round(green * 255) << 16) | (Math.round(blue * 255) << 8);
221
+ }
222
+
223
+ const NUMBER = '[-+]?\\d*\\.?\\d+';
224
+ const PERCENTAGE = NUMBER + '%';
225
+
226
+ function call(...args: string[]): string {
227
+ return '\\(\\s*(' + args.join(')\\s*,?\\s*(') + ')\\s*\\)';
228
+ }
229
+
230
+ function callModern(...args: string[]): string {
231
+ return '\\(\\s*(' + args.join(')\\s*(') + ')\\s*\\)';
232
+ }
233
+
234
+ function callWithSlashSeparator(...args: string[]): string {
235
+ return (
236
+ '\\(\\s*(' +
237
+ args.slice(0, args.length - 1).join(')\\s*,?\\s*(') +
238
+ ')\\s*/\\s*(' +
239
+ args[args.length - 1] +
240
+ ')\\s*\\)'
241
+ );
242
+ }
243
+
244
+ function commaSeparatedCall(...args: string[]): string {
245
+ return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
246
+ }
247
+
248
+ let cachedMatchers: {
249
+ rgb: RegExp;
250
+ rgba: RegExp;
251
+ hsl: RegExp;
252
+ hsla: RegExp;
253
+ hwb: RegExp;
254
+ hex3: RegExp;
255
+ hex4: RegExp;
256
+ hex6: RegExp;
257
+ hex8: RegExp;
258
+ };
259
+
260
+ function getMatchers(): typeof cachedMatchers {
261
+ if (cachedMatchers === undefined) {
262
+ const rgbRegexPattern =
263
+ call(NUMBER, NUMBER, NUMBER) +
264
+ '|' +
265
+ commaSeparatedCall(NUMBER, NUMBER, NUMBER, NUMBER) +
266
+ '|' +
267
+ callWithSlashSeparator(NUMBER, NUMBER, NUMBER, NUMBER);
268
+
269
+ cachedMatchers = {
270
+ rgb: new RegExp('rgb(' + rgbRegexPattern + ')'),
271
+ rgba: new RegExp('rgba(' + rgbRegexPattern + ')'),
272
+ hsl: new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)),
273
+ hsla: new RegExp(
274
+ 'hsla(' +
275
+ commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) +
276
+ '|' +
277
+ callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) +
278
+ ')'
279
+ ),
280
+ hwb: new RegExp(
281
+ 'hwb(' +
282
+ callModern(NUMBER, PERCENTAGE, PERCENTAGE) +
283
+ '|' +
284
+ callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) +
285
+ ')'
286
+ ),
287
+ hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
288
+ hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
289
+ hex6: /^#([0-9a-fA-F]{6})$/,
290
+ hex8: /^#([0-9a-fA-F]{8})$/,
291
+ };
292
+ }
293
+ return cachedMatchers;
294
+ }
295
+
296
+ function parse255(str: string): number {
297
+ const int = parseInt(str, 10);
298
+ if (int < 0) {
299
+ return 0;
300
+ }
301
+ if (int > 255) {
302
+ return 255;
303
+ }
304
+ return int;
305
+ }
306
+
307
+ function parse360(str: string): number {
308
+ const int = parseFloat(str);
309
+ return (((int % 360) + 360) % 360) / 360;
310
+ }
311
+
312
+ function parse1(str: string): number {
313
+ const num = parseFloat(str);
314
+ if (num < 0) {
315
+ return 0;
316
+ }
317
+ if (num > 1) {
318
+ return 255;
319
+ }
320
+ return Math.round(num * 255);
321
+ }
322
+
323
+ function parsePercentage(str: string): number {
324
+ // parseFloat conveniently ignores the final %
325
+ const int = parseFloat(str);
326
+ if (int < 0) {
327
+ return 0;
328
+ }
329
+ if (int > 100) {
330
+ return 1;
331
+ }
332
+ return int / 100;
333
+ }
334
+
335
+ function normalizeKeyword(name: string): number | null {
336
+ switch (name) {
337
+ case 'transparent':
338
+ return 0x00000000;
339
+ // http://www.w3.org/TR/css3-color/#svg-color
340
+ case 'aliceblue':
341
+ return 0xf0f8ffff;
342
+ case 'antiquewhite':
343
+ return 0xfaebd7ff;
344
+ case 'aqua':
345
+ return 0x00ffffff;
346
+ case 'aquamarine':
347
+ return 0x7fffd4ff;
348
+ case 'azure':
349
+ return 0xf0ffffff;
350
+ case 'beige':
351
+ return 0xf5f5dcff;
352
+ case 'bisque':
353
+ return 0xffe4c4ff;
354
+ case 'black':
355
+ return 0x000000ff;
356
+ case 'blanchedalmond':
357
+ return 0xffebcdff;
358
+ case 'blue':
359
+ return 0x0000ffff;
360
+ case 'blueviolet':
361
+ return 0x8a2be2ff;
362
+ case 'brown':
363
+ return 0xa52a2aff;
364
+ case 'burlywood':
365
+ return 0xdeb887ff;
366
+ case 'burntsienna':
367
+ return 0xea7e5dff;
368
+ case 'cadetblue':
369
+ return 0x5f9ea0ff;
370
+ case 'chartreuse':
371
+ return 0x7fff00ff;
372
+ case 'chocolate':
373
+ return 0xd2691eff;
374
+ case 'coral':
375
+ return 0xff7f50ff;
376
+ case 'cornflowerblue':
377
+ return 0x6495edff;
378
+ case 'cornsilk':
379
+ return 0xfff8dcff;
380
+ case 'crimson':
381
+ return 0xdc143cff;
382
+ case 'cyan':
383
+ return 0x00ffffff;
384
+ case 'darkblue':
385
+ return 0x00008bff;
386
+ case 'darkcyan':
387
+ return 0x008b8bff;
388
+ case 'darkgoldenrod':
389
+ return 0xb8860bff;
390
+ case 'darkgray':
391
+ return 0xa9a9a9ff;
392
+ case 'darkgreen':
393
+ return 0x006400ff;
394
+ case 'darkgrey':
395
+ return 0xa9a9a9ff;
396
+ case 'darkkhaki':
397
+ return 0xbdb76bff;
398
+ case 'darkmagenta':
399
+ return 0x8b008bff;
400
+ case 'darkolivegreen':
401
+ return 0x556b2fff;
402
+ case 'darkorange':
403
+ return 0xff8c00ff;
404
+ case 'darkorchid':
405
+ return 0x9932ccff;
406
+ case 'darkred':
407
+ return 0x8b0000ff;
408
+ case 'darksalmon':
409
+ return 0xe9967aff;
410
+ case 'darkseagreen':
411
+ return 0x8fbc8fff;
412
+ case 'darkslateblue':
413
+ return 0x483d8bff;
414
+ case 'darkslategray':
415
+ return 0x2f4f4fff;
416
+ case 'darkslategrey':
417
+ return 0x2f4f4fff;
418
+ case 'darkturquoise':
419
+ return 0x00ced1ff;
420
+ case 'darkviolet':
421
+ return 0x9400d3ff;
422
+ case 'deeppink':
423
+ return 0xff1493ff;
424
+ case 'deepskyblue':
425
+ return 0x00bfffff;
426
+ case 'dimgray':
427
+ return 0x696969ff;
428
+ case 'dimgrey':
429
+ return 0x696969ff;
430
+ case 'dodgerblue':
431
+ return 0x1e90ffff;
432
+ case 'firebrick':
433
+ return 0xb22222ff;
434
+ case 'floralwhite':
435
+ return 0xfffaf0ff;
436
+ case 'forestgreen':
437
+ return 0x228b22ff;
438
+ case 'fuchsia':
439
+ return 0xff00ffff;
440
+ case 'gainsboro':
441
+ return 0xdcdcdcff;
442
+ case 'ghostwhite':
443
+ return 0xf8f8ffff;
444
+ case 'gold':
445
+ return 0xffd700ff;
446
+ case 'goldenrod':
447
+ return 0xdaa520ff;
448
+ case 'gray':
449
+ return 0x808080ff;
450
+ case 'green':
451
+ return 0x008000ff;
452
+ case 'greenyellow':
453
+ return 0xadff2fff;
454
+ case 'grey':
455
+ return 0x808080ff;
456
+ case 'honeydew':
457
+ return 0xf0fff0ff;
458
+ case 'hotpink':
459
+ return 0xff69b4ff;
460
+ case 'indianred':
461
+ return 0xcd5c5cff;
462
+ case 'indigo':
463
+ return 0x4b0082ff;
464
+ case 'ivory':
465
+ return 0xfffff0ff;
466
+ case 'khaki':
467
+ return 0xf0e68cff;
468
+ case 'lavender':
469
+ return 0xe6e6faff;
470
+ case 'lavenderblush':
471
+ return 0xfff0f5ff;
472
+ case 'lawngreen':
473
+ return 0x7cfc00ff;
474
+ case 'lemonchiffon':
475
+ return 0xfffacdff;
476
+ case 'lightblue':
477
+ return 0xadd8e6ff;
478
+ case 'lightcoral':
479
+ return 0xf08080ff;
480
+ case 'lightcyan':
481
+ return 0xe0ffffff;
482
+ case 'lightgoldenrodyellow':
483
+ return 0xfafad2ff;
484
+ case 'lightgray':
485
+ return 0xd3d3d3ff;
486
+ case 'lightgreen':
487
+ return 0x90ee90ff;
488
+ case 'lightgrey':
489
+ return 0xd3d3d3ff;
490
+ case 'lightpink':
491
+ return 0xffb6c1ff;
492
+ case 'lightsalmon':
493
+ return 0xffa07aff;
494
+ case 'lightseagreen':
495
+ return 0x20b2aaff;
496
+ case 'lightskyblue':
497
+ return 0x87cefaff;
498
+ case 'lightslategray':
499
+ return 0x778899ff;
500
+ case 'lightslategrey':
501
+ return 0x778899ff;
502
+ case 'lightsteelblue':
503
+ return 0xb0c4deff;
504
+ case 'lightyellow':
505
+ return 0xffffe0ff;
506
+ case 'lime':
507
+ return 0x00ff00ff;
508
+ case 'limegreen':
509
+ return 0x32cd32ff;
510
+ case 'linen':
511
+ return 0xfaf0e6ff;
512
+ case 'magenta':
513
+ return 0xff00ffff;
514
+ case 'maroon':
515
+ return 0x800000ff;
516
+ case 'mediumaquamarine':
517
+ return 0x66cdaaff;
518
+ case 'mediumblue':
519
+ return 0x0000cdff;
520
+ case 'mediumorchid':
521
+ return 0xba55d3ff;
522
+ case 'mediumpurple':
523
+ return 0x9370dbff;
524
+ case 'mediumseagreen':
525
+ return 0x3cb371ff;
526
+ case 'mediumslateblue':
527
+ return 0x7b68eeff;
528
+ case 'mediumspringgreen':
529
+ return 0x00fa9aff;
530
+ case 'mediumturquoise':
531
+ return 0x48d1ccff;
532
+ case 'mediumvioletred':
533
+ return 0xc71585ff;
534
+ case 'midnightblue':
535
+ return 0x191970ff;
536
+ case 'mintcream':
537
+ return 0xf5fffaff;
538
+ case 'mistyrose':
539
+ return 0xffe4e1ff;
540
+ case 'moccasin':
541
+ return 0xffe4b5ff;
542
+ case 'navajowhite':
543
+ return 0xffdeadff;
544
+ case 'navy':
545
+ return 0x000080ff;
546
+ case 'oldlace':
547
+ return 0xfdf5e6ff;
548
+ case 'olive':
549
+ return 0x808000ff;
550
+ case 'olivedrab':
551
+ return 0x6b8e23ff;
552
+ case 'orange':
553
+ return 0xffa500ff;
554
+ case 'orangered':
555
+ return 0xff4500ff;
556
+ case 'orchid':
557
+ return 0xda70d6ff;
558
+ case 'palegoldenrod':
559
+ return 0xeee8aaff;
560
+ case 'palegreen':
561
+ return 0x98fb98ff;
562
+ case 'paleturquoise':
563
+ return 0xafeeeeff;
564
+ case 'palevioletred':
565
+ return 0xdb7093ff;
566
+ case 'papayawhip':
567
+ return 0xffefd5ff;
568
+ case 'peachpuff':
569
+ return 0xffdab9ff;
570
+ case 'peru':
571
+ return 0xcd853fff;
572
+ case 'pink':
573
+ return 0xffc0cbff;
574
+ case 'plum':
575
+ return 0xdda0ddff;
576
+ case 'powderblue':
577
+ return 0xb0e0e6ff;
578
+ case 'purple':
579
+ return 0x800080ff;
580
+ case 'rebeccapurple':
581
+ return 0x663399ff;
582
+ case 'red':
583
+ return 0xff0000ff;
584
+ case 'rosybrown':
585
+ return 0xbc8f8fff;
586
+ case 'royalblue':
587
+ return 0x4169e1ff;
588
+ case 'saddlebrown':
589
+ return 0x8b4513ff;
590
+ case 'salmon':
591
+ return 0xfa8072ff;
592
+ case 'sandybrown':
593
+ return 0xf4a460ff;
594
+ case 'seagreen':
595
+ return 0x2e8b57ff;
596
+ case 'seashell':
597
+ return 0xfff5eeff;
598
+ case 'sienna':
599
+ return 0xa0522dff;
600
+ case 'silver':
601
+ return 0xc0c0c0ff;
602
+ case 'skyblue':
603
+ return 0x87ceebff;
604
+ case 'slateblue':
605
+ return 0x6a5acdff;
606
+ case 'slategray':
607
+ return 0x708090ff;
608
+ case 'slategrey':
609
+ return 0x708090ff;
610
+ case 'snow':
611
+ return 0xfffafaff;
612
+ case 'springgreen':
613
+ return 0x00ff7fff;
614
+ case 'steelblue':
615
+ return 0x4682b4ff;
616
+ case 'tan':
617
+ return 0xd2b48cff;
618
+ case 'teal':
619
+ return 0x008080ff;
620
+ case 'thistle':
621
+ return 0xd8bfd8ff;
622
+ case 'tomato':
623
+ return 0xff6347ff;
624
+ case 'turquoise':
625
+ return 0x40e0d0ff;
626
+ case 'violet':
627
+ return 0xee82eeff;
628
+ case 'wheat':
629
+ return 0xf5deb3ff;
630
+ case 'white':
631
+ return 0xffffffff;
632
+ case 'whitesmoke':
633
+ return 0xf5f5f5ff;
634
+ case 'yellow':
635
+ return 0xffff00ff;
636
+ case 'yellowgreen':
637
+ return 0x9acd32ff;
638
+ }
639
+ return null;
640
+ }
641
+
642
+ // Convert RRGGBBAA (normalizeColor output) to AARRGGBB (Android format)
643
+ export const rgbaToArgb = (rgba: number): number => {
644
+ const r = (rgba >>> 24) & 0xff;
645
+ const g = (rgba >>> 16) & 0xff;
646
+ const b = (rgba >>> 8) & 0xff;
647
+ const a = rgba & 0xff;
648
+ return ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;
649
+ };
650
+
651
+ // Convert unsigned color to signed Int32 (for Codegen compatibility)
652
+ export const toSignedInt32 = (n: number): number => (n > 0x7fffffff ? n - 0x100000000 : n);
653
+
654
+ // Process color from normalizeColor output (RRGGBBAA -> AARRGGBB -> signed Int32)
655
+ export const processColor = (
656
+ color: number | null | undefined,
657
+ defaultColor = 0xff000000ff // Default: opaque black in RRGGBBAA
658
+ ): number => {
659
+ const rgba = typeof color === 'number' ? color : defaultColor;
660
+ const argb = rgbaToArgb(rgba);
661
+ return toSignedInt32(argb);
662
+ };
663
+
664
+ // Process color that's already in AARRGGBB format (just convert to signed Int32)
665
+ export const processArgbColor = (
666
+ color: number | null | undefined,
667
+ defaultColor = 0xff000000 // Default: opaque black in AARRGGBB
668
+ ): number => {
669
+ const argb = typeof color === 'number' ? color : defaultColor;
670
+ return toSignedInt32(argb);
671
+ };
672
+
673
+ /**
674
+ * Process raw color input from user (handles both string and number inputs)
675
+ * - String colors (e.g., "#FF0000", "red") → normalize → RRGGBBAA → convert to AARRGGBB → signed
676
+ * - Number colors (e.g., 0xFFFF0000) → assume AARRGGBB → just convert to signed
677
+ */
678
+ export const processColorInput = (
679
+ color: number | string | null | undefined,
680
+ defaultColorArgb = 0xff000000 // Default in AARRGGBB format
681
+ ): number => {
682
+ if (color == null) {
683
+ return toSignedInt32(defaultColorArgb);
684
+ }
685
+
686
+ if (typeof color === 'string') {
687
+ const normalized = normalizeColor(color);
688
+ if (normalized == null) {
689
+ return toSignedInt32(defaultColorArgb);
690
+ }
691
+ const argb = rgbaToArgb(normalized);
692
+ return toSignedInt32(argb);
693
+ }
694
+
695
+ // Number color - assume already in AARRGGBB format
696
+ return toSignedInt32(color);
697
+ };
@@ -0,0 +1,14 @@
1
+ import { createContext, useContext } from 'react';
2
+ import type { View } from 'react-native';
3
+ import type { MarkerEventListeners } from '../overlays/Marker';
4
+
5
+ export interface MapContextValue {
6
+ readonly mapView: View;
7
+ markers: Map<string, MarkerEventListeners>;
8
+ }
9
+
10
+ export const MapContext = createContext<MapContextValue | null>(null);
11
+
12
+ export function useMapContext() {
13
+ return useContext(MapContext);
14
+ }
@@ -0,0 +1,9 @@
1
+ import { useState } from 'react';
2
+
3
+ function generateId() {
4
+ return Math.random().toString(36).substring(2) + Date.now().toString(36);
5
+ }
6
+
7
+ export function useOverlayId() {
8
+ return useState(generateId)[0];
9
+ }