Updated comments

This commit is contained in:
Alexei Anoshenko 2026-07-01 17:39:42 +03:00
parent c07cf52081
commit 7b442dea72
13 changed files with 93 additions and 81 deletions

View File

@ -259,15 +259,15 @@ func parseAnimation(obj DataObject) AnimationProperty {
// NewAnimationProperty creates a new animation object and return its interface // NewAnimationProperty creates a new animation object and return its interface
// //
// The following properties can be used: // The following properties can be used:
// - "id" (ID) - specifies the animation identifier. Used only for animation script. // - "id" ([ID]) - specifies the animation identifier. Used only for animation script.
// - "duration" (Duration) - specifies the length of time in seconds that an animation takes to complete one cycle; // - "duration" ([Duration]) - specifies the length of time in seconds that an animation takes to complete one cycle;
// - "delay" (Delay) - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform // - "delay" ([Delay]) - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform
// the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation; // the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation;
// - "timing-function" (TimingFunction) - specifies how an animation progresses through the duration of each cycle; // - "timing-function" ([TimingFunction]) - specifies how an animation progresses through the duration of each cycle;
// - "iteration-count" (IterationCount) - specifies the number of times an animation sequence should be played before stopping. Used only for animation script; // - "iteration-count" ([IterationCount]) - specifies the number of times an animation sequence should be played before stopping. Used only for animation script;
// - "animation-direction" (AnimationDirection) - specifies whether an animation should play forward, backward, // - "animation-direction" ([AnimationDirection]) - specifies whether an animation should play forward, backward,
// or alternate back and forth between playing the sequence forward and backward. Used only for animation script; // or alternate back and forth between playing the sequence forward and backward. Used only for animation script;
// - "property" (PropertyTag) - describes a scenario for changing a View's property. Used only for animation script. // - "property" ([PropertyTag]) - describes a scenario for changing a View's property. Used only for animation script.
func NewAnimationProperty(params Params) AnimationProperty { func NewAnimationProperty(params Params) AnimationProperty {
animation := new(animationData) animation := new(animationData)
animation.init() animation.init()
@ -279,7 +279,7 @@ func NewAnimationProperty(params Params) AnimationProperty {
} }
// NewTransitionAnimation creates animation data for the transition. // NewTransitionAnimation creates animation data for the transition.
// - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used; // - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used (see [TimingFunction]);
// - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0; // - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0;
// - delay - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform // - delay - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform
// the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation. // the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation.
@ -311,7 +311,7 @@ func NewTransitionAnimation(timingFunc string, duration float64, delay float64)
// NewTransitionAnimation creates the animation scenario. // NewTransitionAnimation creates the animation scenario.
// - id - specifies the animation identifier. // - id - specifies the animation identifier.
// - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used; // - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used (see [TimingFunction]);
// - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0; // - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0;
// - delay - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform // - delay - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform
// the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation. // the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation.

View File

@ -21,11 +21,11 @@ type BackgroundGradientAngle struct {
// NewBackgroundConicGradient creates the new background conic gradient // NewBackgroundConicGradient creates the new background conic gradient
// //
// The following properties can be used: // The following properties can be used:
// - "gradient" [Gradient] - Describes gradient stop points. This is a mandatory property while describing background gradients. // - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients.
// - "center-x" [CenterX] - center X point of the gradient. // - "center-x" ([CenterX]) - center X point of the gradient.
// - "center-y" [CenterY] - center Y point of the gradient. // - "center-y" ([CenterY]) - center Y point of the gradient.
// - "from" [From] - start angle position of the gradient. // - "from" ([From]) - start angle position of the gradient.
// - "repeating" [Repeating] - Defines whether stop points needs to be repeated after the last one. // - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundConicGradient(params Params) BackgroundElement { func NewBackgroundConicGradient(params Params) BackgroundElement {
result := new(backgroundConicGradient) result := new(backgroundConicGradient)
result.init() result.init()

View File

@ -74,14 +74,14 @@ type backgroundImage struct {
// NewBackgroundImage creates the new background image // NewBackgroundImage creates the new background image
// //
// The following properties can be used: // The following properties can be used:
// - "src" [Source] - the name of the image in the "images" folder of the resources, or the URL of the image or inline-image. // - "src" ([Source]) - the name of the image in the "images" folder of the resources, or the URL of the image or inline-image.
// - "width" [Width] - the width of the image. // - "width" ([Width]) - the width of the image.
// - "height" [Height] - the height of the image. // - "height" ([Height]) - the height of the image.
// - "image-horizontal-align" [ImageHorizontalAlign] - the horizontal alignment of the image relative to view's bounds. // - "image-horizontal-align" ([ImageHorizontalAlign]) - the horizontal alignment of the image relative to view's bounds.
// - "image-vertical-align" [ImageVerticalAlign] - the vertical alignment of the image relative to view's bounds. // - "image-vertical-align" ([ImageVerticalAlign]) - the vertical alignment of the image relative to view's bounds.
// - "repeat" [Repeat] - the repetition of the image. // - "repeat" ([Repeat]) - the repetition of the image.
// - "fit" [Fit] - the image scaling parameters. // - "fit" ([Fit]) - the image scaling parameters.
// - "attachment" [Attachment] - defines whether a background image's position is fixed within the viewport or scrolls with its containing block. // - "attachment" ([Attachment]) - defines whether a background image's position is fixed within the viewport or scrolls with its containing block.
func NewBackgroundImage(params Params) BackgroundElement { func NewBackgroundImage(params Params) BackgroundElement {
result := new(backgroundImage) result := new(backgroundImage)
result.init() result.init()

View File

@ -52,9 +52,9 @@ type backgroundLinearGradient struct {
// NewBackgroundLinearGradient creates the new background linear gradient. // NewBackgroundLinearGradient creates the new background linear gradient.
// //
// The following properties can be used: // The following properties can be used:
// - "gradient" [Gradient] - Describes gradient stop points. This is a mandatory property while describing background gradients. // - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients.
// - "direction" [Direction] - Defines the direction of the gradient line. // - "direction" ([Direction]) - Defines the direction of the gradient line.
// - "repeating" [Repeating] - Defines whether stop points needs to be repeated after the last one. // - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundLinearGradient(params Params) BackgroundElement { func NewBackgroundLinearGradient(params Params) BackgroundElement {
result := new(backgroundLinearGradient) result := new(backgroundLinearGradient)
result.init() result.init()

View File

@ -42,11 +42,11 @@ type backgroundRadialGradient struct {
// NewBackgroundRadialGradient creates the new background radial gradient. // NewBackgroundRadialGradient creates the new background radial gradient.
// //
// The following properties can be used: // The following properties can be used:
// - "gradient" (Gradient) - Describes gradient stop points. This is a mandatory property while describing background gradients. // - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients.
// - "center-x" (CenterX), "center-y" (CenterY) - Defines the gradient center point coordinates. // - "center-x" ([CenterX]), "center-y" ([CenterY]) - Defines the gradient center point coordinates.
// - "radial-gradient-radius" (RadialGradientRadius) - Defines radius of the radial gradient. // - "radial-gradient-radius" ([RadialGradientRadius]) - Defines radius of the radial gradient.
// - "radial-gradient-shape" (RadialGradientShape) - Defines shape of the radial gradient. // - "radial-gradient-shape" ([RadialGradientShape]) - Defines shape of the radial gradient.
// - "repeating" (Repeating) - Defines whether stop points needs to be repeated after the last one. // - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundRadialGradient(params Params) BackgroundElement { func NewBackgroundRadialGradient(params Params) BackgroundElement {
result := new(backgroundRadialGradient) result := new(backgroundRadialGradient)
result.init() result.init()

View File

@ -261,13 +261,11 @@ func newBorderProperty(value any) BorderProperty {
} }
// NewBorder creates the new BorderProperty. // NewBorder creates the new BorderProperty.
//
// The following properties can be used: // The following properties can be used:
// // - "style" ([Style]). Determines the line style (int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// "style" (Style). Determines the line style (int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine); // - "color" ([ColorTag]). Determines the line color (Color);
// // - "width" ([Width]). Determines the line thickness (SizeUnit).
// "color" (ColorTag). Determines the line color (Color);
//
// "width" (Width). Determines the line thickness (SizeUnit).
func NewBorder(params Params) BorderProperty { func NewBorder(params Params) BorderProperty {
border := new(borderProperty) border := new(borderProperty)
border.init() border.init()

View File

@ -21,7 +21,7 @@ type boundsPropertyData struct {
// NewBoundsProperty creates the new BoundsProperty object. // NewBoundsProperty creates the new BoundsProperty object.
// //
// The following SizeUnit properties can be used: "left" (Left), "right" (Right), "top" (Top), and "bottom" (Bottom). // The following SizeUnit properties can be used: "left" ([Left]), "right" ([Right]), "top" ([Top]), and "bottom" ([Bottom]).
func NewBoundsProperty(params Params) BoundsProperty { func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData) bounds := new(boundsPropertyData)
bounds.init() bounds.init()

View File

@ -5,12 +5,26 @@ import (
"strings" "strings"
) )
// ClipShape defines the type of a clipping region that sets what part of an element should be shown. Parts that are inside the region are shown, while those outside are hidden.
//
// Possible values:
// - InsetClip - an inset rectangle;
// - CircleClip - a circle using a radius and a position;
// - EllipseClip - an ellipse using two radii and a position;
// - PolygonClip - a polygon by providing one or more pairs of coordinates, each of which represents a vertex of the shape.
type ClipShape string type ClipShape string
const ( const (
InsetClip ClipShape = "inset" // InsetClip is the type of a clipping region: an inset rectangle.
CircleClip ClipShape = "circle" InsetClip ClipShape = "inset"
// CircleClip is the type of a clipping region: a circle using a radius and a position.
CircleClip ClipShape = "circle"
// EllipseClip is the type of a clipping region: an ellipse using two radii and a position.
EllipseClip ClipShape = "ellipse" EllipseClip ClipShape = "ellipse"
// PolygonClip is the type of a clipping region: a polygon by providing one or more pairs of coordinates, each of which represents a vertex of the shape.
PolygonClip ClipShape = "polygon" PolygonClip ClipShape = "polygon"
) )
@ -46,26 +60,26 @@ type polygonClipData struct {
// //
// The following properties can be used for shapes: // The following properties can be used for shapes:
// //
// InsetClip: // [InsetClip]:
// - "top" (Top) - offset (SizeUnit) from the top border of a View; // - "top" ([Top]) - offset (SizeUnit) from the top border of a View;
// - "right" (Right) - offset (SizeUnit) from the right border of a View; // - "right" ([Right]) - offset (SizeUnit) from the right border of a View;
// - "bottom" (Bottom) - offset (SizeUnit) from the bottom border of a View; // - "bottom" ([Bottom]) - offset (SizeUnit) from the bottom border of a View;
// - "left" (Left) - offset (SizeUnit) from the left border of a View; // - "left" ([Left]) - offset (SizeUnit) from the left border of a View;
// - "radius" (Radius) - corner radius (RadiusProperty). // - "radius" ([Radius]) - corner radius (RadiusProperty).
// //
// CircleClip: // [CircleClip]:
// - "x" (X) - x-axis position (SizeUnit) of the circle clip center; // - "x" ([X]) - x-axis position (SizeUnit) of the circle clip center;
// - "y" (Y) - y-axis position (SizeUnit) of the circle clip center; // - "y" ([Y]) - y-axis position (SizeUnit) of the circle clip center;
// - "radius" (Radius) - radius (SizeUnit) of the circle clip center. // - "radius" ([Radius]) - radius (SizeUnit) of the circle clip center.
// //
// EllipseClip: // [EllipseClip]:
// - "x" (X) - x-axis position (SizeUnit) of the ellipse clip center; // - "x" ([X]) - x-axis position (SizeUnit) of the ellipse clip center;
// - "y" (Y) - y-axis position (SizeUnit) of the ellipse clip center; // - "y" ([Y]) - y-axis position (SizeUnit) of the ellipse clip center;
// - "radius-x" (RadiusX) - x-axis radius (SizeUnit) of the ellipse clip center; // - "radius-x" ([RadiusX]) - x-axis radius (SizeUnit) of the ellipse clip center;
// - "radius-y" (RadiusY) - y-axis radius (SizeUnit) of the ellipse clip center. // - "radius-y" ([RadiusY]) - y-axis radius (SizeUnit) of the ellipse clip center.
// //
// PolygonClip: // [PolygonClip]:
// - "points" (Points) - an array ([]SizeUnit) of corner points of the polygon in the following order: x1, y1, x2, y2, …. // - "points" ([Points]) - an array ([]SizeUnit) of corner points of the polygon in the following order: x1, y1, x2, y2, ….
// //
// The function will return nil if no properties are specified, unsupported properties are specified, or at least one property has an invalid value. // The function will return nil if no properties are specified, unsupported properties are specified, or at least one property has an invalid value.
func NewClipShapeProperty(shape ClipShape, params Params) ClipShapeProperty { func NewClipShapeProperty(shape ClipShape, params Params) ClipShapeProperty {

View File

@ -60,9 +60,9 @@ func newColumnSeparatorProperty(value any) ColumnSeparatorProperty {
// NewColumnSeparatorProperty creates the new ColumnSeparatorProperty. // NewColumnSeparatorProperty creates the new ColumnSeparatorProperty.
// //
// The following properties can be used: // The following properties can be used:
// - "style" (Style) - Determines the line style (type is int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine); // - "style" ([Style]) - Determines the line style (type is int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - "color" (ColorTag) - Determines the line color (type is [Color]); // - "color" ([ColorTag]) - Determines the line color (type is [Color]);
// - "width" (Width) - Determines the line thickness (type is [SizeUnit]). // - "width" ([Width]) - Determines the line thickness (type is [SizeUnit]).
func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty { func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.init() separator.init()
@ -79,7 +79,7 @@ func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
// NewColumnSeparator creates the new ColumnSeparatorProperty. // NewColumnSeparator creates the new ColumnSeparatorProperty.
// //
// Arguments: // Arguments:
// - style - determines the line style. Valid values: 0 [NoneLine], 1 [SolidLine], 2 [DashedLine], 3 [DottedLine], or 4 [DoubleLine]; // - style - determines the line style. Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - color - determines the line color; // - color - determines the line color;
// - width - determines the line thickness. // - width - determines the line thickness.
func NewColumnSeparator(style int, color Color, width SizeUnit) ColumnSeparatorProperty { func NewColumnSeparator(style int, color Color, width SizeUnit) ColumnSeparatorProperty {

View File

@ -144,16 +144,16 @@ type filterData struct {
// NewFilterProperty creates the new FilterProperty // NewFilterProperty creates the new FilterProperty
// //
// The argument lists the effects to apply. The following effects are possible: // The argument lists the effects to apply. The following effects are possible:
// - "blur" (Blur) - Gaussian blur in pixels (type: float64, value: 0…10000); // - "blur" ([Blur]) - Gaussian blur in pixels (type: float64, value: 0…10000);
// - "brightness" (Brightness) - Brightness change in percents (type: float64, value: 0…10000); // - "brightness" ([Brightness]) - Brightness change in percents (type: float64, value: 0…10000);
// - "contrast" (Contrast) - Contrast change in percents (type: float64, value: 0…10000); // - "contrast" ([Contrast]) - Contrast change in percents (type: float64, value: 0…10000);
// - "drop-shadow" (DropShadow) - Adding shadow (type: []ShadowProperty); // - "drop-shadow" ([DropShadow]) - Adding shadow (type: []ShadowProperty);
// - "grayscale" (Grayscale) - Converting to grayscale in percents (type: float64, value: 0…100%); // - "grayscale" ([Grayscale]) - Converting to grayscale in percents (type: float64, value: 0…100);
// - "hue-rotate" (HueRotate) - Hue rotation (type: AngleUnit); // - "hue-rotate" ([HueRotate]) - Hue rotation (type: AngleUnit);
// - "invert" (Invert) - Invert colors in percents (type: float64, value: 0…100); // - "invert" ([Invert]) - Invert colors in percents (type: float64, value: 0…100);
// - "opacity" (Opacity) - Changing transparency in percents (type: float64, value: 0…100); // - "opacity" ([Opacity]) - Changing transparency in percents (type: float64, value: 0…100);
// - "saturate" (Saturate) - Saturation change in percents (type: float64, value: 0…10000); // - "saturate" ([Saturate]) - Saturation change in percents (type: float64, value: 0…10000);
// - "sepia" (Sepia) - Conversion to sepia in percents (type: float64, value: 0…100). // - "sepia" ([Sepia]) - Conversion to sepia in percents (type: float64, value: 0…100).
func NewFilterProperty(params Params) FilterProperty { func NewFilterProperty(params Params) FilterProperty {
if len(params) > 0 { if len(params) > 0 {
filter := new(filterData) filter := new(filterData)

View File

@ -22,8 +22,8 @@ type outlinePropertyData struct {
// NewOutlineProperty creates the new OutlineProperty. // NewOutlineProperty creates the new OutlineProperty.
// //
// The following properties can be used: // The following properties can be used:
// - "color" (ColorTag) - Determines the line color (Color); // - "color" ([ColorTag]) - Determines the line color (Color);
// - "width" (Width) - Determines the line thickness (SizeUnit). // - "width" ([Width]) - Determines the line thickness (SizeUnit).
func NewOutlineProperty(params Params) OutlineProperty { func NewOutlineProperty(params Params) OutlineProperty {
outline := new(outlinePropertyData) outline := new(outlinePropertyData)
outline.init() outline.init()

View File

@ -171,12 +171,12 @@ func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
// NewShadowProperty create the new shadow property for a view. // NewShadowProperty create the new shadow property for a view.
// //
// The following properties can be used: // The following properties can be used:
// - "color" (ColorTag). Determines the color of the shadow (Color); // - "color" ([ColorTag]) - Determines the color of the shadow (Color);
// - "x-offset" (XOffset). Determines the shadow horizontal offset (SizeUnit); // - "x-offset" ([XOffset]) - Determines the shadow horizontal offset (SizeUnit);
// - "y-offset" (YOffset). Determines the shadow vertical offset (SizeUnit); // - "y-offset" ([YOffset]) - Determines the shadow vertical offset (SizeUnit);
// - "blur" (BlurRadius). Determines the radius of the blur effect (SizeUnit); // - "blur" ([BlurRadius]) - Determines the radius of the blur effect (SizeUnit);
// - "spread-radius" (SpreadRadius). Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink; // - "spread-radius" ([SpreadRadius]) - Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink;
// - "inset" (Inset). Controls (bool) whether to draw shadow inside the frame or outside. // - "inset" ([Inset]) - Controls (bool) whether to draw shadow inside the frame or outside.
func NewShadowProperty(params Params) ShadowProperty { func NewShadowProperty(params Params) ShadowProperty {
shadow := new(shadowPropertyData) shadow := new(shadowPropertyData)
shadow.init() shadow.init()

View File

@ -287,9 +287,9 @@ type transformPropertyData struct {
// //
// The following properties can be used: // The following properties can be used:
// //
// Perspective ("perspective"), TranslateX ("translate-x"), TranslateY ("translate-y"), TranslateZ ("translate-z"), // [Perspective] ("perspective"), [TranslateX] ("translate-x"), [TranslateY] ("translate-y"), [TranslateZ] ("translate-z"),
// ScaleX ("scale-x"), ScaleY ("scale-y"), ScaleZ ("scale-z"), Rotate ("rotate"), RotateX ("rotate-x"), // [ScaleX] ("scale-x"), [ScaleY] ("scale-y"), [ScaleZ] ("scale-z"), [Rotate] ("rotate"), [RotateX] ("rotate-x"),
// RotateY ("rotate-y"), RotateZ ("rotate-z"), SkewX ("skew-x"), and SkewY ("skew-y") // [RotateY] ("rotate-y"), [RotateZ] ("rotate-z"), [SkewX] ("skew-x"), and [SkewY] ("skew-y")
func NewTransformProperty(params Params) TransformProperty { func NewTransformProperty(params Params) TransformProperty {
transform := new(transformPropertyData) transform := new(transformPropertyData)
transform.init() transform.init()