0 | module Text.HTML.Extra.Node
2 | import Data.Linear.Sink
5 | import public Text.HTML
6 | import public Text.HTML.DomID
7 | import public Text.HTML.Extra.Class
8 | import public Text.HTML.Select
19 | AsyncLog = "async-dom-log"
23 | nodeSep = div [class sep] []
27 | spacer = div [class spacer] []
30 | separate : HTMLNodes -> HTMLNodes
31 | separate = intersperse nodeSep
54 | iexpanded : HTMLNode
57 | icollapsed : HTMLNode
80 | lbl : DomID -> String -> HTMLNode
81 | lbl uiid txt = label [forID uiid] [Text txt]
85 | btn : Sink e => e -> String -> List (Attribute Tag.Button) -> HTMLNode
86 | btn ev txt as = button (onClick ev :: as) [Text txt]
92 | -> {default icon cl : Class}
95 | -> List (Attribute Tag.Button)
97 | icn n ev as = button (class cl :: onClick ev :: as) [n]
104 | deleteNode : Sink e => e -> HTMLNode
105 | deleteNode ev = icn {cl = deleteIcon} idelete ev []
108 | addNode : Sink e => e -> HTMLNode
109 | addNode ev = icn {cl = addIcon} iadd ev []
113 | inp : Sink e => (String -> e) -> List (Attribute Tag.Input) -> HTMLNode
114 | inp f as = input (onInput f :: as)
122 | sel : Sink t => Eq v => (v -> t) -> (v -> String) -> List v -> Maybe v -> HTMLNode
123 | sel f g vs i = selectFromListBy' vs ((i ==) . Just) g f []
129 | iwarn = Raw "<svg viewBox='0 0 6.61 6.61'><g transform='matrix(.902 0 0 .902 .319 .685)' fill='none' stroke-width='.419'><g stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round'><path transform='translate(1.35,3)' d='m4.86 2.42-2.9-2e-7-2.9 1e-7 2.9-5.03 1.45 2.51z' stroke-width='.419'/><path d='m3.31 2.05v1.71' stroke-width='.629'/><path d='m3.31 4.63v.0865' stroke-width='.629'/></g></g></svg>"
130 | iok = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m1.32 3.97 1.32 1.06 2.65-3.7-2.74 3-1.23-.351' fill='currentcolor' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"
131 | iadd = Raw "<svg viewBox='0 0 6.61 6.61'><path transform='scale(.265)' d='m11 5v6h-6v3h6v6h3v-6h6v-3h-6v-6h-3z' fill='currentcolor' stroke='currentcolor' stroke-width='.3'/></svg>"
132 | icancel = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m4.43 1.62-1.12 1.12-1.12-1.12-.561.561 1.12 1.12-1.12 1.12.561.561 1.12-1.12 1.12 1.12.561-.561-1.12-1.12 1.12-1.12z' fill='currentcolor' stroke='currentcolor' stroke-width='.0794'/></svg>"
134 | iexpanded = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m5.12 1.9-1.81 3.22-1.81-3.22 1.81 1.41z' fill='currentcolor' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"
135 | icollapsed = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m1.9 1.5 3.22 1.81-3.22 1.81 1.41-1.81z' fill='currentcolor' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"
136 | ireload = Raw "<svg viewBox='0 0 6.61 6.61'><g transform='rotate(-30 3.23 3.6)' fill='currentcolor'><path transform='scale(.265)' d='m12.5 2a10.5 10.5 0 00-10.5 10.5 10.5 10.5 0 0010.5 10.5v-3a7.5 7.5 0 01-7.5-7.5 7.5 7.5 0 017.5-7.5 7.5 7.5 0 017.5 7.5h3a10.5 10.5 0 00-10.5-10.5z'/><path d='m4.51 3.11h2.44l-1.22 2.19z' fill-rule='evenodd' stroke-width='1.84'/></g></svg>"
137 | isortDec = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m5.12 3.7-1.81 2.12-1.81-2.12z' fill='currentcolor' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/><path d='m5.12 2.91-1.81-2.12-1.81 2.12z' fill='none' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"
138 | isortInc = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m5.12 3.7-1.81 2.12-1.81-2.12z' fill='none' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/><path d='m5.12 2.91-1.81-2.12-1.81 2.12z' fill='currentcolor' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"
139 | inoSort = Raw "<svg viewBox='0 0 6.61 6.61'><path d='m5.12 3.7-1.81 2.12-1.81-2.12z' fill='none' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/><path d='m5.12 2.91-1.81-2.12-1.81 2.12z' fill='none' fill-rule='evenodd' stroke='currentcolor' stroke-width='.0794'/></svg>"