diff --git a/CHANGELOG.md b/CHANGELOG.md index 7676c2b..5ad372a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,7 +72,7 @@ # v0.2.0 * Added "animation" and "transition" properties, Animation interface, animation events -* Renamed ColorPropery constant to ColorTag +* Renamed ColorProperty constant to ColorTag * Updated readme * Added the Animation example to the demo * Bug fixing diff --git a/animation.go b/animation.go index 20b8dd7..f2cbd66 100644 --- a/animation.go +++ b/animation.go @@ -85,7 +85,7 @@ const ( LinearTiming = "linear" ) -// StepsTiming return a timing function along stepCount stops along the transition, diplaying each stop for equal lengths of time +// StepsTiming return a timing function along stepCount stops along the transition, displaying each stop for equal lengths of time func StepsTiming(stepCount int) string { return "steps(" + strconv.Itoa(stepCount) + ")" } @@ -130,7 +130,7 @@ type Animation interface { writeTransitionString(tag string, buffer *strings.Builder) animationCSS(session Session) string transitionCSS(buffer *strings.Builder, session Session) - hasAnimatedPropery() bool + hasAnimatedProperty() bool animationName() string } @@ -160,7 +160,7 @@ func NewAnimation(params Params) Animation { return animation } -func (animation *animationData) hasAnimatedPropery() bool { +func (animation *animationData) hasAnimatedProperty() bool { props := animation.getRaw(PropertyTag) if props == nil { ErrorLog("There are no animated properties.") diff --git a/animationEvents.go b/animationEvents.go index 7432cce..7d2178d 100644 --- a/animationEvents.go +++ b/animationEvents.go @@ -30,7 +30,7 @@ const ( AnimationStartEvent = "animation-start-event" // AnimationEndEvent is the constant for "animation-end-event" property tag. - // The "animation-end-event" is fired when aт фnimation has completed. + // The "animation-end-event" is fired when an animation has completed. // If the animation aborts before reaching completion, such as if the element is removed // or the animation is removed from the element, the "animation-end-event" is not fired. AnimationEndEvent = "animation-end-event" @@ -46,7 +46,7 @@ const ( // AnimationIterationEvent is the constant for "animation-iteration-event" property tag. // The "animation-iteration-event" is fired when an iteration of an animation ends, - // and another one begins. This event does not occur at the same time as the animationend event, + // and another one begins. This event does not occur at the same time as the animation end event, // and therefore does not occur for animations with an "iteration-count" of one. AnimationIterationEvent = "animation-iteration-event" ) diff --git a/app_scripts.js b/app_scripts.js index ee1b941..1162fae 100644 --- a/app_scripts.js +++ b/app_scripts.js @@ -1339,7 +1339,7 @@ function mediaSetVolume(elementId, volume) { } } -function startDowndload(url, filename) { +function startDownload(url, filename) { var element = document.getElementById("ruiDownloader"); if (element) { element.href = url; diff --git a/backgroundConicGradient.go b/backgroundConicGradient.go index 00ef8a1..c2b646b 100644 --- a/backgroundConicGradient.go +++ b/backgroundConicGradient.go @@ -209,7 +209,7 @@ func (gradient *backgroundConicGradient) parseGradientText(value string) []Backg for i, element := range elements { var ok bool if vector[i], ok = gradient.stringToGradientPoint(strings.Trim(element, " ")); !ok { - ErrorLogF(`Ivalid %d element of the conic gradient: "%s"`, i, element) + ErrorLogF(`Invalid %d element of the conic gradient: "%s"`, i, element) return nil } } @@ -240,7 +240,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool { return true } - ErrorLogF(`Ivalid conic gradient: "%s"`, value) + ErrorLogF(`Invalid conic gradient: "%s"`, value) return false case []BackgroundGradientAngle: @@ -252,7 +252,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool { for i, point := range value { if point.Color == nil { - ErrorLogF("Ivalid %d element of the conic gradient: Color is nil", i) + ErrorLogF("Invalid %d element of the conic gradient: Color is nil", i) return false } } diff --git a/backgroundGradient.go b/backgroundGradient.go index fcb0e61..9373841 100644 --- a/backgroundGradient.go +++ b/backgroundGradient.go @@ -99,7 +99,7 @@ func (gradient *backgroundGradient) parseGradientText(value string) []Background points := make([]BackgroundGradientPoint, count) for i, element := range elements { if !points[i].setValue(element) { - ErrorLogF(`Ivalid %d element of the conic gradient: "%s"`, i, element) + ErrorLogF(`Invalid %d element of the conic gradient: "%s"`, i, element) return nil } } diff --git a/canvas.go b/canvas.go index 35abf05..5895c59 100644 --- a/canvas.go +++ b/canvas.go @@ -182,7 +182,7 @@ type Canvas interface { SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint) // SetImageFillStyle set the image as the filling pattern. - // repeate - indicating how to repeat the pattern's image. Possible values are: + // repeat - indicating how to repeat the pattern's image. Possible values are: // NoRepeat (0) - neither direction, // RepeatXY (1) - both directions, // RepeatX (2) - horizontal only, @@ -286,7 +286,7 @@ type Canvas interface { DrawImage(x, y float64, image Image) // DrawImageInRect draws the image in the rectangle (x, y, width, height), scaling in height and width if necessary DrawImageInRect(x, y, width, height float64, image Image) - // DrawImageFragment draws the frament (described by srcX, srcY, srcWidth, srcHeight) of image + // DrawImageFragment draws the fragment (described by srcX, srcY, srcWidth, srcHeight) of image // in the rectangle (dstX, dstY, dstWidth, dstHeight), scaling in height and width if necessary DrawImageFragment(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight float64, image Image) @@ -302,12 +302,12 @@ func newCanvas(view CanvasView) Canvas { canvas := new(canvasData) canvas.view = view canvas.session = view.Session() - canvas.session.cavnasStart(view.htmlID()) + canvas.session.canvasStart(view.htmlID()) return canvas } func (canvas *canvasData) finishDraw() { - canvas.session.cavnasFinish() + canvas.session.canvasFinish() } func (canvas *canvasData) View() CanvasView { diff --git a/colorConstants.go b/colorConstants.go index 4505a1f..e59a709 100644 --- a/colorConstants.go +++ b/colorConstants.go @@ -55,8 +55,8 @@ const ( BlueViolet Color = 0xff8a2be2 // Brown color constant Brown Color = 0xffa52a2a - // Burlywood color constant - Burlywood Color = 0xffdeb887 + // BurlyWood color constant + BurlyWood Color = 0xffdeb887 // CadetBlue color constant CadetBlue Color = 0xff5f9ea0 // Chartreuse color constant @@ -67,8 +67,8 @@ const ( Coral Color = 0xffff7f50 // CornflowerBlue color constant CornflowerBlue Color = 0xff6495ed - // Cornsilk color constant - Cornsilk Color = 0xfffff8dc + // CornSilk color constant + CornSilk Color = 0xfffff8dc // Crimson color constant Crimson Color = 0xffdc143c // Cyan color constant @@ -105,8 +105,8 @@ const ( DarkSlateBlue Color = 0xff483d8b // DarkSlateGray color constant DarkSlateGray Color = 0xff2f4f4f - // Darkslategrey color constant - Darkslategrey Color = 0xff2f4f4f + // DarkSlateGrey color constant + DarkSlateGrey Color = 0xff2f4f4f // DarkTurquoise color constant DarkTurquoise Color = 0xff00ced1 // DarkViolet color constant @@ -135,8 +135,8 @@ const ( Gold Color = 0xffffd700 // GoldenRod color constant GoldenRod Color = 0xffdaa520 - // GreenyEllow color constant - GreenyEllow Color = 0xffadff2f + // GreenYellow color constant + GreenYellow Color = 0xffadff2f // Grey color constant Grey Color = 0xff808080 // Honeydew color constant @@ -293,8 +293,8 @@ const ( Violet Color = 0xffee82ee // Wheat color constant Wheat Color = 0xfff5deb3 - // Whitesmoke color constant - Whitesmoke Color = 0xfff5f5f5 + // WhiteSmoke color constant + WhiteSmoke Color = 0xfff5f5f5 // YellowGreen color constant YellowGreen Color = 0xff9acd32 ) diff --git a/downloadFile.go b/downloadFile.go index c1a503a..00ccae9 100644 --- a/downloadFile.go +++ b/downloadFile.go @@ -23,7 +23,7 @@ func (session *sessionData) startDownload(file downloadFile) { currentDownloadId++ id := strconv.Itoa(currentDownloadId) downloadFiles[id] = file - session.callFunc("startDowndload", id, file.filename) + session.callFunc("startDownload", id, file.filename) } func serveDownloadFile(id string, w http.ResponseWriter, r *http.Request) bool { diff --git a/editView.go b/editView.go index 897f890..73939f3 100644 --- a/editView.go +++ b/editView.go @@ -23,7 +23,7 @@ const ( PasswordText = 1 // EmailText - e-mail type of EditView. Allows to enter one email EmailText = 2 - // EmailsText - e-mail type of EditView. Allows to enter multiple emails separeted by comma + // EmailsText - e-mail type of EditView. Allows to enter multiple emails separated by comma EmailsText = 3 // URLText - url type of EditView. Allows to enter one url URLText = 4 @@ -531,7 +531,7 @@ func GetHint(view View, subviewID ...string) string { return "" } -// GetMaxLength returns a maximal lenght of EditView. If a maximal lenght is not limited then 0 is returned +// GetMaxLength returns a maximal length of EditView. If a maximal length is not limited then 0 is returned // If the second argument (subviewID) is not specified or it is "" then a value of the first argument (view) is returned. func GetMaxLength(view View, subviewID ...string) int { return intStyledProperty(view, subviewID, MaxLength, 0) @@ -604,7 +604,7 @@ func AppendEditText(view View, subviewID string, text string) { } } -// GetCaretColor returns the color of the text input carret. +// GetCaretColor returns the color of the text input caret. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. func GetCaretColor(view View, subviewID ...string) Color { return colorStyledProperty(view, subviewID, CaretColor, false) diff --git a/listView.go b/listView.go index 92dbe71..7dadbf7 100644 --- a/listView.go +++ b/listView.go @@ -47,7 +47,7 @@ const ( // ListView - the list view interface type ListView interface { View - ParanetView + ParentView // ReloadListViewData updates ListView content ReloadListViewData() diff --git a/propertyNames.go b/propertyNames.go index 7649cf9..2601fb7 100644 --- a/propertyNames.go +++ b/propertyNames.go @@ -421,7 +421,7 @@ const ( // This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. VerticalTextOrientation = "vertical-text-orientation" - // TextTverflow is the constant for the "text-overflow" property tag. + // TextOverflow is the constant for the "text-overflow" property tag. // The "text-overflow" int property sets how hidden overflow content is signaled to users. // It can be clipped or display an ellipsis ('…'). Valid values are TextOverflow = "text-overflow" @@ -538,7 +538,7 @@ const ( // AvoidBreak is the constant for the "avoid-break" property tag. // The "avoid-break" bool property sets how region breaks should behave inside a generated box. - // If the property value is "true" then fvoids any break from being inserted within the principal box. + // If the property value is "true" then avoids any break from being inserted within the principal box. // If the property value is "false" then allows, but does not force, any break to be inserted within // the principal box. AvoidBreak = "avoid-break" @@ -656,7 +656,7 @@ const ( // allowing text and inline Views to wrap around it. Float = "float" - // UsetData is the constant for the "user-data" property tag. + // UserData is the constant for the "user-data" property tag. // The "user-data" property can contain any user data UserData = "user-data" diff --git a/resizable.go b/resizable.go index b88f8fb..7eb5f7b 100644 --- a/resizable.go +++ b/resizable.go @@ -34,7 +34,7 @@ const ( // Resizable - grid-container of View type Resizable interface { View - ParanetView + ParentView } type resizableData struct { diff --git a/session.go b/session.go index 2a435ee..41ea863 100644 --- a/session.go +++ b/session.go @@ -20,13 +20,13 @@ type webBridge interface { writeMessage(text string) bool addAnimationCSS(css string) clearAnimation() - cavnasStart(htmlID string) + canvasStart(htmlID string) callCanvasFunc(funcName string, args ...any) callCanvasVarFunc(v any, funcName string, args ...any) callCanvasImageFunc(url string, property string, funcName string, args ...any) createCanvasVar(funcName string, args ...any) any updateCanvasProperty(property string, value any) - cavnasFinish() + canvasFinish() canvasTextMetrics(htmlID, font, text string) TextMetrics htmlPropertyValue(htmlID, name string) string answerReceived(answer DataObject) @@ -125,13 +125,13 @@ type Session interface { finishUpdateScript(htmlID string) addAnimationCSS(css string) clearAnimation() - cavnasStart(htmlID string) + canvasStart(htmlID string) callCanvasFunc(funcName string, args ...any) createCanvasVar(funcName string, args ...any) any callCanvasVarFunc(v any, funcName string, args ...any) callCanvasImageFunc(url string, property string, funcName string, args ...any) updateCanvasProperty(property string, value any) - cavnasFinish() + canvasFinish() canvasTextMetrics(htmlID, font, text string) TextMetrics htmlPropertyValue(htmlID, name string) string handleAnswer(data DataObject) @@ -290,7 +290,11 @@ func (session *sessionData) writeInitScript(writer *strings.Builder) { if session.rootView != nil { writer.WriteString(`document.getElementById('ruiRootView').innerHTML = '`) - viewHTML(session.rootView, writer) + buffer := allocStringBuilder() + defer freeStringBuilder(buffer) + viewHTML(session.rootView, buffer) + text := strings.ReplaceAll(buffer.String(), "'", `\'`) + writer.WriteString(text) writer.WriteString("';\nscanElementsSize();") } } @@ -424,9 +428,9 @@ func (session *sessionData) clearAnimation() { } } -func (session *sessionData) cavnasStart(htmlID string) { +func (session *sessionData) canvasStart(htmlID string) { if session.bridge != nil { - session.bridge.cavnasStart(htmlID) + session.bridge.canvasStart(htmlID) } } @@ -461,9 +465,9 @@ func (session *sessionData) callCanvasImageFunc(url string, property string, fun } } -func (session *sessionData) cavnasFinish() { +func (session *sessionData) canvasFinish() { if session.bridge != nil { - session.bridge.cavnasFinish() + session.bridge.canvasFinish() } } diff --git a/sessionUtils.go b/sessionUtils.go index bf3d977..a9e4712 100644 --- a/sessionUtils.go +++ b/sessionUtils.go @@ -42,7 +42,7 @@ func viewByHTMLID(id string, startView View) View { if startView.htmlID() == id { return startView } - if container, ok := startView.(ParanetView); ok { + if container, ok := startView.(ParentView); ok { for _, view := range container.Views() { if view != nil { if v := viewByHTMLID(id, view); v != nil { diff --git a/sizeFunc.go b/sizeFunc.go index d56b101..ff9bab5 100644 --- a/sizeFunc.go +++ b/sizeFunc.go @@ -104,7 +104,7 @@ func (data *sizeFuncData) parseArgs(args []any, allowNumber bool) bool { } } - ErrorLogF(`The %s function argument cann't be a number`, data.tag) + ErrorLogF(`The %s function argument can't be a number`, data.tag) return false } diff --git a/tableView.go b/tableView.go index ae29eb7..897bb4d 100644 --- a/tableView.go +++ b/tableView.go @@ -218,7 +218,7 @@ type CellIndex struct { // TableView - text View type TableView interface { View - ParanetView + ParentView ReloadTableData() CellFrame(row, column int) Frame diff --git a/tableViewUtils.go b/tableViewUtils.go index 3c2e829..d8e46f3 100644 --- a/tableViewUtils.go +++ b/tableViewUtils.go @@ -94,7 +94,7 @@ func GetTableSelectionMode(view View, subviewID ...string) int { return enumStyledProperty(view, subviewID, SelectionMode, NoneSelection, false) } -// GetTableVerticalAlign returns a vertical align in a TavleView cell. Returns one of next values: +// GetTableVerticalAlign returns a vertical align in a TableView cell. Returns one of next values: // TopAlign (0), BottomAlign (1), CenterAlign (2), and BaselineAlign (3) // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. func GetTableVerticalAlign(view View, subviewID ...string) int { diff --git a/view.go b/view.go index 754ef1e..b81dae3 100644 --- a/view.go +++ b/view.go @@ -45,7 +45,7 @@ type View interface { Focusable() bool // Frame returns the location and size of the view in pixels Frame() Frame - // Scroll returns the location size of the scrolable view in pixels + // Scroll returns the location size of the scrollable view in pixels Scroll() Frame // SetAnimated sets the value (second argument) of the property with name defined by the first argument. // Return "true" if the value has been set, in the opposite case "false" are returned and diff --git a/viewByID.go b/viewByID.go index de98db5..45e67e3 100644 --- a/viewByID.go +++ b/viewByID.go @@ -12,7 +12,7 @@ func ViewByID(rootView View, id string) View { return rootView } - if container, ok := rootView.(ParanetView); ok { + if container, ok := rootView.(ParentView); ok { if view := viewByID(container, id); view != nil { return view } @@ -32,13 +32,13 @@ func ViewByID(rootView View, id string) View { return nil } -func viewByID(rootView ParanetView, id string) View { +func viewByID(rootView ParentView, id string) View { for _, view := range rootView.Views() { if view != nil { if view.ID() == id { return view } - if container, ok := view.(ParanetView); ok { + if container, ok := view.(ParentView); ok { if v := viewByID(container, id); v != nil { return v } diff --git a/viewStyleSet.go b/viewStyleSet.go index a35d33f..4d1c8f6 100644 --- a/viewStyleSet.go +++ b/viewStyleSet.go @@ -338,7 +338,7 @@ func (style *viewStyle) set(tag string, value any) bool { return true case DataObject: - if animation := parseAnimation(value); animation.hasAnimatedPropery() { + if animation := parseAnimation(value); animation.hasAnimatedProperty() { style.properties[tag] = []Animation{animation} return true } @@ -348,7 +348,7 @@ func (style *viewStyle) set(tag string, value any) bool { result := true for i := 0; i < value.ArraySize(); i++ { if obj := value.ArrayElement(i).Object(); obj != nil { - if anim := parseAnimation(obj); anim.hasAnimatedPropery() { + if anim := parseAnimation(obj); anim.hasAnimatedProperty() { animations = append(animations, anim) } else { result = false diff --git a/viewsContainer.go b/viewsContainer.go index 86bf757..9811e2e 100644 --- a/viewsContainer.go +++ b/viewsContainer.go @@ -2,7 +2,7 @@ package rui import "strings" -type ParanetView interface { +type ParentView interface { // Views return a list of child views Views() []View } @@ -10,7 +10,7 @@ type ParanetView interface { // ViewsContainer - mutable list-container of Views type ViewsContainer interface { View - ParanetView + ParentView // Append appends a view to the end of the list of a view children Append(view View) // Insert inserts a view to the "index" position in the list of a view children diff --git a/wasmBridge.go b/wasmBridge.go index e3925f1..8d14415 100644 --- a/wasmBridge.go +++ b/wasmBridge.go @@ -135,7 +135,7 @@ func (bridge *wasmBridge) clearAnimation() { styles.Set("textContent", "") } -func (bridge *wasmBridge) cavnasStart(htmlID string) { +func (bridge *wasmBridge) canvasStart(htmlID string) { if ProtocolInDebugLog { DebugLog("const ctx = document.getElementById('" + htmlID + "'elementId').getContext('2d');\nctx.save();") } @@ -204,7 +204,7 @@ func (bridge *wasmBridge) updateCanvasProperty(property string, value any) { } } -func (bridge *wasmBridge) cavnasFinish() { +func (bridge *wasmBridge) canvasFinish() { if !bridge.canvas.IsNull() { DebugLog("ctx.restore()") bridge.canvas.Call("restore") diff --git a/webBridge.go b/webBridge.go index 1c8247c..fee2412 100644 --- a/webBridge.go +++ b/webBridge.go @@ -146,7 +146,7 @@ func (bridge *wsBridge) argToString(arg any) (string, bool) { } } - ErrorLog("Unsupported agument type") + ErrorLog("Unsupported argument type") return "", false } @@ -238,7 +238,7 @@ if (styles) { }`) } -func (bridge *wsBridge) cavnasStart(htmlID string) { +func (bridge *wsBridge) canvasStart(htmlID string) { bridge.canvasBuffer.Reset() bridge.canvasBuffer.WriteString(`const ctx = getCanvasContext('`) bridge.canvasBuffer.WriteString(htmlID) @@ -328,7 +328,7 @@ func (bridge *wsBridge) callCanvasImageFunc(url string, property string, funcNam bridge.canvasBuffer.WriteString(");\n}") } -func (bridge *wsBridge) cavnasFinish() { +func (bridge *wsBridge) canvasFinish() { bridge.canvasBuffer.WriteString("\n") script := bridge.canvasBuffer.String() if ProtocolInDebugLog {