1# lynxjs-elm/virtual-dom
3Virtual DOM implementation for Elm on LynxJS. Replaces browser DOM calls with LynxJS PAPI (Platform API) calls for native iOS/Android rendering.
5This is a low-level package. Most apps should use [`lynxjs-elm/ui`](../ui) instead, which provides typed element constructors built on top of this package.
9This package is an indirect dependency — you don't need to add it manually. It's pulled in by `lynxjs-elm/ui` and `lynxjs-elm/browser`.
24Both are opaque. `Node` represents a native UI element. `Attribute` represents a style, property, attribute, or event handler.
29node : String -> List (Attribute msg) -> List (Node msg) -> Node msg
32Create a native element with a tag name, attributes, and children.
35text : String -> Node msg
38Plain text node. Auto-wrapped in a `<text>` element by the kernel.
41nodeNS : String -> String -> List (Attribute msg) -> List (Node msg) -> Node msg
44Namespaced node. The namespace is ignored in LynxJS — behaves like `node`.
49style : String -> String -> Attribute msg
52Inline style. Example: `style "backgroundColor" "red"`.
55property : String -> Json.Value -> Attribute msg
58JSON property. Includes XSS protection (blocks innerHTML).
61attribute : String -> String -> Attribute msg
64String attribute. Includes XSS protection (blocks `on*` and form actions).
67attributeNS : String -> String -> String -> Attribute msg
70Namespaced attribute. Namespace is ignored in LynxJS.
75on : String -> Handler msg -> Attribute msg
78Attach an event listener. Event names are mapped to LynxJS equivalents at the kernel level:
80| Elm event | LynxJS event |
84| `mousedown` | `touchstart` |
85| `mousemove` | `touchmove` |
86| `mouseup` | `touchend` |
90 = Normal (Json.Decoder msg)
91 | MayStopPropagation (Json.Decoder ( msg, Bool ))
92 | MayPreventDefault (Json.Decoder ( msg, Bool ))
93 | Custom (Json.Decoder { message : msg, stopPropagation : Bool, preventDefault : Bool })
96- `Normal` — standard event handling (`bind` prefix)
97- `MayStopPropagation` — uses `catch` prefix to stop propagation in LynxJS
98- `MayPreventDefault` — not applicable in LynxJS (treated as Normal)
99- `Custom` — maps `stopPropagation` to `catch` prefix
104map : (a -> msg) -> Node a -> Node msg
107Transform messages produced by a subtree.
110mapAttribute : (a -> b) -> Attribute a -> Attribute b
113Transform messages in an attribute.
118keyedNode : String -> List (Attribute msg) -> List ( String, Node msg ) -> Node msg
121Like `node` but each child has a unique string key. Enables efficient reordering, insertion, and removal.
124keyedNodeNS : String -> String -> List (Attribute msg) -> List ( String, Node msg ) -> Node msg
130lazy : (a -> Node msg) -> a -> Node msg
131lazy2 : (a -> b -> Node msg) -> a -> b -> Node msg
132lazy3 : (a -> b -> c -> Node msg) -> a -> b -> c -> Node msg
135Delay node building. The view function is only called if the arguments have changed (by reference equality). Variants up to `lazy8` are available.
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