Skip to content

UI ​

Gamma's UI system is meant to be close to what HTML, CSS and JavaScript give a web page, with a Luau API instead of markup and a DOM, and running natively inside the engine. The same system builds a game HUD, a settings screen, a node-graph tool, a text editor or a whole desktop app.

This page is the design. Each part is built in the order given in the plan; what exists today is marked in the capability table.

Principles ​

  • Few primitives, rich styling. The engine provides a small set of node types. Buttons, sliders, tabs, menus, lists and dialogs are compositions of those nodes, written in Luau and shipped as Gamma's widget library, so a program can restyle or replace any of them.
  • Web semantics where they exist. Layout, the box model, the cascade, events and animations follow CSS and DOM behaviour, with CSS's property names in Upper Camel Case (JustifyContent, BorderRadius, FlexGrow). Someone who knows the web should be able to guess a property, and its behaviour should not surprise them.
  • Reactive by default. State is part of the system, not a package. A node property can be bound to state, and the node updates when the state changes.
  • Not tied to a screen. A UI tree is drawn on a surface: a window, an overlay on a 3D scene, a panel in the 3D world, or a texture.
  • Fast enough for tools. Thousands of nodes, long virtualised lists and per-frame updates have to stay smooth. Layout, style and paint are only recomputed for what changed.

Nodes ​

Every UI node is an object in the tree, with properties, events and children like every other object, so it can be found, inspected, saved and scripted the same way.

NodeWeb equivalentPurpose
View<div>A box. Holds children, takes the whole box model and layout.
Texttext, <span>, <p>Text, including inline spans with their own style and inline child nodes.
Image<img>An image or texture, with ObjectFit and nine-slice.
TextInput<input>, <textarea>Editable single or multi-line text with selection, clipboard, undo and IME.
Terminalxterm.jsA text terminal for a program on a serial port, socket or pipe.
World2D<canvas> with a game loopA 2D world of sprites and tile maps seen through a camera. See 2D games.
ScrollViewoverflow: autoA View that scrolls its content, with momentum and scroll bars.
Canvas<canvas>Draws with a Luau callback through a 2D vector API (paths, fills, strokes, text, images).
ViewportWebGL canvasShows a 3D scene from a camera.
Surfacethe documentThe root of a UI tree, bound to a window, an overlay, a world panel or a texture.

Every node except Surface takes the full style. ScrollView is a View whose Overflow defaults to Scroll, kept as its own node so its scroll position, events and virtualisation have a clear home.

Form controls (Button, Checkbox, Radio, Switch, Slider, Select, NumberInput, ColorPicker), menus, tooltips, dialogs, tabs, tables, trees and virtualised lists are widgets in the Luau library, built on these nodes.

Surfaces ​

  • Window: a native OS window. A program can open several, each with its own title, size, DPI and surface.
  • Overlay: drawn over a 3D scene in a window, as a game HUD.
  • World: a surface placed in the 3D scene, facing a direction or the camera, receiving pointer input through raycasts.
  • Texture: rendered offscreen, for thumbnails, effects or use as a material.

Units on a surface are device-independent pixels. The surface's scale factor (from the OS DPI, or set by the program) maps them to physical pixels, so text and borders stay sharp.

Layout ​

Layout follows CSS:

  • Box model: Width, Height, MinWidth, MaxWidth, MinHeight, MaxHeight, Margin, Padding, BorderWidth, BoxSizing (BorderBox by default, unlike CSS) and AspectRatio.
  • Display: Flex (the default, as in React Native, with FlexDirection = Column), Grid, Block-like flow for text, and None.
  • Flexbox: FlexDirection, FlexWrap, JustifyContent, AlignItems, AlignSelf, AlignContent, FlexGrow, FlexShrink, FlexBasis, Gap, RowGap, ColumnGap, Order. Implemented with Yoga.
  • Grid: Display = Grid with GridTemplateColumns/Rows (lengths, fr, auto, minmax(), repeat() with a count, auto-fill or auto-fit), GridAutoColumns/Rows for implicit tracks, GridColumn/GridRow placement ("2", "-1", "span 2", "1 / 3", "2 / span 2"), RowGap/ColumnGap, and CSS's sparse row-first auto-placement. Items without a size stretch to their cell; an item with a height is placed at the top of its cell, or by AlignSelf. A grid with an auto width that is not stretched (in a flex row, aligned rather than stretched in a column, absolutely placed or itself a grid item) takes the width of its columns at their max-content sizes, as CSS shrinks it to fit. Gamma's own, as Yoga has no grid: items are measured over a few layout passes and then placed absolutely. Named areas, JustifyItems/JustifySelf, column-first flow and dense packing come later.
  • Positioning: Position = Relative | Absolute | Fixed | Sticky with Inset, Top, Right, Bottom, Left, and ZIndex with stacking contexts.
  • Overflow: Visible, Hidden (clips), Scroll and Auto, per axis.

Lengths are written as strings, as in CSS, or as plain numbers of pixels, and read back as strings: "12px", "50%", "auto", "none", "1.5em", "1rem", "10vw", "10vh", and sums such as "100% - 24px" or "calc(1em + 2px)", with spaces around the operators as calc requires. Grid tracks also take "1fr". em is the node's FontSize, which defaults to "1em" (its parent's, so it inherits) and is 16px at the surface; rem is the surface's font size, and vw and vh are hundredths of the surface's size. A sum of a percentage and other units has to be resolved against the parent's size, so a layout that uses one runs a second pass.

Layout runs once per frame, only for subtrees whose layout inputs changed. A node's computed box is readable as node.LayoutRect (position relative to the surface and size, in pixels), and node.LayoutChanged fires when it moves or resizes, as ResizeObserver does.

Styling ​

Styles can be set three ways, in increasing priority (the cascade):

  1. Style sheets: rules with selectors, attached to a surface or a subtree.
  2. Inline styles: a node's Style table, or properties set directly on it.
  3. Animations and transitions currently running on the property.

