, lets you associate the label with some control.
190 | /// Same as for HTML attribute. \
191 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/for)
192 | pub fn for(value: String) -> Attribute {
193 | attribute("htmlFor", value)
194 | }
195 |
196 | /// Alias of `for`. \
197 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/for)
198 | pub fn html_for(value: String) -> Attribute {
199 | attribute("htmlFor", value)
200 | }
201 |
202 | /// Specifies whether the element should be hidden. \
203 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/hidden)
204 | pub fn hidden(value: Bool) -> Attribute {
205 | attribute("hidden", value)
206 | }
207 |
208 | /// Specifies a unique identifier for this element, which can be used to find
209 | /// it later or connect it with other elements. Generate it with useId to avoid
210 | /// clashes between multiple instances of the same component. \
211 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/id)
212 | pub fn id(value: String) -> Attribute {
213 | attribute("id", value)
214 | }
215 |
216 | /// If specified, the component will behave like a custom element. \
217 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/is)
218 | pub fn is(value: String) -> Attribute {
219 | attribute("is", value)
220 | }
221 |
222 | /// Specifies what kind of keyboard to display (for example, text, number or telephone). \
223 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/inputmode)
224 | pub fn input_mode(value: String) -> Attribute {
225 | attribute("inputMode", value)
226 | }
227 |
228 | /// Specifies which property the element represents for structured data crawlers. \
229 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemprop)
230 | pub fn item_prop(value: String) -> Attribute {
231 | attribute("itemProp", value)
232 | }
233 |
234 | /// Specifies the language of the element. \
235 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang)
236 | pub fn lang(value: String) -> Attribute {
237 | attribute("lang", value)
238 | }
239 |
240 | /// Specifies the element role explicitly for assistive technologies.
241 | pub fn role(value: String) -> Attribute {
242 | attribute("role", value)
243 | }
244 |
245 | /// Specifies the slot name when using shadow DOM. \
246 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/slot)
247 | pub fn slot(value: String) -> Attribute {
248 | attribute("slot", value)
249 | }
250 |
251 | /// If explicitly set to true or false, enables or disables spellchecking. \
252 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/spellcheck)
253 | pub fn spell_check(value: Bool) -> Attribute {
254 | attribute("spellCheck", value)
255 | }
256 |
257 | /// Overrides the default Tab button behavior. Avoid using values other than -1 and 0. \
258 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/tabindex)
259 | pub fn tab_index(value: Int) -> Attribute {
260 | attribute("tabIndex", value)
261 | }
262 |
263 | /// Specifies the tooltip text for the element. \
264 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/title)
265 | pub fn title(value: String) -> Attribute {
266 | attribute("title", value)
267 | }
268 |
269 | /// Translate of a translatable element.
270 | pub type Translate {
271 | Yes
272 | No
273 | }
274 |
275 | /// Passing No excludes the element content from being translated. \
276 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/translate)
277 | pub fn translate(value: Translate) -> Attribute {
278 | let value = case value {
279 | Yes -> "yes"
280 | No -> "no"
281 | }
282 | attribute("translate", value)
283 | }
284 |
285 | /// Type of an `input`. Value can be
286 | /// [`"button"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/button),
287 | /// [`"checkbox"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/checkbox),
288 | /// [`"color"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/color),
289 | /// [`"date"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/date),
290 | /// [`"datetime-local"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/datetime-local),
291 | /// [`"email"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/email),
292 | /// [`"file"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/file),
293 | /// [`"hidden"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/hidden),
294 | /// [`"image"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/image),
295 | /// [`"month"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/month),
296 | /// [`"number"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/number),
297 | /// [`"password"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/password),
298 | /// [`"radio"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/radio),
299 | /// [`"range"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/range),
300 | /// [`"reset"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/reset),
301 | /// [`"search"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/search),
302 | /// [`"submit"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/submit),
303 | /// [`"tel"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/tel),
304 | /// [`"text"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/text),
305 | /// [`"time"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/time),
306 | /// [`"url"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/url), or
307 | /// [`"week"`](https://developer.mozilla.org/docs/Web/HTML/Element/input/week).
308 | pub fn type_(name: String) -> Attribute {
309 | attribute("type", name)
310 | }
311 |
312 | /// [Input Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/input#value) \
313 | /// [Button Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#value)
314 | pub fn value(val: String) -> Attribute {
315 | attribute("value", val)
316 | }
317 |
318 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/input#checked)
319 | pub fn checked(is_checked: Bool) -> Attribute {
320 | attribute("checked", is_checked)
321 | }
322 |
323 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/placeholder)
324 | pub fn placeholder(text: String) -> Attribute {
325 | attribute("placeholder", text)
326 | }
327 |
328 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/option#selected)
329 | pub fn selected(is_selected: Bool) -> Attribute {
330 | attribute("selected", is_selected)
331 | }
332 |
333 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/accept)
334 | pub fn accept(types: List(String)) -> Attribute {
335 | attribute("accept", string.join(types, " "))
336 | }
337 |
338 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/acceptCharset)
339 | pub fn accept_charset(types: List(String)) -> Attribute {
340 | attribute("acceptCharset", string.join(types, " "))
341 | }
342 |
343 | pub fn msg(uri: String) -> Attribute {
344 | attribute("msg", uri)
345 | }
346 |
347 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete)
348 | pub fn autocomplete(name: String) -> Attribute {
349 | attribute("autocomplete", name)
350 | }
351 |
352 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autofocus)
353 | pub fn autofocus(should_autofocus: Bool) -> Attribute {
354 | attribute("autofocus", should_autofocus)
355 | }
356 |
357 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/disabled)
358 | pub fn disabled(is_disabled: Bool) -> Attribute {
359 | attribute("disabled", is_disabled)
360 | }
361 |
362 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/name)
363 | pub fn name(name: String) -> Attribute {
364 | attribute("name", name)
365 | }
366 |
367 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/pattern)
368 | pub fn pattern(regex: String) -> Attribute {
369 | attribute("pattern", regex)
370 | }
371 |
372 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/readonly)
373 | pub fn readonly(is_readonly: Bool) -> Attribute {
374 | attribute("readonly", is_readonly)
375 | }
376 |
377 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/required)
378 | pub fn required(is_required: Bool) -> Attribute {
379 | attribute("required", is_required)
380 | }
381 |
382 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/max)
383 | pub fn max(val: String) -> Attribute {
384 | attribute("max", val)
385 | }
386 |
387 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/min)
388 | pub fn min(val: String) -> Attribute {
389 | attribute("min", val)
390 | }
391 |
392 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/step)
393 | pub fn step(val: String) -> Attribute {
394 | attribute("step", val)
395 | }
396 |
397 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/cols)
398 | pub fn cols(val: Int) -> Attribute {
399 | attribute("cols", val)
400 | }
401 |
402 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/rows)
403 | pub fn rows(val: Int) -> Attribute {
404 | attribute("rows", val)
405 | }
406 |
407 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/wrap)
408 | pub fn wrap(mode: String) -> Attribute {
409 | attribute("wrap", mode)
410 | }
411 |
412 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/download)
413 | pub fn download(filename: String) -> Attribute {
414 | attribute("download", filename)
415 | }
416 |
417 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel)
418 | pub fn rel(relationship: String) -> Attribute {
419 | attribute("rel", relationship)
420 | }
421 |
422 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLObjectElement/height)
423 | pub fn height(val: Int) -> Attribute {
424 | attribute("height", val)
425 | }
426 |
427 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLObjectElement/width)
428 | pub fn width(val: Int) -> Attribute {
429 | attribute("width", val)
430 | }
431 |
432 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/autoplay)
433 | pub fn autoplay(should_autoplay: Bool) -> Attribute {
434 | attribute("autoplay", should_autoplay)
435 | }
436 |
437 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/controls)
438 | pub fn controls(visible: Bool) -> Attribute {
439 | attribute("controls", visible)
440 | }
441 |
442 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loop)
443 | pub fn loop(should_loop: Bool) -> Attribute {
444 | attribute("loop", should_loop)
445 | }
446 |
447 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/action)
448 | pub fn action(url: String) -> Attribute {
449 | attribute("action", url)
450 | }
451 |
452 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/enctype)
453 | pub fn enctype(value: String) -> Attribute {
454 | attribute("enctype", value)
455 | }
456 |
457 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/method)
458 | pub fn method(method: String) -> Attribute {
459 | attribute("method", method)
460 | }
461 |
462 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/novalidate)
463 | pub fn novalidate(value: Bool) -> Attribute {
464 | attribute("novalidate", value)
465 | }
466 |
467 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#formaction)
468 | pub fn form_action(action: String) -> Attribute {
469 | attribute("formaction", action)
470 | }
471 |
472 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#formenctype)
473 | pub fn form_enctype(value: String) -> Attribute {
474 | attribute("formenctype", value)
475 | }
476 |
477 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#formmethod)
478 | pub fn form_method(method: String) -> Attribute {
479 | attribute("formmethod", method)
480 | }
481 |
482 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#formnovalidate)
483 | pub fn form_novalidate(value: Bool) -> Attribute {
484 | attribute("formnovalidate", value)
485 | }
486 |
487 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button#formtarget)
488 | pub fn form_target(target: String) -> Attribute {
489 | attribute("formtarget", target)
490 | }
491 |
492 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/HTMLDetailsElement/open)
493 | pub fn open(is_open: Bool) -> Attribute {
494 | attribute("open", is_open)
495 | }
496 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/client.gleam:
--------------------------------------------------------------------------------
1 | import redraw.{type Component}
2 |
3 | /// Root to display React DOM. \
4 | /// [Documentation](https://react.dev/reference/react-dom/client/createRoot#createroot)
5 | pub type Root
6 |
7 | /// Let you create a root to display React components inside a browser DOM node.
8 | /// Contrarily to JavaScript, `create_root` returns a `Result` to avoid runtime
9 | /// error. Indeed, when the provided root does not exist in your HTML, `create_root`
10 | /// fails. You should never assume `create_root` will work out-of-the-box when
11 | /// you're building a library. Otherwise, you could assert the resulting
12 | /// value in your application.
13 | ///
14 | /// ```gleam
15 | /// import redraw/dom/client
16 | ///
17 | /// pub fn main() {
18 | /// let assert Ok(root) = client.create_root("app")
19 | /// client.render(root, app())
20 | /// }
21 | /// ```
22 | ///
23 | /// [Documentation](https://react.dev/reference/react-dom/client/createRoot)
24 | @external(javascript, "../../client.ffi.mjs", "createRoot")
25 | pub fn create_root(root: String) -> Result(Root, Nil)
26 |
27 | /// Let you display React components inside a browser DOM node whose HTML content
28 | /// was previously generated by `react-dom/server`.
29 | /// Contrarily to JavaScript, `hydrate_root` returns a `Result` to avoid runtime
30 | /// error. Indeed, when the provided root does not exist in your HTML, `hydrate_root`
31 | /// fails. You should never assume `hydrate_root` will work out-of-the-box when
32 | /// you're building a library. Otherwise, you could assert the resulting
33 | /// value in your application.
34 | ///
35 | /// ```gleam
36 | /// import redraw/dom/client
37 | ///
38 | /// pub fn main() {
39 | /// let assert Ok(root) = client.hydrate_root("app")
40 | /// }
41 | /// ```
42 | ///
43 | /// [Documentation](https://react.dev/reference/react-dom/client/hydrateRoot)
44 | @external(javascript, "../../client.ffi.mjs", "hydrateRoot")
45 | pub fn hydrate_root(root: String, node: Component) -> Result(Root, Nil)
46 |
47 | /// Call `render(root)` to display a piece of JSX (“React node”) into the React
48 | /// root’s browser DOM node. \
49 | /// [Documentation](https://react.dev/reference/react-dom/client/createRoot#root-render)
50 | @external(javascript, "../../client.ffi.mjs", "render")
51 | pub fn render(root: Root, child: Component) -> Nil
52 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/animation.gleam:
--------------------------------------------------------------------------------
1 | //// The `AnimationEvent` interface represents events providing information
2 | //// related to [animations](https://developer.mozilla.org/docs/Web/CSS/CSS_animations/Using_CSS_animations).
3 |
4 | import redraw/event.{type Event}
5 | import redraw/internals/coerce.{coerce}
6 |
7 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/AnimationEvent)
8 | pub type AnimationEvent
9 |
10 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/AnimationEvent/animationName)
11 | @external(javascript, "../../../events.ffi.mjs", "animationName")
12 | pub fn animation_name(event: AnimationEvent) -> String
13 |
14 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/AnimationEvent/elapsedTime)
15 | @external(javascript, "../../../events.ffi.mjs", "elapsedTime")
16 | pub fn elapsed_time(event: AnimationEvent) -> Float
17 |
18 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/AnimationEvent/pseudoElement)
19 | @external(javascript, "../../../events.ffi.mjs", "pseudoElement")
20 | pub fn pseudo_element(event: AnimationEvent) -> String
21 |
22 | /// `AnimationEvent` inherits `Event`.
23 | pub fn as_event(event: AnimationEvent) -> Event {
24 | coerce(event)
25 | }
26 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/clipboard.gleam:
--------------------------------------------------------------------------------
1 | //// The `ClipboardEvent` interface of the [Clipboard API](https://developer.mozilla.org/docs/Web/API/Clipboard_API) represents events
2 | //// providing information related to modification of the clipboard, that is
3 | //// [`cut`](https://developer.mozilla.org/docs/Web/API/Element/cut_event),
4 | //// [`copy`](https://developer.mozilla.org/docs/Web/API/Element/cut_event), and
5 | //// [`paste`](https://developer.mozilla.org/docs/Web/API/Element/cut_event) events.
6 |
7 | import gleam/dynamic
8 | import redraw/event.{type Event}
9 | import redraw/internals/coerce.{coerce}
10 |
11 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/ClipboardEvent)
12 | pub type ClipboardEvent
13 |
14 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/ClipboardEvent/clipboardData)
15 | @external(javascript, "../../../events.ffi.mjs", "clipboardData")
16 | pub fn clipboard_data(event: ClipboardEvent) -> dynamic.Dynamic
17 |
18 | /// `ClipboardEvent` inherits `Event`.
19 | pub fn as_event(event: ClipboardEvent) -> Event {
20 | coerce(event)
21 | }
22 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/composition.gleam:
--------------------------------------------------------------------------------
1 | //// The DOM `CompositionEvent` represents events that occur due to the user
2 | //// indirectly entering text.
3 | ////
4 | //// [Input Method Editor Documentation](https://developer.mozilla.org/docs/Glossary/Input_method_editor).
5 |
6 | import redraw/event.{type Event}
7 | import redraw/internals/coerce.{coerce}
8 |
9 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/CompositionEvent)
10 | pub type CompositionEvent
11 |
12 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/CompositionEvent/data)
13 | @external(javascript, "../../../events.ffi.mjs", "data")
14 | pub fn data(event: CompositionEvent) -> String
15 |
16 | /// `CompositionEvent` inherits `Event`.
17 | pub fn as_event(event: CompositionEvent) -> Event {
18 | coerce(event)
19 | }
20 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/drag.gleam:
--------------------------------------------------------------------------------
1 | //// The `DragEvent` interface is a DOM event that represents a drag and drop
2 | //// interaction. The user initiates a drag by placing a pointer device (such as
3 | //// a mouse) on the touch surface and then dragging the pointer to a new
4 | //// location (such as another DOM element). Applications are free to interpret
5 | //// a drag and drop interaction in an application-specific way.
6 | ////
7 | //// [Drag and Drop API Documentation](https://developer.mozilla.org/docs/Web/API/HTML_Drag_and_Drop_API)
8 |
9 | import gleam/dynamic
10 | import redraw/dom/event/mouse.{type MouseEvent}
11 | import redraw/dom/event/ui.{type UIEvent}
12 | import redraw/event.{type Event}
13 | import redraw/internals/coerce.{coerce}
14 |
15 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/DragEvent)
16 | pub type DragEvent
17 |
18 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/DragEvent/dataTransfer)
19 | @external(javascript, "../../../events.ffi.mjs", "dataTransfer")
20 | pub fn data_transfer(event: DragEvent) -> dynamic.Dynamic
21 |
22 | /// `DragEvent` inherits from `MouseEvent`.
23 | pub fn as_mouse_event(event: DragEvent) -> MouseEvent {
24 | coerce(event)
25 | }
26 |
27 | /// `DragEvent` inherits from `UIEvent`.
28 | pub fn as_ui_event(event: DragEvent) -> UIEvent {
29 | coerce(event)
30 | }
31 |
32 | /// `DragEvent` inherits `Event`.
33 | pub fn as_event(event: DragEvent) -> Event {
34 | coerce(event)
35 | }
36 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/focus.gleam:
--------------------------------------------------------------------------------
1 | //// The `FocusEvent` interface represents focus-related events, including
2 | //// [`focus`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focus_event),
3 | //// [`blur`](https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event),
4 | //// [`focusin`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focusin_event),
5 | //// and [`focusout`](https://developer.mozilla.org/en-US/docs/Web/API/Element/focusout_event).
6 |
7 | import gleam/dynamic
8 | import redraw/dom/event/ui.{type UIEvent}
9 | import redraw/event.{type Event}
10 | import redraw/internals/coerce.{coerce}
11 |
12 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/FocusEvent)
13 | pub type FocusEvent
14 |
15 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/FocusEvent/relatedTarget)
16 | @external(javascript, "../../../events.ffi.mjs", "relatedTarget")
17 | pub fn related_target(event: FocusEvent) -> dynamic.Dynamic
18 |
19 | /// `FocusEvent` inherits `UIEvent`.
20 | pub fn as_ui_event(event: FocusEvent) -> UIEvent {
21 | coerce(event)
22 | }
23 |
24 | /// `FocusEvent` inherits `Event`.
25 | pub fn as_event(event: FocusEvent) -> Event {
26 | coerce(event)
27 | }
28 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/input.gleam:
--------------------------------------------------------------------------------
1 | //// The `InputEvent` interface represents an event notifying the user of editable content changes.
2 |
3 | import redraw/event.{type Event}
4 | import redraw/internals/coerce.{coerce}
5 |
6 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/InputEvent)
7 | pub type InputEvent
8 |
9 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/InputEvent/data)
10 | @external(javascript, "../../../events.ffi.mjs", "data")
11 | pub fn data(event: InputEvent) -> String
12 |
13 | /// `InputEvent` inherits `Event`.
14 | pub fn as_event(event: InputEvent) -> Event {
15 | coerce(event)
16 | }
17 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/keyboard.gleam:
--------------------------------------------------------------------------------
1 | //// `KeyboardEvent` objects describe a user interaction with the keyboard; each
2 | //// event describes a single interaction between the user and a key (or
3 | //// combination of a key with modifier keys) on the keyboard. The event type
4 | //// ([`keydown`](https://developer.mozilla.org/docs/Web/API/Element/keydown_event),
5 | //// [`keypress`](https://developer.mozilla.org/docs/Web/API/Element/keypress_event),
6 | //// or [`keyup`](https://developer.mozilla.org/docs/Web/API/Element/keyup_event))
7 | //// identifies what kind of keyboard activity occurred.
8 |
9 | import redraw/dom/event/ui.{type UIEvent}
10 | import redraw/event.{type Event}
11 | import redraw/internals/coerce.{coerce}
12 |
13 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent)
14 | pub type KeyboardEvent
15 |
16 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/altKey)
17 | @external(javascript, "../../../events.ffi.mjs", "altKey")
18 | pub fn alt_key(event: KeyboardEvent) -> Bool
19 |
20 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/code)
21 | @external(javascript, "../../../events.ffi.mjs", "code")
22 | pub fn code(event: KeyboardEvent) -> String
23 |
24 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/ctrlKey)
25 | @external(javascript, "../../../events.ffi.mjs", "ctrlKey")
26 | pub fn ctrl_key(event: KeyboardEvent) -> Bool
27 |
28 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/key)
29 | @external(javascript, "../../../events.ffi.mjs", "key")
30 | pub fn key(event: KeyboardEvent) -> String
31 |
32 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/locale)
33 | @external(javascript, "../../../events.ffi.mjs", "locale")
34 | pub fn locale(event: KeyboardEvent) -> String
35 |
36 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/metaKey)
37 | @external(javascript, "../../../events.ffi.mjs", "metaKey")
38 | pub fn meta_key(event: KeyboardEvent) -> Bool
39 |
40 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/location)
41 | @external(javascript, "../../../events.ffi.mjs", "location")
42 | pub fn location(event: KeyboardEvent) -> Float
43 |
44 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/repeat)
45 | @external(javascript, "../../../events.ffi.mjs", "repeat")
46 | pub fn repeat(event: KeyboardEvent) -> Bool
47 |
48 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/shiftKey)
49 | @external(javascript, "../../../events.ffi.mjs", "shiftKey")
50 | pub fn shift_key(event: KeyboardEvent) -> Bool
51 |
52 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/getModifierState)
53 | @external(javascript, "../../../events.ffi.mjs", "getModifierState")
54 | pub fn get_modifier_state(event: KeyboardEvent, key: String) -> Bool
55 |
56 | /// `KeyboardEvent` inherits `UIEvent`.
57 | pub fn as_ui_event(event: KeyboardEvent) -> UIEvent {
58 | coerce(event)
59 | }
60 |
61 | /// `KeyboardEvent` inherits `Event`.
62 | pub fn as_event(event: KeyboardEvent) -> Event {
63 | coerce(event)
64 | }
65 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/mouse.gleam:
--------------------------------------------------------------------------------
1 | //// The `MouseEvent` interface represents events that occur due to the user
2 | //// interacting with a pointing device (such as a mouse). Common events using
3 | //// this interface include [`click`](https://developer.mozilla.org/docs/Web/API/Element/click_event),
4 | //// [`dblclick`](https://developer.mozilla.org/docs/Web/API/Element/dblclick_event),
5 | //// [`mouseup`](https://developer.mozilla.org/docs/Web/API/Element/mouseup_event),
6 | //// [`mousedown`](https://developer.mozilla.org/docs/Web/API/Element/mousedown_event).
7 |
8 | import gleam/dynamic
9 | import redraw/dom/event/ui.{type UIEvent}
10 | import redraw/event.{type Event}
11 | import redraw/internals/coerce.{coerce}
12 |
13 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent)
14 | pub type MouseEvent
15 |
16 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/altKey)
17 | @external(javascript, "../../../events.ffi.mjs", "altKey")
18 | pub fn alt_key(event: MouseEvent) -> Bool
19 |
20 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/button)
21 | @external(javascript, "../../../events.ffi.mjs", "button")
22 | pub fn button(event: MouseEvent) -> Int
23 |
24 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/buttons)
25 | @external(javascript, "../../../events.ffi.mjs", "buttons")
26 | pub fn buttons(event: MouseEvent) -> Int
27 |
28 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/ctrlKey)
29 | @external(javascript, "../../../events.ffi.mjs", "ctrlKey")
30 | pub fn ctrl_key(event: MouseEvent) -> Bool
31 |
32 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/clientX)
33 | @external(javascript, "../../../events.ffi.mjs", "clientX")
34 | pub fn client_x(event: MouseEvent) -> Float
35 |
36 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/clientY)
37 | @external(javascript, "../../../events.ffi.mjs", "clientY")
38 | pub fn client_y(event: MouseEvent) -> Float
39 |
40 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/metaKey)
41 | @external(javascript, "../../../events.ffi.mjs", "metaKey")
42 | pub fn meta_key(event: MouseEvent) -> Bool
43 |
44 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/movementX)
45 | @external(javascript, "../../../events.ffi.mjs", "movementX")
46 | pub fn movement_x(event: MouseEvent) -> Int
47 |
48 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/movementY)
49 | @external(javascript, "../../../events.ffi.mjs", "movementY")
50 | pub fn movement_y(event: MouseEvent) -> Int
51 |
52 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/pageX)
53 | @external(javascript, "../../../events.ffi.mjs", "pageX")
54 | pub fn page_x(event: MouseEvent) -> Float
55 |
56 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/pageY)
57 | @external(javascript, "../../../events.ffi.mjs", "pageY")
58 | pub fn page_y(event: MouseEvent) -> Float
59 |
60 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/offsetX)
61 | @external(javascript, "../../../events.ffi.mjs", "offsetX")
62 | pub fn offset_x(event: MouseEvent) -> Float
63 |
64 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/offsetY)
65 | @external(javascript, "../../../events.ffi.mjs", "offsetY")
66 | pub fn offset_y(event: MouseEvent) -> Float
67 |
68 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
69 | @external(javascript, "../../../events.ffi.mjs", "relatedTarget")
70 | pub fn related_target(event: MouseEvent) -> dynamic.Dynamic
71 |
72 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/screenX)
73 | @external(javascript, "../../../events.ffi.mjs", "screenX")
74 | pub fn screen_x(event: MouseEvent) -> Float
75 |
76 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/screenY)
77 | @external(javascript, "../../../events.ffi.mjs", "screenY")
78 | pub fn screen_y(event: MouseEvent) -> Float
79 |
80 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/shiftKey)
81 | @external(javascript, "../../../events.ffi.mjs", "shiftKey")
82 | pub fn shift_key(event: MouseEvent) -> Bool
83 |
84 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/MouseEvent/getModifierState)
85 | @external(javascript, "../../../events.ffi.mjs", "getModifierState")
86 | pub fn get_modifier_state(event: MouseEvent, key: String) -> Bool
87 |
88 | /// `MouseEvent` inherits `UIEvent`.
89 | pub fn as_ui_event(event: MouseEvent) -> UIEvent {
90 | coerce(event)
91 | }
92 |
93 | /// `MouseEvent` inherits `Event`.
94 | pub fn as_event(event: MouseEvent) -> Event {
95 | coerce(event)
96 | }
97 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/pointer.gleam:
--------------------------------------------------------------------------------
1 | //// The `PointerEvent` interface represents the state of a DOM event produced by
2 | //// a pointer such as the geometry of the contact point, the device type that
3 | //// generated the event, the amount of pressure that was applied on the contact
4 | //// surface, etc.
5 | ////
6 | //// A pointer is a hardware agnostic representation of input devices (such as a
7 | //// mouse, pen or contact point on a touch-enable surface). The pointer can
8 | //// target a specific coordinate (or set of coordinates) on the contact surface
9 | //// such as a screen.
10 | ////
11 | //// A pointer's hit test is the process a browser uses to determine the target
12 | //// element for a pointer event. Typically, this is determined by considering
13 | //// the pointer's location and also the visual layout of elements in a document
14 | //// on screen media.
15 |
16 | import redraw/dom/event/mouse.{type MouseEvent}
17 | import redraw/dom/event/ui.{type UIEvent}
18 | import redraw/event.{type Event}
19 | import redraw/internals/coerce.{coerce}
20 |
21 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent)
22 | pub type PointerEvent
23 |
24 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/altitudeAngle)
25 | @external(javascript, "../../../events.ffi.mjs", "altitudeAngle")
26 | pub fn altitude_angle(event: PointerEvent) -> Int
27 |
28 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/azimuthAngle)
29 | @external(javascript, "../../../events.ffi.mjs", "azimuthAngle")
30 | pub fn azimuth_angle(event: PointerEvent) -> Int
31 |
32 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/height)
33 | @external(javascript, "../../../events.ffi.mjs", "height")
34 | pub fn height(event: PointerEvent) -> Int
35 |
36 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/isPrimary)
37 | @external(javascript, "../../../events.ffi.mjs", "isPrimary")
38 | pub fn is_primary(event: PointerEvent) -> Bool
39 |
40 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/pointerId)
41 | @external(javascript, "../../../events.ffi.mjs", "pointerId")
42 | pub fn pointer_id(event: PointerEvent) -> Int
43 |
44 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/pointerType)
45 | @external(javascript, "../../../events.ffi.mjs", "pointerType")
46 | pub fn pointer_type(event: PointerEvent) -> String
47 |
48 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/pressure)
49 | @external(javascript, "../../../events.ffi.mjs", "pressure")
50 | pub fn pressure(event: PointerEvent) -> Float
51 |
52 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/tangentialPressure)
53 | @external(javascript, "../../../events.ffi.mjs", "tangentialPressure")
54 | pub fn tangential_pressure(event: PointerEvent) -> Float
55 |
56 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/tiltX)
57 | @external(javascript, "../../../events.ffi.mjs", "tiltX")
58 | pub fn tilt_x(event: PointerEvent) -> Int
59 |
60 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/tiltY)
61 | @external(javascript, "../../../events.ffi.mjs", "tiltY")
62 | pub fn tilt_y(event: PointerEvent) -> Int
63 |
64 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/twist)
65 | @external(javascript, "../../../events.ffi.mjs", "twist")
66 | pub fn twist(event: PointerEvent) -> Int
67 |
68 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/PointerEvent/width)
69 | @external(javascript, "../../../events.ffi.mjs", "width")
70 | pub fn width(event: PointerEvent) -> Int
71 |
72 | /// `PointerEvent` inherits `MouseEvent`.
73 | pub fn as_mouse_event(event: PointerEvent) -> MouseEvent {
74 | coerce(event)
75 | }
76 |
77 | /// `PointerEvent` inherits `UIEvent`.
78 | pub fn as_ui_event(event: PointerEvent) -> UIEvent {
79 | coerce(event)
80 | }
81 |
82 | /// `PointerEvent` inherits `Event`.
83 | pub fn as_event(event: PointerEvent) -> Event {
84 | coerce(event)
85 | }
86 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/touch.gleam:
--------------------------------------------------------------------------------
1 | //// To provide quality support for touch-based user interfaces, touch events
2 | //// offer the ability to interpret finger (or stylus) activity on touch screens
3 | //// or trackpads.
4 | ////
5 | //// The touch events interfaces are relatively low-level APIs that can be used
6 | //// to support application-specific multi-touch interactions such as a
7 | //// two-finger gesture. A multi-touch interaction starts when a finger (or
8 | //// stylus) first touches the contact surface. Other fingers may subsequently
9 | //// touch the surface and optionally move across the touch surface. The
10 | //// interaction ends when the fingers are removed from the surface. During this
11 | //// interaction, an application receives touch events during the start, move,
12 | //// and end phases.
13 | ////
14 | //// Touch events are similar to mouse events except they support simultaneous
15 | //// touches and at different locations on the touch surface. The `TouchEvent`
16 | //// interface encapsulates all of the touchpoints that are currently active.
17 | //// The [`Touch`](https://developer.mozilla.org/docs/Web/API/Touch)
18 | //// interface, which represents a single touchpoint, includes information such
19 | //// as the position of the touch point relative to the browser viewport.
20 | ////
21 | //// [Documentation](https://developer.mozilla.org/docs/Web/API/Touch_events)
22 |
23 | import gleam/dynamic
24 | import redraw/dom/event/ui.{type UIEvent}
25 | import redraw/event.{type Event}
26 | import redraw/internals/coerce.{coerce}
27 |
28 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent)
29 | pub type TouchEvent
30 |
31 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/altKey)
32 | @external(javascript, "../../../events.ffi.mjs", "altKey")
33 | pub fn alt_key(event: TouchEvent) -> Bool
34 |
35 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/ctrlKey)
36 | @external(javascript, "../../../events.ffi.mjs", "ctrlKey")
37 | pub fn ctrl_key(event: TouchEvent) -> Bool
38 |
39 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/changedTouches)
40 | @external(javascript, "../../../events.ffi.mjs", "changedTouches")
41 | pub fn changed_touches(event: TouchEvent) -> dynamic.Dynamic
42 |
43 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/metaKey)
44 | @external(javascript, "../../../events.ffi.mjs", "metaKey")
45 | pub fn meta_key(event: TouchEvent) -> Bool
46 |
47 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/shiftKey)
48 | @external(javascript, "../../../events.ffi.mjs", "shiftKey")
49 | pub fn shift_key(event: TouchEvent) -> Bool
50 |
51 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/touches)
52 | @external(javascript, "../../../events.ffi.mjs", "touches")
53 | pub fn touches(event: TouchEvent) -> dynamic.Dynamic
54 |
55 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/targetTouches)
56 | @external(javascript, "../../../events.ffi.mjs", "targetTouches")
57 | pub fn target_touches(event: TouchEvent) -> dynamic.Dynamic
58 |
59 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TouchEvent/getModifierState)
60 | @external(javascript, "../../../events.ffi.mjs", "getModifierState")
61 | pub fn get_modifier_state(event: TouchEvent, key: String) -> Bool
62 |
63 | /// `TouchEvent` inherits `UIEvent`.
64 | pub fn as_ui_event(event: TouchEvent) -> UIEvent {
65 | coerce(event)
66 | }
67 |
68 | /// `TouchEvent` inherits `Event`.
69 | pub fn as_event(event: TouchEvent) -> Event {
70 | coerce(event)
71 | }
72 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/transition.gleam:
--------------------------------------------------------------------------------
1 | //// The `TransitionEvent` interface represents events providing information
2 | //// related to [transitions](https://developer.mozilla.org/docs/Web/CSS/CSS_transitions/Using_CSS_transitions).
3 |
4 | import redraw/event.{type Event}
5 | import redraw/internals/coerce.{coerce}
6 |
7 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
8 | pub type TransitionEvent
9 |
10 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TransitionEvent/elapsedTime)
11 | @external(javascript, "../../../events.ffi.mjs", "elapsedTime")
12 | pub fn elapsed_time(event: TransitionEvent) -> Int
13 |
14 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TransitionEvent/propertyName)
15 | @external(javascript, "../../../events.ffi.mjs", "propertyName")
16 | pub fn property_name(event: TransitionEvent) -> String
17 |
18 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/TransitionEvent/pseudoElement)
19 | @external(javascript, "../../../events.ffi.mjs", "pseudoElement")
20 | pub fn pseudo_element(event: TransitionEvent) -> String
21 |
22 | /// `TransitionEvent` inherits `Event`.
23 | pub fn as_event(event: TransitionEvent) -> Event {
24 | coerce(event)
25 | }
26 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/ui.gleam:
--------------------------------------------------------------------------------
1 | //// The `UIEvent` interface represents simple user interface events.
2 |
3 | import gleam/dynamic
4 | import redraw/event.{type Event}
5 | import redraw/internals/coerce.{coerce}
6 |
7 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/UIEvent)
8 | pub type UIEvent
9 |
10 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/UIEvent/detail)
11 | @external(javascript, "../../../events.ffi.mjs", "detail")
12 | pub fn detail(event: UIEvent) -> Int
13 |
14 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/UIEvent/view)
15 | @external(javascript, "../../../events.ffi.mjs", "view")
16 | pub fn view(event: UIEvent) -> dynamic.Dynamic
17 |
18 | /// `UIEvent` inherits `Event`.
19 | pub fn as_event(event: UIEvent) -> Event {
20 | coerce(event)
21 | }
22 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/event/wheel.gleam:
--------------------------------------------------------------------------------
1 | //// The `WheelEvent` interface represents events that occur due to the user
2 | //// moving a mouse wheel or similar input device.
3 | ////
4 | //// > This is the standard wheel event interface to use. Old versions
5 | //// of browsers implemented the non-standard and non-cross-browser-compatible
6 | //// `MouseWheelEvent` and `MouseScrollEvent` interfaces. Use this interface and
7 | //// avoid the non-standard ones.
8 | ////
9 | //// Don't confuse the wheel event with the [`scroll`](https://developer.mozilla.org/docs/Web/API/Element/scroll_event) event:
10 | //// - A `wheel` event doesn't necessarily dispatch a `scroll` event. For example,
11 | //// the element may be unscrollable at all. Zooming actions using the wheel
12 | //// or trackpad also fire `wheel` events.
13 | //// - A `scroll` event isn't necessarily triggered by a `wheel` event. Elements
14 | //// can also be scrolled by using the keyboard, dragging a scrollbar, or
15 | //// using JavaScript.
16 | //// - Even when the `wheel` event does trigger scrolling, the `delta*` values in
17 | //// the `wheel` event don't necessarily reflect the content's scrolling
18 | //// direction.
19 |
20 | import redraw/dom/event/mouse.{type MouseEvent}
21 | import redraw/dom/event/ui.{type UIEvent}
22 | import redraw/event.{type Event}
23 | import redraw/internals/coerce.{coerce}
24 |
25 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/WheelEvent)
26 | pub type WheelEvent
27 |
28 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaMode)
29 | @external(javascript, "../../../events.ffi.mjs", "deltaMode")
30 | pub fn delta_mode(event: WheelEvent) -> Int
31 |
32 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaX)
33 | @external(javascript, "../../../events.ffi.mjs", "deltaX")
34 | pub fn delta_x(event: WheelEvent) -> Float
35 |
36 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaY)
37 | @external(javascript, "../../../events.ffi.mjs", "deltaY")
38 | pub fn delta_y(event: WheelEvent) -> Float
39 |
40 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaZ)
41 | @external(javascript, "../../../events.ffi.mjs", "deltaZ")
42 | pub fn delta_z(event: WheelEvent) -> Float
43 |
44 | /// `WheelEvent` inherits `MouseEvent`.
45 | pub fn as_mouse_event(event: WheelEvent) -> MouseEvent {
46 | coerce(event)
47 | }
48 |
49 | /// `WheelEvent` inherits `UIEvent`.
50 | pub fn as_ui_event(event: WheelEvent) -> UIEvent {
51 | coerce(event)
52 | }
53 |
54 | /// `WheelEvent` inherits `Event`.
55 | pub fn as_event(event: WheelEvent) -> Event {
56 | coerce(event)
57 | }
58 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/html.gleam:
--------------------------------------------------------------------------------
1 | //// All built-in browser components, such as ``, ``, etc. support
2 | //// common attributes and events. \
3 | //// To stay compatible with the Lustre API, Redraw defines the entire set of
4 | //// HTML elements. They're instantiated with JSX under-the-hood, and requires
5 | //// a modern runtime to get them working.
6 | ////
7 | //// [Find detailed documentation on MDN](https://developer.mozilla.org/docs/Web/HTML/Element).
8 |
9 | import redraw.{type Component}
10 | import redraw/dom/attribute.{type Attribute}
11 |
12 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/html)
13 | pub fn html(attrs: List(Attribute), children: List(Component)) -> Component {
14 | let attrs = to_props(attrs)
15 | redraw.jsx("html", attrs, children)
16 | }
17 |
18 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/link)
19 | pub fn link(attrs: List(Attribute)) -> Component {
20 | let attrs = to_props(attrs)
21 | redraw.jsx("link", attrs, Nil)
22 | }
23 |
24 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
25 | pub fn meta(attrs: List(Attribute)) -> Component {
26 | let attrs = to_props(attrs)
27 | redraw.jsx("meta", attrs, Nil)
28 | }
29 |
30 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/script)
31 | pub fn script(attrs: List(Attribute), script: String) -> Component {
32 | let attrs = to_props(attrs)
33 | redraw.jsx("script", attrs, [text(script)])
34 | }
35 |
36 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/style)
37 | pub fn style(attrs: List(Attribute), content) -> Component {
38 | let attrs = to_props(attrs)
39 | redraw.jsx("style", attrs, [text(content)])
40 | }
41 |
42 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/title)
43 | pub fn title(attrs: List(Attribute), content) -> Component {
44 | let attrs = to_props(attrs)
45 | redraw.jsx("title", attrs, [text(content)])
46 | }
47 |
48 | /// Empty node. Does not render anything in the DOM.
49 | pub fn none() -> Component {
50 | redraw.jsx("none_", Nil, Nil)
51 | }
52 |
53 | /// [Documentation](https://developer.mozilla.org/docs/Web/API/Text)
54 | pub fn text(content: String) -> Component {
55 | redraw.jsx("text_", Nil, content)
56 | }
57 |
58 | // DOM nodes
59 |
60 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/a)
61 | pub fn a(attrs: List(Attribute), children: List(Component)) -> Component {
62 | let attrs = to_props(attrs)
63 | redraw.jsx("a", attrs, children)
64 | }
65 |
66 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/abbr)
67 | pub fn abbr(attrs: List(Attribute), children: List(Component)) -> Component {
68 | let attrs = to_props(attrs)
69 | redraw.jsx("abbr", attrs, children)
70 | }
71 |
72 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/address)
73 | pub fn address(attrs: List(Attribute), children: List(Component)) -> Component {
74 | let attrs = to_props(attrs)
75 | redraw.jsx("address", attrs, children)
76 | }
77 |
78 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/area)
79 | pub fn area(attrs) -> Component {
80 | let attrs = to_props(attrs)
81 | redraw.jsx("area", attrs, Nil)
82 | }
83 |
84 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/article)
85 | pub fn article(attrs: List(Attribute), children: List(Component)) -> Component {
86 | let attrs = to_props(attrs)
87 | redraw.jsx("article", attrs, children)
88 | }
89 |
90 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/aside)
91 | pub fn aside(attrs: List(Attribute), children: List(Component)) -> Component {
92 | let attrs = to_props(attrs)
93 | redraw.jsx("aside", attrs, children)
94 | }
95 |
96 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/audio)
97 | pub fn audio(attrs: List(Attribute), children: List(Component)) -> Component {
98 | let attrs = to_props(attrs)
99 | redraw.jsx("audio", attrs, children)
100 | }
101 |
102 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/b)
103 | pub fn b(attrs: List(Attribute), children: List(Component)) -> Component {
104 | let attrs = to_props(attrs)
105 | redraw.jsx("b", attrs, children)
106 | }
107 |
108 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/base)
109 | pub fn base(attrs: List(Attribute)) -> Component {
110 | let attrs = to_props(attrs)
111 | redraw.jsx("base", attrs, Nil)
112 | }
113 |
114 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/bdi)
115 | pub fn bdi(attrs: List(Attribute), children: List(Component)) -> Component {
116 | let attrs = to_props(attrs)
117 | redraw.jsx("bdi", attrs, children)
118 | }
119 |
120 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/bdo)
121 | pub fn bdo(attrs: List(Attribute), children: List(Component)) -> Component {
122 | let attrs = to_props(attrs)
123 | redraw.jsx("bdo", attrs, children)
124 | }
125 |
126 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/blockquote)
127 | pub fn blockquote(
128 | attrs: List(Attribute),
129 | children: List(Component),
130 | ) -> Component {
131 | let attrs = to_props(attrs)
132 | redraw.jsx("blockquote", attrs, children)
133 | }
134 |
135 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/body)
136 | pub fn body(attrs: List(Attribute), children: List(Component)) -> Component {
137 | let attrs = to_props(attrs)
138 | redraw.jsx("body", attrs, children)
139 | }
140 |
141 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/br)
142 | pub fn br(attrs: List(Attribute)) -> Component {
143 | let attrs = to_props(attrs)
144 | redraw.jsx("br", attrs, Nil)
145 | }
146 |
147 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/button)
148 | pub fn button(attrs: List(Attribute), children: List(Component)) -> Component {
149 | let attrs = to_props(attrs)
150 | redraw.jsx("button", attrs, children)
151 | }
152 |
153 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/canvas)
154 | pub fn canvas(attrs: List(Attribute), children: List(Component)) -> Component {
155 | let attrs = to_props(attrs)
156 | redraw.jsx("canvas", attrs, children)
157 | }
158 |
159 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/caption)
160 | pub fn caption(attrs: List(Attribute), children: List(Component)) -> Component {
161 | let attrs = to_props(attrs)
162 | redraw.jsx("caption", attrs, children)
163 | }
164 |
165 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/cite)
166 | pub fn cite(attrs: List(Attribute), children: List(Component)) -> Component {
167 | let attrs = to_props(attrs)
168 | redraw.jsx("cite", attrs, children)
169 | }
170 |
171 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/code)
172 | pub fn code(attrs: List(Attribute), children: List(Component)) -> Component {
173 | let attrs = to_props(attrs)
174 | redraw.jsx("code", attrs, children)
175 | }
176 |
177 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/col)
178 | pub fn col(attrs: List(Attribute)) -> Component {
179 | let attrs = to_props(attrs)
180 | redraw.jsx("col", attrs, Nil)
181 | }
182 |
183 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup)
184 | pub fn colgroup(attrs: List(Attribute), children: List(Component)) -> Component {
185 | let attrs = to_props(attrs)
186 | redraw.jsx("colgroup", attrs, children)
187 | }
188 |
189 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/data)
190 | pub fn data(attrs: List(Attribute), children: List(Component)) -> Component {
191 | let attrs = to_props(attrs)
192 | redraw.jsx("data", attrs, children)
193 | }
194 |
195 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/datalist)
196 | pub fn datalist(attrs: List(Attribute), children: List(Component)) -> Component {
197 | let attrs = to_props(attrs)
198 | redraw.jsx("datalist", attrs, children)
199 | }
200 |
201 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/dd)
202 | pub fn dd(attrs: List(Attribute), children: List(Component)) -> Component {
203 | let attrs = to_props(attrs)
204 | redraw.jsx("dd", attrs, children)
205 | }
206 |
207 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/del)
208 | pub fn del(attrs: List(Attribute), children: List(Component)) -> Component {
209 | let attrs = to_props(attrs)
210 | redraw.jsx("del", attrs, children)
211 | }
212 |
213 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/details)
214 | pub fn details(attrs: List(Attribute), children: List(Component)) -> Component {
215 | let attrs = to_props(attrs)
216 | redraw.jsx("details", attrs, children)
217 | }
218 |
219 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/dfn)
220 | pub fn dfn(attrs: List(Attribute), children: List(Component)) -> Component {
221 | let attrs = to_props(attrs)
222 | redraw.jsx("dfn", attrs, children)
223 | }
224 |
225 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/dialog)
226 | pub fn dialog(attrs: List(Attribute), children: List(Component)) -> Component {
227 | let attrs = to_props(attrs)
228 | redraw.jsx("dialog", attrs, children)
229 | }
230 |
231 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/div)
232 | pub fn div(attrs: List(Attribute), children: List(Component)) -> Component {
233 | let attrs = to_props(attrs)
234 | redraw.jsx("div", attrs, children)
235 | }
236 |
237 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/dl)
238 | pub fn dl(attrs: List(Attribute), children: List(Component)) -> Component {
239 | let attrs = to_props(attrs)
240 | redraw.jsx("dl", attrs, children)
241 | }
242 |
243 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/dt)
244 | pub fn dt(attrs: List(Attribute), children: List(Component)) -> Component {
245 | let attrs = to_props(attrs)
246 | redraw.jsx("dt", attrs, children)
247 | }
248 |
249 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/em)
250 | pub fn em(attrs: List(Attribute), children: List(Component)) -> Component {
251 | let attrs = to_props(attrs)
252 | redraw.jsx("em", attrs, children)
253 | }
254 |
255 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/embed)
256 | pub fn embed(attrs: List(Attribute)) -> Component {
257 | let attrs = to_props(attrs)
258 | redraw.jsx("embed", attrs, Nil)
259 | }
260 |
261 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/fieldset)
262 | pub fn fieldset(attrs: List(Attribute), children: List(Component)) -> Component {
263 | let attrs = to_props(attrs)
264 | redraw.jsx("fieldset", attrs, children)
265 | }
266 |
267 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/figcaption)
268 | pub fn figcaption(
269 | attrs: List(Attribute),
270 | children: List(Component),
271 | ) -> Component {
272 | let attrs = to_props(attrs)
273 | redraw.jsx("figcaption", attrs, children)
274 | }
275 |
276 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/figure)
277 | pub fn figure(attrs: List(Attribute), children: List(Component)) -> Component {
278 | let attrs = to_props(attrs)
279 | redraw.jsx("figure", attrs, children)
280 | }
281 |
282 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/footer)
283 | pub fn footer(attrs: List(Attribute), children: List(Component)) -> Component {
284 | let attrs = to_props(attrs)
285 | redraw.jsx("footer", attrs, children)
286 | }
287 |
288 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/form)
289 | pub fn form(attrs: List(Attribute), children: List(Component)) -> Component {
290 | let attrs = to_props(attrs)
291 | redraw.jsx("form", attrs, children)
292 | }
293 |
294 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h1)
295 | pub fn h1(attrs: List(Attribute), children: List(Component)) -> Component {
296 | let attrs = to_props(attrs)
297 | redraw.jsx("h1", attrs, children)
298 | }
299 |
300 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h2)
301 | pub fn h2(attrs: List(Attribute), children) -> Component {
302 | let attrs = to_props(attrs)
303 | redraw.jsx("h2", attrs, children)
304 | }
305 |
306 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h3)
307 | pub fn h3(attrs: List(Attribute), children) -> Component {
308 | let attrs = to_props(attrs)
309 | redraw.jsx("h3", attrs, children)
310 | }
311 |
312 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h4)
313 | pub fn h4(attrs: List(Attribute), children) -> Component {
314 | let attrs = to_props(attrs)
315 | redraw.jsx("h4", attrs, children)
316 | }
317 |
318 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h5)
319 | pub fn h5(attrs: List(Attribute), children) -> Component {
320 | let attrs = to_props(attrs)
321 | redraw.jsx("h5", attrs, children)
322 | }
323 |
324 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/h6)
325 | pub fn h6(attrs: List(Attribute), children) -> Component {
326 | let attrs = to_props(attrs)
327 | redraw.jsx("h6", attrs, children)
328 | }
329 |
330 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/head)
331 | pub fn head(attrs: List(Attribute), children: List(Component)) -> Component {
332 | let attrs = to_props(attrs)
333 | redraw.jsx("head", attrs, children)
334 | }
335 |
336 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/header)
337 | pub fn header(attrs: List(Attribute), children: List(Component)) -> Component {
338 | let attrs = to_props(attrs)
339 | redraw.jsx("header", attrs, children)
340 | }
341 |
342 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/hgroup)
343 | pub fn hgroup(attrs: List(Attribute), children: List(Component)) -> Component {
344 | let attrs = to_props(attrs)
345 | redraw.jsx("hgroup", attrs, children)
346 | }
347 |
348 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/hr)
349 | pub fn hr(attrs) {
350 | let attrs = to_props(attrs)
351 | redraw.jsx("hr", attrs, Nil)
352 | }
353 |
354 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/i)
355 | pub fn i(attrs: List(Attribute), children: List(Component)) -> Component {
356 | let attrs = to_props(attrs)
357 | redraw.jsx("i", attrs, children)
358 | }
359 |
360 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/iframe)
361 | pub fn iframe(attrs: List(Attribute)) -> Component {
362 | let attrs = to_props(attrs)
363 | redraw.jsx("iframe", attrs, Nil)
364 | }
365 |
366 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/img)
367 | pub fn img(attrs: List(Attribute)) -> Component {
368 | let attrs = to_props(attrs)
369 | redraw.jsx("img", attrs, Nil)
370 | }
371 |
372 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/input)
373 | pub fn input(attrs: List(Attribute)) -> Component {
374 | let attrs = to_props(attrs)
375 | redraw.jsx("input", attrs, Nil)
376 | }
377 |
378 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/ins)
379 | pub fn ins(attrs: List(Attribute), children: List(Component)) -> Component {
380 | let attrs = to_props(attrs)
381 | redraw.jsx("ins", attrs, children)
382 | }
383 |
384 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/kbd)
385 | pub fn kbd(attrs: List(Attribute), children: List(Component)) -> Component {
386 | let attrs = to_props(attrs)
387 | redraw.jsx("kbd", attrs, children)
388 | }
389 |
390 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/label)
391 | pub fn label(attrs: List(Attribute), children: List(Component)) -> Component {
392 | let attrs = to_props(attrs)
393 | redraw.jsx("label", attrs, children)
394 | }
395 |
396 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/legend)
397 | pub fn legend(attrs: List(Attribute), children: List(Component)) -> Component {
398 | let attrs = to_props(attrs)
399 | redraw.jsx("legend", attrs, children)
400 | }
401 |
402 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/li)
403 | pub fn li(attrs: List(Attribute), children: List(Component)) -> Component {
404 | let attrs = to_props(attrs)
405 | redraw.jsx("li", attrs, children)
406 | }
407 |
408 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/main)
409 | pub fn main(attrs: List(Attribute), children: List(Component)) -> Component {
410 | let attrs = to_props(attrs)
411 | redraw.jsx("main", attrs, children)
412 | }
413 |
414 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/map)
415 | pub fn map(attrs: List(Attribute), children: List(Component)) -> Component {
416 | let attrs = to_props(attrs)
417 | redraw.jsx("map", attrs, children)
418 | }
419 |
420 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/mark)
421 | pub fn mark(attrs: List(Attribute), children: List(Component)) -> Component {
422 | let attrs = to_props(attrs)
423 | redraw.jsx("mark", attrs, children)
424 | }
425 |
426 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/menu)
427 | pub fn menu(attrs: List(Attribute), children: List(Component)) -> Component {
428 | let attrs = to_props(attrs)
429 | redraw.jsx("menu", attrs, children)
430 | }
431 |
432 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/meter)
433 | pub fn meter(attrs: List(Attribute), children: List(Component)) -> Component {
434 | let attrs = to_props(attrs)
435 | redraw.jsx("meter", attrs, children)
436 | }
437 |
438 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/nav)
439 | pub fn nav(attrs: List(Attribute), children: List(Component)) -> Component {
440 | let attrs = to_props(attrs)
441 | redraw.jsx("nav", attrs, children)
442 | }
443 |
444 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/noscript)
445 | pub fn noscript(attrs: List(Attribute), children: List(Component)) -> Component {
446 | let attrs = to_props(attrs)
447 | redraw.jsx("noscript", attrs, children)
448 | }
449 |
450 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/object)
451 | pub fn object(attrs: List(Attribute), children: List(Component)) -> Component {
452 | let attrs = to_props(attrs)
453 | redraw.jsx("object", attrs, children)
454 | }
455 |
456 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/ol)
457 | pub fn ol(attrs: List(Attribute), children: List(Component)) -> Component {
458 | let attrs = to_props(attrs)
459 | redraw.jsx("ol", attrs, children)
460 | }
461 |
462 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/optgroup)
463 | pub fn optgroup(attrs: List(Attribute), children: List(Component)) -> Component {
464 | let attrs = to_props(attrs)
465 | redraw.jsx("optgroup", attrs, children)
466 | }
467 |
468 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/option)
469 | pub fn option(attrs: List(Attribute), children: List(Component)) -> Component {
470 | let attrs = to_props(attrs)
471 | redraw.jsx("option", attrs, children)
472 | }
473 |
474 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/output)
475 | pub fn output(attrs: List(Attribute), children: List(Component)) -> Component {
476 | let attrs = to_props(attrs)
477 | redraw.jsx("output", attrs, children)
478 | }
479 |
480 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/p)
481 | pub fn p(attrs: List(Attribute), children: List(Component)) -> Component {
482 | let attrs = to_props(attrs)
483 | redraw.jsx("p", attrs, children)
484 | }
485 |
486 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/picture)
487 | pub fn picture(attrs: List(Attribute), children: List(Component)) -> Component {
488 | let attrs = to_props(attrs)
489 | redraw.jsx("picture", attrs, children)
490 | }
491 |
492 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/pre)
493 | pub fn pre(attrs: List(Attribute), children: List(Component)) -> Component {
494 | let attrs = to_props(attrs)
495 | redraw.jsx("pre", attrs, children)
496 | }
497 |
498 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/progress)
499 | pub fn progress(attrs: List(Attribute), children: List(Component)) -> Component {
500 | let attrs = to_props(attrs)
501 | redraw.jsx("progress", attrs, children)
502 | }
503 |
504 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/q)
505 | pub fn q(attrs: List(Attribute), children: List(Component)) -> Component {
506 | let attrs = to_props(attrs)
507 | redraw.jsx("q", attrs, children)
508 | }
509 |
510 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/rp)
511 | pub fn rp(attrs: List(Attribute), children: List(Component)) -> Component {
512 | let attrs = to_props(attrs)
513 | redraw.jsx("rp", attrs, children)
514 | }
515 |
516 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/rt)
517 | pub fn rt(attrs: List(Attribute), children: List(Component)) -> Component {
518 | let attrs = to_props(attrs)
519 | redraw.jsx("rt", attrs, children)
520 | }
521 |
522 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/ruby)
523 | pub fn ruby(attrs: List(Attribute), children: List(Component)) -> Component {
524 | let attrs = to_props(attrs)
525 | redraw.jsx("ruby", attrs, children)
526 | }
527 |
528 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/s)
529 | pub fn s(attrs: List(Attribute), children: List(Component)) -> Component {
530 | let attrs = to_props(attrs)
531 | redraw.jsx("s", attrs, children)
532 | }
533 |
534 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/samp)
535 | pub fn samp(attrs: List(Attribute), children: List(Component)) -> Component {
536 | let attrs = to_props(attrs)
537 | redraw.jsx("samp", attrs, children)
538 | }
539 |
540 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/section)
541 | pub fn section(attrs: List(Attribute), children: List(Component)) -> Component {
542 | let attrs = to_props(attrs)
543 | redraw.jsx("section", attrs, children)
544 | }
545 |
546 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/select)
547 | pub fn select(attrs: List(Attribute), children: List(Component)) -> Component {
548 | let attrs = to_props(attrs)
549 | redraw.jsx("select", attrs, children)
550 | }
551 |
552 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/slot)
553 | pub fn slot(attrs: List(Attribute), children: List(Component)) -> Component {
554 | let attrs = to_props(attrs)
555 | redraw.jsx("slot", attrs, children)
556 | }
557 |
558 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/small)
559 | pub fn small(attrs: List(Attribute), children: List(Component)) -> Component {
560 | let attrs = to_props(attrs)
561 | redraw.jsx("small", attrs, children)
562 | }
563 |
564 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/source)
565 | pub fn source(attrs: List(Attribute)) -> Component {
566 | let attrs = to_props(attrs)
567 | redraw.jsx("source", attrs, Nil)
568 | }
569 |
570 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/span)
571 | pub fn span(attrs: List(Attribute), children: List(Component)) -> Component {
572 | let attrs = to_props(attrs)
573 | redraw.jsx("span", attrs, children)
574 | }
575 |
576 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/strong)
577 | pub fn strong(attrs: List(Attribute), children: List(Component)) -> Component {
578 | let attrs = to_props(attrs)
579 | redraw.jsx("strong", attrs, children)
580 | }
581 |
582 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/sub)
583 | pub fn sub(attrs: List(Attribute), children: List(Component)) -> Component {
584 | let attrs = to_props(attrs)
585 | redraw.jsx("sub", attrs, children)
586 | }
587 |
588 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/summary)
589 | pub fn summary(attrs: List(Attribute), children: List(Component)) -> Component {
590 | let attrs = to_props(attrs)
591 | redraw.jsx("summary", attrs, children)
592 | }
593 |
594 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/sup)
595 | pub fn sup(attrs: List(Attribute), children: List(Component)) -> Component {
596 | let attrs = to_props(attrs)
597 | redraw.jsx("sup", attrs, children)
598 | }
599 |
600 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/table)
601 | pub fn table(attrs: List(Attribute), children: List(Component)) -> Component {
602 | let attrs = to_props(attrs)
603 | redraw.jsx("table", attrs, children)
604 | }
605 |
606 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/tbody)
607 | pub fn tbody(attrs: List(Attribute), children: List(Component)) -> Component {
608 | let attrs = to_props(attrs)
609 | redraw.jsx("tbody", attrs, children)
610 | }
611 |
612 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/td)
613 | pub fn td(attrs: List(Attribute), children: List(Component)) -> Component {
614 | let attrs = to_props(attrs)
615 | redraw.jsx("td", attrs, children)
616 | }
617 |
618 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/template)
619 | pub fn template(attrs: List(Attribute), children: List(Component)) -> Component {
620 | let attrs = to_props(attrs)
621 | redraw.jsx("template", attrs, children)
622 | }
623 |
624 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/textarea)
625 | pub fn textarea(attrs: List(Attribute), children: List(Component)) -> Component {
626 | let attrs = to_props(attrs)
627 | redraw.jsx("textarea", attrs, children)
628 | }
629 |
630 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot)
631 | pub fn tfoot(attrs: List(Attribute), children: List(Component)) -> Component {
632 | let attrs = to_props(attrs)
633 | redraw.jsx("tfoot", attrs, children)
634 | }
635 |
636 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/th)
637 | pub fn th(attrs: List(Attribute), children: List(Component)) -> Component {
638 | let attrs = to_props(attrs)
639 | redraw.jsx("th", attrs, children)
640 | }
641 |
642 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/thead)
643 | pub fn thead(attrs: List(Attribute), children: List(Component)) -> Component {
644 | let attrs = to_props(attrs)
645 | redraw.jsx("thead", attrs, children)
646 | }
647 |
648 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/time)
649 | pub fn time(attrs: List(Attribute), children: List(Component)) -> Component {
650 | let attrs = to_props(attrs)
651 | redraw.jsx("time", attrs, children)
652 | }
653 |
654 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/tr)
655 | pub fn tr(attrs: List(Attribute), children: List(Component)) -> Component {
656 | let attrs = to_props(attrs)
657 | redraw.jsx("tr", attrs, children)
658 | }
659 |
660 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/track)
661 | pub fn track(attrs: List(Attribute)) -> Component {
662 | let attrs = to_props(attrs)
663 | redraw.jsx("track", attrs, Nil)
664 | }
665 |
666 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/u)
667 | pub fn u(attrs: List(Attribute), children: List(Component)) -> Component {
668 | let attrs = to_props(attrs)
669 | redraw.jsx("u", attrs, children)
670 | }
671 |
672 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/ul)
673 | pub fn ul(attrs: List(Attribute), children: List(Component)) -> Component {
674 | let attrs = to_props(attrs)
675 | redraw.jsx("ul", attrs, children)
676 | }
677 |
678 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/var)
679 | pub fn var(attrs: List(Attribute), children: List(Component)) -> Component {
680 | let attrs = to_props(attrs)
681 | redraw.jsx("var", attrs, children)
682 | }
683 |
684 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/video)
685 | pub fn video(attrs: List(Attribute), children: List(Component)) -> Component {
686 | let attrs = to_props(attrs)
687 | redraw.jsx("video", attrs, children)
688 | }
689 |
690 | /// [Documentation](https://developer.mozilla.org/docs/Web/HTML/Element/wbr)
691 | pub fn wbr(attrs: List(Attribute)) -> Component {
692 | let attrs = to_props(attrs)
693 | redraw.jsx("wbr", attrs, Nil)
694 | }
695 |
696 | // TODO expose it later
697 | @external(javascript, "../../attribute.ffi.mjs", "toProps")
698 | @internal
699 | pub fn to_props(attrs: List(Attribute)) -> b
700 |
--------------------------------------------------------------------------------
/redraw_dom/src/redraw/dom/svg.gleam:
--------------------------------------------------------------------------------
1 | //// All built-in browser components, such as ``, ``, etc. support
2 | //// common props and events. \
3 | //// To stay compatible with the Lustre API, Redraw defines the entire set of
4 | //// SVG elements. They're instantiated with JSX under-the-hood, and requires
5 | //// a modern runtime to get them working.
6 | ////
7 | //// [Find detailed documentation on MDN](https://developer.mozilla.org/docs/Web/SVG/Element).
8 |
9 | import redraw.{type Component}
10 | import redraw/dom/attribute.{type Attribute}
11 |
12 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/a)
13 | pub fn a(attrs: List(Attribute), children: List(Component)) -> Component {
14 | let attrs = to_props(attrs)
15 | redraw.jsx("a", attrs, children)
16 | }
17 |
18 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/animate)
19 | pub fn animate(attrs: List(Attribute), children: List(Component)) -> Component {
20 | let attrs = to_props(attrs)
21 | redraw.jsx("animate", attrs, children)
22 | }
23 |
24 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/animateMotion)
25 | pub fn animate_motion(
26 | attrs: List(Attribute),
27 | children: List(Component),
28 | ) -> Component {
29 | let attrs = to_props(attrs)
30 | redraw.jsx("animateMotion", attrs, children)
31 | }
32 |
33 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/animateTransform)
34 | pub fn animate_transform(
35 | attrs: List(Attribute),
36 | children: List(Component),
37 | ) -> Component {
38 | let attrs = to_props(attrs)
39 | redraw.jsx("animateTransform", attrs, children)
40 | }
41 |
42 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/circle)
43 | pub fn circle(attrs: List(Attribute), children: List(Component)) -> Component {
44 | let attrs = to_props(attrs)
45 | redraw.jsx("circle", attrs, children)
46 | }
47 |
48 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/clipPath)
49 | pub fn clip_path(attrs: List(Attribute), children: List(Component)) -> Component {
50 | let attrs = to_props(attrs)
51 | redraw.jsx("clipPath", attrs, children)
52 | }
53 |
54 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/defs)
55 | pub fn defs(attrs: List(Attribute), children: List(Component)) -> Component {
56 | let attrs = to_props(attrs)
57 | redraw.jsx("defs", attrs, children)
58 | }
59 |
60 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/desc)
61 | pub fn desc(attrs: List(Attribute), children: List(Component)) -> Component {
62 | let attrs = to_props(attrs)
63 | redraw.jsx("desc", attrs, children)
64 | }
65 |
66 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/discard)
67 | pub fn discard(attrs: List(Attribute), children: List(Component)) -> Component {
68 | let attrs = to_props(attrs)
69 | redraw.jsx("discard", attrs, children)
70 | }
71 |
72 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/ellipse)
73 | pub fn ellipse(attrs: List(Attribute), children: List(Component)) -> Component {
74 | let attrs = to_props(attrs)
75 | redraw.jsx("ellipse", attrs, children)
76 | }
77 |
78 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feBlend)
79 | pub fn fe_blend(attrs: List(Attribute), children: List(Component)) -> Component {
80 | let attrs = to_props(attrs)
81 | redraw.jsx("feBlend", attrs, children)
82 | }
83 |
84 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feColorMatrix)
85 | pub fn fe_color_matrix(
86 | attrs: List(Attribute),
87 | children: List(Component),
88 | ) -> Component {
89 | let attrs = to_props(attrs)
90 | redraw.jsx("feColorMatrix", attrs, children)
91 | }
92 |
93 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feComponentTransfer)
94 | pub fn fe_component_transfer(
95 | attrs: List(Attribute),
96 | children: List(Component),
97 | ) -> Component {
98 | let attrs = to_props(attrs)
99 | redraw.jsx("feComponentTransfer", attrs, children)
100 | }
101 |
102 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feComposite)
103 | pub fn fe_composite(
104 | attrs: List(Attribute),
105 | children: List(Component),
106 | ) -> Component {
107 | let attrs = to_props(attrs)
108 | redraw.jsx("feComposite", attrs, children)
109 | }
110 |
111 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feConvolveMatrix)
112 | pub fn fe_convolve_matrix(
113 | attrs: List(Attribute),
114 | children: List(Component),
115 | ) -> Component {
116 | let attrs = to_props(attrs)
117 | redraw.jsx("feConvolveMatrix", attrs, children)
118 | }
119 |
120 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feDiffuseLighting)
121 | pub fn fe_diffuse_lighting(
122 | attrs: List(Attribute),
123 | children: List(Component),
124 | ) -> Component {
125 | let attrs = to_props(attrs)
126 | redraw.jsx("feDiffuseLighting", attrs, children)
127 | }
128 |
129 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feDisplacementMap)
130 | pub fn fe_displacement_map(
131 | attrs: List(Attribute),
132 | children: List(Component),
133 | ) -> Component {
134 | let attrs = to_props(attrs)
135 | redraw.jsx("feDisplacementMap", attrs, children)
136 | }
137 |
138 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feDistantLight)
139 | pub fn fe_distant_light(
140 | attrs: List(Attribute),
141 | children: List(Component),
142 | ) -> Component {
143 | let attrs = to_props(attrs)
144 | redraw.jsx("feDistantLight", attrs, children)
145 | }
146 |
147 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feDropShadow)
148 | pub fn fe_drop_shadow(
149 | attrs: List(Attribute),
150 | children: List(Component),
151 | ) -> Component {
152 | let attrs = to_props(attrs)
153 | redraw.jsx("feDropShadow", attrs, children)
154 | }
155 |
156 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feFlood)
157 | pub fn fe_flood(attrs: List(Attribute), children: List(Component)) -> Component {
158 | let attrs = to_props(attrs)
159 | redraw.jsx("feFlood", attrs, children)
160 | }
161 |
162 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feFuncA)
163 | pub fn fe_func_a(attrs: List(Attribute), children: List(Component)) -> Component {
164 | let attrs = to_props(attrs)
165 | redraw.jsx("feFuncA", attrs, children)
166 | }
167 |
168 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feFuncB)
169 | pub fn fe_func_b(attrs: List(Attribute), children: List(Component)) -> Component {
170 | let attrs = to_props(attrs)
171 | redraw.jsx("feFuncB", attrs, children)
172 | }
173 |
174 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feFuncG)
175 | pub fn fe_func_g(attrs: List(Attribute), children: List(Component)) -> Component {
176 | let attrs = to_props(attrs)
177 | redraw.jsx("feFuncG", attrs, children)
178 | }
179 |
180 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feFuncR)
181 | pub fn fe_func_r(attrs: List(Attribute), children: List(Component)) -> Component {
182 | let attrs = to_props(attrs)
183 | redraw.jsx("feFuncR", attrs, children)
184 | }
185 |
186 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feGaussianBlur)
187 | pub fn fe_gaussian_blur(
188 | attrs: List(Attribute),
189 | children: List(Component),
190 | ) -> Component {
191 | let attrs = to_props(attrs)
192 | redraw.jsx("feGaussianBlur", attrs, children)
193 | }
194 |
195 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feImage)
196 | pub fn fe_image(attrs: List(Attribute), children: List(Component)) -> Component {
197 | let attrs = to_props(attrs)
198 | redraw.jsx("feImage", attrs, children)
199 | }
200 |
201 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feMerge)
202 | pub fn fe_merge(attrs: List(Attribute), children: List(Component)) -> Component {
203 | let attrs = to_props(attrs)
204 | redraw.jsx("feMerge", attrs, children)
205 | }
206 |
207 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feMergeNode)
208 | pub fn fe_merge_node(
209 | attrs: List(Attribute),
210 | children: List(Component),
211 | ) -> Component {
212 | let attrs = to_props(attrs)
213 | redraw.jsx("feMergeNode", attrs, children)
214 | }
215 |
216 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feMorphology)
217 | pub fn fe_morphology(
218 | attrs: List(Attribute),
219 | children: List(Component),
220 | ) -> Component {
221 | let attrs = to_props(attrs)
222 | redraw.jsx("feMorphology", attrs, children)
223 | }
224 |
225 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feOffset)
226 | pub fn fe_offset(attrs: List(Attribute), children: List(Component)) -> Component {
227 | let attrs = to_props(attrs)
228 | redraw.jsx("feOffset", attrs, children)
229 | }
230 |
231 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/fePointLight)
232 | pub fn fe_point_light(
233 | attrs: List(Attribute),
234 | children: List(Component),
235 | ) -> Component {
236 | let attrs = to_props(attrs)
237 | redraw.jsx("fePointLight", attrs, children)
238 | }
239 |
240 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feSpecularLighting)
241 | pub fn fe_specular_lighting(
242 | attrs: List(Attribute),
243 | children: List(Component),
244 | ) -> Component {
245 | let attrs = to_props(attrs)
246 | redraw.jsx("feSpecularLighting", attrs, children)
247 | }
248 |
249 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feSpotLight)
250 | pub fn fe_spot_light(
251 | attrs: List(Attribute),
252 | children: List(Component),
253 | ) -> Component {
254 | let attrs = to_props(attrs)
255 | redraw.jsx("feSpotLight", attrs, children)
256 | }
257 |
258 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feTile)
259 | pub fn fe_tile(attrs: List(Attribute), children: List(Component)) -> Component {
260 | let attrs = to_props(attrs)
261 | redraw.jsx("feTile", attrs, children)
262 | }
263 |
264 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/feTurbulence)
265 | pub fn fe_turbulence(
266 | attrs: List(Attribute),
267 | children: List(Component),
268 | ) -> Component {
269 | let attrs = to_props(attrs)
270 | redraw.jsx("feTurbulence", attrs, children)
271 | }
272 |
273 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/filter)
274 | pub fn filter(attrs: List(Attribute), children: List(Component)) -> Component {
275 | let attrs = to_props(attrs)
276 | redraw.jsx("filter", attrs, children)
277 | }
278 |
279 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/foreignObject)
280 | pub fn foreign_object(
281 | attrs: List(Attribute),
282 | children: List(Component),
283 | ) -> Component {
284 | let attrs = to_props(attrs)
285 | redraw.jsx("foreignObject", attrs, children)
286 | }
287 |
288 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/g)
289 | pub fn g(attrs: List(Attribute), children: List(Component)) -> Component {
290 | let attrs = to_props(attrs)
291 | redraw.jsx("g", attrs, children)
292 | }
293 |
294 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/hatch)
295 | pub fn hatch(attrs: List(Attribute), children: List(Component)) -> Component {
296 | let attrs = to_props(attrs)
297 | redraw.jsx("hatch", attrs, children)
298 | }
299 |
300 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/hatchpath)
301 | pub fn hatchpath(attrs: List(Attribute), children: List(Component)) -> Component {
302 | let attrs = to_props(attrs)
303 | redraw.jsx("hatchpath", attrs, children)
304 | }
305 |
306 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/image)
307 | pub fn image(attrs: List(Attribute), children: List(Component)) -> Component {
308 | let attrs = to_props(attrs)
309 | redraw.jsx("image", attrs, children)
310 | }
311 |
312 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/line)
313 | pub fn line(attrs: List(Attribute), children: List(Component)) -> Component {
314 | let attrs = to_props(attrs)
315 | redraw.jsx("line", attrs, children)
316 | }
317 |
318 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient)
319 | pub fn linear_gradient(
320 | attrs: List(Attribute),
321 | children: List(Component),
322 | ) -> Component {
323 | let attrs = to_props(attrs)
324 | redraw.jsx("linearGradient", attrs, children)
325 | }
326 |
327 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/marker)
328 | pub fn marker(attrs: List(Attribute), children: List(Component)) -> Component {
329 | let attrs = to_props(attrs)
330 | redraw.jsx("marker", attrs, children)
331 | }
332 |
333 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/mask)
334 | pub fn mask(attrs: List(Attribute), children: List(Component)) -> Component {
335 | let attrs = to_props(attrs)
336 | redraw.jsx("mask", attrs, children)
337 | }
338 |
339 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/metadata)
340 | pub fn metadata(attrs: List(Attribute), children: List(Component)) -> Component {
341 | let attrs = to_props(attrs)
342 | redraw.jsx("metadata", attrs, children)
343 | }
344 |
345 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/mpath)
346 | pub fn mpath(attrs: List(Attribute), children: List(Component)) -> Component {
347 | let attrs = to_props(attrs)
348 | redraw.jsx("mpath", attrs, children)
349 | }
350 |
351 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/path)
352 | pub fn path(attrs: List(Attribute), children: List(Component)) -> Component {
353 | let attrs = to_props(attrs)
354 | redraw.jsx("path", attrs, children)
355 | }
356 |
357 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/pattern)
358 | pub fn pattern(attrs: List(Attribute), children: List(Component)) -> Component {
359 | let attrs = to_props(attrs)
360 | redraw.jsx("pattern", attrs, children)
361 | }
362 |
363 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/polygon)
364 | pub fn polygon(attrs: List(Attribute), children: List(Component)) -> Component {
365 | let attrs = to_props(attrs)
366 | redraw.jsx("polygon", attrs, children)
367 | }
368 |
369 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/polyline)
370 | pub fn polyline(attrs: List(Attribute), children: List(Component)) -> Component {
371 | let attrs = to_props(attrs)
372 | redraw.jsx("polyline", attrs, children)
373 | }
374 |
375 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient)
376 | pub fn radial_gradient(
377 | attrs: List(Attribute),
378 | children: List(Component),
379 | ) -> Component {
380 | let attrs = to_props(attrs)
381 | redraw.jsx("radialGradient", attrs, children)
382 | }
383 |
384 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/rect)
385 | pub fn rect(attrs: List(Attribute), children: List(Component)) -> Component {
386 | let attrs = to_props(attrs)
387 | redraw.jsx("rect", attrs, children)
388 | }
389 |
390 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/script)
391 | pub fn script(attrs: List(Attribute), children: List(Component)) -> Component {
392 | let attrs = to_props(attrs)
393 | redraw.jsx("script", attrs, children)
394 | }
395 |
396 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/set)
397 | pub fn set(attrs: List(Attribute), children: List(Component)) -> Component {
398 | let attrs = to_props(attrs)
399 | redraw.jsx("set", attrs, children)
400 | }
401 |
402 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/stop)
403 | pub fn stop(attrs: List(Attribute), children: List(Component)) -> Component {
404 | let attrs = to_props(attrs)
405 | redraw.jsx("stop", attrs, children)
406 | }
407 |
408 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/style)
409 | pub fn style(attrs: List(Attribute), children: List(Component)) -> Component {
410 | let attrs = to_props(attrs)
411 | redraw.jsx("style", attrs, children)
412 | }
413 |
414 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/svg)
415 | pub fn svg(attrs: List(Attribute), children: List(Component)) -> Component {
416 | let attrs = to_props(attrs)
417 | redraw.jsx("svg", attrs, children)
418 | }
419 |
420 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/switch)
421 | pub fn switch(attrs: List(Attribute), children: List(Component)) -> Component {
422 | let attrs = to_props(attrs)
423 | redraw.jsx("switch", attrs, children)
424 | }
425 |
426 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/symbol)
427 | pub fn symbol(attrs: List(Attribute), children: List(Component)) -> Component {
428 | let attrs = to_props(attrs)
429 | redraw.jsx("symbol", attrs, children)
430 | }
431 |
432 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/text)
433 | pub fn text(attrs: List(Attribute), children: List(Component)) -> Component {
434 | let attrs = to_props(attrs)
435 | redraw.jsx("text", attrs, children)
436 | }
437 |
438 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/textPath)
439 | pub fn text_path(attrs: List(Attribute), children: List(Component)) -> Component {
440 | let attrs = to_props(attrs)
441 | redraw.jsx("textPath", attrs, children)
442 | }
443 |
444 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/title)
445 | pub fn title(attrs: List(Attribute), children: List(Component)) -> Component {
446 | let attrs = to_props(attrs)
447 | redraw.jsx("title", attrs, children)
448 | }
449 |
450 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/tspan)
451 | pub fn tspan(attrs: List(Attribute), children: List(Component)) -> Component {
452 | let attrs = to_props(attrs)
453 | redraw.jsx("tspan", attrs, children)
454 | }
455 |
456 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/use)
457 | pub fn use_(attrs: List(Attribute), children: List(Component)) -> Component {
458 | let attrs = to_props(attrs)
459 | redraw.jsx("use", attrs, children)
460 | }
461 |
462 | /// [Documentation](https://developer.mozilla.org/docs/Web/SVG/Element/view)
463 | pub fn view(attrs: List(Attribute), children: List(Component)) -> Component {
464 | let attrs = to_props(attrs)
465 | redraw.jsx("view", attrs, children)
466 | }
467 |
468 | @external(javascript, "../../attribute.ffi.mjs", "toProps")
469 | fn to_props(attrs: List(Attribute)) -> b
470 |
--------------------------------------------------------------------------------
/redraw_dom/test/redraw_dom_test.gleam:
--------------------------------------------------------------------------------
1 | import gleeunit
2 | import gleeunit/should
3 |
4 | pub fn main() {
5 | gleeunit.main()
6 | }
7 |
8 | // gleeunit test functions end in `_test`
9 | pub fn hello_world_test() {
10 | 1
11 | |> should.equal(1)
12 | }
13 |
--------------------------------------------------------------------------------
/scripts/publish.sh:
--------------------------------------------------------------------------------
1 | cp $PWD/README.md redraw/README.md
2 | cd redraw
3 | gleam publish
4 | cd ../redraw_dom
5 | gleam publish
6 |
--------------------------------------------------------------------------------