@rnmapbox/maps 10.0.0-beta.49 → 10.0.0-beta.53
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/android/.gitignore +9 -0
- package/android/.npmignore +9 -0
- package/android/rctmgl/.gitignore +1 -0
- package/android/rctmgl/.npmignore +1 -0
- package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/modules/RCTMGLModule.java +2 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/modules/RCTMGLModule.kt +3 -1
- package/index.d.ts +1 -1
- package/ios/RCTMGL/MGLModule.m +2 -1
- package/ios/RCTMGL-v10/MGLModule.m +3 -1
- package/ios/RCTMGL-v10/MGLModule.swift +15 -2
- package/javascript/components/AbstractLayer.tsx +2 -1
- package/javascript/components/Camera.tsx +1 -2
- package/javascript/index.js +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +1 -2
- package/javascript/utils/{MapboxStyles.ts → MapboxStyles.d.ts} +0 -0
- package/javascript/utils/StyleValue.ts +3 -8
- package/lib/commonjs/classes/AnimatedCoordinatesArray.js +165 -0
- package/lib/commonjs/classes/AnimatedCoordinatesArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js +44 -0
- package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedPoint.js +117 -0
- package/lib/commonjs/classes/AnimatedPoint.js.map +1 -0
- package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js +155 -0
- package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedShape.js +78 -0
- package/lib/commonjs/classes/AnimatedShape.js.map +1 -0
- package/lib/commonjs/classes/index.d.js +17 -0
- package/lib/commonjs/classes/index.d.js.map +1 -0
- package/lib/commonjs/classes/index.js +61 -0
- package/lib/commonjs/classes/index.js.map +1 -0
- package/lib/commonjs/components/AbstractLayer.js +61 -0
- package/lib/commonjs/components/AbstractLayer.js.map +1 -0
- package/lib/commonjs/components/AbstractSource.js +26 -0
- package/lib/commonjs/components/AbstractSource.js.map +1 -0
- package/lib/commonjs/components/Atmosphere.js +26 -0
- package/lib/commonjs/components/Atmosphere.js.map +1 -0
- package/lib/commonjs/components/BackgroundLayer.js +82 -0
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -0
- package/lib/commonjs/components/Callout.js +119 -0
- package/lib/commonjs/components/Callout.js.map +1 -0
- package/lib/commonjs/components/Camera.js +336 -0
- package/lib/commonjs/components/Camera.js.map +1 -0
- package/lib/commonjs/components/CircleLayer.js +87 -0
- package/lib/commonjs/components/CircleLayer.js.map +1 -0
- package/lib/commonjs/components/FillExtrusionLayer.js +89 -0
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -0
- package/lib/commonjs/components/FillLayer.js +89 -0
- package/lib/commonjs/components/FillLayer.js.map +1 -0
- package/lib/commonjs/components/HeadingIndicator.js +33 -0
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -0
- package/lib/commonjs/components/HeatmapLayer.js +90 -0
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -0
- package/lib/commonjs/components/ImageSource.js +66 -0
- package/lib/commonjs/components/ImageSource.js.map +1 -0
- package/lib/commonjs/components/Images.js +98 -0
- package/lib/commonjs/components/Images.js.map +1 -0
- package/lib/commonjs/components/Light.js +51 -0
- package/lib/commonjs/components/Light.js.map +1 -0
- package/lib/commonjs/components/LineLayer.js +89 -0
- package/lib/commonjs/components/LineLayer.js.map +1 -0
- package/lib/commonjs/components/MapView.js +740 -0
- package/lib/commonjs/components/MapView.js.map +1 -0
- package/lib/commonjs/components/MarkerView.js +102 -0
- package/lib/commonjs/components/MarkerView.js.map +1 -0
- package/lib/commonjs/components/NativeBridgeComponent.js +85 -0
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -0
- package/lib/commonjs/components/NativeUserLocation.js +41 -0
- package/lib/commonjs/components/NativeUserLocation.js.map +1 -0
- package/lib/commonjs/components/PointAnnotation.js +121 -0
- package/lib/commonjs/components/PointAnnotation.js.map +1 -0
- package/lib/commonjs/components/RasterDemSource.js +95 -0
- package/lib/commonjs/components/RasterDemSource.js.map +1 -0
- package/lib/commonjs/components/RasterLayer.js +85 -0
- package/lib/commonjs/components/RasterLayer.js.map +1 -0
- package/lib/commonjs/components/RasterSource.js +112 -0
- package/lib/commonjs/components/RasterSource.js.map +1 -0
- package/lib/commonjs/components/ShapeSource.js +193 -0
- package/lib/commonjs/components/ShapeSource.js.map +1 -0
- package/lib/commonjs/components/SkyLayer.js +73 -0
- package/lib/commonjs/components/SkyLayer.js.map +1 -0
- package/lib/commonjs/components/Style.js +269 -0
- package/lib/commonjs/components/Style.js.map +1 -0
- package/lib/commonjs/components/SymbolLayer.js +49 -0
- package/lib/commonjs/components/SymbolLayer.js.map +1 -0
- package/lib/commonjs/components/Terrain.js +37 -0
- package/lib/commonjs/components/Terrain.js.map +1 -0
- package/lib/commonjs/components/UserLocation.js +255 -0
- package/lib/commonjs/components/UserLocation.js.map +1 -0
- package/lib/commonjs/components/VectorSource.js +175 -0
- package/lib/commonjs/components/VectorSource.js.map +1 -0
- package/lib/commonjs/components/annotations/Annotation.js +105 -0
- package/lib/commonjs/components/annotations/Annotation.js.map +1 -0
- package/lib/commonjs/global.d.js +2 -0
- package/lib/commonjs/global.d.js.map +1 -0
- package/lib/commonjs/index.js +331 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +27 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/modules/location/locationManager.js +85 -0
- package/lib/commonjs/modules/location/locationManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +45 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflinePack.js +41 -0
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -0
- package/lib/commonjs/modules/offline/offlineManager.js +356 -0
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +60 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -0
- package/lib/commonjs/modules/snapshot/snapshotManager.js +68 -0
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -0
- package/lib/commonjs/requestAndroidLocationPermissions.js +25 -0
- package/lib/commonjs/requestAndroidLocationPermissions.js.map +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/BridgeValue.js +66 -0
- package/lib/commonjs/utils/BridgeValue.js.map +1 -0
- package/lib/commonjs/utils/Logger.js +119 -0
- package/lib/commonjs/utils/Logger.js.map +1 -0
- package/lib/commonjs/utils/MapboxStyles.d.js +183 -0
- package/lib/commonjs/utils/MapboxStyles.d.js.map +1 -0
- package/lib/commonjs/utils/StyleValue.js +41 -0
- package/lib/commonjs/utils/StyleValue.js.map +1 -0
- package/lib/commonjs/utils/animated/Animated.js +33 -0
- package/lib/commonjs/utils/animated/Animated.js.map +1 -0
- package/lib/commonjs/utils/deprecation.js +40 -0
- package/lib/commonjs/utils/deprecation.js.map +1 -0
- package/lib/commonjs/utils/filterUtils.js +13 -0
- package/lib/commonjs/utils/filterUtils.js.map +1 -0
- package/lib/commonjs/utils/geoUtils.d.js +2 -0
- package/lib/commonjs/utils/geoUtils.d.js.map +1 -0
- package/lib/commonjs/utils/geoUtils.js +65 -0
- package/lib/commonjs/utils/geoUtils.js.map +1 -0
- package/lib/commonjs/utils/index.d.js +2 -0
- package/lib/commonjs/utils/index.d.js.map +1 -0
- package/lib/commonjs/utils/index.js +122 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/styleMap.js +1530 -0
- package/lib/commonjs/utils/styleMap.js.map +1 -0
- package/lib/commonjs/web/MapContext.js +12 -0
- package/lib/commonjs/web/MapContext.js.map +1 -0
- package/lib/commonjs/web/MapboxModule.js +21 -0
- package/lib/commonjs/web/MapboxModule.js.map +1 -0
- package/lib/commonjs/web/UnimplementedComponent.js +16 -0
- package/lib/commonjs/web/UnimplementedComponent.js.map +1 -0
- package/lib/commonjs/web/components/Camera.js +48 -0
- package/lib/commonjs/web/components/Camera.js.map +1 -0
- package/lib/commonjs/web/components/MapView.js +67 -0
- package/lib/commonjs/web/components/MapView.js.map +1 -0
- package/lib/commonjs/web/index.js +41 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/utils/Logger.js +100 -0
- package/lib/commonjs/web/utils/Logger.js.map +1 -0
- package/lib/module/classes/AnimatedCoordinatesArray.js +158 -0
- package/lib/module/classes/AnimatedCoordinatesArray.js.map +1 -0
- package/lib/module/classes/AnimatedExtractCoordinateFromArray.js +37 -0
- package/lib/module/classes/AnimatedExtractCoordinateFromArray.js.map +1 -0
- package/lib/module/classes/AnimatedPoint.js +110 -0
- package/lib/module/classes/AnimatedPoint.js.map +1 -0
- package/lib/module/classes/AnimatedRouteCoordinatesArray.js +148 -0
- package/lib/module/classes/AnimatedRouteCoordinatesArray.js.map +1 -0
- package/lib/module/classes/AnimatedShape.js +71 -0
- package/lib/module/classes/AnimatedShape.js.map +1 -0
- package/lib/module/classes/index.d.js +6 -0
- package/lib/module/classes/index.d.js.map +1 -0
- package/lib/module/classes/index.js +6 -0
- package/lib/module/classes/index.js.map +1 -0
- package/lib/module/components/AbstractLayer.js +54 -0
- package/lib/module/components/AbstractLayer.js.map +1 -0
- package/lib/module/components/AbstractSource.js +18 -0
- package/lib/module/components/AbstractSource.js.map +1 -0
- package/lib/module/components/Atmosphere.js +16 -0
- package/lib/module/components/Atmosphere.js.map +1 -0
- package/lib/module/components/BackgroundLayer.js +73 -0
- package/lib/module/components/BackgroundLayer.js.map +1 -0
- package/lib/module/components/Callout.js +110 -0
- package/lib/module/components/Callout.js.map +1 -0
- package/lib/module/components/Camera.js +326 -0
- package/lib/module/components/Camera.js.map +1 -0
- package/lib/module/components/CircleLayer.js +78 -0
- package/lib/module/components/CircleLayer.js.map +1 -0
- package/lib/module/components/FillExtrusionLayer.js +80 -0
- package/lib/module/components/FillExtrusionLayer.js.map +1 -0
- package/lib/module/components/FillLayer.js +80 -0
- package/lib/module/components/FillLayer.js.map +1 -0
- package/lib/module/components/HeadingIndicator.js +25 -0
- package/lib/module/components/HeadingIndicator.js.map +1 -0
- package/lib/module/components/HeatmapLayer.js +81 -0
- package/lib/module/components/HeatmapLayer.js.map +1 -0
- package/lib/module/components/ImageSource.js +57 -0
- package/lib/module/components/ImageSource.js.map +1 -0
- package/lib/module/components/Images.js +89 -0
- package/lib/module/components/Images.js.map +1 -0
- package/lib/module/components/Light.js +42 -0
- package/lib/module/components/Light.js.map +1 -0
- package/lib/module/components/LineLayer.js +80 -0
- package/lib/module/components/LineLayer.js.map +1 -0
- package/lib/module/components/MapView.js +730 -0
- package/lib/module/components/MapView.js.map +1 -0
- package/lib/module/components/MarkerView.js +93 -0
- package/lib/module/components/MarkerView.js.map +1 -0
- package/lib/module/components/NativeBridgeComponent.js +78 -0
- package/lib/module/components/NativeBridgeComponent.js.map +1 -0
- package/lib/module/components/NativeUserLocation.js +33 -0
- package/lib/module/components/NativeUserLocation.js.map +1 -0
- package/lib/module/components/PointAnnotation.js +112 -0
- package/lib/module/components/PointAnnotation.js.map +1 -0
- package/lib/module/components/RasterDemSource.js +86 -0
- package/lib/module/components/RasterDemSource.js.map +1 -0
- package/lib/module/components/RasterLayer.js +76 -0
- package/lib/module/components/RasterLayer.js.map +1 -0
- package/lib/module/components/RasterSource.js +103 -0
- package/lib/module/components/RasterSource.js.map +1 -0
- package/lib/module/components/ShapeSource.js +184 -0
- package/lib/module/components/ShapeSource.js.map +1 -0
- package/lib/module/components/SkyLayer.js +64 -0
- package/lib/module/components/SkyLayer.js.map +1 -0
- package/lib/module/components/Style.js +259 -0
- package/lib/module/components/Style.js.map +1 -0
- package/lib/module/components/SymbolLayer.js +40 -0
- package/lib/module/components/SymbolLayer.js.map +1 -0
- package/lib/module/components/Terrain.js +27 -0
- package/lib/module/components/Terrain.js.map +1 -0
- package/lib/module/components/UserLocation.js +246 -0
- package/lib/module/components/UserLocation.js.map +1 -0
- package/lib/module/components/VectorSource.js +166 -0
- package/lib/module/components/VectorSource.js.map +1 -0
- package/lib/module/components/annotations/Annotation.js +97 -0
- package/lib/module/components/annotations/Annotation.js.map +1 -0
- package/lib/module/global.d.js +2 -0
- package/lib/module/global.d.js.map +1 -0
- package/lib/module/index.js +105 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/modules/location/locationManager.js +77 -0
- package/lib/module/modules/location/locationManager.js.map +1 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +38 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -0
- package/lib/module/modules/offline/OfflinePack.js +34 -0
- package/lib/module/modules/offline/OfflinePack.js.map +1 -0
- package/lib/module/modules/offline/offlineManager.js +347 -0
- package/lib/module/modules/offline/offlineManager.js.map +1 -0
- package/lib/module/modules/snapshot/SnapshotOptions.js +53 -0
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -0
- package/lib/module/modules/snapshot/snapshotManager.js +60 -0
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -0
- package/lib/module/requestAndroidLocationPermissions.js +19 -0
- package/lib/module/requestAndroidLocationPermissions.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/BridgeValue.js +59 -0
- package/lib/module/utils/BridgeValue.js.map +1 -0
- package/lib/module/utils/Logger.js +112 -0
- package/lib/module/utils/Logger.js.map +1 -0
- package/lib/module/utils/MapboxStyles.d.js +179 -0
- package/lib/module/utils/MapboxStyles.d.js.map +1 -0
- package/lib/module/utils/StyleValue.js +34 -0
- package/lib/module/utils/StyleValue.js.map +1 -0
- package/lib/module/utils/animated/Animated.js +25 -0
- package/lib/module/utils/animated/Animated.js.map +1 -0
- package/lib/module/utils/deprecation.js +33 -0
- package/lib/module/utils/deprecation.js.map +1 -0
- package/lib/module/utils/filterUtils.js +7 -0
- package/lib/module/utils/filterUtils.js.map +1 -0
- package/lib/module/utils/geoUtils.d.js +2 -0
- package/lib/module/utils/geoUtils.d.js.map +1 -0
- package/lib/module/utils/geoUtils.js +50 -0
- package/lib/module/utils/geoUtils.js.map +1 -0
- package/lib/module/utils/index.d.js +2 -0
- package/lib/module/utils/index.d.js.map +1 -0
- package/lib/module/utils/index.js +99 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/styleMap.js +1505 -0
- package/lib/module/utils/styleMap.js.map +1 -0
- package/lib/module/web/MapContext.js +4 -0
- package/lib/module/web/MapContext.js.map +1 -0
- package/lib/module/web/MapboxModule.js +13 -0
- package/lib/module/web/MapboxModule.js.map +1 -0
- package/lib/module/web/UnimplementedComponent.js +8 -0
- package/lib/module/web/UnimplementedComponent.js.map +1 -0
- package/lib/module/web/components/Camera.js +40 -0
- package/lib/module/web/components/Camera.js.map +1 -0
- package/lib/module/web/components/MapView.js +60 -0
- package/lib/module/web/components/MapView.js.map +1 -0
- package/lib/module/web/index.js +16 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/utils/Logger.js +93 -0
- package/lib/module/web/utils/Logger.js.map +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts +28 -0
- package/lib/typescript/components/AbstractLayer.d.ts.map +1 -0
- package/lib/typescript/components/AbstractSource.d.ts +9 -0
- package/lib/typescript/components/AbstractSource.d.ts.map +1 -0
- package/lib/typescript/components/Atmosphere.d.ts +9 -0
- package/lib/typescript/components/Atmosphere.d.ts.map +1 -0
- package/lib/typescript/components/Camera.d.ts +119 -0
- package/lib/typescript/components/Camera.d.ts.map +1 -0
- package/lib/typescript/components/HeadingIndicator.d.ts +7 -0
- package/lib/typescript/components/HeadingIndicator.d.ts.map +1 -0
- package/lib/typescript/components/MarkerView.d.ts +52 -0
- package/lib/typescript/components/MarkerView.d.ts.map +1 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts +50 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -0
- package/lib/typescript/components/PointAnnotation.d.ts +162 -0
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -0
- package/lib/typescript/components/ShapeSource.d.ts +222 -0
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -0
- package/lib/typescript/components/SymbolLayer.d.ts +65 -0
- package/lib/typescript/components/SymbolLayer.d.ts.map +1 -0
- package/lib/typescript/components/Terrain.d.ts +20 -0
- package/lib/typescript/components/Terrain.d.ts.map +1 -0
- package/lib/typescript/requestAndroidLocationPermissions.d.ts +2 -0
- package/lib/typescript/requestAndroidLocationPermissions.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +16 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/utils/BridgeValue.d.ts +46 -0
- package/lib/typescript/utils/BridgeValue.d.ts.map +1 -0
- package/lib/typescript/utils/StyleValue.d.ts +10 -0
- package/lib/typescript/utils/StyleValue.d.ts.map +1 -0
- package/lib/typescript/utils/deprecation.d.ts +12 -0
- package/lib/typescript/utils/deprecation.d.ts.map +1 -0
- package/lib/typescript/utils/filterUtils.d.ts +2 -0
- package/lib/typescript/utils/filterUtils.d.ts.map +1 -0
- package/lib/typescript/utils/styleMap.d.ts +1489 -0
- package/lib/typescript/utils/styleMap.d.ts.map +1 -0
- package/lib/typescript/web/MapContext.d.ts +7 -0
- package/lib/typescript/web/MapContext.d.ts.map +1 -0
- package/lib/typescript/web/components/Camera.d.ts +18 -0
- package/lib/typescript/web/components/Camera.d.ts.map +1 -0
- package/lib/typescript/web/components/MapView.d.ts +20 -0
- package/lib/typescript/web/components/MapView.d.ts.map +1 -0
- package/lib/typescript/web/utils/Logger.d.ts +48 -0
- package/lib/typescript/web/utils/Logger.d.ts.map +1 -0
- package/package.json +38 -6
- package/plugin/jest.config.js +1 -0
- package/plugin/src/withMapbox.ts +365 -0
- package/plugin/tsconfig.json +9 -0
- package/.eslintrc.js +0 -111
- package/.gitattributes +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -112
- package/.github/ISSUE_TEMPLATE/bug_setup.md +0 -23
- package/.github/ISSUE_TEMPLATE/feature.md +0 -15
- package/.github/dependabot.yml +0 -42
- package/.github/label-actions.yml +0 -26
- package/.github/pull_request_template.md +0 -27
- package/.github/stale.yml +0 -11
- package/.github/workflows/android-actions.yml +0 -56
- package/.github/workflows/bump-version.yml +0 -54
- package/.github/workflows/ios-actions.yml +0 -81
- package/.github/workflows/label-actions.yml +0 -17
- package/.github/workflows/on-push.yml +0 -131
- package/.github/workflows/publish.yml +0 -29
- package/.husky/pre-commit +0 -5
- package/.nvmrc +0 -2
- package/.prettierrc.js +0 -4
- package/.sonarcloud.properties +0 -15
- package/CONTRIBUTING.md +0 -30
- package/README-v10.md +0 -86
- package/RELEASE.md +0 -28
- package/app.plugin.js +0 -1
- package/babel.config.js +0 -9
- package/docs/Annotation.md +0 -39
- package/docs/Annotations.md +0 -20
- package/docs/Atmosphere.md +0 -265
- package/docs/BackgroundLayer.md +0 -166
- package/docs/Callout.md +0 -15
- package/docs/Camera.md +0 -152
- package/docs/CircleLayer.md +0 -470
- package/docs/CustomHttpHeaders.md +0 -89
- package/docs/FillExtrusionLayer.md +0 -346
- package/docs/FillLayer.md +0 -310
- package/docs/GettingStarted.md +0 -87
- package/docs/HeadingIndicator.md +0 -10
- package/docs/HeatmapLayer.md +0 -215
- package/docs/ImageSource.md +0 -13
- package/docs/Images.md +0 -12
- package/docs/Light.md +0 -159
- package/docs/LineLayer.md +0 -606
- package/docs/Logger.md +0 -22
- package/docs/MapView.md +0 -228
- package/docs/MapboxGL.md +0 -83
- package/docs/MarkerView.md +0 -26
- package/docs/NativeUserLocation.md +0 -11
- package/docs/OfflineManager.md +0 -264
- package/docs/PointAnnotation.md +0 -42
- package/docs/RasterDemSource.md +0 -15
- package/docs/RasterLayer.md +0 -357
- package/docs/RasterSource.md +0 -19
- package/docs/ShapeSource.md +0 -106
- package/docs/SkyLayer.md +0 -259
- package/docs/Style.md +0 -12
- package/docs/StyleSheet.md +0 -226
- package/docs/SymbolLayer.md +0 -1659
- package/docs/Terrain.md +0 -77
- package/docs/UserLocation.md +0 -39
- package/docs/VectorSource.md +0 -49
- package/docs/docs.json +0 -6571
- package/docs/snapshotManager.md +0 -55
- package/scripts/.eslintrc.js +0 -12
- package/scripts/autogenHelpers/DocJSONBuilder.js +0 -458
- package/scripts/autogenHelpers/JSDocNodeTree.js +0 -134
- package/scripts/autogenHelpers/MarkdownBuilder.js +0 -38
- package/scripts/autogenHelpers/globals.js +0 -518
- package/scripts/autogenerate.js +0 -545
- package/scripts/download-style-spec.sh +0 -15
- package/scripts/templates/MapboxStyles.ts.ejs +0 -97
- package/scripts/templates/RCTMGLStyle.h.ejs +0 -34
- package/scripts/templates/RCTMGLStyle.m.ejs +0 -106
- package/scripts/templates/RCTMGLStyle.swift.ejs +0 -116
- package/scripts/templates/RCTMGLStyleFactory.java.ejs +0 -108
- package/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +0 -116
- package/scripts/templates/component.md.ejs +0 -122
- package/scripts/templates/index.d.ts.ejs +0 -56
- package/scripts/templates/styleMap.ts.ejs +0 -118
- package/setup-jest.js +0 -125
- package/style-spec/v8.json +0 -6727
- package/tsconfig.json +0 -24
package/docs/snapshotManager.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!-- This file was autogenerated from snapshotManager.js do not modify -->
|
|
2
|
-
# <MapboxGL.snapshotManager />
|
|
3
|
-
The snapshotManager generates static raster images of the map.
|
|
4
|
-
Each snapshot image depicts a portion of a map defined by an SnapshotOptions object you provide.
|
|
5
|
-
The snapshotter generates the snapshot asynchronous.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## methods
|
|
9
|
-
### takeSnap(options)
|
|
10
|
-
|
|
11
|
-
Takes a snapshot of the base map using the provided Snapshot options. NOTE pitch, heading, zoomLevel only works when centerCoordinate is set!
|
|
12
|
-
|
|
13
|
-
#### arguments
|
|
14
|
-
| Name | Type | Required | Description |
|
|
15
|
-
| ---- | :--: | :------: | :----------: |
|
|
16
|
-
| `options` | `SnapshotOptions` | `Yes` | Snapshot options for create a static image of the base map |
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```javascript
|
|
21
|
-
// creates a temp file png of base map
|
|
22
|
-
const uri = await MapboxGL.snapshotManager.takeSnap({
|
|
23
|
-
centerCoordinate: [-74.126410, 40.797968],
|
|
24
|
-
width: width,
|
|
25
|
-
height: height,
|
|
26
|
-
zoomLevel: 12,
|
|
27
|
-
pitch: 30,
|
|
28
|
-
heading: 20,
|
|
29
|
-
styleURL: MapboxGL.StyleURL.Dark,
|
|
30
|
-
writeToDisk: true, // Create a temporary file
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// creates base64 png of base map without logo
|
|
34
|
-
const uri = await MapboxGL.snapshotManager.takeSnap({
|
|
35
|
-
centerCoordinate: [-74.126410, 40.797968],
|
|
36
|
-
width: width,
|
|
37
|
-
height: height,
|
|
38
|
-
zoomLevel: 12,
|
|
39
|
-
pitch: 30,
|
|
40
|
-
heading: 20,
|
|
41
|
-
styleURL: MapboxGL.StyleURL.Dark,
|
|
42
|
-
withLogo: false, // Disable Mapbox logo (Android only)
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// creates snapshot with bounds
|
|
46
|
-
const uri = await MapboxGL.snapshotManager.takeSnap({
|
|
47
|
-
bounds: [[-74.126410, 40.797968], [-74.143727, 40.772177]],
|
|
48
|
-
width: width,
|
|
49
|
-
height: height,
|
|
50
|
-
styleURL: MapboxGL.StyleURL.Dark,
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
package/scripts/.eslintrc.js
DELETED
|
@@ -1,458 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { exec } = require('child_process');
|
|
4
|
-
|
|
5
|
-
const dir = require('node-dir');
|
|
6
|
-
const docgen = require('react-docgen');
|
|
7
|
-
const parseJsDoc = require('react-docgen/dist/utils/parseJsDoc').default;
|
|
8
|
-
|
|
9
|
-
const JSDocNodeTree = require('./JSDocNodeTree');
|
|
10
|
-
|
|
11
|
-
const COMPONENT_PATH = path.join(
|
|
12
|
-
__dirname,
|
|
13
|
-
'..',
|
|
14
|
-
'..',
|
|
15
|
-
'javascript',
|
|
16
|
-
'components',
|
|
17
|
-
);
|
|
18
|
-
const MODULES_PATH = path.join(__dirname, '..', '..', 'javascript', 'modules');
|
|
19
|
-
|
|
20
|
-
const OUTPUT_PATH = path.join(__dirname, '..', '..', 'docs', 'docs.json');
|
|
21
|
-
const IGNORE_FILES = [
|
|
22
|
-
'AbstractLayer',
|
|
23
|
-
'AbstractSource',
|
|
24
|
-
'NativeBridgeComponent',
|
|
25
|
-
];
|
|
26
|
-
const IGNORE_PATTERN = /\.web\./;
|
|
27
|
-
|
|
28
|
-
const IGNORE_METHODS = ['setNativeProps'];
|
|
29
|
-
|
|
30
|
-
const fileExtensionsRegex = /.(js|tsx|(?<!d.)ts)$/;
|
|
31
|
-
|
|
32
|
-
class DocJSONBuilder {
|
|
33
|
-
constructor(styledLayers) {
|
|
34
|
-
this._styledLayers = {};
|
|
35
|
-
|
|
36
|
-
for (const styleLayer of styledLayers) {
|
|
37
|
-
let ComponentName = pascelCase(styleLayer.name);
|
|
38
|
-
const fakeLayers = ['Light', 'Atmosphere', 'Terrain'];
|
|
39
|
-
if (fakeLayers.includes(ComponentName)) {
|
|
40
|
-
this._styledLayers[ComponentName] = styleLayer;
|
|
41
|
-
} else {
|
|
42
|
-
this._styledLayers[ComponentName + 'Layer'] = styleLayer;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get options() {
|
|
48
|
-
return {
|
|
49
|
-
match: fileExtensionsRegex,
|
|
50
|
-
shortName: true,
|
|
51
|
-
sort: true,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
isPrivateMethod(methodName = '') {
|
|
56
|
-
return !methodName || methodName.charAt(0) === '_';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
postprocess(component, name) {
|
|
60
|
-
// Remove all private methods and parse examples from docblock
|
|
61
|
-
|
|
62
|
-
if (!Array.isArray(component.methods)) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
component.name = name;
|
|
67
|
-
|
|
68
|
-
// Main description
|
|
69
|
-
component.description = component.description.replace(
|
|
70
|
-
/(\n*)(@\w+) (\{.*\})/g,
|
|
71
|
-
'',
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
// Styles
|
|
75
|
-
if (this._styledLayers[name] && this._styledLayers[name].properties) {
|
|
76
|
-
component.styles = [];
|
|
77
|
-
|
|
78
|
-
for (const prop of this._styledLayers[name].properties) {
|
|
79
|
-
const docStyle = {
|
|
80
|
-
name: prop.name,
|
|
81
|
-
type: prop.type,
|
|
82
|
-
values: [],
|
|
83
|
-
minimum: prop.doc.minimum,
|
|
84
|
-
maximum: prop.doc.maximum,
|
|
85
|
-
units: prop.doc.units,
|
|
86
|
-
default: prop.doc.default,
|
|
87
|
-
description: prop.doc.description,
|
|
88
|
-
requires: prop.doc.requires,
|
|
89
|
-
disabledBy: prop.doc.disabledBy,
|
|
90
|
-
allowedFunctionTypes: prop.allowedFunctionTypes || [],
|
|
91
|
-
expression: prop.expression,
|
|
92
|
-
transition: prop.transition,
|
|
93
|
-
};
|
|
94
|
-
if (prop.type === 'enum') {
|
|
95
|
-
docStyle.values = Object.keys(prop.doc.values).map((value) => {
|
|
96
|
-
return { value, doc: prop.doc.values[value].doc };
|
|
97
|
-
});
|
|
98
|
-
} else if (prop.type === 'array') {
|
|
99
|
-
docStyle.type = `${docStyle.type}<${prop.value}>`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
component.styles.push(docStyle);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function mapNestedProp(propMeta) {
|
|
107
|
-
const result = {
|
|
108
|
-
type: {
|
|
109
|
-
name: propMeta.name,
|
|
110
|
-
value: propMeta.value,
|
|
111
|
-
},
|
|
112
|
-
description: propMeta.description,
|
|
113
|
-
required: propMeta.required,
|
|
114
|
-
};
|
|
115
|
-
if (propMeta.value) {
|
|
116
|
-
result.type.value = propMeta.value;
|
|
117
|
-
}
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function tsTypeDesc(tsType) {
|
|
122
|
-
if (!tsType?.name) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (tsType.name === 'signature') {
|
|
127
|
-
if (tsType.raw.length < 200) {
|
|
128
|
-
return `${tsType.raw
|
|
129
|
-
.replace(/(\n|\s)/g, '')
|
|
130
|
-
.replace(/(\|)/g, '\\|')}`;
|
|
131
|
-
} else {
|
|
132
|
-
return 'FIX ME FORMAT BIG OBJECT';
|
|
133
|
-
}
|
|
134
|
-
} else if (tsType.name === 'union') {
|
|
135
|
-
if (tsType.raw) {
|
|
136
|
-
// Props
|
|
137
|
-
return tsType.raw.replace(/\|/g, '\\|');
|
|
138
|
-
} else if (tsType.elements) {
|
|
139
|
-
// Methods
|
|
140
|
-
return tsType.elements.map((e) => e.name).join(' \\| ');
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
return tsType.name;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @typedef {{arguments: {type:TSType,name:string}[], return: TSType]}} TSFuncSignature
|
|
149
|
-
* @typedef {{key:string, value:TSType}[]} TSKVProperties
|
|
150
|
-
* @typedef {{properties: TSKVProperties}} TSObjectSignature
|
|
151
|
-
* @typedef {{name: 'void'}} TSVoidType
|
|
152
|
-
* @typedef {{name: string}} TSTypeType
|
|
153
|
-
* @typedef {{name: 'signature', type:'function', raw:string, signature: TSFuncSignature}} TSFunctionType
|
|
154
|
-
* @typedef {{name: 'signature', type:'object', raw:string, signature: TSObjectSignature}} TSObjectType
|
|
155
|
-
* @typedef {TSVoidType | TSFunctionType | TSTypeType | TSObjectType} TSType
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @params {TSType} tsType
|
|
160
|
-
* @returns {tsType is TSFunctionType}
|
|
161
|
-
*/
|
|
162
|
-
function tsTypeIsFunction(tsType) {
|
|
163
|
-
return tsType.type === 'function';
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* @params {TSType} tsType
|
|
168
|
-
* @returns {tsType is TSObjectType}
|
|
169
|
-
*/
|
|
170
|
-
function tsTypeIsObject(tsType) {
|
|
171
|
-
return tsType.type === 'object';
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @param {TSType} tsType
|
|
176
|
-
*/
|
|
177
|
-
function tsTypeDump(tsType) {
|
|
178
|
-
if (tsTypeIsFunction(tsType)) {
|
|
179
|
-
let { signature } = tsType;
|
|
180
|
-
return `(${signature.arguments
|
|
181
|
-
.map(({ name, type }) => `${name}:${tsTypeDump(type)}`)
|
|
182
|
-
.join(', ')}) => ${tsTypeDump(signature.return)}`;
|
|
183
|
-
} else if (tsTypeIsObject(tsType)) {
|
|
184
|
-
let { signature } = tsType;
|
|
185
|
-
return `{${signature.properties
|
|
186
|
-
.map(({ key, value }) => `${key}: ${tsTypeDump(value)}`)
|
|
187
|
-
.join(', ')}}`;
|
|
188
|
-
} else {
|
|
189
|
-
return tsType.name;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function tsTypeDescType(tsType) {
|
|
194
|
-
if (!tsType?.name) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (tsType.name === 'signature' && tsType.type === 'object') {
|
|
199
|
-
const { properties } = tsType.signature;
|
|
200
|
-
if (properties) {
|
|
201
|
-
const value = properties.map((kv) => {
|
|
202
|
-
return mapProp(
|
|
203
|
-
mapNestedProp({ ...kv.value, description: kv.description }),
|
|
204
|
-
kv.key,
|
|
205
|
-
false,
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
return { name: 'shape', value };
|
|
209
|
-
} else if (tsType.raw.length < 200) {
|
|
210
|
-
return `${tsType.raw
|
|
211
|
-
.replace(/(\n|\s)/g, '')
|
|
212
|
-
.replace(/(\|)/g, '\\|')}`;
|
|
213
|
-
} else {
|
|
214
|
-
return 'FIX ME FORMAT BIG OBJECT';
|
|
215
|
-
}
|
|
216
|
-
} else if (tsType.name === 'signature' && tsType.type === 'function') {
|
|
217
|
-
return { name: 'func', funcSignature: tsTypeDump(tsType) };
|
|
218
|
-
} else if (tsType.name === 'union') {
|
|
219
|
-
if (tsType.raw) {
|
|
220
|
-
// Props
|
|
221
|
-
return tsType.raw.replace(/\|/g, '\\|');
|
|
222
|
-
} else if (tsType.elements) {
|
|
223
|
-
// Methods
|
|
224
|
-
return tsType.elements.map((e) => e.name).join(' \\| ');
|
|
225
|
-
}
|
|
226
|
-
} else {
|
|
227
|
-
return tsType.name;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function mapProp(propMeta, propName, array) {
|
|
232
|
-
let result = {};
|
|
233
|
-
if (!array) {
|
|
234
|
-
result = {
|
|
235
|
-
name: propName || 'FIX ME NO NAME',
|
|
236
|
-
required: propMeta.required || false,
|
|
237
|
-
type:
|
|
238
|
-
propMeta.type?.name ||
|
|
239
|
-
tsTypeDescType(propMeta.tsType) ||
|
|
240
|
-
'FIX ME UNKNOWN TYPE',
|
|
241
|
-
default: !propMeta.defaultValue
|
|
242
|
-
? 'none'
|
|
243
|
-
: propMeta.defaultValue.value.replace(/\n/g, ''),
|
|
244
|
-
description: propMeta.description || 'FIX ME NO DESCRIPTION',
|
|
245
|
-
};
|
|
246
|
-
if (
|
|
247
|
-
result.type &&
|
|
248
|
-
result.type.name === 'func' &&
|
|
249
|
-
result.type.funcSignature
|
|
250
|
-
) {
|
|
251
|
-
result.description = `${result.description}\n*signature:*\`${result.type.funcSignature}\``;
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
if (propName) {
|
|
255
|
-
result.name = propName;
|
|
256
|
-
}
|
|
257
|
-
if (propMeta.required !== undefined) {
|
|
258
|
-
result.required = propMeta.required;
|
|
259
|
-
}
|
|
260
|
-
result.type =
|
|
261
|
-
(propMeta.type && propMeta.type.name) ||
|
|
262
|
-
tsTypeDescType(propMeta.tsType) ||
|
|
263
|
-
'FIX ME UNKNOWN TYPE';
|
|
264
|
-
if (propMeta.defaultValue) {
|
|
265
|
-
result.default = propMeta.defaultValue.value.replace(/\n/g, '');
|
|
266
|
-
}
|
|
267
|
-
if (propMeta.description) {
|
|
268
|
-
result.description = propMeta.description;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (
|
|
273
|
-
propMeta.type &&
|
|
274
|
-
propMeta.type.name === 'arrayOf' &&
|
|
275
|
-
propMeta.type.value
|
|
276
|
-
) {
|
|
277
|
-
result.type = {
|
|
278
|
-
name: 'array',
|
|
279
|
-
value: mapProp(mapNestedProp(propMeta.type.value), undefined, true),
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (propMeta.type && propMeta.type.name === 'func') {
|
|
284
|
-
const jsdoc = parseJsDoc(propMeta.description);
|
|
285
|
-
if (jsdoc && jsdoc.description) {
|
|
286
|
-
result.description = jsdoc.description;
|
|
287
|
-
}
|
|
288
|
-
if (jsdoc && jsdoc.params && jsdoc.params.length > 0) {
|
|
289
|
-
result.params = jsdoc.params;
|
|
290
|
-
}
|
|
291
|
-
if (jsdoc && jsdoc.returns) {
|
|
292
|
-
result.returns = jsdoc.returns;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (
|
|
296
|
-
propMeta.type &&
|
|
297
|
-
propMeta.type.name === 'shape' &&
|
|
298
|
-
propMeta.type.value
|
|
299
|
-
) {
|
|
300
|
-
const type = propMeta.type.value;
|
|
301
|
-
const value = Object.keys(type).map((_name) =>
|
|
302
|
-
mapProp(mapNestedProp(type[_name]), _name, false),
|
|
303
|
-
);
|
|
304
|
-
result.type = { name: 'shape', value };
|
|
305
|
-
}
|
|
306
|
-
return result;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// props
|
|
310
|
-
component.props = Object.keys(component.props).map((propName) => {
|
|
311
|
-
const propMeta = component.props[propName];
|
|
312
|
-
|
|
313
|
-
return mapProp(propMeta, propName, false);
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// methods
|
|
317
|
-
const privateMethods = [];
|
|
318
|
-
for (const method of component.methods) {
|
|
319
|
-
if (this.isPrivateMethod(method.name)) {
|
|
320
|
-
privateMethods.push(method.name);
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (method.docblock) {
|
|
325
|
-
const examples = method.docblock
|
|
326
|
-
.split('@')
|
|
327
|
-
.filter((block) => block.startsWith('example'));
|
|
328
|
-
method.examples = examples.map((example) =>
|
|
329
|
-
example.substring('example'.length),
|
|
330
|
-
);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
privateMethods.push(...IGNORE_METHODS);
|
|
334
|
-
|
|
335
|
-
component.methods = component.methods.filter(
|
|
336
|
-
(method) => !privateMethods.includes(method.name),
|
|
337
|
-
);
|
|
338
|
-
|
|
339
|
-
component.methods.forEach((method) => {
|
|
340
|
-
method.params.forEach((param) => {
|
|
341
|
-
param.type = { name: tsTypeDesc(param.type) };
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
console.log(
|
|
346
|
-
`Processed ${component.name} (${component.props?.length ?? 0} props, ${
|
|
347
|
-
component.methods?.length ?? 0
|
|
348
|
-
} methods)`,
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
generateReactComponentsTask(results, filePath) {
|
|
353
|
-
return new Promise((resolve, reject) => {
|
|
354
|
-
dir.readFiles(
|
|
355
|
-
filePath,
|
|
356
|
-
this.options,
|
|
357
|
-
(err, content, fileNameWithExt, next) => {
|
|
358
|
-
if (err) {
|
|
359
|
-
return reject(err);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
let fileName = fileNameWithExt.replace(/\.(js|tsx|ts$)/, '');
|
|
363
|
-
if (
|
|
364
|
-
IGNORE_FILES.includes(fileName) ||
|
|
365
|
-
fileName.match(IGNORE_PATTERN)
|
|
366
|
-
) {
|
|
367
|
-
next();
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
let parsedComponents = docgen.parse(content, {
|
|
372
|
-
babelOptions: {
|
|
373
|
-
filename: fileNameWithExt,
|
|
374
|
-
},
|
|
375
|
-
});
|
|
376
|
-
let [parsed] = parsedComponents;
|
|
377
|
-
fileName = fileName.replace(fileExtensionsRegex, '');
|
|
378
|
-
parsed.fileNameWithExt = fileNameWithExt;
|
|
379
|
-
results[fileName] = parsed;
|
|
380
|
-
|
|
381
|
-
this.postprocess(results[fileName], fileName);
|
|
382
|
-
|
|
383
|
-
return next();
|
|
384
|
-
},
|
|
385
|
-
() => resolve(),
|
|
386
|
-
);
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
generateModulesTask(results, filePath) {
|
|
391
|
-
return new Promise((resolve, reject) => {
|
|
392
|
-
exec(
|
|
393
|
-
`npx documentation build ${MODULES_PATH} -f json`,
|
|
394
|
-
(err, stdout, stderr) => {
|
|
395
|
-
if (err || stderr) {
|
|
396
|
-
reject(err || stderr);
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const modules = JSON.parse(stdout);
|
|
401
|
-
for (const module of modules) {
|
|
402
|
-
const node = new JSDocNodeTree(module);
|
|
403
|
-
const name = `${module.name
|
|
404
|
-
.charAt(0)
|
|
405
|
-
.toLowerCase()}${module.name.substring(1)}`;
|
|
406
|
-
|
|
407
|
-
const pathParts = module.context.file.split('/');
|
|
408
|
-
const fileNameWithExt = pathParts[pathParts.length - 1];
|
|
409
|
-
|
|
410
|
-
results[name] = {
|
|
411
|
-
name,
|
|
412
|
-
fileNameWithExt,
|
|
413
|
-
description: node.getText(),
|
|
414
|
-
props: [],
|
|
415
|
-
styles: [],
|
|
416
|
-
methods: node.getMethods(),
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
resolve();
|
|
421
|
-
},
|
|
422
|
-
);
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
sortObject(not_sorted) {
|
|
427
|
-
return Object.keys(not_sorted)
|
|
428
|
-
.sort()
|
|
429
|
-
.reduce(
|
|
430
|
-
(acc, key) => ({
|
|
431
|
-
...acc,
|
|
432
|
-
[key]: not_sorted[key],
|
|
433
|
-
}),
|
|
434
|
-
{},
|
|
435
|
-
);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
async generate() {
|
|
439
|
-
this.generateModulesTask({}, MODULES_PATH);
|
|
440
|
-
|
|
441
|
-
const results = {};
|
|
442
|
-
|
|
443
|
-
const tasks = [
|
|
444
|
-
this.generateReactComponentsTask(results, COMPONENT_PATH),
|
|
445
|
-
this.generateModulesTask(results, MODULES_PATH),
|
|
446
|
-
];
|
|
447
|
-
|
|
448
|
-
return Promise.all(tasks).then(() => {
|
|
449
|
-
fs.writeFileSync(
|
|
450
|
-
OUTPUT_PATH,
|
|
451
|
-
JSON.stringify(this.sortObject(results), null, 2),
|
|
452
|
-
);
|
|
453
|
-
return true;
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
module.exports = DocJSONBuilder;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
class JSDocNodeTree {
|
|
2
|
-
constructor(root) {
|
|
3
|
-
this._root = root;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
getChildrenByTag(node, tag) {
|
|
7
|
-
if (!node || !Array.isArray(node.children)) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
return node.children.filter((child) => child.type === tag);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
getName() {
|
|
14
|
-
if (!this._root) {
|
|
15
|
-
return '';
|
|
16
|
-
}
|
|
17
|
-
return this._root.namespace;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getText() {
|
|
21
|
-
if (!this.hasChildren()) {
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let text = '';
|
|
26
|
-
for (let paragraph of this.getChildrenByTag(
|
|
27
|
-
this._root.description,
|
|
28
|
-
'paragraph',
|
|
29
|
-
)) {
|
|
30
|
-
for (let textNode of this.getChildrenByTag(paragraph, 'text')) {
|
|
31
|
-
text += textNode.value;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return text;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getMethods() {
|
|
39
|
-
if (!this._hasArray(this._root.members, 'instance')) {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const methods = [];
|
|
44
|
-
for (let field of this._root.members.instance) {
|
|
45
|
-
if (field.kind !== 'function' || this._isPrivateMethod(field)) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const node = new JSDocNodeTree(field);
|
|
50
|
-
methods.push({
|
|
51
|
-
name: field.name,
|
|
52
|
-
description: node.getText(),
|
|
53
|
-
params: this.getMethodParams(field),
|
|
54
|
-
examples: this.getExamples(field),
|
|
55
|
-
returns: this.getReturnValue(field),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return methods;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
getMethodParams(field) {
|
|
63
|
-
if (!this._hasArray(field, 'params')) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const methodParams = [];
|
|
68
|
-
for (let param of field.params) {
|
|
69
|
-
if (param.title !== 'param') {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const node = new JSDocNodeTree(param);
|
|
74
|
-
methodParams.push({
|
|
75
|
-
name: param.name,
|
|
76
|
-
description: node.getText(),
|
|
77
|
-
type: { name: this.getType(param.type) },
|
|
78
|
-
optional: param.type.type === 'OptionalType',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return methodParams;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getExamples(field) {
|
|
86
|
-
if (!this._hasArray(field, 'examples')) {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
return field.examples.map((example) => example.description);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
getReturnValue(field) {
|
|
93
|
-
if (!this._hasArray(field, 'returns')) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const returnNode = field.returns[0];
|
|
98
|
-
const descriptionNode = new JSDocNodeTree(returnNode);
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
description: descriptionNode.getText(),
|
|
102
|
-
type: { name: this.getType(returnNode.type) },
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getType(typeNode) {
|
|
107
|
-
if (!typeNode) {
|
|
108
|
-
return '';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (typeNode.expression) {
|
|
112
|
-
return typeNode.expression.name;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return typeNode.name || '';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
hasChildren() {
|
|
119
|
-
return this._hasArray(this._root.description, 'children');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
_hasArray(node, propName) {
|
|
123
|
-
if (!this._root) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
return Array.isArray(node[propName]) && node[propName].length;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
_isPrivateMethod(field) {
|
|
130
|
-
return field.name.charAt(0) === '_';
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = JSDocNodeTree;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const ejs = require('ejs');
|
|
5
|
-
|
|
6
|
-
const TMPL_PATH = path.join(__dirname, '..', 'templates');
|
|
7
|
-
const TMPL_FILE = fs.readFileSync(
|
|
8
|
-
path.join(TMPL_PATH, 'component.md.ejs'),
|
|
9
|
-
'utf8',
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
class MarkdownBuilder {
|
|
13
|
-
generateComponentFile(docJSON, componentName) {
|
|
14
|
-
const tmpl = ejs.compile(TMPL_FILE, { strict: true });
|
|
15
|
-
const fileContents = tmpl({ component: docJSON[componentName] });
|
|
16
|
-
fs.writeFileSync(
|
|
17
|
-
path.join(__dirname, '..', '..', 'docs', `${componentName}.md`),
|
|
18
|
-
fileContents,
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
generate() {
|
|
23
|
-
const docJSONFile = fs.readFileSync(
|
|
24
|
-
path.join(__dirname, '..', '..', 'docs', 'docs.json'),
|
|
25
|
-
'utf8',
|
|
26
|
-
);
|
|
27
|
-
const docJSON = JSON.parse(docJSONFile);
|
|
28
|
-
const componentPaths = Object.keys(docJSON);
|
|
29
|
-
|
|
30
|
-
for (let componentPath of componentPaths) {
|
|
31
|
-
this.generateComponentFile(docJSON, componentPath);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log('Markdown is finish generating');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = MarkdownBuilder;
|