From a49e75d96c91dda0ec6eba68703df0090572dc1e Mon Sep 17 00:00:00 2001 From: hariroshan Date: Sat, 4 Mar 2023 19:48:01 +0530 Subject: [PATCH] added docs --- elm-native/src/Native/Attributes.elm | 939 ++++++++++++++++++++++++++- elm-native/src/Native/Dialogs.elm | 109 +++- elm-native/src/Native/Event.elm | 79 ++- elm-native/src/Native/Frame.elm | 72 +- elm-native/src/Native/Layout.elm | 205 +++++- elm-native/src/Native/Page.elm | 25 + elm-native/src/Native/Types.elm | 28 +- 7 files changed, 1414 insertions(+), 43 deletions(-) diff --git a/elm-native/src/Native/Attributes.elm b/elm-native/src/Native/Attributes.elm index db31be8..273c6a4 100644 --- a/elm-native/src/Native/Attributes.elm +++ b/elm-native/src/Native/Attributes.elm @@ -1,4 +1,476 @@ -module Native.Attributes exposing (..) +module Native.Attributes exposing + ( dangerousEvalExpression, bindAttributeWithExpression + , ios, android + , modalConfig, items + , fontSize + , fontWeight + , fontStyle + , formattedText + , letterSpacing + , lineHeight + , nativeTextViewProtected + , text + , key + , icon + , style + , textAlignment + , textDecoration + , textShadow + , textTransform + , whiteSpace + , stretchLastChild + , orientation + , itemHeight + , itemWidth + , alignContent + , alignItems + , flexDirection + , flexWrap + , justifyContent + , padding + , paddingBottom + , paddingLeft + , paddingRight + , paddingTop + , accessibilityHidden + , accessibilityHint + , accessibilityIdentifier + , accessibilityLabel + , accessibilityLanguage + , accessibilityLiveRegion + , accessibilityMediaSession + , accessibilityRole + , accessibilityState + , accessibilityValue + , accessible + , alignSelf + , androidDynamicElevationOffset + , androidElevation + , automationText + , background + , backgroundColor + , backgroundImage + , borderBottomColor + , borderBottomLeftRadius + , borderBottomRightRadius + , borderBottomWidth + , borderColor + , borderLeftColor + , borderLeftWidth + , borderRadius + , borderRightColor + , borderRightWidth + , borderTopColor + , borderTopLeftRadius + , borderTopRightRadius + , borderTopWidth + , borderWidth + , boxShadow + , class + , col + , colSpan + , color + , column + , columns + , columnSpan + , css + , cssClasses + , cssPseudoClasses + , cssType + , dock + , domNode + , effectiveBorderBottomWidth + , effectiveBorderLeftWidth + , effectiveBorderRightWidth + , effectiveBorderTopWidth + , effectiveHeight + , effectiveLeft + , effectiveMarginBottom + , effectiveMarginLeft + , effectiveMarginRight + , effectiveMarginTop + , effectiveMinHeight + , effectiveMinWidth + , effectivePaddingBottom + , effectivePaddingLeft + , effectivePaddingRight + , effectivePaddingTop + , effectiveTop + , effectiveWidth + , flexGrow + , flexShrink + , flexWrapBefore + , height + , horizontalAlignment + , id + , itemId + , iosIgnoreSafeArea + , iosOverflowSafeArea + , iosOverflowSafeAreaEnabled + , isCollapsed + , isEnabled + , isLayoutRequired + , isLayoutValid + , isUserInteractionEnabled + , left + , margin + , marginBottom + , marginLeft + , marginRight + , marginTop + , minHeight + , minWidth + , nativeViewProtected + , opacity + , order + , originX + , originY + , perspective + , recycleNativeView + , reusable + , rotate + , rotateX + , rotateY + , row + , busy + , rows + , rowSpan + , scaleX + , scaleY + , top + , translateX + , translateY + , textWrap + , verticalAlignment + , viewController + , visibility + , width + , actionBarVisibility + , animated + , transition + , defaultAnimatedNavigation + , defaultTransition + , accessibilityAnnouncePageEnabled + , actionBarHidden + , androidStatusBarBackground + , backgroundSpanUnderStatusBar + , enableSwipeBackNavigation + , statusBarStyle + , date + , iosPreferredDatePickerStyle + , maxDate + , minDate + , day + , month + , year + , html + , decodeHeight + , decodeWidth + , isLoading + , loadMode + , src + , stretch + , tintColor + , selectedIndex + , maxValue + , value + , checked + , minValue + , horizontalOffset + , isScrollEnabled + , scrollBarIndicatorVisible + , scrollableHeight + , scrollableWidth + , verticalOffset + , hint + , textFieldBackgroundColor + , textFieldHintColor + , title + , flat + , titleView + , selectedBackgroundColor + , androidOffscreenTabLimit + , androidSelectedTabHighlightColor + , androidSwipeEnabled + , androidTabsPosition + , iosIconRenderingMode + , selectedTabTextColor + , tabBackgroundColor + , tabTextColor + , tabTextFontSize + , canBeLoaded + , canGoBack + , canGoForward + , iconSource + , autocapitalizationType + , autocorrect + , autofillType + , closeOnReturn + , editable + , keyboardType + , maxLength + , returnKeyType + , secure + , secureWithoutAutofill + , updateTextTrigger + , maxLines + , hour + , maxHour + , maxMinute + , minHour + , minMinute + , minute + , minuteInterval + , time + , iosPosition + , androidPosition + , iosSystemIcon + , androidSystemIcon + , iosEstimatedRowHeight + , rowHeight + , separatorColor + , fontFamily + ) + +{-| Nativescript element attributes + + +# Attributes + +@docs dangerousEvalExpression, bindAttributeWithExpression +@docs ios, android +@docs modalConfig, items + +@docs fontSize +@docs fontWeight +@docs fontStyle +@docs formattedText +@docs letterSpacing +@docs lineHeight +@docs nativeTextViewProtected +@docs text +@docs key +@docs icon +@docs style +@docs textAlignment +@docs textDecoration +@docs textShadow +@docs textTransform +@docs whiteSpace +@docs stretchLastChild +@docs orientation +@docs itemHeight +@docs itemWidth +@docs alignContent +@docs alignItems +@docs flexDirection +@docs flexWrap +@docs justifyContent +@docs padding +@docs paddingBottom +@docs paddingLeft +@docs paddingRight +@docs paddingTop +@docs accessibilityHidden +@docs accessibilityHint +@docs accessibilityIdentifier +@docs accessibilityLabel +@docs accessibilityLanguage +@docs accessibilityLiveRegion +@docs accessibilityMediaSession +@docs accessibilityRole +@docs accessibilityState +@docs accessibilityValue +@docs accessible +@docs alignSelf +@docs androidDynamicElevationOffset +@docs androidElevation +@docs automationText +@docs background +@docs backgroundColor +@docs backgroundImage +@docs borderBottomColor +@docs borderBottomLeftRadius +@docs borderBottomRightRadius +@docs borderBottomWidth +@docs borderColor +@docs borderLeftColor +@docs borderLeftWidth +@docs borderRadius +@docs borderRightColor +@docs borderRightWidth +@docs borderTopColor +@docs borderTopLeftRadius +@docs borderTopRightRadius +@docs borderTopWidth +@docs borderWidth +@docs boxShadow +@docs class +@docs col +@docs colSpan +@docs color +@docs column +@docs columns +@docs columnSpan +@docs css +@docs cssClasses +@docs cssPseudoClasses +@docs cssType +@docs dock +@docs domNode +@docs effectiveBorderBottomWidth +@docs effectiveBorderLeftWidth +@docs effectiveBorderRightWidth +@docs effectiveBorderTopWidth +@docs effectiveHeight +@docs effectiveLeft +@docs effectiveMarginBottom +@docs effectiveMarginLeft +@docs effectiveMarginRight +@docs effectiveMarginTop +@docs effectiveMinHeight +@docs effectiveMinWidth +@docs effectivePaddingBottom +@docs effectivePaddingLeft +@docs effectivePaddingRight +@docs effectivePaddingTop +@docs effectiveTop +@docs effectiveWidth +@docs flexGrow +@docs flexShrink +@docs flexWrapBefore +@docs height +@docs horizontalAlignment +@docs id +@docs itemId +@docs iosIgnoreSafeArea +@docs iosOverflowSafeArea +@docs iosOverflowSafeAreaEnabled +@docs isCollapsed +@docs isEnabled +@docs isLayoutRequired +@docs isLayoutValid +@docs isUserInteractionEnabled +@docs left +@docs margin +@docs marginBottom +@docs marginLeft +@docs marginRight +@docs marginTop +@docs minHeight +@docs minWidth +@docs nativeViewProtected +@docs opacity +@docs order +@docs originX +@docs originY +@docs perspective +@docs recycleNativeView +@docs reusable +@docs rotate +@docs rotateX +@docs rotateY +@docs row +@docs busy +@docs rows +@docs rowSpan +@docs scaleX +@docs scaleY +@docs top +@docs translateX +@docs translateY +@docs textWrap +@docs verticalAlignment +@docs viewController +@docs visibility +@docs width +@docs actionBarVisibility +@docs animated +@docs transition +@docs defaultAnimatedNavigation +@docs defaultTransition +@docs accessibilityAnnouncePageEnabled +@docs actionBarHidden +@docs androidStatusBarBackground +@docs backgroundSpanUnderStatusBar +@docs enableSwipeBackNavigation +@docs statusBarStyle +@docs date +@docs iosPreferredDatePickerStyle +@docs maxDate +@docs minDate +@docs day +@docs month +@docs year +@docs html +@docs decodeHeight +@docs decodeWidth +@docs isLoading +@docs loadMode +@docs src +@docs stretch +@docs tintColor +@docs selectedIndex +@docs maxValue +@docs value +@docs checked +@docs minValue +@docs horizontalOffset +@docs isScrollEnabled +@docs scrollBarIndicatorVisible +@docs scrollableHeight +@docs scrollableWidth +@docs verticalOffset +@docs hint +@docs textFieldBackgroundColor +@docs textFieldHintColor +@docs title +@docs flat +@docs titleView +@docs selectedBackgroundColor +@docs androidOffscreenTabLimit +@docs androidSelectedTabHighlightColor +@docs androidSwipeEnabled +@docs androidTabsPosition +@docs iosIconRenderingMode +@docs selectedTabTextColor +@docs tabBackgroundColor +@docs tabTextColor +@docs tabTextFontSize +@docs canBeLoaded +@docs canGoBack +@docs canGoForward +@docs iconSource +@docs autocapitalizationType +@docs autocorrect +@docs autofillType +@docs closeOnReturn +@docs editable +@docs keyboardType +@docs maxLength +@docs returnKeyType +@docs secure +@docs secureWithoutAutofill +@docs updateTextTrigger +@docs maxLines +@docs hour +@docs maxHour +@docs maxMinute +@docs minHour +@docs minMinute +@docs minute +@docs minuteInterval +@docs time +@docs iosPosition +@docs androidPosition +@docs iosSystemIcon +@docs androidSystemIcon +@docs iosEstimatedRowHeight +@docs rowHeight +@docs separatorColor +@docs fontFamily + +-} import Html exposing (Attribute) import Html.Attributes exposing (attribute, property) @@ -6,1141 +478,1597 @@ import Json.Encode as E import Native exposing (ListViewModel) +{-| Sets fontSize +-} fontSize : String -> Attribute msg fontSize = attribute "font-size" +{-| Sets fontWeight +-} fontWeight : String -> Attribute msg fontWeight = attribute "font-weight" +{-| Sets fontStyle +-} fontStyle : String -> Attribute msg fontStyle = attribute "font-style" +{-| Sets formattedText +-} formattedText : String -> Attribute msg formattedText = attribute "formatted-text" +{-| Sets letterSpacing +-} letterSpacing : String -> Attribute msg letterSpacing = attribute "letter-spacing" +{-| Sets lineHeight +-} lineHeight : String -> Attribute msg lineHeight = attribute "line-height" +{-| Sets nativeTextViewProtected +-} nativeTextViewProtected : String -> Attribute msg nativeTextViewProtected = attribute "native-text-view-protected" +{-| Sets text +-} text : String -> Attribute msg text = attribute "text" +{-| Sets key +-} key : String -> Attribute msg key = attribute "key" +{-| Sets icon +-} icon : String -> Attribute msg icon = attribute "icon" +{-| Sets style +-} style : String -> Attribute msg style = attribute "style" +{-| Sets textAlignment +-} textAlignment : String -> Attribute msg textAlignment = attribute "text-alignment" +{-| Sets textDecoration +-} textDecoration : String -> Attribute msg textDecoration = attribute "text-decoration" +{-| Sets textShadow +-} textShadow : String -> Attribute msg textShadow = attribute "text-shadow" +{-| Sets textTransform +-} textTransform : String -> Attribute msg textTransform = attribute "text-transform" +{-| Sets whiteSpace +-} whiteSpace : String -> Attribute msg whiteSpace = attribute "white-space" +{-| Sets stretchLastChild +-} stretchLastChild : String -> Attribute msg stretchLastChild = attribute "stretch-last-child" +{-| Sets orientation +-} orientation : String -> Attribute msg orientation = attribute "orientation" +{-| Sets itemHeight +-} itemHeight : String -> Attribute msg itemHeight = attribute "item-height" +{-| Sets itemWidth +-} itemWidth : String -> Attribute msg itemWidth = attribute "item-width" +{-| Sets alignContent +-} alignContent : String -> Attribute msg alignContent = attribute "align-content" +{-| Sets alignItems +-} alignItems : String -> Attribute msg alignItems = attribute "align-items" +{-| Sets flexDirection +-} flexDirection : String -> Attribute msg flexDirection = attribute "flex-direction" +{-| Sets flexWrap +-} flexWrap : String -> Attribute msg flexWrap = attribute "flex-wrap" +{-| Sets justifyContent +-} justifyContent : String -> Attribute msg justifyContent = attribute "justify-content" +{-| Sets padding +-} padding : String -> Attribute msg padding = attribute "padding" +{-| Sets paddingBottom +-} paddingBottom : String -> Attribute msg paddingBottom = attribute "padding-bottom" +{-| Sets paddingLeft +-} paddingLeft : String -> Attribute msg paddingLeft = attribute "padding-left" +{-| Sets paddingRight +-} paddingRight : String -> Attribute msg paddingRight = attribute "padding-right" +{-| Sets paddingTop +-} paddingTop : String -> Attribute msg paddingTop = attribute "padding-top" +{-| Sets accessibilityHidden +-} accessibilityHidden : String -> Attribute msg accessibilityHidden = attribute "accessibility-hidden" +{-| Sets accessibilityHint +-} accessibilityHint : String -> Attribute msg accessibilityHint = attribute "accessibility-hint" +{-| Sets accessibilityIdentifier +-} accessibilityIdentifier : String -> Attribute msg accessibilityIdentifier = attribute "accessibility-identifier" +{-| Sets accessibilityLabel +-} accessibilityLabel : String -> Attribute msg accessibilityLabel = attribute "accessibility-label" +{-| Sets accessibilityLanguage +-} accessibilityLanguage : String -> Attribute msg accessibilityLanguage = attribute "accessibility-language" +{-| Sets accessibilityLiveRegion +-} accessibilityLiveRegion : String -> Attribute msg accessibilityLiveRegion = attribute "accessibility-live-region" +{-| Sets accessibilityMediaSession +-} accessibilityMediaSession : String -> Attribute msg accessibilityMediaSession = attribute "accessibility-media-session" +{-| Sets accessibilityRole +-} accessibilityRole : String -> Attribute msg accessibilityRole = attribute "accessibility-role" +{-| Sets accessibilityState +-} accessibilityState : String -> Attribute msg accessibilityState = attribute "accessibility-state" +{-| Sets accessibilityValue +-} accessibilityValue : String -> Attribute msg accessibilityValue = attribute "accessibility-value" +{-| Sets accessible +-} accessible : String -> Attribute msg accessible = attribute "accessible" +{-| Sets alignSelf +-} alignSelf : String -> Attribute msg alignSelf = attribute "align-self" +{-| Sets androidDynamicElevationOffset +-} androidDynamicElevationOffset : String -> Attribute msg androidDynamicElevationOffset = attribute "android-dynamic-elevation-offset" +{-| Sets androidElevation +-} androidElevation : String -> Attribute msg androidElevation = attribute "android-elevation" +{-| Sets automationText +-} automationText : String -> Attribute msg automationText = attribute "automation-text" +{-| Sets background +-} background : String -> Attribute msg background = attribute "background" +{-| Sets backgroundColor +-} backgroundColor : String -> Attribute msg backgroundColor = attribute "background-color" +{-| Sets backgroundImage +-} backgroundImage : String -> Attribute msg backgroundImage = attribute "background-image" +{-| Sets borderBottomColor +-} borderBottomColor : String -> Attribute msg borderBottomColor = attribute "border-bottom-color" +{-| Sets borderBottomLeftRadius +-} borderBottomLeftRadius : String -> Attribute msg borderBottomLeftRadius = attribute "border-bottom-left-radius" +{-| Sets borderBottomRightRadius +-} borderBottomRightRadius : String -> Attribute msg borderBottomRightRadius = attribute "border-bottom-right-radius" +{-| Sets borderBottomWidth +-} borderBottomWidth : String -> Attribute msg borderBottomWidth = attribute "border-bottom-width" +{-| Sets borderColor +-} borderColor : String -> Attribute msg borderColor = attribute "border-color" +{-| Sets borderLeftColor +-} borderLeftColor : String -> Attribute msg borderLeftColor = attribute "border-left-color" +{-| Sets borderLeftWidth +-} borderLeftWidth : String -> Attribute msg borderLeftWidth = attribute "border-left-width" +{-| Sets borderRadius +-} borderRadius : String -> Attribute msg borderRadius = attribute "border-radius" +{-| Sets borderRightColor +-} borderRightColor : String -> Attribute msg borderRightColor = attribute "border-right-color" +{-| Sets borderRightWidth +-} borderRightWidth : String -> Attribute msg borderRightWidth = attribute "border-right-width" +{-| Sets borderTopColor +-} borderTopColor : String -> Attribute msg borderTopColor = attribute "border-top-color" +{-| Sets borderTopLeftRadius +-} borderTopLeftRadius : String -> Attribute msg borderTopLeftRadius = attribute "border-top-left-radius" +{-| Sets borderTopRightRadius +-} borderTopRightRadius : String -> Attribute msg borderTopRightRadius = attribute "border-top-right-radius" +{-| Sets borderTopWidth +-} borderTopWidth : String -> Attribute msg borderTopWidth = attribute "border-top-width" +{-| Sets borderWidth +-} borderWidth : String -> Attribute msg borderWidth = attribute "border-width" +{-| Sets boxShadow +-} boxShadow : String -> Attribute msg boxShadow = attribute "box-shadow" +{-| Sets class +-} class : String -> Attribute msg class = attribute "class-name" +{-| Sets col +-} col : String -> Attribute msg col = attribute "col" +{-| Sets colSpan +-} colSpan : String -> Attribute msg colSpan = attribute "col-span" +{-| Sets color +-} color : String -> Attribute msg color = attribute "color" +{-| Sets column +-} column : String -> Attribute msg column = attribute "column" +{-| Sets columns +-} columns : String -> Attribute msg columns = attribute "columns" +{-| Sets columnSpan +-} columnSpan : String -> Attribute msg columnSpan = attribute "column-span" +{-| Sets css +-} css : String -> Attribute msg css = attribute "css" +{-| Sets cssClasses +-} cssClasses : String -> Attribute msg cssClasses = attribute "css-classes" +{-| Sets cssPseudoClasses +-} cssPseudoClasses : String -> Attribute msg cssPseudoClasses = attribute "css-pseudo-classes" +{-| Sets cssType +-} cssType : String -> Attribute msg cssType = attribute "css-type" +{-| Sets dock +-} dock : String -> Attribute msg dock = attribute "dock" +{-| Sets domNode +-} domNode : String -> Attribute msg domNode = attribute "dom-node" +{-| Sets effectiveBorderBottomWidth +-} effectiveBorderBottomWidth : String -> Attribute msg effectiveBorderBottomWidth = attribute "effective-border-bottom-width" +{-| Sets effectiveBorderLeftWidth +-} effectiveBorderLeftWidth : String -> Attribute msg effectiveBorderLeftWidth = attribute "effective-border-left-width" +{-| Sets effectiveBorderRightWidth +-} effectiveBorderRightWidth : String -> Attribute msg effectiveBorderRightWidth = attribute "effective-border-right-width" +{-| Sets effectiveBorderTopWidth +-} effectiveBorderTopWidth : String -> Attribute msg effectiveBorderTopWidth = attribute "effective-border-top-width" +{-| Sets effectiveHeight +-} effectiveHeight : String -> Attribute msg effectiveHeight = attribute "effective-height" +{-| Sets effectiveLeft +-} effectiveLeft : String -> Attribute msg effectiveLeft = attribute "effective-left" +{-| Sets effectiveMarginBottom +-} effectiveMarginBottom : String -> Attribute msg effectiveMarginBottom = attribute "effective-margin-bottom" +{-| Sets effectiveMarginLeft +-} effectiveMarginLeft : String -> Attribute msg effectiveMarginLeft = attribute "effective-margin-left" +{-| Sets effectiveMarginRight +-} effectiveMarginRight : String -> Attribute msg effectiveMarginRight = attribute "effective-margin-right" +{-| Sets effectiveMarginTop +-} effectiveMarginTop : String -> Attribute msg effectiveMarginTop = attribute "effective-margin-top" +{-| Sets effectiveMinHeight +-} effectiveMinHeight : String -> Attribute msg effectiveMinHeight = attribute "effective-min-height" +{-| Sets effectiveMinWidth +-} effectiveMinWidth : String -> Attribute msg effectiveMinWidth = attribute "effective-min-width" +{-| Sets effectivePaddingBottom +-} effectivePaddingBottom : String -> Attribute msg effectivePaddingBottom = attribute "effective-padding-bottom" +{-| Sets effectivePaddingLeft +-} effectivePaddingLeft : String -> Attribute msg effectivePaddingLeft = attribute "effective-padding-left" +{-| Sets effectivePaddingRight +-} effectivePaddingRight : String -> Attribute msg effectivePaddingRight = attribute "effective-padding-right" +{-| Sets effectivePaddingTop +-} effectivePaddingTop : String -> Attribute msg effectivePaddingTop = attribute "effective-padding-top" +{-| Sets effectiveTop +-} effectiveTop : String -> Attribute msg effectiveTop = attribute "effective-top" +{-| Sets effectiveWidth +-} effectiveWidth : String -> Attribute msg effectiveWidth = attribute "effective-width" +{-| Sets flexGrow +-} flexGrow : String -> Attribute msg flexGrow = attribute "flex-grow" +{-| Sets flexShrink +-} flexShrink : String -> Attribute msg flexShrink = attribute "flex-shrink" +{-| Sets flexWrapBefore +-} flexWrapBefore : String -> Attribute msg flexWrapBefore = attribute "flex-wrap-before" +{-| Sets height +-} height : String -> Attribute msg height = attribute "height" +{-| Sets horizontalAlignment +-} horizontalAlignment : String -> Attribute msg horizontalAlignment = attribute "horizontal-alignment" +{-| Sets id +-} id : String -> Attribute msg id = attribute "id" +{-| Sets itemId +-} itemId : String -> Attribute msg itemId = attribute "item-id" +{-| Sets iosIgnoreSafeArea +-} iosIgnoreSafeArea : String -> Attribute msg iosIgnoreSafeArea = attribute "ios-ignore-safe-area" +{-| Sets iosOverflowSafeArea +-} iosOverflowSafeArea : String -> Attribute msg iosOverflowSafeArea = attribute "ios-overflow-safe-area" +{-| Sets iosOverflowSafeAreaEnabled +-} iosOverflowSafeAreaEnabled : String -> Attribute msg iosOverflowSafeAreaEnabled = attribute "ios-overflow-safe-area-enabled" +{-| Sets isCollapsed +-} isCollapsed : String -> Attribute msg isCollapsed = attribute "is-collapsed" +{-| Sets isEnabled +-} isEnabled : String -> Attribute msg isEnabled = attribute "is-enabled" +{-| Sets isLayoutRequired +-} isLayoutRequired : String -> Attribute msg isLayoutRequired = attribute "is-layout-required" +{-| Sets isLayoutValid +-} isLayoutValid : String -> Attribute msg isLayoutValid = attribute "is-layout-valid" +{-| Sets isUserInteractionEnabled +-} isUserInteractionEnabled : String -> Attribute msg isUserInteractionEnabled = attribute "is-user-interaction-enabled" +{-| Sets left +-} left : String -> Attribute msg left = attribute "left" +{-| Sets margin +-} margin : String -> Attribute msg margin = attribute "margin" +{-| Sets marginBottom +-} marginBottom : String -> Attribute msg marginBottom = attribute "margin-bottom" +{-| Sets marginLeft +-} marginLeft : String -> Attribute msg marginLeft = attribute "margin-left" +{-| Sets marginRight +-} marginRight : String -> Attribute msg marginRight = attribute "margin-right" +{-| Sets marginTop +-} marginTop : String -> Attribute msg marginTop = attribute "margin-top" +{-| Sets minHeight +-} minHeight : String -> Attribute msg minHeight = attribute "min-height" +{-| Sets minWidth +-} minWidth : String -> Attribute msg minWidth = attribute "min-width" +{-| Sets nativeViewProtected +-} nativeViewProtected : String -> Attribute msg nativeViewProtected = attribute "native-view-protected" +{-| Sets opacity +-} opacity : String -> Attribute msg opacity = attribute "opacity" +{-| Sets order +-} order : String -> Attribute msg order = attribute "order" +{-| Sets originX +-} originX : String -> Attribute msg originX = attribute "origin-x" +{-| Sets originY +-} originY : String -> Attribute msg originY = attribute "origin-y" +{-| Sets perspective +-} perspective : String -> Attribute msg perspective = attribute "perspective" +{-| Sets recycleNativeView +-} recycleNativeView : String -> Attribute msg recycleNativeView = attribute "recycle-native-view" +{-| Sets reusable +-} reusable : String -> Attribute msg reusable = attribute "reusable" +{-| Sets rotate +-} rotate : String -> Attribute msg rotate = attribute "rotate" +{-| Sets rotateX +-} rotateX : String -> Attribute msg rotateX = attribute "rotate-x" +{-| Sets rotateY +-} rotateY : String -> Attribute msg rotateY = attribute "rotate-y" +{-| Sets row +-} row : String -> Attribute msg row = attribute "row" +{-| Sets busy +-} busy : String -> Attribute msg busy = attribute "busy" +{-| Sets rows +-} rows : String -> Attribute msg rows = attribute "rows" +{-| Sets rowSpan +-} rowSpan : String -> Attribute msg rowSpan = attribute "row-span" +{-| Sets scaleX +-} scaleX : String -> Attribute msg scaleX = attribute "scale-x" +{-| Sets scaleY +-} scaleY : String -> Attribute msg scaleY = attribute "scale-y" +{-| Sets top +-} top : String -> Attribute msg top = attribute "top" +{-| Sets translateX +-} translateX : String -> Attribute msg translateX = attribute "translate-x" +{-| Sets translateY +-} translateY : String -> Attribute msg translateY = attribute "translate-y" +{-| Sets textWrap +-} textWrap : String -> Attribute msg textWrap = attribute "text-wrap" +{-| Sets verticalAlignment +-} verticalAlignment : String -> Attribute msg verticalAlignment = attribute "vertical-alignment" +{-| Sets viewController +-} viewController : String -> Attribute msg viewController = attribute "view-controller" +{-| Sets visibility +-} visibility : String -> Attribute msg visibility = attribute "visibility" +{-| Sets width +-} width : String -> Attribute msg width = attribute "width" +{-| Sets actionBarVisibility +-} actionBarVisibility : String -> Attribute msg actionBarVisibility = attribute "action-bar-visibility" +{-| Sets animated +-} animated : String -> Attribute msg animated = attribute "animated" +{-| Sets transition +-} transition : String -> Attribute msg transition = attribute "transition" +{-| Sets defaultAnimatedNavigation +-} defaultAnimatedNavigation : String -> Attribute msg defaultAnimatedNavigation = attribute "default-animated-navigation" +{-| Sets defaultTransition +-} defaultTransition : String -> Attribute msg defaultTransition = attribute "default-transition" +{-| Sets accessibilityAnnouncePageEnabled +-} accessibilityAnnouncePageEnabled : String -> Attribute msg accessibilityAnnouncePageEnabled = attribute "accessibility-announce-page-enabled" +{-| Sets actionBarHidden +-} actionBarHidden : String -> Attribute msg actionBarHidden = attribute "action-bar-hidden" +{-| Sets androidStatusBarBackground +-} androidStatusBarBackground : String -> Attribute msg androidStatusBarBackground = attribute "android-status-bar-background" +{-| Sets backgroundSpanUnderStatusBar +-} backgroundSpanUnderStatusBar : String -> Attribute msg backgroundSpanUnderStatusBar = attribute "background-span-under-status-bar" +{-| Sets enableSwipeBackNavigation +-} enableSwipeBackNavigation : String -> Attribute msg enableSwipeBackNavigation = attribute "enable-swipe-back-navigation" +{-| Sets statusBarStyle +-} statusBarStyle : String -> Attribute msg statusBarStyle = attribute "status-bar-style" +{-| Sets date +-} date : String -> Attribute msg date = attribute "date" +{-| Sets iosPreferredDatePickerStyle +-} iosPreferredDatePickerStyle : String -> Attribute msg iosPreferredDatePickerStyle = attribute "ios-preferred-date-picker-style" +{-| Sets maxDate +-} maxDate : String -> Attribute msg maxDate = attribute "max-date" +{-| Sets minDate +-} minDate : String -> Attribute msg minDate = attribute "min-date" +{-| Sets day +-} day : String -> Attribute msg day = attribute "day" +{-| Sets month +-} month : String -> Attribute msg month = attribute "month" +{-| Sets year +-} year : String -> Attribute msg year = attribute "year" +{-| Sets html +-} html : String -> Attribute msg html = attribute "html" +{-| Sets decodeHeight +-} decodeHeight : String -> Attribute msg decodeHeight = attribute "decode-height" +{-| Sets decodeWidth +-} decodeWidth : String -> Attribute msg decodeWidth = attribute "decode-width" +{-| Sets isLoading +-} isLoading : String -> Attribute msg isLoading = attribute "is-loading" +{-| Sets loadMode +-} loadMode : String -> Attribute msg loadMode = attribute "load-mode" +{-| Sets src +-} src : String -> Attribute msg src = attribute "src" +{-| Sets stretch +-} stretch : String -> Attribute msg stretch = attribute "stretch" +{-| Sets tintColor +-} tintColor : String -> Attribute msg tintColor = attribute "tint-color" +{-| Sets selectedIndex +-} selectedIndex : String -> Attribute msg selectedIndex = attribute "selected-index" +{-| Sets maxValue +-} maxValue : String -> Attribute msg maxValue = attribute "max-value" +{-| Sets value +-} value : String -> Attribute msg value = attribute "value" +{-| Sets checked +-} checked : String -> Attribute msg checked = attribute "checked" +{-| Sets minValue +-} minValue : String -> Attribute msg minValue = attribute "min-value" +{-| Sets horizontalOffset +-} horizontalOffset : String -> Attribute msg horizontalOffset = attribute "horizontal-offset" +{-| Sets isScrollEnabled +-} isScrollEnabled : String -> Attribute msg isScrollEnabled = attribute "is-scroll-enabled" +{-| Sets scrollBarIndicatorVisible +-} scrollBarIndicatorVisible : String -> Attribute msg scrollBarIndicatorVisible = attribute "scroll-bar-indicator-visible" +{-| Sets scrollableHeight +-} scrollableHeight : String -> Attribute msg scrollableHeight = attribute "scrollable-height" +{-| Sets scrollableWidth +-} scrollableWidth : String -> Attribute msg scrollableWidth = attribute "scrollable-width" +{-| Sets verticalOffset +-} verticalOffset : String -> Attribute msg verticalOffset = attribute "vertical-offset" +{-| Sets hint +-} hint : String -> Attribute msg hint = attribute "hint" +{-| Sets textFieldBackgroundColor +-} textFieldBackgroundColor : String -> Attribute msg textFieldBackgroundColor = attribute "text-field-background-color" +{-| Sets textFieldHintColor +-} textFieldHintColor : String -> Attribute msg textFieldHintColor = attribute "text-field-hint-color" +{-| Sets title +-} title : String -> Attribute msg title = attribute "title" +{-| Sets flat +-} flat : String -> Attribute msg flat = attribute "flat" +{-| Sets titleView +-} titleView : String -> Attribute msg titleView = attribute "title-view" +{-| Sets selectedBackgroundColor +-} selectedBackgroundColor : String -> Attribute msg selectedBackgroundColor = attribute "selected-background-color" +{-| Sets androidOffscreenTabLimit +-} androidOffscreenTabLimit : String -> Attribute msg androidOffscreenTabLimit = attribute "android-offscreen-tab-limit" +{-| Sets androidSelectedTabHighlightColor +-} androidSelectedTabHighlightColor : String -> Attribute msg androidSelectedTabHighlightColor = attribute "android-selected-tab-highlight-color" +{-| Sets androidSwipeEnabled +-} androidSwipeEnabled : String -> Attribute msg androidSwipeEnabled = attribute "android-swipe-enabled" +{-| Sets androidTabsPosition +-} androidTabsPosition : String -> Attribute msg androidTabsPosition = attribute "android-tabs-position" +{-| Sets iosIconRenderingMode +-} iosIconRenderingMode : String -> Attribute msg iosIconRenderingMode = attribute "ios-icon-rendering-mode" +{-| Sets selectedTabTextColor +-} selectedTabTextColor : String -> Attribute msg selectedTabTextColor = attribute "selected-tab-text-color" +{-| Sets tabBackgroundColor +-} tabBackgroundColor : String -> Attribute msg tabBackgroundColor = attribute "tab-background-color" +{-| Sets tabTextColor +-} tabTextColor : String -> Attribute msg tabTextColor = attribute "tab-text-color" +{-| Sets tabTextFontSize +-} tabTextFontSize : String -> Attribute msg tabTextFontSize = attribute "tab-text-font-size" +{-| Sets canBeLoaded +-} canBeLoaded : String -> Attribute msg canBeLoaded = attribute "can-be-loaded" +{-| Sets canGoBack +-} canGoBack : String -> Attribute msg canGoBack = attribute "can-go-back" +{-| Sets canGoForward +-} canGoForward : String -> Attribute msg canGoForward = attribute "can-go-forward" +{-| Sets iconSource +-} iconSource : String -> Attribute msg iconSource = attribute "icon-source" +{-| Sets autocapitalizationType +-} autocapitalizationType : String -> Attribute msg autocapitalizationType = attribute "autocapitalization-type" +{-| Sets autocorrect +-} autocorrect : String -> Attribute msg autocorrect = attribute "autocorrect" +{-| Sets autofillType +-} autofillType : String -> Attribute msg autofillType = attribute "autofill-type" +{-| Sets closeOnReturn +-} closeOnReturn : String -> Attribute msg closeOnReturn = attribute "close-on-return" +{-| Sets editable +-} editable : String -> Attribute msg editable = attribute "editable" +{-| Sets keyboardType +-} keyboardType : String -> Attribute msg keyboardType = attribute "keyboard-type" +{-| Sets maxLength +-} maxLength : String -> Attribute msg maxLength = attribute "max-length" +{-| Sets returnKeyType +-} returnKeyType : String -> Attribute msg returnKeyType = attribute "return-key-type" +{-| Sets secure +-} secure : String -> Attribute msg secure = attribute "secure" +{-| Sets secureWithoutAutofill +-} secureWithoutAutofill : String -> Attribute msg secureWithoutAutofill = attribute "secure-without-autofill" +{-| Sets updateTextTrigger +-} updateTextTrigger : String -> Attribute msg updateTextTrigger = attribute "update-text-trigger" +{-| Sets maxLines +-} maxLines : String -> Attribute msg maxLines = attribute "max-lines" +{-| Sets hour +-} hour : String -> Attribute msg hour = attribute "hour" +{-| Sets maxHour +-} maxHour : String -> Attribute msg maxHour = attribute "max-hour" +{-| Sets maxMinute +-} maxMinute : String -> Attribute msg maxMinute = attribute "max-minute" +{-| Sets minHour +-} minHour : String -> Attribute msg minHour = attribute "min-hour" +{-| Sets minMinute +-} minMinute : String -> Attribute msg minMinute = attribute "min-minute" +{-| Sets minute +-} minute : String -> Attribute msg minute = attribute "minute" +{-| Sets minuteInterval +-} minuteInterval : String -> Attribute msg minuteInterval = attribute "minute-interval" +{-| Sets time +-} time : String -> Attribute msg time = attribute "time" +{-| Sets iosPosition +-} iosPosition : String -> Attribute msg iosPosition = attribute "ios.position" +{-| Sets androidPosition +-} androidPosition : String -> Attribute msg androidPosition = attribute "android.position" +{-| Sets iosSystemIcon +-} iosSystemIcon : String -> Attribute msg iosSystemIcon = attribute "ios.system-icon" +{-| Sets androidSystemIcon +-} androidSystemIcon : String -> Attribute msg androidSystemIcon = attribute "android.system-icon" +{-| Sets iosEstimatedRowHeight +-} iosEstimatedRowHeight : String -> Attribute msg iosEstimatedRowHeight = attribute "ios-estimated-row-height" +{-| Sets rowHeight +-} rowHeight : String -> Attribute msg rowHeight = attribute "row-height" +{-| Sets separatorColor of listView +-} separatorColor : String -> Attribute msg separatorColor = attribute "separator-color" +{-| Sets fontFamily to element +-} fontFamily : String -> Attribute msg fontFamily = attribute "font-family" @@ -1170,27 +2098,36 @@ dangerousEvalExpression expression = In any other case, there won't be any value to bind to. So it will be empty. Use hypens instead of camelcase like `font-family` and not `fontFamily` + -} bindAttributeWithExpression : String -> String -> Attribute msg bindAttributeWithExpression attributeName expression = attribute ("bind-" ++ attributeName) ("b{" ++ expression ++ "}") +{-| Allows setting iOS only attributes. The attribute is set only when the mobile OS is iOS +-} ios : String -> String -> Attribute msg ios propertyName propertyValue = attribute "ios" (propertyName ++ ";" ++ propertyValue) +{-| Allows setting android only attributes. The attribute is set only when the mobile OS is android +-} android : String -> String -> Attribute msg android propertyName propertyValue = attribute "android" (propertyName ++ ";" ++ propertyValue) +{-| Used to show a page as modal and no backstack is added +-} modalConfig : Bool -> Attribute msg modalConfig isFullScreenModal = property "modalPage" (E.bool isFullScreenModal) +{-| Sets encoded items to [listViewWithSingleTemplate](Native#listViewWithSingleTemplate) or [listViewWithMultipleTemplate](Native#listViewWithMultipleTemplate) +-} items : ListViewModel a -> Attribute msg items listViewModel = property "items" (Native.getEncodedItems listViewModel) diff --git a/elm-native/src/Native/Dialogs.elm b/elm-native/src/Native/Dialogs.elm index 4083bb6..95e239b 100644 --- a/elm-native/src/Native/Dialogs.elm +++ b/elm-native/src/Native/Dialogs.elm @@ -1,35 +1,42 @@ module Native.Dialogs exposing - ( Action - , Alert - , action - , alert - , confirm - , defaultActionOption - , defaultAlertOption - , defaultConfirmOption - , defaultLoginOption - , login - , prompt - , setAndroidOnlyCancelable - , setCancelButtonText - , setCapitalizationType - , setDefaultText - , setInputType - , setNeutralButtonText - , setOkButtonText - , setPassword - , setPasswordHint - , setTitle - , setUserName - , setUserNameHint, defaultPromptOption + ( Action, Alert, Confirm, Login, LoginResult, Prompt, PromptResult + , defaultActionOption, defaultAlertOption, defaultConfirmOption, defaultLoginOption, defaultPromptOption + , setAndroidOnlyCancelable, setCancelButtonText, setCapitalizationType, setDefaultText, setInputType, setNeutralButtonText, setOkButtonText, setPassword, setPasswordHint, setTitle, setUserName, setUserNameHint + , action, alert, confirm, login, prompt ) +{-| Used to show NativeScript dialogs + + +# Types + +@docs Action, Alert, Confirm, Login, LoginResult, Prompt, PromptResult + + +# Default Options + +@docs defaultActionOption, defaultAlertOption, defaultConfirmOption, defaultLoginOption, defaultPromptOption + + +# Setters + +@docs setAndroidOnlyCancelable, setCancelButtonText, setCapitalizationType, setDefaultText, setInputType, setNeutralButtonText, setOkButtonText, setPassword, setPasswordHint, setTitle, setUserName, setUserNameHint + + +# Dialogs + +@docs action, alert, confirm, login, prompt + +-} + import Json.Decode as D import Json.Encode as E import Native.Types exposing (CapitalizationType(..), InputType(..), capitalizationToString, inputTypeToString) import TaskPort exposing (FunctionName, QualifiedName, Task, callNS, inNamespace) +{-| Alert dialog options +-} type alias Alert = { title : Maybe String , message : String @@ -38,6 +45,8 @@ type alias Alert = } +{-| Action dialog options +-} type alias Action = { title : Maybe String , message : String @@ -47,6 +56,8 @@ type alias Action = } +{-| Confirm dialog options +-} type alias Confirm = { title : Maybe String , message : String @@ -57,6 +68,8 @@ type alias Confirm = } +{-| Login dialog options +-} type alias Login = { title : Maybe String , message : String @@ -70,6 +83,8 @@ type alias Login = } +{-| Result of Login dialog +-} type alias LoginResult = { username : String , password : String @@ -77,6 +92,8 @@ type alias LoginResult = } +{-| Prompt dialog options +-} type alias Prompt = { title : Maybe String , message : String @@ -89,12 +106,16 @@ type alias Prompt = } +{-| Result of Prompt dialog +-} type alias PromptResult = { text : String , result : Bool } +{-| Default Alert Option +-} defaultAlertOption : String -> Alert defaultAlertOption message = { title = Nothing @@ -104,6 +125,8 @@ defaultAlertOption message = } +{-| Default Action Option +-} defaultActionOption : String -> List String -> String -> Action defaultActionOption message actions cancelButtonText = { title = Nothing @@ -114,6 +137,8 @@ defaultActionOption message actions cancelButtonText = } +{-| Default Confirm Option +-} defaultConfirmOption : String -> Confirm defaultConfirmOption message = { title = Nothing @@ -125,6 +150,8 @@ defaultConfirmOption message = } +{-| Default Login Option +-} defaultLoginOption : String -> Login defaultLoginOption message = { title = Nothing @@ -139,6 +166,8 @@ defaultLoginOption message = } +{-| Default Prompt Option +-} defaultPromptOption : String -> Prompt defaultPromptOption message = { title = Nothing @@ -152,61 +181,85 @@ defaultPromptOption message = } +{-| Setter for title +-} setTitle : String -> { a | title : Maybe String } -> { a | title : Maybe String } setTitle title record = { record | title = Just title } +{-| Setter for okButtonText +-} setOkButtonText : String -> { a | okButtonText : Maybe String } -> { a | okButtonText : Maybe String } setOkButtonText okButtonText record = { record | okButtonText = Just okButtonText } +{-| Setter for cancelButtonText +-} setCancelButtonText : String -> { a | cancelButtonText : Maybe String } -> { a | cancelButtonText : Maybe String } setCancelButtonText cancelButtonText record = { record | cancelButtonText = Just cancelButtonText } +{-| Setter for neutralButtonText +-} setNeutralButtonText : String -> { a | neutralButtonText : Maybe String } -> { a | neutralButtonText : Maybe String } setNeutralButtonText neutralButtonText record = { record | neutralButtonText = Just neutralButtonText } +{-| Setter for defaultText +-} setDefaultText : String -> { a | defaultText : Maybe String } -> { a | defaultText : Maybe String } setDefaultText defaultText record = { record | defaultText = Just defaultText } +{-| Setter for capitalizationType +-} setCapitalizationType : String -> { a | capitalizationType : Maybe String } -> { a | capitalizationType : Maybe String } setCapitalizationType capitalizationType record = { record | capitalizationType = Just capitalizationType } +{-| Setter for inputType +-} setInputType : String -> { a | inputType : Maybe String } -> { a | inputType : Maybe String } setInputType inputType record = { record | inputType = Just inputType } +{-| Setter for userNameHint +-} setUserNameHint : String -> { a | userNameHint : Maybe String } -> { a | userNameHint : Maybe String } setUserNameHint userNameHint record = { record | userNameHint = Just userNameHint } +{-| Setter for userName +-} setUserName : String -> { a | userName : Maybe String } -> { a | userName : Maybe String } setUserName userName record = { record | userName = Just userName } +{-| Setter for passwordHint +-} setPasswordHint : String -> { a | passwordHint : Maybe String } -> { a | passwordHint : Maybe String } setPasswordHint passwordHint record = { record | passwordHint = Just passwordHint } +{-| Setter for password +-} setPassword : String -> { a | password : Maybe String } -> { a | password : Maybe String } setPassword password record = { record | password = Just password } +{-| Setter for androidOnlyCancelable +-} setAndroidOnlyCancelable : Bool -> { a | androidOnlyCancelable : Maybe Bool } -> { a | androidOnlyCancelable : Maybe Bool } setAndroidOnlyCancelable androidOnlyCancelable record = { record | androidOnlyCancelable = Just androidOnlyCancelable } @@ -354,6 +407,8 @@ taskportNamespace = inNamespace "hariroshan/elm-native" "v1" +{-| Creates Alert Dialog Task +-} alert : Alert -> Task () alert = callNS @@ -363,6 +418,8 @@ alert = } +{-| Creates Action Dialog Task +-} action : Action -> Task String action = callNS @@ -372,6 +429,8 @@ action = } +{-| Creates Confirm Dialog Task +-} confirm : Confirm -> Task Bool confirm = callNS @@ -381,6 +440,8 @@ confirm = } +{-| Creates Login Dialog Task +-} login : Login -> Task LoginResult login = callNS @@ -390,6 +451,8 @@ login = } +{-| Creates Prompt Dialog Task +-} prompt : Prompt -> Task PromptResult prompt = callNS diff --git a/elm-native/src/Native/Event.elm b/elm-native/src/Native/Event.elm index 325a6e5..3f56e40 100644 --- a/elm-native/src/Native/Event.elm +++ b/elm-native/src/Native/Event.elm @@ -1,6 +1,5 @@ module Native.Event exposing - ( decodeAttribute - , on + ( on , onBlur , onBusyChange , onDateChange @@ -14,54 +13,100 @@ module Native.Event exposing , onTextChange , onUnloaded , onValueChange + , decodeAttribute ) +{-| Events listeners for Nativescript UI Elements + + +# Events + +@docs on +@docs onBlur +@docs onBusyChange +@docs onDateChange +@docs onEventWith +@docs onFocus +@docs onItemTap +@docs onLoaded +@docs onReturnPress +@docs onSelectedIndexChange +@docs onTap +@docs onTextChange +@docs onUnloaded +@docs onValueChange + + +# Decoder + +@docs decodeAttribute + +-} + import Html exposing (Attribute) import Html.Events as Event import Json.Decode as D import Json.Encode as E +{-| Listens for textChange event +-} onTextChange : (String -> msg) -> Attribute msg onTextChange msg = on "textChange" (D.field "value" D.string |> D.map msg) +{-| Listen for tap +-} onTap : msg -> Attribute msg onTap msg = on "tap" (D.succeed msg) +{-| Listen for returnPress +-} onReturnPress : msg -> Attribute msg onReturnPress msg = on "returnPress" (D.succeed msg) +{-| Listen for focus +-} onFocus : msg -> Attribute msg onFocus msg = on "focus" (D.succeed msg) +{-| Listen for blur +-} onBlur : msg -> Attribute msg onBlur msg = on "blur" (D.succeed msg) +{-| Listen for loaded +-} onLoaded : msg -> Attribute msg onLoaded msg = on "loaded" (D.succeed msg) +{-| Listen for unloaded +-} onUnloaded : msg -> Attribute msg onUnloaded msg = on "unloaded" (D.succeed msg) +{-| Listen for busyChange +-} onBusyChange : msg -> Attribute msg onBusyChange msg = on "busyChange" (D.succeed msg) +{-| Listen for dateChange +-} onDateChange : ({ day : Int, month : Int, year : Int } -> msg) -> Attribute msg onDateChange msg = on "dateChange" @@ -72,21 +117,29 @@ onDateChange msg = ) +{-| Listens for selectedIndexChange +-} onSelectedIndexChange : (Int -> msg) -> Attribute msg onSelectedIndexChange msg = on "selectedIndexChange" (D.field "value" D.int |> D.map msg) +{-| Listen for valueChange +-} onValueChange : (Float -> msg) -> Attribute msg onValueChange msg = on "valueChange" (D.field "value" D.float |> D.map msg) +{-| Listen for itemTap in listView +-} onItemTap : (Int -> msg) -> Attribute msg onItemTap msg = on "itemTap" (D.field "index" D.int |> D.map msg) +{-| Allows you to build your own events and decoders +-} on : String -> D.Decoder msg -> Attribute msg on eventName = Event.on eventName @@ -114,27 +167,27 @@ type alias EventOptions = } +{-| Allows you to decode attributes from nativescript object -{- Usage: +Usage: - listView - [ N.items model.encodedItems ] - [ button - [ N.itemId <| bindingExpression "$value.id" - , Event.on "tap" (Event.decodeAttribute "itemId" D.string |> D.map ItemTap) - ] - [] - ] + listViewWithSingleTemplate + [ items listViewModel ] + [ button + [ bindAttributeWithExpression "item-id" "$value.id" + , on "tap" (Event.decodeAttribute "itemId" D.string |> D.map ItemTap) + ] + [] + ] -} - - decodeAttribute : String -> D.Decoder a -> D.Decoder a decodeAttribute attributeName decoder = D.at [ "object", attributeName ] decoder {-| Method values are kept under {custom: {[methodName]: value}} +We will improve this in future For example: diff --git a/elm-native/src/Native/Frame.elm b/elm-native/src/Native/Frame.elm index 6cf177c..b1f2fe7 100644 --- a/elm-native/src/Native/Frame.elm +++ b/elm-native/src/Native/Frame.elm @@ -3,12 +3,12 @@ module Native.Frame exposing , TransitionCurve(..) , TransitionName(..) , defaultNavigationOptions - , view , goBack , goTo , handleBack , init , mapCurrentPage + , view , setAnimated , setBackstackVisible , setClearHistory @@ -17,11 +17,47 @@ module Native.Frame exposing , setTransitioniOS ) +{-| Frame handles all the navigations between pages, tracks history and so on. + +Represents the logical View unit that is responsible for navigation within an application. Nested frames are supported, enabling hierarchical navigation scenarios. + + +# Types + +@docs Model +@docs TransitionCurve +@docs TransitionName + + +# Functions + +@docs defaultNavigationOptions +@docs goBack +@docs goTo +@docs handleBack +@docs init +@docs mapCurrentPage +@docs view + + +# Setter + +@docs setAnimated +@docs setBackstackVisible +@docs setClearHistory +@docs setTransition +@docs setTransitionAndroid +@docs setTransitioniOS + +-} + import Html exposing (Attribute, Html) import Html.Attributes exposing (property) import Json.Encode as E +{-| Model that holds the frame related data responsible for page rendering and clearing +-} type alias Model page = { current : page , history : List page @@ -30,6 +66,8 @@ type alias Model page = } +{-| Transistion animations supported by frame while navigating to/back page +-} type TransitionName = IosOnlyCurlUp | IosOnlyCurlDown @@ -43,6 +81,8 @@ type TransitionName | SlideBottom +{-| Animation for transition animation +-} type TransitionCurve = Ease | EaseIn @@ -53,6 +93,8 @@ type TransitionCurve | CubicBezier ( Float, Float ) ( Float, Float ) +{-| Transition options +-} type alias Transition = { name : Maybe TransitionName , duration : Maybe Int @@ -143,6 +185,8 @@ encodeTransition transition = |> E.object +{-| NavigationOptions is used to configure navigation while navigating to a page +-} type alias NavigationOptions = { animated : Maybe Bool , transition : Maybe Transition @@ -166,6 +210,8 @@ encodeNavigationOptions navOptions = |> E.object +{-| Default navigation options +-} defaultNavigationOptions : NavigationOptions defaultNavigationOptions = { animated = Nothing @@ -177,36 +223,50 @@ defaultNavigationOptions = } +{-| Setters for animated +-} setAnimated : b -> { a | animated : Maybe b } -> { a | animated : Maybe b } setAnimated val mod = { mod | animated = Just val } +{-| Setters for transition +-} setTransition : b -> { a | transition : Maybe b } -> { a | transition : Maybe b } setTransition val mod = { mod | transition = Just val } +{-| Setters for transitioniOS +-} setTransitioniOS : b -> { a | transitioniOS : Maybe b } -> { a | transitioniOS : Maybe b } setTransitioniOS val mod = { mod | transitioniOS = Just val } +{-| Setters for transitionAndroid +-} setTransitionAndroid : b -> { a | transitionAndroid : Maybe b } -> { a | transitionAndroid : Maybe b } setTransitionAndroid val mod = { mod | transitionAndroid = Just val } +{-| Setters for backstackVisible +-} setBackstackVisible : b -> { a | backstackVisible : Maybe b } -> { a | backstackVisible : Maybe b } setBackstackVisible val mod = { mod | backstackVisible = Just val } +{-| Setters for clearHistory +-} setClearHistory : b -> { a | clearHistory : Maybe b } -> { a | clearHistory : Maybe b } setClearHistory val mod = { mod | clearHistory = Just val } +{-| Renders the page on to mobile screen +-} view : List (Attribute msg) -> (page -> Html msg) -> Model page -> Html msg view attrs getPage frameModel = let @@ -227,6 +287,8 @@ view attrs getPage frameModel = history +{-| Map function for mapping current page +-} mapCurrentPage : (page -> page) -> Model page -> Model page mapCurrentPage mapFx frameModel = { frameModel @@ -236,6 +298,8 @@ mapCurrentPage mapFx frameModel = } +{-| init function to initalize frame model +-} init : page -> Model page init currentPage = { current = currentPage @@ -245,6 +309,8 @@ init currentPage = } +{-| Used to sync pages and history when nativescript navigates to different page. +-} handleBack : Bool -> Model page -> Model page handleBack isBackNavigation model = if not isBackNavigation then @@ -263,11 +329,15 @@ handleBack isBackNavigation model = } +{-| Allows frame to go back to previous page +-} goBack : Model page -> Model page goBack model = { model | popStack = True } +{-| Allows frame to move to next page +-} goTo : page -> Maybe NavigationOptions -> Model page -> Model page goTo page maybeNavigationOptions model = { model diff --git a/elm-native/src/Native/Layout.elm b/elm-native/src/Native/Layout.elm index f4cfb70..00eb84b 100644 --- a/elm-native/src/Native/Layout.elm +++ b/elm-native/src/Native/Layout.elm @@ -5,10 +5,26 @@ module Native.Layout exposing , gridLayout , rootLayout , stackLayout - , tabView , wrapLayout + , tabView ) +{-| Layout is used to organize the UI elements in the mobile screen [refer.](https://docs.nativescript.org/ui-and-styling.html#layout-containers) + + +# Layouts + +@docs absoluteLayout +@docs dockLayout +@docs flexboxLayout +@docs gridLayout +@docs rootLayout +@docs stackLayout +@docs wrapLayout +@docs tabView + +-} + import Html exposing (Attribute, Html) @@ -17,41 +33,228 @@ buildLayout nodeName attrs children = Html.node nodeName attrs children +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#absolutelayout) + +The AbsoluteLayout container is the simplest layout container in NativeScript. + +AbsoluteLayout has the following behavior: + + - Uses a pair of absolute left/top coordinates to position its children. + - Doesn't enforce any layout constraints on its children. + - Doesn't resize its children at runtime when its size changes. + +Example + + absoluteLayout [ backgroundColor "#3c495e" ] + [ label + [ text "10,10" + , left "10" + , top "10" + , width "100" + , height "100" + , backgroundColor "#43b883" + ] + [] + , label + [ text "120,10" + , left "120" + , top "10" + , width "100" + , height "100" + , backgroundColor "#43b883" + ] + [] + ] + +-} absoluteLayout : List (Attribute msg) -> List (Html msg) -> Html msg absoluteLayout = buildLayout "ns-absolute-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#docklayout) + +DockLayout is a layout container that lets you dock child elements to the sides or the center of the layout. + +DockLayout has the following behavior: + + - Uses the dock property to dock its children to the left, right, top, bottom or center of the layout. + - To dock a child element to the center, it must be the last child of the container and you must set the stretchLastChild property of the parent to true. + - Enforces layout constraints to its children. + - Resizes its children at runtime when its size changes. + +Example + + dockLayout + [ stretchLastChild "false", backgroundColor "#3c495e" ] + [ label [ text "left", dock "left", width "40", backgroundColor "#43b883" ] [] + , label [ text "top", dock "top", width "40", backgroundColor "#289062" ] [] + , label [ text "right", dock "right", width "40", backgroundColor "#43b883" ] [] + , label [ text "bottom", dock "bottom", width "40", backgroundColor "#289062" ] [] + ] + +-} dockLayout : List (Attribute msg) -> List (Html msg) -> Html msg dockLayout = buildLayout "ns-dock-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#gridlayout) + +GridLayout is a layout container that lets you arrange its child elements in a table-like manner. + +The grid consists of rows, columns, and cells. A cell can span one or more rows and one or more columns. It can contain multiple child elements which can span over multiple rows and columns, and even overlap each other. + +By default, GridLayout has one column and one row. You can add columns and rows by configuring the columns and the rows properties. In these properties, you need to set the number of columns and rows and their width and height. You set the number of columns by listing their widths, separated by a comma. You set the number of rows by listing their heights, separated by a comma. + +You can set a fixed size for column width and row height or you can create them in a responsive manner: + + - An absolute number: Indicates a fixed size. + - auto: Makes the column as wide as its widest child or makes the row as tall as its tallest child. + - `*`: Takes as much space as available after filling all auto and fixed size columns or rows. + +Example + + -- Grid layout with fixed sizing + gridLayout [ columns "115, 115", rows "115, 115" ] + [ label [ text "0,0", row "0", col "0", backgroundColor "#43b883" ] [] + , label [ text "0,1", row "0", col "1", backgroundColor "#1c6b48" ] [] + , label [ text "1,0", row "1", col "0", backgroundColor "#289062" ] [] + , label [ text "1,1", row "1", col "1", backgroundColor "#43b883" ] [] + ] + + -- Grid layout with star sizing + gridLayout [ columns "*, 2*", rows "2*, 3*", backgroundColor "#3c495e" ] + [ label [ text "0,0", row "0", col "0", backgroundColor "#43b883" ] [] + , label [ text "0,1", row "0", col "1", backgroundColor "#1c6b48" ] [] + , label [ text "1,0", row "1", col "0", backgroundColor "#289062" ] [] + , label [ text "1,1", row "1", col "1", backgroundColor "#43b883" ] [] + ] + + -- Grid layout with fixed and auto sizing + gridLayout [ columns "80, auto", rows "80, 80", backgroundColor "#3c495e" ] + [ label [ text "0,0", row "0", col "0", backgroundColor "#43b883" ] [] + , label [ text "0,1", row "0", col "1", backgroundColor "#1c6b48" ] [] + , label [ text "1,0", row "1", col "0", backgroundColor "#289062" ] [] + , label [ text "1,1", row "1", col "1", backgroundColor "#43b883" ] [] + ] + +-} gridLayout : List (Attribute msg) -> List (Html msg) -> Html msg gridLayout = buildLayout "ns-grid-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#stacklayout) + +StackLayout is a layout container that lets you stack the child elements vertically (default) or horizontally. + +Important: + +Try not to nest too many StackLayout in your markup. If you find yourself nesting a lot of StackLayout you will likely get better performance by switching to a GridLayout or FlexboxLayout. +See [Layout Nesting](https://docs.nativescript.org/common-pitfalls.html#layout-nesting) for more information. + +Example + + stackLayout [ backgroundColor "#3c495e" ] + [ label [ text "first", height "70", backgroundColor "#43b883" ] [] + , label [ text "second", height "70", backgroundColor "#289062" ] [] + , label [ text "third", height "70", backgroundColor "#1c6b48" ] [] + ] + + -- Horizontal stacking + stackLayout [ orientation "horizontal", backgroundColor "#3c495e" ] + [ label [ text "first", height "70", backgroundColor "#43b883" ] [] + , label [ text "second", height "70", backgroundColor "#289062" ] [] + , label [ text "third", height "70", backgroundColor "#1c6b48" ] [] + ] + +-} stackLayout : List (Attribute msg) -> List (Html msg) -> Html msg stackLayout = buildLayout "ns-stack-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#rootlayout) + +RootLayout is a layout container designed to be used as the primary root layout container for your app with a built in api to easily control dynamic view layers. It extends a GridLayout so has all the features of a grid but enhanced with additional apis. + +-} rootLayout : List (Attribute msg) -> List (Html msg) -> Html msg rootLayout = buildLayout "ns-root-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#wraplayout) + +WrapLayout is a layout container that lets you position items in rows or columns, based on the orientation property. When the space is filled, the container automatically wraps items onto a new row or column. + + wrapLayout [] + [ label [ text "first", width "30%", height "30%", backgroundColor "#43b883" ] [] + , label [ text "second", width "30%", height "30%", backgroundColor "#1c6b48" ] [] + , label [ text "third", width "30%", height "30%", backgroundColor "#289062" ] [] + , label [ text "fourth", width "30%", height "30%", backgroundColor "#289062" ] [] + ] + +-} wrapLayout : List (Attribute msg) -> List (Html msg) -> Html msg wrapLayout = buildLayout "ns-wrap-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#flexboxlayout) + +FlexboxLayout is a layout container that provides a non-exact implementation of the CSS Flexbox layout. This layout lets you arrange child components both horizontally and vertically. + + -- Default flex layout + flexboxLayout [ backgroundColor "#3c495e" ] + [ label [ text "first", width "70", backgroundColor "#43b883" ] [] + , label [ text "second", width "70", backgroundColor "#1c6b48" ] [] + , label [ text "third", width "70", backgroundColor "#289062" ] [] + ] + + -- Column flex layout + flexboxLayout [ flexDirection "column", backgroundColor "#3c495e" ] + [ label [ text "first", width "70", backgroundColor "#43b883" ] [] + , label [ text "second", width "70", backgroundColor "#1c6b48" ] [] + , label [ text "third", width "70", backgroundColor "#289062" ] [] + ] + + -- Row flex layout with items aligned to flex-start + flexboxLayout [ alignItems "flex-start", backgroundColor "#3c495e" ] + [ label [ text "first", width "70", backgroundColor "#43b883" ] [] + , label [ text "second", width "70", backgroundColor "#1c6b48" ] [] + , label [ text "third", width "70", backgroundColor "#289062" ] [] + ] + + -- Row flex layout with custom order + flexboxLayout [ alignItems "flex-start", backgroundColor "#3c495e" ] + [ label [ text "first", order "2", width "70", backgroundColor "#43b883" ] [] + , label [ text "second", order "3", width "70", backgroundColor "#1c6b48" ] [] + , label [ text "third", order "1", width "70", backgroundColor "#289062" ] [] + ] + + -- Row flex layout with wrapping + flexboxLayout [ flexWrap "wrap", backgroundColor "#3c495e" ] + [ label [ text "first", width "30%", backgroundColor "#43b883" ] [] + , label [ text "second", width "30%", backgroundColor "#1c6b48" ] [] + , label [ text "third", width "30%", backgroundColor "#289062" ] [] + , label [ text "fourth", width "30%", backgroundColor "#289062" ] [] + ] + +-} flexboxLayout : List (Attribute msg) -> List (Html msg) -> Html msg flexboxLayout = buildLayout "ns-flexbox-layout" +{-| [Refer](https://docs.nativescript.org/ui-and-styling.html#tabview) + +TabView is a navigation component that shows content grouped into tabs and lets users switch between tabs. + +Currently, TabViewItem expects a single child element. In most cases, you might want to wrap your content in a layout. + +-} tabView : List (Attribute msg) -> List (Html msg) -> Html msg tabView = buildLayout "ns-tab-view" diff --git a/elm-native/src/Native/Page.elm b/elm-native/src/Native/Page.elm index 3e8ae71..323ec30 100644 --- a/elm-native/src/Native/Page.elm +++ b/elm-native/src/Native/Page.elm @@ -4,12 +4,33 @@ module Native.Page exposing , pageWithActionBar ) +{-| Page is a UI component that represents an application screen. NativeScript apps typically consist of one or more that wrap content such as an and other UI widgets. +[refer](https://docs.nativescript.org/ui-and-styling.html#page) + + +# Functions + +@docs modal +@docs page +@docs pageWithActionBar + +-} + import Html exposing (Attribute, Html) import Json.Decode as D import Native.Attributes as N import Native.Event as Event +{-| Page takes onBackNavigation which should be used to SyncFrame + +Example +SyncFrame bool -> +( { model | rootFrame = Frame.handleBack bool model.rootFrame }, Cmd.none ) + +Page takes only one child + +-} page : (Bool -> msg) -> List (Attribute msg) -> Html msg -> Html msg page onBackNavigation attrs layout = Html.node "ns-page" @@ -17,6 +38,8 @@ page onBackNavigation attrs layout = [ layout ] +{-| Similar to page but actionBar support +-} pageWithActionBar : (Bool -> msg) -> List (Attribute msg) -> Html msg -> Html msg -> Html msg pageWithActionBar onBackNavigation attrs actionBar layout = Html.node "ns-page" @@ -29,6 +52,8 @@ makeOnBackNavigation msg = Event.on "navigatedTo" (D.field "isBackNavigation" D.bool |> D.map msg) +{-| Used to make modal page +-} modal : (Bool -> msg) -> Bool -> Html msg -> Html msg modal syncFrame isFullScreen child = page syncFrame diff --git a/elm-native/src/Native/Types.elm b/elm-native/src/Native/Types.elm index e973371..aeead5f 100644 --- a/elm-native/src/Native/Types.elm +++ b/elm-native/src/Native/Types.elm @@ -1,11 +1,25 @@ module Native.Types exposing - ( CapitalizationType(..) - , InputType(..) - , capitalizationToString - , inputTypeToString + ( CapitalizationType(..), InputType(..) + , capitalizationToString, inputTypeToString ) +{-| Type variants used in nativescript. + +# Types + +@docs CapitalizationType, InputType + + +# Functions + +@docs capitalizationToString, inputTypeToString + +-} + + +{-| Used to Capitalize Text +-} type CapitalizationType = Sentences | None @@ -13,6 +27,8 @@ type CapitalizationType | Words +{-| Used for InputType +-} type InputType = Text | Password @@ -22,6 +38,8 @@ type InputType | Phone +{-| Converts InputType to string +-} inputTypeToString : InputType -> String inputTypeToString input = case input of @@ -44,6 +62,8 @@ inputTypeToString input = "phone" +{-| Converts CapitalizationType to string +-} capitalizationToString : CapitalizationType -> String capitalizationToString cap = case cap of