@nativescript-community/ui-mapbox 6.2.29 → 6.2.31

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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.2.31](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.30...v6.2.31) (2024-10-04)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-mapbox
9
+
10
+ ## [6.2.30](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.29...v6.2.30) (2024-10-01)
11
+
12
+ ### Bug Fixes
13
+
14
+ * **ios:** updated Mapbox to 6.4.2 with bitcode disabled ([6bc7eb5](https://github.com/nativescript-community/ui-mapbox/commit/6bc7eb55ef8444a9c02c787f95ef757de3e13efc))
15
+
6
16
  ## [6.2.29](https://github.com/nativescript-community/ui-mapbox/compare/v6.2.28...v6.2.29) (2024-09-21)
7
17
 
8
18
  **Note:** Version bump only for package @nativescript-community/ui-mapbox
@@ -2,6 +2,41 @@ import { Color } from '@nativescript/core';
2
2
  function toCamelCase(s) {
3
3
  return s.replace(/([-_][a-z])/gi, ($1) => $1.toUpperCase().replace('-', '').replace('_', ''));
4
4
  }
5
+ const styleExtras = {
6
+ // padding
7
+ iconTextFitPadding: {
8
+ iosType: 'edgeinsets'
9
+ },
10
+ // offsets
11
+ iconOffset: {
12
+ iosType: 'vector'
13
+ },
14
+ textOffset: {
15
+ iosType: 'vector'
16
+ },
17
+ lineOffset: {
18
+ iosType: 'vector'
19
+ },
20
+ // translates
21
+ fillTranslate: {
22
+ iosType: 'vector'
23
+ },
24
+ lineTranslate: {
25
+ iosType: 'vector'
26
+ },
27
+ iconTranslate: {
28
+ iosType: 'vector'
29
+ },
30
+ textTranslate: {
31
+ iosType: 'vector'
32
+ },
33
+ circleTranslate: {
34
+ iosType: 'vector'
35
+ },
36
+ fillExtrusionTranslate: {
37
+ iosType: 'vector'
38
+ }
39
+ };
5
40
  const keysMap = {
6
41
  'circle-pitch-scale': 'circleScaleAlignment',
7
42
  'circle-translate': 'circleTranslation',
@@ -39,24 +74,39 @@ const keysMap = {
39
74
  'raster-brightness-min': 'maximumRasterBrightness',
40
75
  'raster-brightness-max': 'minimumRasterBrightness'
41
76
  };
42
- function transformValue(key, value) {
43
- if (key.indexOf('-color') !== -1 && !Array.isArray(value)) {
77
+ function transformValue(key, value, _styleType) {
78
+ if (_styleType === 'color') {
44
79
  const color = value instanceof Color ? value : new Color(value);
45
80
  return color.ios;
46
81
  }
47
- switch (key) {
48
- case 'raster-resampling':
49
- if (value === 'linear') {
50
- return 0 /* MGLRasterResamplingMode.Linear */;
51
- }
52
- else if (value === 'nearest') {
53
- return 1 /* MGLRasterResamplingMode.Nearest */;
54
- }
55
- else {
82
+ else if (_styleType === 'vector') {
83
+ const vector = CGVectorMake(value[0], value[1]);
84
+ return NSExpression.expressionWithMGLJSONObject(NSValue.valueWithCGVector(vector));
85
+ }
86
+ else if (_styleType === 'edgeinsets') {
87
+ const edgeInsets = new UIEdgeInsets({
88
+ top: value[0],
89
+ left: value[1],
90
+ bottom: value[2],
91
+ right: value[3]
92
+ });
93
+ return NSExpression.expressionWithMGLJSONObject(NSValue.valueWithUIEdgeInsets(edgeInsets));
94
+ }
95
+ else {
96
+ switch (key) {
97
+ case 'raster-resampling':
98
+ if (value === 'linear') {
99
+ return 0 /* MGLRasterResamplingMode.Linear */;
100
+ }
101
+ else if (value === 'nearest') {
102
+ return 1 /* MGLRasterResamplingMode.Nearest */;
103
+ }
104
+ else {
105
+ return value;
106
+ }
107
+ default:
56
108
  return value;
57
- }
58
- default:
59
- return value;
109
+ }
60
110
  }
61
111
  }
62
112
  export class PropertyParser {
@@ -66,7 +116,7 @@ export class PropertyParser {
66
116
  Object.keys(propertiesObject).forEach((k) => {
67
117
  const actualKey = keysMap[k] || toCamelCase(k);
68
118
  const value = propertiesObject[k];
69
- const rValue = transformValue(k, value);
119
+ const rValue = transformValue(k, value, styleExtras[k]?.iosType);
70
120
  if (Array.isArray(value)) {
71
121
  nProperties[actualKey] = NSExpression.expressionWithMGLJSONObject(rValue);
72
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-mapbox",
3
- "version": "6.2.29",
3
+ "version": "6.2.31",
4
4
  "description": "Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.",
5
5
  "main": "index",
6
6
  "typings": "index.d.ts",
@@ -54,5 +54,5 @@
54
54
  "dependencies": {
55
55
  "@nativescript-community/perms": "^2.3.0"
56
56
  },
57
- "gitHead": "2bfa8ee6d14b84c3c882875ebb6aaedca9b7fb64"
57
+ "gitHead": "e5fa6d76aae45d35f8f4bacf7617423e77130f12"
58
58
  }
@@ -1,3 +1,2 @@
1
- platform :ios, '13.0'
2
-
3
- pod 'Mapbox-iOS-SDK', '~> 5.1.1'
1
+ # see https://github.com/CocoaPods/CocoaPods/issues/11867 for why i use podspec
2
+ pod 'Mapbox-iOS-SDK', :podspec => 'https://raw.githubusercontent.com/nativescript-community/mapbox-gl-native-ios/refs/heads/main/Mapbox-iOS-SDK.podspec'