Selectors cover what most CSS uses:

  • type (View, Text), class (.primary, from a node's Classes), id (#save, from Id), *
  • descendant (A B), child (A > B), sibling (A + B, A ~ B)
  • states: :hover, :active, :dragging, :drag-over, :focus, :focus-visible, :focus-within, :disabled, :checked, :selected, :empty
  • structure: :first-child, :last-child, :nth-child(an+b), :not(...), :is(...), :where(...), :has(...)
  • attributes: [Variant=ghost], from node attributes

Specificity and source order decide between matching rules as in CSS. Text properties (FontFamily, FontSize, FontWeight, Color, LineHeight, TextAlign and others) inherit from the parent; layout and paint properties do not. Inherit, Initial and Unset work as in CSS.

Variables: a property can read a custom property set on an ancestor with "var(--accent)", which is how themes work: a theme is a set of variables on the surface, swapped at run time.

Queries: rules can be wrapped in a media query (surface width and height, scale factor, prefers-color-scheme, prefers-reduced-motion) or a container query (an ancestor's size).

Style sheets are Luau tables:

luau
local sheet = Ui.StyleSheet({
	[".button"] = {
		Padding = "8px 16px",
		BorderRadius = 6,
		Background = "var(--accent)",
		Transition = "Background 120ms EaseOut",
	},
	[".button:hover"] = { Background = "var(--accent-hover)" },
	["@media (max-width: 600px)"] = {
		[".sidebar"] = { Display = "None" },
	},
})

or text files in a CSS-like syntax (*.gss), loaded with Ui.LoadStyleSheet(path) and reloaded when the file changes.

What exists today:

  • A StyleSheet styles the UI nodes in its parent and below it, down to the next Surface. Its rules are text in Source, which a place saves: selectors, then Name: value; declarations in braces, @media blocks, @keyframes rules and /* */ comments. A value is a quoted string, a number, true or false, or else the text as written, so Padding: 8px 16px; and Background: #3b82f6; need no quotes. A mistake throws an error naming its line. Ui.StyleSheet(table) writes a table like the one above as that text, in the order of its selectors' text, as a table has no order of its own (use text or a file where the order of two rules of equal specificity matters); Ui.StyleSheet(text) takes text, and Ui.LoadStyleSheet(path) reads a .gss file. Enabled = false turns a sheet off. A sheet from Ui.LoadStyleSheet has its SourceFile set, and reads the file again within half a second of it changing, so editing a .gss file restyles a running game; a mistake in the new text keeps the old rules and logs a warning naming the line.
  • Selectors: types (any class, tested with IsA), .class (from Classes, a space separated list, with AddClass, RemoveClass, HasClass and ToggleClass), #id (from Id), *, [Attribute] and [Attribute=value], the four combinators, :hover, :active (from IsHovered and IsPressed), :dragging and :drag-over (from IsDragging and IsDragOver), :focus, :focus-visible (the same as :focus for now), :focus-within, :disabled, :checked and :selected (true boolean attributes Disabled, Checked and Selected), :empty, :first-child, :last-child, :nth-child(an+b) (with odd and even), :not(), :is() and :where() (which adds no specificity) with compound selectors, and :has() with relative selectors (.card:has(> Image), .field:has(:focus), .item:has(+ .item)), whose specificity is its most specific argument's. Specificity and order decide as in CSS, and a sheet further down the tree comes after one above it.
  • A property set on the node itself, by a script, a place or a tween, wins over every sheet from then on. Until then the node keeps its own value, which comes back when no rule sets the property any more and which a place saves in place of the styled one.
  • var(--name) and var(--name, fallback) read custom properties, set by --name: value; declarations or by attributes named --name (surface:SetAttribute("--accent", "#3b82f6")), and inherited down the tree, so a theme is a set of attributes on the surface. A property whose variable has no value and no fallback keeps the node's own value. inherit, initial and unset work as in CSS.
  • @media takes min-width, max-width, min-height, max-height (the surface's size, in pixels), orientation, prefers-color-scheme (Gamma reports light) and prefers-reduced-motion (no-preference), joined with and, with commas between alternatives.
  • Styles apply at the start of a surface's layout, so a script reading a styled property right after changing a class sees the old value until the next frame or Layout. A change to a node's classes, Id, attributes or state (hover, press, focus, dragging) restyles only that node and its descendants, with the sheets and variables above it; adding, removing or moving nodes, a changed sheet, any such change while a sheet uses :has(), + or ~, and a change of focus while one uses :focus-within, restyle the whole surface. Surface:GetRestyledNodeCount() in C++ says how many nodes the last restyle visited.

Paint ​

  • Background: colours ("#rrggbbaa", "rgb()", "hsl()", "oklch()", Color values), linear, radial and conic gradients, images with size/position/repeat, several layers.
  • Borders: width, colour and style per side, BorderRadius per corner (elliptical radii later), Outline and OutlineOffset.
  • Effects: BoxShadow (several, inset), Opacity, Filter (blur, brightness, contrast, grayscale, drop-shadow), BackdropFilter, MixBlendMode.
  • Transforms: Transform (translate, scale, rotate, skew, matrices) and TransformOrigin, applied after layout as in CSS. Hit testing follows them.
  • Clipping: by overflow, by BorderRadius, and by ClipPath later.
  • Cursor: Cursor per node.

Gamma draws the UI with its own renderer on bgfx: rounded rects, borders and shadows as signed-distance shapes in one batched pass, glyphs from a texture atlas, and offscreen passes only for filters and opacity groups. It does not go through ImGui or a browser engine.

What is drawn today:

  • Background and BorderColor take "#rgb", "#rgba", "#rrggbb", "#rrggbbaa", "rgb()"/"rgba()", "hsl()"/"hsla()" (with commas or spaces and an optional / alpha), "transparent", basic named colours, or a Color, and read back as written. Background defaults to transparent and BorderColor to black (CSS's currentColor comes with the Color property).
  • Background also takes a gradient: "linear-gradient(to right, #fff, #000)" (an angle such as 45deg, or to a side or corner, defaulting to to bottom), "radial-gradient(circle at top left, white, black)" (circle or ellipse, closest-side, closest-corner, farthest-side or farthest-corner, or radii, and at a position) and "conic-gradient(from 90deg at 50% 50%, red, yellow, red)". Colour stops take one or two positions as percentages or lengths (angles or percentages around a conic gradient), and stops without one are spaced evenly, as in CSS. A lone position between two stops is a colour hint, where their colours mix half and half ("linear-gradient(red, 20%, blue)"). Several layers go in one Background separated by commas, the first on top, with a colour under them all that may only come last: "linear-gradient(#ffffff40, #fff0), linear-gradient(to right, red, blue), white". Colours mix with premultiplied alpha, so fading to transparent does not go grey. repeating-linear-gradient(), repeating-radial-gradient() and repeating-conic-gradient() repeat the colours from the first stop to the last, so "repeating-linear-gradient(45deg, #000 0 10px, #fff 10px 20px)" draws stripes. Each gradient (each period of a repeating one) is drawn from 256 samples, and a frame shows up to 256 different ones; past that they draw as their first colour.
  • Per-side solid borders from BorderWidth (and BorderTopWidth and the other sides), and BorderRadius with one to four corners (BorderTopLeftRadius and the others). A percentage in a radius refers to the box's smaller side, and radii too big for their side shrink together, as in CSS.
  • BoxShadow takes CSS's list of shadows, such as "0 2px 6px rgba(0, 0, 0, 0.3)" or "0 1px 2px black, 0 8px 24px #0004": offset x and y, then an optional blur radius and spread, in any unit but percentages, and a colour (the text Color when left out). The first shadow is on top. A spread grows the corner radii with the box, and the blur is a Gaussian across the nearest edge, so a small box with a large blur is a little stronger than in a browser. An outer shadow is also drawn under the box, so it shows through a translucent Background. inset draws a shadow inside the padding box instead, over the background and under the content, cast by the edge of a hole that is the padding box moved by the offset and shrunk by the spread ("inset 0 2px 4px #0003"). Hit testing ignores shadows.
  • Opacity from 0 to 1 is multiplied down the tree. CSS fades a whole group at once, which matters where children overlap; that comes with the offscreen passes for filters.
  • ZIndex (a whole number, default 0) sorts nodes within their stacking context. The surface, and every node with a ZIndex other than 0 or an Opacity below 1, is a stacking context: it draws its own box, then the nodes in it by ZIndex (negative ones behind the rest) and tree order, each nested context drawn whole.
  • Transform takes a CSS transform list: translate(x, y), translateX(), translateY(), scale(x, y), scaleX(), scaleY(), rotate(angle), skew(x, y), skewX(), skewY() and matrix(a, b, c, d, e, f), with lengths in any unit (percentages of the node's own box) and angles in deg, rad, grad or turn, applied right to left, or "none". It moves the node and everything in it after layout, so other nodes keep their places, about TransformOrigin (default "50% 50%", its centre; it takes one or two lengths or left, center, right, top and bottom). A positive angle turns clockwise, as y points down. A node with a transform is a stacking context, and hit testing and clicks into a TextInput follow its transform. A clip seen through a rotation or a skew clips to its bounding box, so a turned node with Overflow = Hidden clips less than CSS does.
  • Overflow = Hidden clips descendants to the node's padding box, as a rectangle; clipping to rounded corners comes later.
  • Overflow = Scroll clips as Hidden does and scrolls the content by ScrollPosition (a Vector2, kept between 0 and the content's size less the padding box's, so a script setting it too far gets the end). ScrollSize is the content's size, padding included, as of the last layout. The mouse wheel scrolls the nearest scroll container under the pointer that can still move that way, about three lines a notch, and one at its end passes the wheel to the one around it. A thin bar over the right (and bottom) edge shows the position while the content overflows. Dragging the bar scrolls with it, and a press on the strip beside it pages toward the press, a padding box at a time, without the press doing anything else; momentum and touch scrolling come later. ScrollView is a View whose Overflow starts as Scroll. The children of a scroll container keep their size along the scroll axis rather than shrinking to fit it, as CSS's min-height: auto keeps them; give the container itself FlexBasis = 0 (CSS's flex: 1 1 0) to have it take only the space left in its parent.
  • A Surface with Target = Window is laid out to the window's size every frame of Gamma play and drawn over the 3D scene, in tree order with other window surfaces. Units are window pixels until DPI scaling arrives.

Text ​

  • Font loading from files and assets, FontFamily lists with fallback, weights, italics, variable fonts later.
  • Shaping with HarfBuzz for ligatures, kerning and complex scripts, and bidirectional (right-to-left) text. The first step uses stb_truetype for simple Latin text.
  • Wrapping (WhiteSpace, WordBreak, OverflowWrap), TextOverflow = Ellipsis, LineClamp, TextAlign, LineHeight, LetterSpacing, TextDecoration, TextTransform, TextShadow.
  • Rich text: a Text node holds spans, each with its own style and events (links), and inline child nodes (an icon in a sentence).
  • Selection and copying on any text with UserSelect = Text; full editing in TextInput, including IME composition from SDL.
  • Measurement: Ui.MeasureText(text, style, maxWidth).

What exists today:

  • A Text node with a Text string. Layout measures it, so it takes the width of its text and wraps to fit the width it is given; its own UI children are not laid out.
  • Fonts: Gamma bundles Noto Sans (regular and bold, under the SIL Open Font License, in Assets/Fonts), which is also sans-serif and the fallback of every family list, followed by Noto Sans Symbols and Noto Sans Symbols 2 (also bundled, under the same licence) for arrows, dingbats and other symbols. Noto Sans Mono (regular and bold, also bundled) is monospace, and has box drawing and block characters. Ui.LoadFont(family, path, weight?) adds a TrueType or OpenType file. FontFamily takes a CSS list such as "Brand, Noto Sans, sans-serif", and each character uses the first font in the list that has it. FontWeight takes 1 to 1000, "normal" or "bold", and picks each family's nearest weight; there is no synthetic bold or italic.
  • Color, FontFamily, FontWeight, LineHeight, TextAlign (Left, Center, Right) and WhiteSpace (Normal, NoWrap) inherit, as FontSize does. Each reads "inherit" until it is set, and setting "inherit" unsets it. LineHeight takes "normal" (the font's own spacing), a number (a multiple of the font size, which inherits as a multiple) or a length.
  • TextOverflow = Ellipsis ends a line too wide for its box with "…"; it is most useful with WhiteSpace = NoWrap. Lines break at "\n" and, when wrapping, at spaces; a word longer than its line stays whole.
  • Text is laid out with stb_truetype: advances and kerning only, so no ligatures, complex scripts or right-to-left text yet. Glyphs are rasterized at their size into a shared atlas and drawn on whole pixels. Unicode's default ignorable characters, such as variation selectors (the U+FE0F in "☀️") and zero width joiners, draw nothing rather than a missing glyph.
  • Rich text: with RichText = true, a Text node reads its Text as markup with HTML's inline tags, so runs of one paragraph can differ and still wrap together. <b> is bold, <u> underlines, <s> strikes through, and <font color="#e11d48" size="20" face="monospace" weight="600"> sets any of a colour, a size in pixels, a font family and a weight; tags nest and close in order, <br> breaks the line, and &lt;, &gt;, &amp;, &quot;, &apos; and &#...; are characters. A tag it does not know, or one that is not closed in order, is shown as written. Each line is as tall as the tallest text on it, and every glyph on it shares one baseline, as CSS's line boxes do. DisplayText reads the characters shown, and selection counts those. Ui.Text({ Spans = { "Score: ", { Text = "120", Bold = true, Color = "#16a34a" } } }) writes the markup for you from a list of strings and tables (Text, Bold, Underline, Strikethrough, Color as a string or a Color, Size, FontFamily and FontWeight), escaping the text, and follows a state holding such a list; Ui.Markup(spans) returns the same markup. There is no italic yet, since there are no italic faces, and no links or inline nodes.
  • UserSelect = Text lets the pointer select the characters of Text nodes, as CSS's user-select does. It is inherited, so setting it on a surface or a panel makes all the text in it selectable, and None on a descendant turns it off again. Dragging across a Text node selects from where the press was, Shift with a click extends the selection, a double click selects a word and a triple click a line. A surface has one selection, which a press anywhere else clears and Control+C (Command+C on macOS) copies to the system clipboard when the focused node does not take the key. It is drawn behind the glyphs in the node's SelectionColor. text:GetCharacterAt(position) says which character, counted from 1 in DisplayText, is drawn at a point in the surface, or nil between characters, so a click can find a word or a link. From a script, text:Select(anchor, cursor) (caret positions from 1, so Select(1, 6) selects the first five characters), text:ClearSelection(), text:GetSelectedText() and surface:GetSelectedText(). Selection stays within one node for now, and new text clears it.
  • A TextInput node edits text, as input and textarea do. It takes keyboard focus when clicked (a click puts the caret there, and dragging selects) and edits with the arrows, Home and End (with Shift selecting, and Control or Alt going by word), Backspace, Delete, and Control (Command on macOS) with A, C, X, V, Z and Y, through the system clipboard. Typed text comes through the OS, so keyboard layouts and input methods work: text an input method is composing shows underlined at the caret, and its candidates are placed by it. Its properties are Text, Placeholder, PlaceholderColor, SelectionColor, MaxLength (0, the default, is no limit), MultiLine, CursorPosition and SelectionStart (character positions from 1, as Luau's strings count, and SelectionStart -1 for no selection). A single line input is about 20 characters wide until sized, centres its line in a taller box, scrolls sideways to keep the caret in view, turns line breaks into spaces and fires Submitted(text) for Enter. A MultiLine one wraps at spaces (and within a word too long for a line), grows with its text and types Enter. Undo goes back through up to 100 edits, with a run of typing or deleting as one.
  • A Terminal node is a text terminal, as xterm is, for a program at the other end of a serial port, a socket or a pipe. terminal:Write(data) runs what the program sent, and Input(data) fires with what the terminal sends back: typed and pasted text, keys as xterm encodes them, and the answers to the program's queries (cursor position, device attributes, TERM). It understands what Linux programs send to an xterm-256color terminal: cursor movement, erasing, scroll regions, the alternate screen, 16, 256 and 24-bit colours, bold, faint, italic, underline, inverse and strikethrough, wide characters, line drawing, bracketed paste, application cursor keys and window titles (its Title property). It is 80 by 24 cells until sized, fills the box it is given in the monospace font unless FontFamily says otherwise, and its read-only Columns and Rows follow that box. It takes keyboard focus when clicked, and keeps Tab for the program. Dragging selects text; Control+C copies while there is a selection and interrupts otherwise (Control+Shift+C always copies), and Control+V or Control+Shift+V pastes. The mouse wheel and Shift+PageUp or Shift+PageDown scroll back through up to ScrollbackLines lines (1000 by default), and on the alternate screen the wheel sends arrow keys instead. Its other members are ScrollOffset, SelectionColor, Clear(), Paste(text), GetSelectedText(), GetLineText(row) (rows from 1) and the Bell event. There is no mouse reporting yet.

Images ​

What exists today:

  • An Image node with a Source: a file path (relative to the asset root) or an http:// or https:// URL. The image loads on a thread of its own, and nodes with the same source share it. PNG, JPEG, BMP, GIF, TGA and WebP are read. Animated GIFs and WebPs play and loop, all on one clock, with frames meant to last 10ms or less shown for 100ms as browsers do.
  • Until its own size is set, an Image takes its image's size once it has loaded (0 by 0 before, or if it fails), and a size set on one side scales the other to keep the image's shape, as an img does. It is stretched over its content box (CSS's default object-fit: fill) and is a leaf to layout, so its children are not drawn.
  • ImageRendering = Pixelated scales to the nearest pixel, for pixel art; Auto, the default, scales smoothly.
  • ObjectFit fits the image to its content box as CSS's object-fit does, always centred: Fill (the default) stretches it, Contain makes it as large as fits whole, Cover as small as covers the box, None keeps its own size, and ScaleDown is None or Contain, whichever is smaller. What falls outside the box is cut off.
  • Nine-slice: SliceCenter, a Rect in the image's pixels, marks its middle. The corners outside it keep their size (times SliceScale, default 1) and the edges and middle stretch, as Roblox's SliceCenter and CSS's border-image do, so one small image can frame a panel of any size. Corners too big for the box shrink together. An empty SliceCenter, the default, draws the image whole with ObjectFit.
  • Rounded clipping and image backgrounds come later.

Events ​

Events follow the DOM model:

  • Pointer: PointerDown, PointerUp, PointerMove, PointerEnter, PointerLeave, Click, DoubleClick, ContextMenu, Wheel, for mouse, touch and pen alike, with pointer capture.
  • Keyboard: KeyDown, KeyUp, TextInput, delivered to the focused node.
  • Focus: Focus, Blur, FocusIn, FocusOut; TabIndex and arrow-key navigation, also driven by a gamepad.
  • Drag and drop: DragStart, DragOver, Drop, DragEnd within the program, and files dropped from the OS.
  • Clipboard: Copy, Cut, Paste.
  • Lifecycle: Mounted, Unmounted, LayoutChanged.

An event is a table with Target, CurrentTarget, position, buttons and modifiers. It travels through a capture phase from the surface down to the target and a bubble phase back up. Handlers can call event:StopPropagation() and event:PreventDefault() (to stop a TextInput inserting a key, for example). Hit testing honours transforms, clipping, PointerEvents = None and ZIndex. Input a UI handles is not passed on to the program's other input handlers, so clicking a HUD button does not also fire a weapon.

Shortcuts are Shortcut instances, scoped to a surface or a focused subtree (see below).

What exists today, for the mouse in Gamma play:

  • Click fires for a primary button press and release, on the nearest node that was under both, then on each of its UI ancestors up to the surface, as a bubbling DOM event. PointerEnter and PointerLeave fire on a node when the pointer comes over it or a descendant and when it leaves them, without bubbling, outside in for entering and inside out for leaving.
  • Each of PointerDown, PointerUp, PointerMove, Wheel, Click, DoubleClick, KeyDown and KeyUp has a capture form (PointerDownCapture, ClickCapture, KeyDownCapture and so on) that fires first, from the surface down to the target, as DOM listeners added with capture: true do. The same event object then bubbles, and StopPropagation in a capture handler ends the whole dispatch, so a panel can keep presses or keys from everything inside it.
  • ContextMenu fires for a secondary (right) button press, on the node under the pointer and then up the tree, as the DOM's contextmenu, and the press reaches Input with gameProcessedEvent set when something listened.
  • DoubleClick fires after the Click of the second press in a run, bubbling the same way. Presses within half a second and 4 pixels of the one before make a run, and ClickCount on the PointerEvent of PointerDown, PointerUp, Click and DoubleClick says which press of the run it is: 1, 2 for a double click, 3 for a triple click (which can select a line), and 0 for a click the keyboard made.
  • PointerDown, PointerUp, PointerMove and Wheel fire on the node under the pointer and bubble up the same way. PreventDefault on PointerDown keeps the press from moving focus or placing a caret, and on Wheel keeps it from scrolling.
  • Handlers get a PointerEvent with Target (the node under the pointer, or for Click the nearest node under both press and release), CurrentTarget (the node whose handlers are running), Position, ClickCount, the modifier keys held at the time (Shift, Control, Alt and Meta, booleans) and, for Wheel, WheelDelta (notches, positive away from the user). One event passes up the tree, and event:StopPropagation() stops it going further.
  • node:CapturePointer(), usually called in PointerDown, sends PointerMove and PointerUp to that node wherever the pointer goes until the button is released, as for a dragged slider. ReleasePointerCapture() ends it early and HasPointerCapture() reads it.
  • IsHovered is true on the node under the pointer and its ancestors, and IsPressed on the pressed node and its ancestors until the release, as CSS's :hover and :active. Both fire their property changed signals, so a style can follow them.
  • Drag and drop within the UI: a press on a node with Draggable = true (or inside one) that moves more than 4 pixels fires DragStart on it, bubbling, where a handler can set event.Data (any value an attribute can hold, copied) or call PreventDefault to keep it a plain press. During the drag the pointer's other events stop, the dragged node has IsDragging, DragEnter and DragLeave fire on nodes as the pointer comes over and leaves them (without bubbling, like PointerEnter), and DragOver bubbles from the node under the pointer each move. A DragOver handler that calls PreventDefault accepts the drag, as on the web, and its node has IsDragOver until the pointer leaves. Releasing over an accepting node fires Drop, bubbling from the node under the pointer; then DragEnd bubbles from the dragged node with Dropped saying whether it landed. Every drag event has Data and DragSource. A drag ends the press without PointerUp or Click. Files dropped from the OS come later.
  • PointerEvents = None lets the pointer through a node and everything in it to what is behind. It is inherited, as in CSS, so a descendant can set Auto again, and a surface with None lets clicks on its empty parts through to the game.
  • Hit testing follows the paint order (so ZIndex) and Overflow = Hidden clipping, and finds a node by its layout rect whether or not it draws anything. The pointer goes to the window surfaces as they were last laid out, and enter and leave also fire when the layout moves a node under a still pointer.
  • A press over a node with a Click, DoubleClick, PointerDown or PointerUp handler, and the release that ends it, reach Input with gameProcessedEvent set, so clicking a button does not also act in the game.
  • Only the mouse's primary button clicks; the secondary button fires ContextMenu.

Focus and the keyboard, in Gamma play:

  • A node with a TabIndex of 0 or more (a TextInput starts at 0, everything else at -1) takes its surface's keyboard focus when pressed, and a press on anything else takes focus from whatever had it. node:Focus() and node:Blur() do the same from a script, IsFocused reads it, and Focused and Blurred fire. node:ScrollIntoView() scrolls each scrolling ancestor as little as it takes to show the node, and Tab does it for the node it focuses. A node that leaves its surface or is hidden loses focus.
  • Keys go to the focused node of the topmost window surface that has one. KeyDown (also for keys the OS repeats while held) and KeyUp fire on it and then bubble up, with a KeyEvent holding KeyCode, Shift, Control, Alt, Meta, Repeat, Target and CurrentTarget. StopPropagation ends the bubbling and PreventDefault stops what the key would do. After the handlers, Tab and Shift+Tab move focus (positive TabIndex values first, then 0 in tree order), the arrow keys move it to the nearest focusable node in their direction on a surface with SpatialNavigation = true (a node in the same row or column wins over a nearer diagonal one, and a widget that uses the arrows itself keeps them), Enter and Space click a focused node that is not a TextInput, and a focused TextInput edits.
  • A Shortcut fires Activated when its Keys, such as "Ctrl+S", "Ctrl+Shift+Z", "Alt+Enter" or "Escape", are pressed with exactly those modifiers. Mod means Cmd on macOS and Ctrl elsewhere, and Enabled turns it off. One parented to a surface is in scope whenever that surface gets keys, focused or not, and one parented to another node only while that node or a descendant has focus; the innermost match wins. It runs for a press that the focused node's handlers and default action did not use, never for a repeat, never while a Terminal has focus, and while a TextInput has focus only for chords with Ctrl, Alt or Meta. Ui.Shortcut({ Keys = "Ctrl+S", Activated = save }) makes one.
  • Keys and wheel turns the UI uses reach Input with gameProcessedEvent set, as clicks do, so typing in a field does not also move a character. With nothing focused, keys go to the game alone. Key repeats, typed text and input method text reach only the UI.

Reactivity ​

luau
local count = Ui.State(0)
local label = Ui.Computed(function(use)
	return `Clicked {use(count)} times`
end)

local view = Ui.View({
	Classes = { "card" },
	Children = {
		Ui.Text({ Text = label }),
		Widgets.Button({
			Text = "Add",
			Click = function()
				count:Set(count:Get() + 1)
			end,
		}),
		Ui.ForEach(items, function(item)
			return Ui.Text({ Key = item.Id, Text = item.Name })
		end),
	},
})
  • Ui.State(value) holds a value with Get, Set and Changed.
  • Ui.Computed(fn) derives a value from the states it uses, and recomputes only when they change.
  • Any node property, style value or child list accepts a state or computed, and the node follows it. Bindings are released when the node is destroyed.
  • Ui.ForEach(list, fn) renders a keyed list, reusing nodes by Key so their state, focus and animations survive reordering.
  • Ui.Animated(state, transition) follows a state smoothly, for springs and tweens driven by code.
  • Constructors take a props table: properties, Style, Classes, Children and event handlers by name. Entries without a key are children too, parented after Children, so Ui.View({ Gap = 4, title, body }) works. Building the tree by hand with Ui.new("View") and parenting still works, and is what the constructors do underneath. Ui.new(className, props) takes the same props for any class that can be created, such as Part.

What exists today:

  • Ui.State(value) has Get, Set and Changed (whose Connect returns a connection with Disconnect). Setting the value it already holds fires nothing.
  • Ui.Computed(function(use) ... end) runs at once and again whenever a state or computed it read through use changes, and follows only what the last run read. Set on it is an error, and Destroy stops it.
  • A constructor prop given a state or computed sets the property and follows it; destroying the node stops that. A property it sets counts as set on the node, so style sheets leave it alone.
  • Ui.ForEach(list, render, key) turns a list, or a state holding one, into a computed list of nodes for Children or a props table's children. key is a field name ("Id"), a function of the item, or left out to use the item itself; a key seen again reuses its node, a key that goes destroys its node, and a key twice is an error. The bound nodes come after the node's other children, in the list's order, and only those out of place are moved.
  • Ui.Spring(source, speed, damping) follows a state or computed as a spring: speed is its angular frequency in radians a second (10) and damping its damping ratio (1 settles fastest without overshooting; below 1 bounces). A new goal keeps the velocity it has, so a value can be dragged around and let go. It moves numbers, Vector2, Vector3 and Color; anything else jumps.
  • Ui.Animated(source, info) follows a state or computed over the time and easing of a TweenInfo (0.2 seconds, Quad, Out by default), from wherever it has got to when the goal changes. It blends numbers, Vector2, Vector3, Color and Transform; anything else jumps at the end.
  • Ui.StyleSheet takes states and computeds as values in its table ([".card"] = { Background = accent }), or one holding the whole text or table, and writes the sheet's Source again when one changes, so a theme can be a state. Every node it styles restyles at the next layout.
  • Binding the same node's children to two lists moves the first list's nodes after the second's when it changes.

Widgets ​

The Widgets global builds controls out of Views and Text, so a style sheet can restyle any of them. Each returns a View with a class named after the widget (Button, Checkbox, Switch, Slider, RadioGroup, Select, NumberInput, ColorPicker, Table, Tree, ProgressBar, Spinner, Accordion, Splitter, Tabs, Dialog, VirtualList, Markdown; a MenuButton is a Button with the MenuButton class too) and passes any props it does not use itself, such as Name, Classes or Width, to that View. Widgets.Theme() makes a style sheet with the default look, to put in the surface; it reads --accent, --accent-text, --text, --border, --control, --muted, --radius and --focus, so surface:SetAttribute("--accent", "#e11d48") recolours every widget.

luau
local volume = Ui.State(50)
Ui.Surface({
	Children = {
		Widgets.Theme(),
		Widgets.Button({ Text = "Save", Activated = save }),
		Widgets.Button({ Text = "Cancel", Variant = "ghost", Activated = cancel }),
		Widgets.Checkbox({ Text = "Sound", Checked = soundOn }),
		Widgets.Slider({ Value = volume, Min = 0, Max = 100, Step = 5 }),
		Widgets.RadioGroup({ Options = { "Easy", "Normal", "Hard" }, Value = difficulty }),
	},
})
  • Button: Text, Activated (on a click, Enter or Space), Variant (sets the Variant attribute; the theme draws ghost with an outline) and Disabled.
  • Checkbox and Switch: Text, Checked, Changed(value) and Disabled. A click or Space toggles them.
  • Slider: Value, Min (0), Max (100), Step (1, or 0 for any value), Changed(value) and Disabled. A press sets the value under the pointer and captures it, so dragging past the ends works; the arrow keys, Page Up, Page Down, Home and End step it. The track's parts are SliderTrack, SliderFill and SliderThumb.
  • RadioGroup: Options (strings, or { Value = ..., Text = ... }), Value, Changed(value) and Disabled. Only the checked radio, or the first, is in the tab order, and the arrow keys move the choice, as on the web.
  • A value prop given a state is kept in step both ways: the widget follows the state and sets it when the user changes it. A plain value is where the widget's own state starts. Disabled may be a state too, and sets the Disabled attribute that :disabled matches; Checked sets Checked for :checked.
  • Select: Options (as for RadioGroup), Value, Placeholder, Changed(value) and Disabled. A click, Enter or Space opens its list, which closes on a choice, Escape, Tab or a click anywhere else; the arrows move the highlight while it is open and change the value while it is closed. The root has the Open attribute while it is open, and the list's parts are List, ListRow (with Highlighted and Selected attributes) and ListSeparator.
  • NumberInput: Value, Min, Max, Step (1, which also sets how many decimals it shows), Changed(value), Placeholder and Disabled. Its parts are a TextInput (NumberInputField) and two NumberInputStep buttons. Typed text takes effect on Enter or when the field loses focus, snapped to Step from Min and kept between Min and Max; text that is not a number puts the value back. Up and Down step it.
  • MenuButton: Text, Items ({ Text = ..., Activated = ..., Disabled = ... }, or "-" for a separator), Variant and Disabled. It opens the same list, and choosing an item runs its Activated.
  • Tabs: Tabs ({ Key = ..., Text = ..., Content = node }), Value (the chosen key, the first by default) and Changed(key). Only the chosen tab's content is in the TabPanel; the rest are kept out of the tree. The arrow keys, Home and End move between tabs.
  • Dialog: Open, Title, Closed(), Dismissable (true) and children. It returns a DialogBackdrop that covers its parent, so put it in the surface; the Dialog box inside takes focus when it opens. Escape or a click on the backdrop closes it unless Dismissable is false. While it is open, Tab and Shift+Tab go round the focusable nodes inside it, and when it closes, focus goes back to the node that had it before. Surface.FocusedNode reads which node has a surface's focus.
  • Tooltip: Widgets.Tooltip(anchor, text, delay) shows text under anchor after delay seconds (0.4) while the pointer rests on it or it has focus, in the anchor's surface, and returns the Tooltip node.
  • VirtualList: Items (a list or a state), Render(item, index), ItemHeight and Overscan (3 rows). It scrolls, and makes nodes only for the rows in view, placing each absolutely at its row; give it a height. ItemHeight is a number of pixels for every row (32), a function (item, index) -> number for rows whose heights you know, or "auto" for rows that size themselves, such as wrapped text: those start at EstimatedItemHeight (32) and the rows below move once each has laid out, so the scroll bar settles as you scroll.
  • Markdown: Text (Markdown, or a state holding it) becomes nodes: headings (MarkdownHeading and MarkdownH1 to MarkdownH6), paragraphs (MarkdownParagraph), bulleted and numbered lists nested by indentation (MarkdownList, MarkdownListItem, MarkdownBullet, MarkdownListText), block quotes (MarkdownQuote), fenced code blocks (MarkdownCode, MarkdownCodeText), tables with column alignment (MarkdownTable, MarkdownTableRow, MarkdownTableHeader, MarkdownTableCell), rules (MarkdownRule) and images on a line of their own (MarkdownImage). Inline, **bold**, `code`, ~~struck~~, links and <https://...> become rich text, and *emphasis* is coloured, since there are no italic faces yet. A click on a link calls LinkActivated(url); open it with Process or handle it in the game. A line ending in two spaces or a backslash breaks there. Raw HTML is shown as written.
  • ProgressBar: Value out of Max (100), shown by the width of its ProgressFill. With Value nil it has the Indeterminate attribute, and the theme slides its fill back and forth with @keyframes.
  • Spinner: three SpinnerDots that the theme pulses one after another, for work of unknown length.
  • Accordion: Sections ({ Key = ..., Title = ..., Content = node }), Value (the open key, or with Multiple = true a list of open keys) and Changed(value). Each AccordionSection has an AccordionHeader that opens or closes it on a click, Enter or Space (closing the open one unless Multiple), and an AccordionPanel shown while it is open; the section has the Open attribute. Up, Down, Home and End move between headers.
  • Splitter: First and Second nodes in two SplitterPanes, side by side or, with Direction = "Column", one above the other, and a SplitterHandle between them. Value is the first pane's share of the space (0.5), kept so neither pane is smaller than Min pixels (40), and Changed(value) follows it as the handle is dragged or, with the handle focused, moved 5% by the arrows.
  • Toast: Widgets.Toast(surface, text, options) shows a Toast in a ToastStack at the bottom right of the surface, above the rest, for options.Duration seconds (4; 0 keeps it). Variant ("info", "success" or "error") sets its attribute for the theme, and Action = { Text = ..., Activated = ... } adds a ToastAction button that runs and dismisses it. A click anywhere else on it dismisses it too. It returns the toast and a function that dismisses it; dismissing sets Leaving, which the theme fades out, and removes it a quarter of a second later.
  • ContextMenu: Widgets.ContextMenu(target, items) opens a menu of items (as MenuButton takes them) at the pointer when target is right-clicked, in its surface above the rest, with the keys of Select's list. A choice, Escape, Tab or a click anywhere else closes it. It returns the ContextMenu anchor, a View of no size at the pointer that the list hangs from.
  • ColorPicker: Value (a Color, white by default), Changed(color) and Disabled. A ColorPickerArea square picks saturation across and brightness up, a ColorPickerHue strip picks the hue, and a ColorPickerHex TextInput beside a ColorPickerSwatch takes a code such as #3b82f6 or 3b8 on Enter or blur (anything else puts the code back). Hue and saturation are kept apart from the colour, so dragging to black or grey and back does not lose them. The square and the strip take focus, and the arrows move them by 1% or 1 degree, ten times as far with Shift. With Alpha (a number from 0 to 1, or a state), a ColorPickerAlpha strip under the hue picks the opacity, with AlphaChanged(alpha), since a Color has no alpha of its own; the field then shows and takes eight digit codes such as #3b82f680.
  • Table: Columns ({ Key = ..., Header = ..., Width = ..., Sortable = ..., Resizable = ..., MinWidth = ..., Render = function(row), SortValue = function(row) }), Rows (a list of tables, or a state), Value (the selected row) with Changed(row), Activated(row), and SortKey, SortDescending and Sorted(key, descending). A column without Width shares the space left; a cell shows Render(row), a node or text, or else tostring(row[Key]). A click on a sortable header sorts by it, and a second click reverses the order; the header cell has the Sorted attribute ("ascending" or "descending"). The TableBody scrolls when the table has a height, takes focus, and moves the selection with the arrows, Page Up, Page Down, Home and End, scrolling it into view; Enter or a double click on a row calls Activated. Dragging the right edge of a Resizable column's header (its TableResizer) sets the column's width, down to MinWidth (30), and calls ColumnResized(key, width). With RowHeight, every row is that many pixels tall and only the rows in view, and three either side, have nodes, placed in a content node as tall as all of them, so a table of thousands of rows stays quick. Its parts are TableHeader, TableHeaderCell, TableSortMark, TableResizer, TableRow (with Selected) and TableCell.
  • Tree: Items ({ Key = ..., Text = ..., Children = { ... } }, or a state), Expanded (keys of branches open at first), Value (the selected key) with Changed(key), Toggled(key, open) and Activated(key). Only the selected row, or the first, is in the tab order. Up and Down move between the rows shown, Right opens a branch and then goes into it, Left closes it and then goes to its parent, Home and End go to the ends, Enter opens or closes a branch, and a click on the caret or a double click on the row does too. Enter or a double click on a leaf calls Activated(key). The selection follows focus; closing a branch around it selects the branch. An item with HasChildren = true and no Children is a branch whose children LoadChildren(key) returns the first time it opens. It runs in a task of its own, so it can wait on a request, and meanwhile the row has Loading and the group shows a TreeLoading row. The children are kept when Items changes, a load that errors says so and tries again when the branch next opens, and a branch that loads no children becomes a leaf. With Multiple = true, Value is a list of keys and Changed gets the list: a click selects one row, Control (or Meta) with a click adds or removes one, Shift with a click or an arrow selects every row shown from the last one chosen, Control with an arrow moves focus without changing the selection, Space adds or removes the focused row, and Control+A selects every row shown. Its parts are TreeItem, TreeRow (with Selected and, on a branch, Expanded), TreeCaret, TreeLabel, TreeGroup, indented by the theme, and TreeLoading.

Animation ​

  • Transitions (done): Transition = "Opacity 200ms EaseOut, Background 0.3s 0.1s linear" animates a property when its value changes for any reason: a state, a style rule starting or stopping to match, a script setting it. Each entry is a property name (or all, or a shorthand such as Padding for its sides), a duration, an optional delay and an optional easing: linear, ease, ease-in, ease-out, ease-in-out (also written EaseInOut), cubic-bezier(), steps(), or spring(stiffness, damping) (spring alone is spring(170, 26)), which moves as a spring of unit mass from rest, may overshoot, and lasts until it settles when the entry gives no duration, as in "Transform spring(300, 20)". Animations take a spring easing the same way. A change partway through starts from the value shown. Transitions advance when the surface lays out, so they run while the surface is drawn every frame.
    • Numbers, colours (mixed with premultiplied alpha), lengths, box shorthands and transform lists made of the same functions blend. Anything else, such as an enum, auto or two different transform lists, switches at once.
    • The property reads back the value shown, as getComputedStyle does. node:IsTransitioning("Opacity") tells whether one is running, and TransitionEnded fires with the property's name when it arrives. A saved place and a clone keep the value it was going to.
    • A node outside a surface changes at once, as does a transition removed from Transition while it runs.
  • Keyframes (done): @keyframes Pulse { from { Opacity: 1 } 50% { Opacity: 0.4 } to { Opacity: 1 } } in a style sheet (or ["@keyframes Pulse"] = { from = {...}, ["50%"] = {...} } in a table), run with Animation = "Pulse 1s ease-in-out infinite alternate". An entry takes CSS's animation shorthand in any order: the name, a duration, a delay, an easing (applied between each pair of steps), an iteration count or infinite, a direction (normal, reverse, alternate, alternate-reverse) and a fill mode (none, forwards, backwards, both), with commas between animations.
    • A step that leaves out a property, including a missing from or to, uses the node's own value there. Values blend as transitions' do, and a number against a length is that many pixels; anything else switches halfway between its steps. var() is not read inside keyframes yet.
    • An animation starts at the first layout after it is named, or after its node joins a surface, and keeps playing while a restyle names it again. While it plays, its values win over the node's own and its styles'; the property reads back the animated value, and a place saves the node's own. AnimationEnded fires with its name after its last iteration.
    • The rules come from every enabled style sheet in the surface, a later sheet's winning for the same name.
  • Code: the tween service and Ui.Animated for anything else. Tweens:Create blends a UI node's colour, length and transform strings as transitions do, and switches any other string at the end.
  • Every property with a numeric, length, colour or transform value can be animated. prefers-reduced-motion is visible to style sheets.

Accessibility ​

Each surface keeps an accessibility tree from node roles (Role = "Button"), labels and states, exposed to the OS screen reader through SDL or the platform API. Widgets in the library set roles themselves. Focus is always visible with :focus-visible, and everything reachable by pointer is reachable by keyboard.

Compared with the web platform ​

Status: done, next (in the current phase of the plan), planned (a later phase), later (no step yet), out (not planned).

Web featureGammaStatus
Box model, box-sizing, min/max sizesyesdone
FlexboxYogadone
%, px, auto lengthsstrings and numbersdone
em, rem, vw, vh, calc sumsyesdone
frgrid tracksdone
GridGamma's owndone (named areas later)
Absolute and fixed positioningyesdone (absolute), planned (fixed)
Sticky positioningyeslater
z-index, stacking contextsyesdone
Overflow, clipping, scrollingOverflow, ScrollViewdone (rectangular clipping, wheel scrolling, draggable scroll bars, ScrollIntoView), planned (momentum, touch)
Backgrounds, gradients, imagesyesdone (solid colours, Image nodes from files and URLs, ObjectFit, nine-slice), planned
Border radius, borders, outlinesyesdone (radius and solid borders), planned (outlines, styles)
Box and text shadowsyesplanned
Opacity, filters, backdrop filters, blend modesyesdone (opacity, multiplied), later
Transforms (2D)yesdone
Transforms (3D), perspectiveworld surfaces insteadout
Cascade, specificity, inheritanceyesplanned
Selectors and pseudo-classesmostdone, with :has, :is and :where
Custom properties (var())yesplanned
Media and container queriesyesplanned (media), later (container)
Transitionsyesdone
Keyframe animationsyesdone
Web fonts, fallback, weightsfont files and assetsdone (files, fallback by character, nearest weight)
Complex shaping, bidiHarfBuzzlater
Inline formatting, spans, inline nodesText spanspartly (styled runs through RichText and Spans; no links or inline nodes yet)
Text selection and copyingUserSelectdone (within one Text node; Control+C copies)
Form controlswidget librarydone (button, checkbox, switch, slider, radio group, select, number input, colour picker, menu button)
Text editing, IMETextInputdone
DOM events, capture and bubble, preventDefaultyesdone (pointer, wheel and key events with capture and bubble phases, PreventDefault, pointer capture, PointerEvents, IsHovered/IsPressed, DoubleClick)
Focus, tab orderyesdone (focus, TabIndex, Tab order, :focus, :focus-visible and :focus-within, arrow keys in widgets, spatial navigation with SpatialNavigation, ScrollIntoView), planned (gamepad, which needs gamepad input first)
Drag and drop, file dropyesdone (within the UI: Draggable, DragStart to DragEnd, :drag-over), later (files from the OS)
ClipboardSDLdone (text in TextInput), planned (events)
ResizeObserver, MutationObserverLayoutChanged, tree eventsdone (LayoutRect), planned
<canvas> 2DCanvaslater
WebGLViewport with the 3D rendererlater
<video>, <audio>media nodeslater
Accessibility treeyeslater
Reactive statebuilt inplanned
HTML markup, innerHTML, the browser DOM APILuau constructors insteadout
Running JavaScript or arbitrary web pagesnot a browserout

Apache License 2.0