# CLI, terminal, markup & browser DOM

CLI routers (/cli), TTY & ANSI control (/tty, /ansi), color math (/color), SHTML/CSS compilers (/repr/html, /repr/css), and JS Web APIs.

## Module /cli

Declarative command-line argument and subcommand router DSL (action, query, cmd, scope, mount) with automatic help output.

```tangu
(use /cli)
```

#### action

`(action ...args)`

Declares a mutating CLI action route with handler and options.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `args` | `Any` | yes | — |

#### cmd

`(cmd ...args)`

Declares a general CLI subcommand route.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `args` | `Any` | yes | — |

#### echo-help

`(echo-help router-arg target-path)`

Prints help information for available CLI commands.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `router-arg` | `Any` | no | — |
| `target-path` | `Any` | no | — |

#### format-help

`(format-help router-arg target-path)`

Formats help information for available CLI commands as a string.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `router-arg` | `Any` | no | — |
| `target-path` | `Any` | no | — |

#### mount

`(mount ...args)`

Mounts a child CLI router at the given command segment.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `args` | `Any` | yes | — |

#### query

`(query ...args)`

Declares a read-only CLI query route with handler and options.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `args` | `Any` | yes | — |

#### router

`(router ...route-defs)`

Constructs a CLI Router with grouped queries and actions.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `route-defs` | `Any` | yes | — |

#### run

`(run cli-router args)`

Resolves and executes CLI router.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `cli-router` | `Any` | no | — |
| `args` | `Any` | no | — |

#### scope

`(scope ...args)`

Groups nested CLI routes under a common prefix or shared options.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `args` | `Any` | yes | — |

## Module /tty

Terminal capability detection, dimensions, raw mode controls, and interactive prompt helpers.

```tangu
(use /tty)
```

#### ask

`(tty/ask) -> String | ()`

Writes an optional prompt to active `*out*`, flushes, and reads a single line from active `*in*`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `prompt` | `Any` | no | Optional prompt displayed before reading a line |

```tangu
(let name (tty/ask "Name: "))
```

#### color-enabled?

`(tty/color-enabled?) -> Bool`

Returns `true` if ANSI color output should be enabled for the target stream, honoring `NO_COLOR`, `FORCE_COLOR`, `TERM=dumb`, and TTY status.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `stream` | `Any | Symbol` | no | Optional stream value or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |

```tangu
(tty/color-enabled?)
(tty/color-enabled? :err-port)
```

#### is-tty?

`(tty/is-tty?) -> Bool`

Returns `true` if the target stream (defaults to active `*out*`) is attached to an interactive OS terminal (TTY).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `stream` | `Any | Symbol` | no | Optional stream value (such as `out-port`, `*out*`, or `Buffer`) or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |

```tangu
(tty/is-tty?)
(tty/is-tty? :err-port)
```

#### size

`(tty/size) -> Map | ()`

Returns `{:cols Int :rows Int}` when attached to a terminal, or `()` when not attached to a TTY.

```tangu
(let dims (tty/size))
```

## Module /ansi

ANSI terminal escape sequences for foreground/background styling, 256-color/RGB output, and text weights.

```tangu
(use /ansi)
```

#### blue

`(blue s)`

