[macos] Replaced UIColor with NSColor in documentation

This commit is contained in:
Minh Nguyễn
2018-04-16 15:29:38 -07:00
committed by Minh Nguyễn
parent 3d3b87e020
commit 3a0a3e4281
10 changed files with 372 additions and 5 deletions

View File

@@ -664,13 +664,13 @@ function duplicatePlatformDecls(src) {
// Look for a documentation comment that contains “MGLColor” or “UIColor”
// and the subsequent function, method, or property declaration. Try not to
// match greedily.
return src.replace(/(\/\*\*(?:\*[^\/]|[^*])*?\*\/)(\s*[^;]+?\b(?:MGL|NS|UI)(?:Color|EdgeInsets(?:Zero)?)\b[^;]+?;)/g,
return src.replace(/(\/\*\*(?:\*[^\/]|[^*])*?\b(?:MGL|NS|UI)Color\b[\s\S]*?\*\/)(\s*.+?;)/g,
(match, comment, decl) => {
let macosComment = comment.replace(/\b(?:MGL|UI)(Color|EdgeInsets(?:Zero)?)\b/g, 'NS$1')
let macosComment = comment.replace(/\b(?:MGL|UI)Color\b/g, 'NSColor')
// Use the correct indefinite article.
.replace(/\ba(\s+`?NS(?:Color|EdgeInsets))\b/gi, 'an$1');
let iosDecl = decl.replace(/\bMGL(Color|EdgeInsets)\b/g, 'UI$1');
let macosDecl = decl.replace(/\b(?:MGL|UI)(Color|EdgeInsets)\b/g, 'NS$1');
.replace(/\ba(\s+`?NSColor)\b/gi, 'an$1');
let iosDecl = decl.replace(/\bMGLColor\b/g, 'UIColor');
let macosDecl = decl.replace(/\b(?:MGL|UI)Color\b/g, 'NSColor');
return `\
#if TARGET_OS_IPHONE
${comment}${iosDecl}

View File

@@ -37,6 +37,7 @@ which it is added.
#pragma mark - Accessing the Paint Attributes
#if TARGET_OS_IPHONE
/**
The color with which the background will be drawn.
@@ -59,6 +60,30 @@ which it is added.
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *backgroundColor;
#else
/**
The color with which the background will be drawn.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `backgroundPattern` is set to
`nil`. Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable
This property does not support applying interpolation or step functions to
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *backgroundColor;
#endif
/**
The transition affecting any changes to this layer’s `backgroundColor` property.

View File

@@ -137,6 +137,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition circleBlurTransition;
#if TARGET_OS_IPHONE
/**
The fill color of the circle.
@@ -154,6 +155,25 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *circleColor;
#else
/**
The fill color of the circle.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *circleColor;
#endif
/**
The transition affecting any changes to this layer’s `circleColor` property.
@@ -265,6 +285,7 @@ MGL_EXPORT
@property (nonatomic, null_resettable) NSExpression *circlePitchScale __attribute__((unavailable("Use circleScaleAlignment instead.")));
#if TARGET_OS_IPHONE
/**
The stroke color of the circle.
@@ -282,6 +303,25 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *circleStrokeColor;
#else
/**
The stroke color of the circle.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *circleStrokeColor;
#endif
/**
The transition affecting any changes to this layer’s `circleStrokeColor` property.

View File

@@ -101,6 +101,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition fillExtrusionBaseTransition;
#if TARGET_OS_IPHONE
/**
The base color of this layer. The extrusion's surfaces will be shaded
differently based on this color in combination with the `light` settings. If
@@ -124,6 +125,31 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillExtrusionColor;
#else
/**
The base color of this layer. The extrusion's surfaces will be shaded
differently based on this color in combination with the `light` settings. If
this color is specified with an alpha component, the alpha component will be
ignored; use `fillExtrusionOpacity` to set layer opacityco.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `fillExtrusionPattern` is set to
`nil`. Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillExtrusionColor;
#endif
/**
The transition affecting any changes to this layer’s `fillExtrusionColor` property.

View File

@@ -95,6 +95,7 @@ MGL_EXPORT
@property (nonatomic, null_resettable) NSExpression *fillAntialias __attribute__((unavailable("Use fillAntialiased instead.")));
#if TARGET_OS_IPHONE
/**
The color of the filled part of this layer.
@@ -115,6 +116,28 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillColor;
#else
/**
The color of the filled part of this layer.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `fillPattern` is set to `nil`.
Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillColor;
#endif
/**
The transition affecting any changes to this layer’s `fillColor` property.
@@ -148,6 +171,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition fillOpacityTransition;
#if TARGET_OS_IPHONE
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
@@ -165,6 +189,25 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillOutlineColor;
#else
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
This property is only applied to the style if `fillPattern` is set to `nil`,
and `fillAntialiased` is set to an expression that evaluates to `YES`.
Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *fillOutlineColor;
#endif
/**
The transition affecting any changes to this layer’s `fillOutlineColor` property.

View File

@@ -65,6 +65,7 @@ MGL_EXPORT
#pragma mark - Accessing the Paint Attributes
#if TARGET_OS_IPHONE
/**
The color of each screen point based on its density value in a heatmap. This
property is normally set to an interpolation or step expression with the
@@ -86,6 +87,29 @@ MGL_EXPORT
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *heatmapColor;
#else
/**
The color of each screen point based on its density value in a heatmap. This
property is normally set to an interpolation or step expression with the
`$heatmapDensity` value as its input.
The default value of this property is an expression that evaluates to a rainbow
color scale from blue to red. Set this property to `nil` to reset it to the
default value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$heatmapDensity` variable
This property does not support applying interpolation or step functions to
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *heatmapColor;
#endif
/**
Similar to `heatmapWeight` but controls the intensity of the heatmap globally.

View File

@@ -75,6 +75,7 @@ MGL_EXPORT
#pragma mark - Accessing the Paint Attributes
#if TARGET_OS_IPHONE
/**
The shading color used to accentuate rugged terrain like sharp cliffs and
gorges.
@@ -95,6 +96,28 @@ MGL_EXPORT
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeAccentColor;
#else
/**
The shading color used to accentuate rugged terrain like sharp cliffs and
gorges.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable
This property does not support applying interpolation or step functions to
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeAccentColor;
#endif
/**
The transition affecting any changes to this layer’s `hillshadeAccentColor` property.
@@ -129,6 +152,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition hillshadeExaggerationTransition;
#if TARGET_OS_IPHONE
/**
The shading color of areas that faces towards the light source.
@@ -148,6 +172,27 @@ MGL_EXPORT
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeHighlightColor;
#else
/**
The shading color of areas that faces towards the light source.
The default value of this property is an expression that evaluates to
`NSColor.whiteColor`. Set this property to `nil` to reset it to the default
value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable
This property does not support applying interpolation or step functions to
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeHighlightColor;
#endif
/**
The transition affecting any changes to this layer’s `hillshadeHighlightColor` property.
@@ -202,6 +247,7 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeIlluminationDirection;
#if TARGET_OS_IPHONE
/**
The shading color of areas that face away from the light source.
@@ -221,6 +267,27 @@ MGL_EXPORT
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeShadowColor;
#else
/**
The shading color of areas that face away from the light source.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable
This property does not support applying interpolation or step functions to
feature attributes.
*/
@property (nonatomic, null_resettable) NSExpression *hillshadeShadowColor;
#endif
/**
The transition affecting any changes to this layer’s `hillshadeShadowColor` property.

View File

@@ -128,6 +128,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition positionTransition;
#if TARGET_OS_IPHONE
/**
Color tint for lighting extruded geometries.
@@ -150,6 +151,30 @@ MGL_EXPORT
light property in the Mapbox Style Specification.
*/
@property (nonatomic) NSExpression *color;
#else
/**
Color tint for lighting extruded geometries.
The default value of this property is an expression that evaluates to
`NSColor.whiteColor`.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable
This property does not support applying interpolation or step functions to
feature attributes.
This property corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-js/style-spec/#light-color"><code>color</code></a>
light property in the Mapbox Style Specification.
*/
@property (nonatomic) NSExpression *color;
#endif
/**
The transition affecting any changes to this layer’s `color` property.

View File

@@ -248,6 +248,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition lineBlurTransition;
#if TARGET_OS_IPHONE
/**
The color with which the line will be drawn.
@@ -268,6 +269,28 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *lineColor;
#else
/**
The color with which the line will be drawn.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `linePattern` is set to `nil`.
Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *lineColor;
#endif
/**
The transition affecting any changes to this layer’s `lineColor` property.

View File

@@ -1470,6 +1470,7 @@ MGL_EXPORT
#pragma mark - Accessing the Paint Attributes
#if TARGET_OS_IPHONE
/**
The tint color to apply to the icon. The `iconImageName` property must be set
to a template image.
@@ -1491,6 +1492,29 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *iconColor;
#else
/**
The tint color to apply to the icon. The `iconImageName` property must be set
to a template image.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `iconImageName` is non-`nil`.
Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *iconColor;
#endif
/**
The transition affecting any changes to this layer’s `iconColor` property.
@@ -1528,6 +1552,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition iconHaloBlurTransition;
#if TARGET_OS_IPHONE
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
template image.
@@ -1549,6 +1574,29 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *iconHaloColor;
#else
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
template image.
The default value of this property is an expression that evaluates to
`NSColor.clearColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `iconImageName` is non-`nil`.
Otherwise, it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *iconHaloColor;
#endif
/**
The transition affecting any changes to this layer’s `iconHaloColor` property.
@@ -1714,6 +1762,7 @@ MGL_EXPORT
@property (nonatomic, null_resettable) NSExpression *iconTranslateAnchor __attribute__((unavailable("Use iconTranslationAnchor instead.")));
#if TARGET_OS_IPHONE
/**
The color with which the text will be drawn.
@@ -1734,6 +1783,28 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *textColor;
#else
/**
The color with which the text will be drawn.
The default value of this property is an expression that evaluates to
`NSColor.blackColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `text` is non-`nil`. Otherwise,
it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *textColor;
#endif
/**
The transition affecting any changes to this layer’s `textColor` property.
@@ -1771,6 +1842,7 @@ MGL_EXPORT
*/
@property (nonatomic) MGLTransition textHaloBlurTransition;
#if TARGET_OS_IPHONE
/**
The color of the text's halo, which helps it stand out from backgrounds.
@@ -1791,6 +1863,28 @@ MGL_EXPORT
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *textHaloColor;
#else
/**
The color of the text's halo, which helps it stand out from backgrounds.
The default value of this property is an expression that evaluates to
`NSColor.clearColor`. Set this property to `nil` to reset it to the default
value.
This property is only applied to the style if `text` is non-`nil`. Otherwise,
it is ignored.
You can set this property to an expression containing any of the following:
* Constant `NSColor` values
* Predefined functions, including mathematical and string operators
* Conditional expressions
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
*/
@property (nonatomic, null_resettable) NSExpression *textHaloColor;
#endif
/**
The transition affecting any changes to this layer’s `textHaloColor` property.