@maplibre/maplibre-react-native 10.0.0-alpha.18 → 10.0.0-alpha.19
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 +4 -0
- package/android/rctmln/build.gradle +4 -4
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNMapView.java +64 -64
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java +12 -1
- package/docs/FillExtrusionLayer.md +19 -0
- package/docs/RasterLayer.md +1 -1
- package/docs/SymbolLayer.md +7 -5
- package/docs/docs.json +25 -6
- package/ios/RCTMLN/RCTMLNStyle.h +1 -0
- package/ios/RCTMLN/RCTMLNStyle.m +7 -0
- package/javascript/components/annotations/Annotation.tsx +4 -1
- package/javascript/utils/MaplibreStyles.d.ts +191 -239
- package/javascript/utils/styleMap.ts +1 -0
- package/package.json +3 -3
- package/scripts/autogenHelpers/globals.js +24 -67
- package/scripts/autogenerate.js +12 -5
- package/style-spec/v8.json +1248 -655
|
@@ -178,6 +178,7 @@ const styleMap = {
|
|
|
178
178
|
fillExtrusionHeightTransition: StyleTypes.Transition,
|
|
179
179
|
fillExtrusionBase: StyleTypes.Constant,
|
|
180
180
|
fillExtrusionBaseTransition: StyleTypes.Transition,
|
|
181
|
+
fillExtrusionVerticalGradient: StyleTypes.Constant,
|
|
181
182
|
|
|
182
183
|
rasterOpacity: StyleTypes.Constant,
|
|
183
184
|
rasterOpacityTransition: StyleTypes.Transition,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "A MapLibre GL Native plugin for creating maps in React Native",
|
|
4
|
-
"version": "10.0.0-alpha.
|
|
4
|
+
"version": "10.0.0-alpha.19",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"fetch:style:spec": "./scripts/download-style-spec.sh",
|
|
25
|
-
"generate": "yarn node ./scripts/autogenerate",
|
|
26
|
-
"test": "
|
|
25
|
+
"generate": "yarn fetch:style:spec && yarn node ./scripts/autogenerate",
|
|
26
|
+
"test": "yarn lint && yarn unittest",
|
|
27
27
|
"unittest": "jest",
|
|
28
28
|
"unittest:single": "jest --testNamePattern",
|
|
29
29
|
"lint": "eslint .",
|
|
@@ -263,73 +263,30 @@ global.getEnums = function (layers) {
|
|
|
263
263
|
};
|
|
264
264
|
|
|
265
265
|
global.dtsInterfaceType = function (prop) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
// propTypes.push('ConstantPropType');
|
|
293
|
-
} else if (prop.type === 'number') {
|
|
294
|
-
propTypes.push('number');
|
|
295
|
-
} else if (prop.type === 'enum') {
|
|
296
|
-
propTypes.push(
|
|
297
|
-
`Enum<${pascelCase(prop.name)}Enum, ${pascelCase(prop.name)}EnumValues>`,
|
|
298
|
-
);
|
|
299
|
-
} else if (prop.type === 'boolean') {
|
|
300
|
-
propTypes.push('boolean');
|
|
301
|
-
} else if (prop.type === 'resolvedImage') {
|
|
302
|
-
propTypes.push('ResolvedImageType');
|
|
303
|
-
} else if (prop.type === 'formatted') {
|
|
304
|
-
propTypes.push('FormattedString');
|
|
305
|
-
} else if (prop.type === 'string') {
|
|
306
|
-
propTypes.push('string');
|
|
307
|
-
} else {
|
|
308
|
-
console.error('Unexpected type:', prop.type);
|
|
309
|
-
throw new Error(`Unexpected type: ${prop.type} for ${prop.name}`);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/*
|
|
313
|
-
if (prop.allowedFunctionTypes && prop.allowedFunctionTypes.length > 0) {
|
|
314
|
-
propTypes.push('StyleFunctionProps');
|
|
315
|
-
}
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
if (propTypes.length > 1) {
|
|
319
|
-
return `${propTypes.map((p) => startAtSpace(4, p)).join(' | ')},
|
|
320
|
-
${startAtSpace(2, '')}`;
|
|
321
|
-
} else {
|
|
322
|
-
if (prop.expressionSupported) {
|
|
323
|
-
let params = '';
|
|
324
|
-
if (prop.expression && prop.expression.parameters) {
|
|
325
|
-
params = `,[${prop.expression.parameters
|
|
326
|
-
.map((v) => `'${v}'`)
|
|
327
|
-
.join(',')}]`;
|
|
328
|
-
}
|
|
329
|
-
return `Value<${propTypes[0]}${params}>`;
|
|
330
|
-
} else {
|
|
331
|
-
return propTypes[0];
|
|
332
|
-
}
|
|
266
|
+
switch (prop.type) {
|
|
267
|
+
case 'number':
|
|
268
|
+
return 'number';
|
|
269
|
+
case 'string':
|
|
270
|
+
return 'string';
|
|
271
|
+
case 'boolean':
|
|
272
|
+
return 'boolean';
|
|
273
|
+
case 'array':
|
|
274
|
+
return 'any[]';
|
|
275
|
+
case 'padding':
|
|
276
|
+
return 'number[]';
|
|
277
|
+
case 'enum':
|
|
278
|
+
return prop.doc && prop.doc.values ?
|
|
279
|
+
Object.keys(prop.doc.values).map(value => `'${value}'`).join(' | ') :
|
|
280
|
+
'string';
|
|
281
|
+
case 'color':
|
|
282
|
+
return 'string';
|
|
283
|
+
case 'resolvedImage':
|
|
284
|
+
return 'string';
|
|
285
|
+
case 'formatted':
|
|
286
|
+
return 'string';
|
|
287
|
+
// ... other cases ...
|
|
288
|
+
default:
|
|
289
|
+
throw new Error(`Unexpected type: ${prop.type} for ${prop.name}`);
|
|
333
290
|
}
|
|
334
291
|
};
|
|
335
292
|
|
package/scripts/autogenerate.js
CHANGED
|
@@ -139,7 +139,12 @@ function getPropertiesForLayer(layerName) {
|
|
|
139
139
|
) {
|
|
140
140
|
prop.allowedFunctionTypes = ['camera'];
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
// Overide type padding
|
|
143
|
+
if(prop.type === 'padding') {
|
|
144
|
+
prop.type = 'array';
|
|
145
|
+
prop.value = 'number';
|
|
146
|
+
prop.length = 4;
|
|
147
|
+
}
|
|
143
148
|
return prop;
|
|
144
149
|
});
|
|
145
150
|
|
|
@@ -325,10 +330,6 @@ async function generate() {
|
|
|
325
330
|
input: path.join(TMPL_PATH, 'RCTMLNStyle.h.ejs'),
|
|
326
331
|
output: path.join(IOS_OUTPUT_PATH, 'RCTMLNStyle.h'),
|
|
327
332
|
},
|
|
328
|
-
/*{
|
|
329
|
-
input: path.join(TMPL_PATH, 'index.d.ts.ejs'),
|
|
330
|
-
output: path.join(IOS_OUTPUT_PATH, 'index.d.ts'),
|
|
331
|
-
},*/
|
|
332
333
|
{
|
|
333
334
|
input: path.join(TMPL_PATH, 'MaplibreStyles.ts.ejs'),
|
|
334
335
|
output: path.join(JS_OUTPUT_PATH, 'MaplibreStyles.d.ts'),
|
|
@@ -356,6 +357,12 @@ async function generate() {
|
|
|
356
357
|
let results = tmpl({layers});
|
|
357
358
|
if (filename.endsWith('ts')) {
|
|
358
359
|
results = await prettier.format(results, { ...prettierrc, filepath: filename});
|
|
360
|
+
// Ensure all enums are exported
|
|
361
|
+
results = results.replace(/enum (\w+Enum) \{[^}]+\}\n/g, 'export $&');
|
|
362
|
+
// Replace Array<any> with any[]
|
|
363
|
+
results = results.replace(/Array<any>/g, 'any[]');
|
|
364
|
+
// Replace padding type with float array
|
|
365
|
+
results = results.replace(/padding: string;/g, 'padding: number[];');
|
|
359
366
|
}
|
|
360
367
|
fs.writeFileSync(output, results);
|
|
361
368
|
}));
|