1module VirtualDom exposing
4 , Attribute, style, property, attribute, attributeNS
7 , keyedNode, keyedNodeNS
8 , lazy, lazy2, lazy3, lazy4, lazy5, lazy6, lazy7, lazy8
11{-| API to the core diffing algorithm. Adapted for LynxJS native rendering.
14@docs Node, text, node, nodeNS
17@docs Attribute, style, property, attribute, attributeNS
23@docs map, mapAttribute
26@docs keyedNode, keyedNodeNS
29@docs lazy, lazy2, lazy3, lazy4, lazy5, lazy6, lazy7, lazy8
33import Elm.Kernel.VirtualDom
34import Json.Decode as Json
37{-| An immutable chunk of data representing a native UI element.
42{-| Create a native element with a tag name, a list of attributes/properties
43including styles and event listeners, and a list of child nodes.
45 import Json.Encode as Json
49 node "view" [] [ text "Hello!" ]
51node : String -> List (Attribute msg) -> List (Node msg) -> Node msg
53 Elm.Kernel.VirtualDom.node (Elm.Kernel.VirtualDom.noScript tag)
56{-| Create a namespaced element. In LynxJS, namespaces are ignored —
57this behaves identically to `node`.
59nodeNS : String -> String -> List (Attribute msg) -> List (Node msg) -> Node msg
61 Elm.Kernel.VirtualDom.nodeNS namespace (Elm.Kernel.VirtualDom.noScript tag)
64{-| Just put plain text in the UI. In LynxJS, this is auto-wrapped in a
65`<text>` element by the kernel.
69text : String -> Node msg
71 Elm.Kernel.VirtualDom.text
74{-| Transform the messages produced by a subtree.
76map : (a -> msg) -> Node a -> Node msg
78 Elm.Kernel.VirtualDom.map
85{-| Represents an attribute, property, style, or event on an element.
87type Attribute msg = Attribute
95 [ style "backgroundColor" "red"
96 , style "height" "90px"
97 , style "width" "100%"
103style : String -> String -> Attribute msg
105 Elm.Kernel.VirtualDom.style
108{-| Create a property.
110 import Json.Encode as Encode
112 buttonLabel : Node msg
114 node "view" [ property "id" (Encode.string "myView") ] [ text "Label" ]
116property : String -> Json.Value -> Attribute msg
118 Elm.Kernel.VirtualDom.property
119 (Elm.Kernel.VirtualDom.noInnerHtmlOrFormAction key)
120 (Elm.Kernel.VirtualDom.noJavaScriptOrHtmlJson value)
123{-| Create an attribute. Sets the attribute on the native element.
127 node "view" [ attribute "id" "main" ] [ text "Hello" ]
129attribute : String -> String -> Attribute msg
131 Elm.Kernel.VirtualDom.attribute
132 (Elm.Kernel.VirtualDom.noOnOrFormAction key)
133 (Elm.Kernel.VirtualDom.noJavaScriptOrHtmlUri value)
136{-| Create a namespaced attribute. In LynxJS, the namespace is ignored —
137this behaves identically to `attribute`.
139attributeNS : String -> String -> String -> Attribute msg
140attributeNS namespace key value =
141 Elm.Kernel.VirtualDom.attributeNS
143 (Elm.Kernel.VirtualDom.noOnOrFormAction key)
144 (Elm.Kernel.VirtualDom.noJavaScriptOrHtmlUri value)
147{-| Transform the messages produced by an `Attribute`.
149mapAttribute : (a -> b) -> Attribute a -> Attribute b
151 Elm.Kernel.VirtualDom.mapAttribute
158{-| Create custom event handlers.
160 import Json.Decode as Decode
162 onTap : msg -> Attribute msg
164 on "tap" (Normal (Decode.succeed msg))
166on : String -> Handler msg -> Attribute msg
168 Elm.Kernel.VirtualDom.on
171{-| When using `on` you can customize the event behavior:
173 - `Normal` — standard event handling
174 - `MayStopPropagation` — in LynxJS, uses `catch` prefix to stop propagation
175 - `MayPreventDefault` — not applicable in LynxJS, treated as Normal
176 - `Custom` — maps `stopPropagation` to `catch` prefix
179 = Normal (Json.Decoder msg)
180 | MayStopPropagation (Json.Decoder (msg, Bool))
181 | MayPreventDefault (Json.Decoder (msg, Bool))
182 | Custom (Json.Decoder { message : msg, stopPropagation : Bool, preventDefault : Bool })
189{-| A performance optimization that delays the building of virtual DOM nodes.
191lazy : (a -> Node msg) -> a -> Node msg
193 Elm.Kernel.VirtualDom.lazy
196{-| Same as `lazy` but checks on two arguments.
198lazy2 : (a -> b -> Node msg) -> a -> b -> Node msg
200 Elm.Kernel.VirtualDom.lazy2
203{-| Same as `lazy` but checks on three arguments.
205lazy3 : (a -> b -> c -> Node msg) -> a -> b -> c -> Node msg
207 Elm.Kernel.VirtualDom.lazy3
210{-| Same as `lazy` but checks on four arguments.
212lazy4 : (a -> b -> c -> d -> Node msg) -> a -> b -> c -> d -> Node msg
214 Elm.Kernel.VirtualDom.lazy4
217{-| Same as `lazy` but checks on five arguments.
219lazy5 : (a -> b -> c -> d -> e -> Node msg) -> a -> b -> c -> d -> e -> Node msg
221 Elm.Kernel.VirtualDom.lazy5
224{-| Same as `lazy` but checks on six arguments.
226lazy6 : (a -> b -> c -> d -> e -> f -> Node msg) -> a -> b -> c -> d -> e -> f -> Node msg
228 Elm.Kernel.VirtualDom.lazy6
231{-| Same as `lazy` but checks on seven arguments.
233lazy7 : (a -> b -> c -> d -> e -> f -> g -> Node msg) -> a -> b -> c -> d -> e -> f -> g -> Node msg
235 Elm.Kernel.VirtualDom.lazy7
238{-| Same as `lazy` but checks on eight arguments.
240lazy8 : (a -> b -> c -> d -> e -> f -> g -> h -> Node msg) -> a -> b -> c -> d -> e -> f -> g -> h -> Node msg
242 Elm.Kernel.VirtualDom.lazy8
249{-| Works just like `node`, but you add a unique identifier to each child
252keyedNode : String -> List (Attribute msg) -> List ( String, Node msg ) -> Node msg
254 Elm.Kernel.VirtualDom.keyedNode (Elm.Kernel.VirtualDom.noScript tag)
257{-| Create a keyed and namespaced node. In LynxJS, the namespace is ignored.
259keyedNodeNS : String -> String -> List (Attribute msg) -> List ( String, Node msg ) -> Node msg
260keyedNodeNS namespace tag =
261 Elm.Kernel.VirtualDom.keyedNodeNS namespace (Elm.Kernel.VirtualDom.noScript tag)
265-- FOR INTERNAL USE ONLY
268toHandlerInt : Handler msg -> Int
269toHandlerInt handler =
272 MayStopPropagation _ -> 1
273 MayPreventDefault _ -> 2
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list