Wraps `s` in ANSI foreground blue (`\x1b[34m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### bold

`(bold s)`

Wraps `s` in ANSI bold formatting (`\x1b[1m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### colored

`(colored styles text)`

Conditionally wraps `text` in ANSI `styles` when `(tty/color-enabled?)` is `true`, or returns plain `text` when `false`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `styles` | `Any` | no | — |
| `text` | `Any` | no | — |

#### cyan

`(cyan s)`

Wraps `s` in ANSI foreground cyan (`\x1b[36m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### dim

`(dim s)`

Wraps `s` in ANSI dim/faint formatting (`\x1b[2m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### gray

`(gray s)`

Wraps `s` in ANSI foreground bright black / gray (`\x1b[90m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### green

`(green s)`

Wraps `s` in ANSI foreground green (`\x1b[32m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### italic

`(italic s)`

Wraps `s` in ANSI italic formatting (`\x1b[3m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### magenta

`(magenta s)`

Wraps `s` in ANSI foreground magenta (`\x1b[35m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### red

`(red s)`

Wraps `s` in ANSI foreground red (`\x1b[31m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### reset

`(reset)`

Returns the ANSI SGR reset sequence (`\x1b[0m`).

#### style

`(style styles text)`

Purely wraps `text` in a single combined ANSI SGR sequence for `styles` (a style symbol like `:red` or an Array like `[:bold :red]`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `styles` | `Any` | no | — |
| `text` | `Any` | no | — |

#### underline

`(underline s)`

Wraps `s` in ANSI underline formatting (`\x1b[4m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### white

`(white s)`

Wraps `s` in ANSI foreground white (`\x1b[37m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

#### yellow

`(yellow s)`

Wraps `s` in ANSI foreground yellow (`\x1b[33m...\x1b[0m`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `s` | `Any` | no | — |

## Module /color

Color space conversions (hex, RGB, HSL, OKLCH), WCAG contrast ratios, and tonal palette operations.

```tangu
(use /color)
```

### Structs

#### HSL

`Struct` in `/color`

Cylindrical HSL color space:
- h: hue angle in degrees (0.0..360.0)
- s: saturation (0.0..1.0)
- l: lightness (0.0..1.0)
- a: alpha (0.0..1.0, default 1.0)

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `h` | `Float` | `—` | — |
| `s` | `Float` | `—` | — |
| `l` | `Float` | `—` | — |
| `a` | `Float` | `—` | — |

#### Oklch

`Struct` in `/color`

Perceptual Oklch color space:
- l: perceived lightness (0.0..1.0)
- c: chroma (0.0..~0.4)
- h: hue angle in degrees (0.0..360.0)
- a: alpha (0.0..1.0, default 1.0)

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `l` | `Float` | `—` | — |
| `c` | `Float` | `—` | — |
| `h` | `Float` | `—` | — |
| `a` | `Float` | `—` | — |

#### RGB

`Struct` in `/color`

3-channel linear or sRGB color (0.0..1.0).
Derives `Eq` and `Vec` for full Euclidean vector arithmetic (`+`, `-`, `*`, `/`, `cmul`, `lerp`, `dot`).

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `r` | `Float` | `—` | — |
| `g` | `Float` | `—` | — |
| `b` | `Float` | `—` | — |

#### RGBA

`Struct` in `/color`

4-channel sRGB color with alpha (0.0..1.0, default alpha 1.0).

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `r` | `Float` | `—` | — |
| `g` | `Float` | `—` | — |
| `b` | `Float` | `—` | — |
| `a` | `Float` | `—` | — |

#### contrast-ratio

`(contrast-ratio fg bg) -> Float`

Computes the WCAG 2.1 contrast ratio (`1.0` to `21.0`) between two colors.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `fg` | `Any` | no | Foreground color |
| `bg` | `Any` | no | Background color |

```tangu
(color/contrast-ratio "#000000" "#ffffff") ; -> 21.0
```

#### darken

`(darken color amount) -> Oklch`

Decreases perceptual Oklch lightness `l` by `amount`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `amount` | `Float` | no | Lightness delta in Oklch (0.0..1.0) |

```tangu
(color/darken "#3b82f6" 0.12)
```

#### desaturate

`(desaturate color amount) -> Oklch`

Decreases Oklch chroma `c` toward neutral gray.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `amount` | `Float` | no | Chroma decrease |

```tangu
(color/desaturate "#3b82f6" 0.05)
```

#### invert

`(invert color) -> RGBA`

Inverts the RGB channels (`1.0 - c`) while keeping alpha unchanged.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/invert "#000000")
```

#### lighten

`(lighten color amount) -> Oklch`

Increases perceptual Oklch lightness `l` by `amount`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `amount` | `Float` | no | Lightness delta in Oklch (0.0..1.0) |

```tangu
(color/lighten "#3b82f6" 0.12)
```

#### linear-to-srgb

`(linear-to-srgb c) -> Float | RGB`

Encodes linear-light channel(s) into sRGB gamma.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `value` | `Float | RGB | RGBA` | no | Linear-light channel or color |

```tangu
(color/linear-to-srgb 0.214)
```

#### luminance

`(luminance color) -> Float`

Computes WCAG relative luminance (`0.0` black to `1.0` white).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/luminance "#ffffff") ; -> 1.0
```

#### mix

`(mix c1 c2 [t]) -> Oklch`

Perceptually interpolates between `c1` and `c2` in Oklch space.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `c1` | `Any` | no | First color |
| `c2` | `Any` | no | Second color |
| `t` | `Float` | yes | Interpolation factor 0.0..1.0 (default 0.5) |

```tangu
(color/mix "#3b82f6" "#ec4899" 0.5)
```

#### parse

`(parse input) -> RGBA`

Parses any CSS color string, integer, or color struct into normalized `RGBA` (`0.0..1.0`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `input` | `String | Int | RGB | RGBA | Oklch | HSL` | no | CSS hex/rgb()/oklch() string, packed int, or color struct |

```tangu
(color/parse "#3b82f6")
```

#### rotate-hue

`(rotate-hue color degrees) -> Oklch`

Shifts the Oklch hue angle by `degrees` (modulo 360).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `degrees` | `Float` | no | Hue rotation in degrees |

```tangu
(color/rotate-hue "#3b82f6" 180.0)
```

#### saturate

`(saturate color amount) -> Oklch`

Increases Oklch chroma `c` for a more vivid color.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `amount` | `Float` | no | Chroma increase |

```tangu
(color/saturate "#3b82f6" 0.05)
```

#### srgb-to-linear

`(srgb-to-linear c) -> Float | RGB`

Decodes gamma-encoded sRGB channel(s) into linear light.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `value` | `Float | RGB | RGBA` | no | sRGB channel or color |

```tangu
(color/srgb-to-linear 0.5)
```

#### to-css

`(to-css color [format]) -> String`

Serializes a color into a standard CSS color function or hex string.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Color value |
| `format` | `KeySymbol` | yes | Optional output syntax (:rgb, :hsl, :oklch, :hex) |

```tangu
(color/to-css (color/Oklch 0.7 0.15 240.0) :oklch)
```

#### to-hex

`(to-hex color [include-alpha]) -> String`

Formats a color as a CSS hex string (`#rrggbb` or `#rrggbbaa`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Color value |
| `include_alpha` | `Bool` | yes | Include alpha channel as #RRGGBBAA |

```tangu
(color/to-hex (color/RGB 1.0 0.0 0.0)) ; -> "#ff0000"
```

#### to-hsl

`(to-hsl color) -> HSL`

Converts any color value into cylindrical `HSL` (`h`, `s`, `l`, `a`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-hsl "#10b981")
```

#### to-int

`(to-int color) -> Int`

Packs an RGB(A) color into a 32-bit `0xRRGGBBAA` or `0xAARRGGBB` integer.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-int "#ffffff")
```

#### to-oklch

`(to-oklch color) -> Oklch`

Converts any color value into perceptual Oklch (`l`, `c`, `h`, `a`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-oklch (color/RGB 0.2 0.4 0.9))
```

#### to-rgb

`(to-rgb color) -> RGB`

Converts any color value to 3-channel `RGB`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-rgb "#ff0000")
```

#### to-rgba

`(to-rgba color) -> RGBA`

Converts any color value to 4-channel `RGBA`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-rgba "#ff000080")
```

#### to-u8

`(to-u8 color) -> Array`

Converts `RGBA` floating channels (`0.0..1.0`) into `[r g b a]` bytes (`0..255`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `RGB | RGBA | Oklch | HSL | String | Int` | no | Input color struct, CSS color string, or 0xRRGGBB integer |

```tangu
(color/to-u8 (color/RGBA 1.0 0.5 0.0 1.0))
```

#### with-alpha

`(with-alpha color alpha) -> RGBA`

Returns a copy of `color` with its alpha channel set to `alpha`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `color` | `Any` | no | Base color |
| `alpha` | `Float` | no | Alpha channel 0.0..1.0 |

```tangu
(color/with-alpha "#000000" 0.4)
```

## Module /repr/html

SHTML (#shtml / #html) node renderer, attribute/class utilities, and template formatter (format-html).

```tangu
(use /repr/html)
```

#### add-classes

`(add-classes attrs ...classes) -> None`

Mutates `attrs:class` in place by appending `classes` without overwriting existing classes.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `attrs` | `Map` | no | Mutable attributes Map |
| `classes` | `Any` | no | One or more class names/arrays/maps |

```tangu
(repr-html/add-classes attrs "card" "elevated")
```

#### escape-html

`(escape-html text) -> String`

Escapes HTML special characters (`&`, `<`, `>`, `"`, `'`) for safe text/attribute interpolation.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `text` | `Any` | no | Raw text or value to escape |

```tangu
(repr-html/escape-html "<script>") ; -> "&lt;script&gt;"
```

#### format-class

`(format-class value) -> Array`

Normalizes class strings, nested arrays, or conditional maps into a flat deduplicated Array of class tokens.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `value` | `Any` | no | Class name String, Array, or Map of {:cls bool} |

```tangu
(repr-html/format-class ["btn" {"is-active" true}])
```

#### format-html

`(format-html html-expr) -> String`

Renders an `#shtml` / `#html` expression tree into valid HTML5 (normalizing boolean attributes per §2.4.2).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `html_expr` | `Any` | no | Evaluated SHTML node or list of nodes |

```tangu
(repr-html/format-html #shtml [:p {:class "lead"} "Hello"])
```

#### format-html-template

`(format-html-template chunks slots [flags]) -> String`

Runtime helper compiling interpolated HTML template literals safely.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `chunks` | `Array` | no | Static HTML template chunks |
| `slots` | `Array` | no | Interpolated slot values |
| `flags` | `String` | yes | Optional compiler escape mode flags |

```tangu
(repr-html/format-html-template ["<p>" "</p>"] ["Hi"])
```

#### merge-attrs

`(merge-attrs ...maps) -> Map`

Merges attribute Maps left-to-right while cleanly concatenating `:class` lists instead of replacing them.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `maps` | `Map` | no | Attribute maps to merge left-to-right |

```tangu
(repr-html/merge-attrs {:class "btn"} extra-attrs)
```

#### parse-component-params

`(parse-component-params params-arr) -> Map`

Normalizes `#shtml` custom component parameters into `{:attrs Map :children Array}`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `params` | `Array` | no | Variadic SHTML component body `[attrs? ...children]` |

```tangu
(let {:attrs attrs :children children} (repr-html/parse-component-params params))
```

#### shtml->html

`(shtml->html html-expr) -> String`

Canonical alias of `format-html`: serializes `#shtml` nodes to an HTML string.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `html_expr` | `Any` | no | Evaluated SHTML node tree |

```tangu
(repr-html/shtml->html [:div "Hello"])
```

## Module /repr/css

CSS AST compiler and nested stylesheet formatter (format-css, scss->css) powering #css blocks.

```tangu
(use /repr/css)
```

#### format-css

`(format-css css-expr) -> String`

Compiles an `#css` S-expression stylesheet (including nested `&` selectors, `@media`/`@layer`, custom properties) into standard CSS.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `css_expr` | `Any` | no | Evaluated `#css` AST rule tree or Array of rules |

```tangu
(repr-css/format-css #css [[:.card {:padding "1rem" :&hover {:opacity 0.9}}]])
```

#### scss->css

`(scss->css css-expr) -> String`

Alias of `format-css`: lowers nested `#css` S-expression rules to flat browser-ready CSS.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `css_expr` | `Any` | no | Evaluated `#css` stylesheet expression |

```tangu
(repr-css/scss->css my-styles)
```

## Module /repr/js/dom

Typed Browser DOM and Document/Element interop bindings when compiling Tangu to JavaScript.

```tangu
(use /repr/js/dom)
```

#### Animation-Event

`Animation-Event`

Tangu kebab-case alias for `AnimationEvent`.

#### AnimationEvent

`AnimationEvent`

DOM CSS keyframe animation lifecycle event interface.

#### CSS-Style-Declaration

`CSS-Style-Declaration`

Tangu kebab-case alias for `CSSStyleDeclaration`.

#### CSSStyleDeclaration

`CSSStyleDeclaration`

Inline/computed CSS style property map (`element.style`).

#### Canvas-Rendering-Context-2D

`Canvas-Rendering-Context-2D`

Tangu kebab-case alias for `CanvasRenderingContext2D`.

#### CanvasRenderingContext2D

`CanvasRenderingContext2D`

2D Canvas immediate-mode drawing context.

#### Clipboard-Event

`Clipboard-Event`

Tangu kebab-case alias for `ClipboardEvent`.

#### ClipboardEvent

`ClipboardEvent`

DOM copy/cut/paste clipboard event interface.

#### Custom-Event

`Custom-Event`

Tangu kebab-case alias for `CustomEvent`.

#### CustomEvent

`CustomEvent`

DOM `CustomEvent` constructor carrying arbitrary `:detail` payloads.

#### DOM-Rect

`DOM-Rect`

Tangu kebab-case alias for `DOMRect`.

#### DOM-Token-List

`DOM-Token-List`

Tangu kebab-case alias for `DOMTokenList`.

#### DOMRect

`DOMRect`

Bounding box dimensions and viewport offsets returned by `getBoundingClientRect()`.

#### DOMTokenList

`DOMTokenList`

DOM `classList` / `relList` token collection (`add`, `remove`, `toggle`).

#### Document

`Document`

DOM `Document` interface constructor/type for JS targets.

#### Document-Fragment

`Document-Fragment`

Tangu kebab-case alias for DOM `DocumentFragment`.

#### DocumentFragment

`DocumentFragment`

Lightweight offscreen DOM `DocumentFragment` container.

#### Drag-Event

`Drag-Event`

Tangu kebab-case alias for `DragEvent`.

#### DragEvent

`DragEvent`

DOM HTML5 drag-and-drop event interface.

#### Element

`Element`

DOM `Element` interface for attributes, classes, selectors, and layout.

#### Event

`Event`

DOM `Event` base constructor/interface.

#### Focus-Event

`Focus-Event`

Tangu kebab-case alias for `FocusEvent`.

#### FocusEvent

`FocusEvent`

DOM focus/blur transition event interface.

#### HTML-Anchor-Element

`HTML-Anchor-Element`

Tangu kebab-case alias for `HTMLAnchorElement`.

#### HTML-Audio-Element

`HTML-Audio-Element`

Tangu kebab-case alias for `HTMLAudioElement`.

#### HTML-Button-Element

`HTML-Button-Element`

Tangu kebab-case alias for `HTMLButtonElement`.

#### HTML-Canvas-Element

`HTML-Canvas-Element`

Tangu kebab-case alias for `HTMLCanvasElement`.

#### HTML-Dialog-Element

`HTML-Dialog-Element`

Tangu kebab-case alias for `HTMLDialogElement`.

#### HTML-Element

`HTML-Element`

Tangu kebab-case alias for `HTMLElement`.

#### HTML-Form-Element

`HTML-Form-Element`

Tangu kebab-case alias for `HTMLFormElement`.

#### HTML-Image-Element

`HTML-Image-Element`

Tangu kebab-case alias for `HTMLImageElement`.

#### HTML-Input-Element

`HTML-Input-Element`

Tangu kebab-case alias for `HTMLInputElement`.

#### HTML-Select-Element

`HTML-Select-Element`

Tangu kebab-case alias for `HTMLSelectElement`.

#### HTML-Template-Element

`HTML-Template-Element`

Tangu kebab-case alias for `HTMLTemplateElement`.

#### HTML-Text-Area-Element

`HTML-Text-Area-Element`

Tangu kebab-case alias for `HTMLTextAreaElement`.

#### HTML-Video-Element

`HTML-Video-Element`

Tangu kebab-case alias for `HTMLVideoElement`.

#### HTMLAnchorElement

`HTMLAnchorElement`

DOM `<a>` hyperlink element interface.

#### HTMLAudioElement

`HTMLAudioElement`

DOM `<audio>` media element interface.

#### HTMLButtonElement

`HTMLButtonElement`

DOM `<button>` element interface.

#### HTMLCanvasElement

`HTMLCanvasElement`

DOM `<canvas>` element interface (`getContext`, `toBlob`).

#### HTMLDialogElement

`HTMLDialogElement`

DOM `<dialog>` element interface (`showModal`, `close`).

#### HTMLElement

`HTMLElement`

DOM `HTMLElement` base interface for all HTML elements.

#### HTMLFormElement

`HTMLFormElement`

DOM `<form>` element interface (`submit`, `requestSubmit`, `reportValidity`).

#### HTMLImageElement

`HTMLImageElement`

DOM `<img>` image element interface.

#### HTMLInputElement

`HTMLInputElement`

DOM `<input>` element interface (`.value`, `.checked`, `.files`).

#### HTMLSelectElement

`HTMLSelectElement`

DOM `<select>` element interface.

#### HTMLTemplateElement

`HTMLTemplateElement`

DOM `<template>` HTML template element interface.

#### HTMLTextAreaElement

`HTMLTextAreaElement`

DOM `<textarea>` element interface.

#### HTMLVideoElement

`HTMLVideoElement`

DOM `<video>` media element interface.

#### History

`History`

Browser session `History` state stack interface.

#### Input-Event

`Input-Event`

Tangu kebab-case alias for `InputEvent`.

#### InputEvent

`InputEvent`

DOM live text editing input event interface.

#### Intersection-Observer

`Intersection-Observer`

Tangu kebab-case alias for `IntersectionObserver`.

#### IntersectionObserver

`IntersectionObserver`

Browser `IntersectionObserver` tracking element viewport/scroll intersections.

#### Keyboard-Event

`Keyboard-Event`

Tangu kebab-case alias for `KeyboardEvent`.

#### KeyboardEvent

`KeyboardEvent`

DOM keyboard keydown/keyup event interface.

#### Location

`Location`

Browser `Location` URL and navigation interface.

#### Media-Query-List

`Media-Query-List`

Tangu kebab-case alias for `MediaQueryList`.

#### MediaQueryList

`MediaQueryList`

Evaluated CSS media query state with change listener support.

#### Mouse-Event

`Mouse-Event`

Tangu kebab-case alias for `MouseEvent`.

#### MouseEvent

`MouseEvent`

DOM pointer/mouse click and movement event interface.

#### Mutation-Observer

`Mutation-Observer`

Tangu kebab-case alias for `MutationObserver`.

#### MutationObserver

`MutationObserver`

Browser `MutationObserver` watching DOM subtree and attribute changes.

#### Navigator

`Navigator`

Browser `Navigator` user-agent and capability interface.

#### Node

`Node`

Base DOM `Node` interface inherited by elements, text nodes, and documents.

#### Node-List

`Node-List`

Tangu kebab-case alias for `NodeList`.

#### NodeList

`NodeList`

DOM `NodeList` collection returned by `querySelectorAll`.

#### Pointer-Event

`Pointer-Event`

Tangu kebab-case alias for `PointerEvent`.

#### PointerEvent

`PointerEvent`

Unified pointer/mouse/pen/touch event interface.

#### Resize-Observer

`Resize-Observer`

Tangu kebab-case alias for `ResizeObserver`.

#### ResizeObserver

`ResizeObserver`

Browser `ResizeObserver` reacting to element border/content-box size changes.

#### SVG-Element

`SVG-Element`

Tangu kebab-case alias for `SVGElement`.

#### SVGElement

`SVGElement`

DOM base interface for `<svg>` and SVG graphics elements.

#### Shadow-Root

`Shadow-Root`

Tangu kebab-case alias for DOM `ShadowRoot`.

#### ShadowRoot

`ShadowRoot`

DOM `ShadowRoot` interface representing encapsulated component subtrees.

#### Storage

`Storage`

Web Storage interface backing `localStorage` and `sessionStorage`.

#### Submit-Event

`Submit-Event`

Tangu kebab-case alias for `SubmitEvent`.

#### SubmitEvent

`SubmitEvent`

DOM form submission event interface exposing `.submitter`.

#### Touch-Event

`Touch-Event`

Tangu kebab-case alias for `TouchEvent`.

#### TouchEvent

`TouchEvent`

DOM mobile multi-touch gesture event interface.

#### Transition-Event

`Transition-Event`

Tangu kebab-case alias for `TransitionEvent`.

#### TransitionEvent

`TransitionEvent`

DOM CSS transition completion event interface.

#### Wheel-Event

`Wheel-Event`

Tangu kebab-case alias for `WheelEvent`.

#### WheelEvent

`WheelEvent`

DOM mouse wheel and trackpad scroll event interface.

#### Window

`Window`

DOM `Window` interface constructor/type for JS targets.

#### cancelAnimationFrame

`cancelAnimationFrame`

Cancels a previously scheduled `requestAnimationFrame` callback.

#### customElements

`customElements`

Browser `CustomElementRegistry` for defining Custom Elements.

#### document

`document`

Ambient DOM `Document` global object for querying and mutating the page tree.

#### getComputedStyle

`getComputedStyle`

Returns resolved `CSSStyleDeclaration` values for a DOM `Element`.

#### history

`history`

Browser `History` API (`pushState`, `replaceState`, `back`, `forward`).

#### localStorage

`localStorage`

Persistent per-origin key-value Web `Storage` global.

#### location

`location`

Browser `Location` object representing and navigating the current document URL.

#### matchMedia

`matchMedia`

Creates a `MediaQueryList` evaluating a CSS media query against the viewport.

#### navigator

`navigator`

Browser `Navigator` object exposing user agent, clipboard, serviceWorker, and platform APIs.

#### requestAnimationFrame

`requestAnimationFrame`

Schedules a callback before the next browser repaint cycle.

#### sessionStorage

`sessionStorage`

Per-tab session-scoped key-value Web `Storage` global.

#### window

`window`

Ambient browser `window` global object for JavaScript compilation targets.

## Module /repr/js/web

Typed Web Platform API bindings (fetch, Storage, History, Workers, URL, WebSocket) for the JavaScript target.

```tangu
(use /repr/js/web)
```

#### Abort-Controller

`Abort-Controller`

Tangu kebab-case alias for `AbortController`.

#### Abort-Signal

`Abort-Signal`

Tangu kebab-case alias for `AbortSignal`.

#### AbortController

`AbortController`

Controller issuing cancellation signals (`signal`, `abort()`).

#### AbortSignal

`AbortSignal`

Read-only cancellation token checked by Fetch and event listeners.

#### Blob

`Blob`

Immutable raw binary file-like object.

#### Broadcast-Channel

`Broadcast-Channel`

Tangu kebab-case alias for `BroadcastChannel`.

#### BroadcastChannel

`BroadcastChannel`

Cross-tab same-origin messaging channel.

#### Console

`Console`

Web Console interface type.

#### Crypto

`Crypto`

Web Crypto interface type.

#### Date

`Date`

JavaScript `Date` instant constructor.

#### Event-Source

`Event-Source`

Tangu kebab-case alias for `EventSource`.

#### EventSource

`EventSource`

Browser Server-Sent Events (SSE) client constructor.

#### File

`File`

File metadata + binary `Blob` from file inputs or drag-and-drop.

#### File-Reader

`File-Reader`

Tangu kebab-case alias for `FileReader`.

#### FileReader

`FileReader`

Asynchronous browser reader for `Blob` / `File` objects.

#### Form-Data

`Form-Data`

Tangu kebab-case alias for `FormData`.

#### FormData

`FormData`

Multipart/URL-encoded form body container (`new FormData()`).

#### Headers

`Headers`

Fetch `Headers` case-insensitive header map.

#### Intl

`Intl`

ECMAScript Internationalization namespace (`DateTimeFormat`, `NumberFormat`, `Collator`).

#### Message-Channel

`Message-Channel`

Tangu kebab-case alias for `MessageChannel`.

#### Message-Port

`Message-Port`

Tangu kebab-case alias for `MessagePort`.

#### MessageChannel

`MessageChannel`

Paired `MessagePort` communication channel constructor.

#### MessagePort

`MessagePort`

Channel endpoint for posting structured messages across workers/frames.

#### Performance

`Performance`

Web Performance interface type.

#### Promise

`Promise`

ECMAScript asynchronous `Promise` constructor (`all`, `race`, `resolve`, `reject`).

#### Readable-Stream

`Readable-Stream`

Tangu kebab-case alias for `ReadableStream`.

#### ReadableStream

`ReadableStream`

WHATWG Streams API readable byte/value stream.

#### Request

`Request`

Fetch `Request` immutable HTTP request object.

#### Response

`Response`

Fetch `Response` HTTP response wrapper.

#### Subtle-Crypto

`Subtle-Crypto`

Tangu kebab-case alias for `SubtleCrypto`.

#### SubtleCrypto

`SubtleCrypto`

Web Cryptography `crypto.subtle` low-level cipher/hash interface.

#### Text-Decoder

`Text-Decoder`

Tangu kebab-case alias for `TextDecoder`.

#### Text-Encoder

`Text-Encoder`

Tangu kebab-case alias for `TextEncoder`.

#### TextDecoder

`TextDecoder`

Byte buffer -> UTF-8 string decoder.

#### TextEncoder

`TextEncoder`

UTF-8 string -> `Uint8Array` Web Streams/Encoding API.

#### Transform-Stream

`Transform-Stream`

Tangu kebab-case alias for `TransformStream`.

#### TransformStream

`TransformStream`

WHATWG Streams API pipeable transform pair.

#### URL

`URL`

WHATWG `URL` parser and builder.

#### URL-Search-Params

`URL-Search-Params`

Tangu kebab-case alias for `URLSearchParams`.

#### URLSearchParams

`URLSearchParams`

WHATWG query-string parser and serializer.

#### Web-Socket

`Web-Socket`

Tangu kebab-case alias for `WebSocket`.

#### WebSocket

`WebSocket`

Standard browser WebSocket client constructor.

#### Worker

`Worker`

Web Worker background thread constructor.

#### Writable-Stream

`Writable-Stream`

Tangu kebab-case alias for `WritableStream`.

#### WritableStream

`WritableStream`

WHATWG Streams API writable sink stream.

#### atob

`atob`

Decodes a Base64 ASCII string to a binary string.

#### btoa

`btoa`

Encodes a binary string into Base64 ASCII.

#### clearInterval

`clearInterval`

Cancels an interval handle returned by `setInterval`.

#### clearTimeout

`clearTimeout`

Cancels a timer handle returned by `setTimeout`.

#### console

`console`

Web Console diagnostic logging global (`log`, `warn`, `error`, `time`).

#### crypto

`crypto`

Web Crypto global providing `getRandomValues`, `randomUUID`, and `subtle`.

#### fetch

`fetch`

Standard Web Fetch API returning a `Promise<Response>`.

#### globalThis

`globalThis`

Standard ECMAScript `globalThis` root namespace.

#### performance

`performance`

Web High-Resolution Time API (`performance.now()`).

#### queueMicrotask

`queueMicrotask`

Enqueues a microtask callback ahead of the next render/event turn.

#### setInterval

`setInterval`

Schedules a recurring interval callback.

#### setTimeout

`setTimeout`

Schedules a one-shot timer callback after a millisecond delay.

#### structuredClone

`structuredClone`

Deeply clones transferable/structured JS objects natively.
