ui_controls

library ui_controls

Modules

choices

Choices (decisions/F11.md, F11b): Select, ChoiceList and Radios, and F11c's Tabs, each one element drawing its items, which reach screen readers as its parts. What they do with their labels is written once over Labels, whatever their values' type; only finding the chosen value and giving one back is generic.

menus

Menus (decisions/F11.md, F11a): a list of actions in a layer, opened below a button, beside an item as its submenu, or where the pointer was as a context menu. Each item is an element of its own, a MenuRow, which the keyboard's focus and the pointer highlight alike; the list moves the focus among them.

progress

Spinners and progress bars (decisions/F11.md, F11e, and F12.md, F12c): signs of work under way, painted again each frame while they move (Widget::settling).

toasts

Toasts (decisions/F11.md, F11a): short news in one layer in the window's bottom end corner, newest at the bottom, three at most with the rest waiting, each going after its duration, its time paused while the pointer is over it or the focus is in it. An error stays until closed, and so does a toast with an action while a screen reader reads; each is spoken as it shows (announce) rather than read from the tree, which still holds its buttons, Tab reaching them after the content.

tooltips

Tooltips (decisions/F11.md, F11a): a Tooltip wraps the element it describes, and shows its text in a layer above it (below when there is no room) once the pointer rests on it for half a second, or at once when the keyboard's focus comes to it. It stays while the pointer is over the element or the tooltip, and Escape or a press hides it (WCAG 1.4.13); it takes no input and no focus. To a screen reader its text is the element's description.

ui_controls

The controls of pkg::alloy::ui (REFOCUS.md, R6e, question 9A): widgets on the core's layers, what an app's menus, choices and notices and a game's pause screens want, with nothing of the app services.

Dependencies

pkg::alloy::com

COM on Windows, the package pkg::alloy::com (PLAN.md, F6b; a package of its own since F10, which window and text share): interface ids, calls through another object's table of functions, and the strings, arrays and variants UI Automation, the file dialogs, drops and DirectWrite pass, with UTF-16 text both ways. The tables' slots each user reads are checked against MinGW's headers by tests/windows/com_layout.sh.

pkg::alloy::dbus

A D-Bus client (PLAN.md, F6c): a connection to a bus over a Unix socket, authenticated as the process's user (SASL EXTERNAL), which sends method calls, replies, errors and signals and receives them, for the accessibility bus and the desktop portal and any program using the session or system bus. Calls can wait for their reply; everything else arrives through receive, which never blocks, the connection's socket polled beside a program's own (fd).

pkg::alloy::dbus::wire

D-Bus's wire format, little-endian: values written and read by their signatures, each aligned to its size from the message's start, and the messages around them (a header of fixed fields and a field array, then the body).

pkg::alloy::draw

A retained 2D renderer over pkg::alloy::gpu (PLAN.md, stage F3): a canvas holds a tree of nodes, each with a transform, a clip for its children and a paint, the primitives it draws in its own coordinates. A frame redraws only what changed since the last one, into a texture the canvas keeps, then copies that to the frame. Coordinates are physical pixels, y down; colors are sRGB with straight alpha, blended as browsers blend them.

pkg::alloy::draw::atlas

Pictures packed into pages the canvas keeps, in shelves: rows of pictures as tall as their first, the next starting below the tallest. Each picture sits in a border of one pixel, its edge repeated for an image so linear filtering does not bleed in its neighbours, clear for a mask. A picture released leaves its area to the next that fits in it, and a page holding none is empty again.

pkg::alloy::draw::damage

The device rectangles a frame redraws: those changed since the last one, kept few as they come, then snapped to whole pixels and merged into at most a few that do not overlap, since a pixel drawn twice would blend twice.

pkg::alloy::draw::encoding

Nodes and their primitives encoded as the shader's instances: each 48 floats in draw.wgsl's Instance layout, in device space. A node keeps only its bounds, which a change damages; a frame encodes the nodes meeting its damaged rectangles as it gathers them.

pkg::alloy::draw::frame

A frame: nodes changed since the last encoded again, their old and new bounds damaged, then the instances touching each damaged rectangle gathered in painter's order, in runs of one texture, and drawn under its scissor into the kept texture, which is copied to the frame or, for a canvas over another's drawing, blended over it.

pkg::alloy::draw::glyphs

Text's glyphs: each rasterized once per face, glyph, size and quarter pixel of x position (pkg::alloy::text, F4 question 2), kept in pages of their own: outlines' coverage in one-channel pages, color glyphs' premultiplied RGBA (F10's emoji) in four-channel ones, drawn at whole pixels in their own colors. A page is cut into 16 plots, each packed in shelves, stamped with the frame it last gave a glyph and listing the keys of the glyphs it holds (F14c). A glyph goes into the most recently used plot of its format with room, else an empty one, else a new page while the format's budget allows, else the least recently used plot the frame being drawn has not used, cleared. A frame needing more than the budget gets pages past it, which are emptied first and released once empty. What drew from a cleared plot stays in the kept texture, and the frames to come pack its glyphs anew as they draw them.

pkg::alloy::gpu

The GPU, the same way on every platform (PLAN.md, stage F2): an API in WebGPU's shape over Vulkan, Metal on macOS (F7b), WebGPU in the browser, and a CPU rasterizer that runs the same shaders, for tests and where no GPU is.

pkg::alloy::gpu::commands

Commands recorded for the device to run when submitted: every backend runs the same list, the CPU device directly, Vulkan from a command buffer it records, WebGPU through the browser's encoder.

pkg::alloy::gpu::cpu::device

The CPU device: buffers and textures in memory, shaders run by the SPIR-V interpreter, triangles rasterized by raster.alloy. It follows WebGPU's rules (pixel centers at halves, the top-left fill rule, depth from 0 to 1, y up in clip space), so its images are the reference the GPU backends are compared with.

pkg::alloy::gpu::cpu::interpreter

Runs the SPIR-V the shader compiler writes, one invocation at a time, for the CPU device. The module is decoded once: every instruction into an Op, every result id given fixed cells (32-bit words) in a register file, every variable fixed cells in memory, composites flattened, since shaders do not recurse. A pointer is three cells: its space (memory, a buffer, a texture or sampler handle), the buffer or handle's index, and the offset, in cells in memory and in bytes in buffers, where values are laid out by their decorations. The ops are then compiled into steps naming registers, types' sizes and branches' targets found, which a run goes through reading nothing else.

pkg::alloy::gpu::cpu::raster

Triangles into pixels for the CPU device, by WebGPU's rules: clipped against the near plane, mapped to the target with y down, covered where a pixel's center is inside by the top-left rule (edges in fixed point, 8 bits under the pixel), outputs interpolated with perspective (integers flat, from the first vertex), the fragment stage run per pixel and its color blended into the target.

pkg::alloy::gpu::cpu::resources

What the CPU device holds: buffers as bytes, textures as RGBA8 pixels (red in the low byte), samplers as their settings. Shaders reach them through the bindings a draw or dispatch sets.

pkg::alloy::gpu::metal::metal

The Metal device (PLAN.md, F7b), on macOS: Metal's objects through Objective-C messages (pkg::alloy::objc). Shaders are the MSL #shader wrote (shader/msl.alloy), compiled when made; each stage binds its resources at the Metal indices metal_index gives, and its vertex buffers after them. Buffers and textures live in the GPU's private memory: writes wait until the next submission copies them in from a shared staging buffer with a blit, and reads copy out into a shared buffer the device waits on. Metal tracks what each command buffer uses, so objects are released at once. A window's surface is a CAMetalLayer as its view's layer, each frame one of its drawables. Clip space keeps y up, as WebGPU's.

pkg::alloy::gpu::shader::blob

A compiled shader as the program carries it: bytes #shader makes while compiling, read back when the program creates the shader. Words of 4 bytes, little-endian:

pkg::alloy::gpu::shader::compiler

The shader compiler: checks a WGSL module's syntax tree and writes it as a SPIR-V 1.3 module for Vulkan 1.1, which the CPU rasterizer runs too. Every entry point (@vertex, @fragment, @compute) becomes a SPIR-V entry function that reads the stage's inputs from Input variables, calls the WGSL function, and writes its result to Output variables. Locals declared with var are Function variables, let values are SSA ids. The first error stops it.

pkg::alloy::gpu::shader::msl

Metal's shading language from the shader compiler's SPIR-V (PLAN.md, F7b): the module the compiler wrote from the checked WGSL, its types, layouts and control flow already settled, read back and written as MSL source, which the Metal device compiles while the program runs. Only what the compiler emits is read: structured selections and loops, no phi.

pkg::alloy::gpu::shader::spirv

SPIR-V's numbers, the ones the shader compiler emits and the CPU device's interpreter and the MSL writer read, and the instruction words: an instruction is its word count in the top half of its first word, its opcode in the bottom half, then its operands.

pkg::alloy::gpu::shader::syntax

WGSL's syntax, as far as the package's shaders use it: tokens, and a tree of nodes kept in arrays and named by index, which the checker walks. Parsing stops at the first error, reported with its line and column.

pkg::alloy::gpu::shader::types

The shader compiler's types: interned, each with its SPIR-V id once declared, and laid out in memory by WGSL's rules for the buffers that hold them.

pkg::alloy::gpu::slots

The indices a device's objects take in its tables: a released one first, so a table stays as long as the most objects alive at once.

pkg::alloy::gpu::vulkan::vk

The part of Vulkan the GPU package uses, written by hand from the Khronos headers (vulkan_core.h, Apache-2.0 or MIT): the structures it fills, in C's layout, the numbers it passes, and the functions, loaded through vkGetInstanceProcAddr and vkGetDeviceProcAddr. Dispatchable handles (instance, physical device, device, queue, command buffer) are pointers; the others are 64-bit numbers.

pkg::alloy::gpu::vulkan::vulkan

The Vulkan device: Vulkan 1.1 with dynamic rendering and synchronization2, core in 1.3. Buffers and textures live in the GPU's memory; writes wait in a staging buffer until the next submission copies them in, and reads copy out through a buffer the host reads after waiting. Textures rest between commands in the layout their usage asks for, and every pass, copy and dispatch ends with a full barrier: simple rules, enough until measurements ask for more. Clip space keeps y up, as WebGPU's, through a viewport of negative height.

pkg::alloy::gpu::webgpu::webgpu

The WebGPU device, in a browser: the JavaScript beside this file (webgpu.web.js) opens the browser's device before the program starts and keeps the objects, the program holding their indices. Shaders are the WGSL #shader checked, which the browser compiles. Reads back (read_texture, read_buffer) are not there: WebGPU only completes them later, in the browser's event loop.

pkg::alloy::objc

Objective-C from Alloy (PLAN.md, F7), the package pkg::alloy::objc: the runtime's C functions, loaded while running, for AppKit and Metal on Apple systems. Every message is objc_msgSend read as the method's exact C prototype (F0 question 4), so arguments pass as the method declares them:

pkg::alloy::text

Text in pure Alloy (PLAN.md, stages F4 and F10): TrueType faces, text split into runs by script and emoji presentation, shaping by the faces' OpenType features, line breaking by UAX #14 with carets on grapheme clusters by UAX #29, and glyphs rasterized into coverage masks. It knows nothing of the GPU: pkg::alloy::draw draws a layout. Text is shaped as HarfBuzz shapes it. The bundled font is Inter Regular, made bold by thickening it. Two packages install more on the fonts (REFOCUS.md, R6d): pkg::alloy::text_scripts the complex scripts' shapers and both directions mixed by UAX #9, pkg::alloy::text_fonts CFF, variable and color faces (COLR, CBDT, sbix, as premultiplied RGBA) and fallback to the system's fonts. Without them every run is shaped by the default shaper, left to right, and characters Inter lacks show as boxes, the same on every target.

pkg::alloy::text::font::face

A font face read from TrueType data: where its tables are, its metrics, characters to glyphs, advances and outlines. Its bytes are kept as given, read in place.

pkg::alloy::text::font::outline

Glyph outlines: from glyf, contours of on- and off-curve points (quadratic curves), composite glyphs assembled from their components; from CFF and CFF2 (text_fonts' cff.alloy), lines and cubic curves.

pkg::alloy::text::font::raster

Outlines into coverage masks (PLAN.md, F4 question 2): every line's signed area accumulated per pixel, then summed along each row, as font-rs does; curves are flattened into lines first. Grayscale, unhinted.

pkg::alloy::text::font::reader

Big-endian numbers read out of font data, 0 past its end, so a truncated or malformed font reads as zeros rather than faulting.

pkg::alloy::text::paragraphs

Laying text out: paragraphs between mandatory breaks, each given its direction and levels by UAX #9 (text_scripts' bidi, else left to right) and shaped in runs of one style and level, then filled into lines in the text's order at UAX #14's opportunities (spaces at a line's end hang past it; a word wider than a line breaks between clusters, and with text_scripts words of Thai, Lao, Khmer and Myanmar between any two graphemes), each line's glyphs put in visual order by their levels (L1, L2), lines stacked by their faces' metrics and aligned on their paragraph's side.

pkg::alloy::text::shaping::apply

Applying GSUB's and GPOS's lookups to a buffer, as HarfBuzz's apply context does (hb-ot-layout-gsubgpos.hh): each lookup over the glyphs its feature's mask selects, skipping those its flags ignore and the default ignorables; sequences matched by glyph, class or coverage, ligatures formed with the marks between their components kept apart, and the lookups a contextual rule names applied at positions within its match. The buffer is one array: the glyphs before at are those already done, HarfBuzz's output buffer, the rest its input.

pkg::alloy::text::shaping::buffer

The glyphs being shaped, as HarfBuzz's buffer keeps them: each with its cluster, the features it takes (a mask), what Unicode says of its character, what GDEF and substitutions say of its glyph, the ligature it belongs to, its syllable and what its script's shaper found; and their positions, with what each is attached to. Glyphs stay in the text's order, right to left too.

pkg::alloy::text::shaping::context

Contextual lookups, GSUB's 5 and 6 and GPOS's 7 and 8: a sequence of glyphs matched by glyph, class or coverage, with what comes before and after it, then other lookups applied at positions within it.

pkg::alloy::text::shaping::fallback

Marks placed without GPOS, around their base's ink box by their combining class, as HarfBuzz places them (hb-ot-shape-fallback.cc).

pkg::alloy::text::shaping::gpos

Glyph positioning (GPOS): single and pair adjustments, cursive attachment, marks attached to bases, ligatures and other marks, contextual and chained contextual lookups, through extensions, applied as HarfBuzz applies them. Attached glyphs keep what they attach to, resolved into offsets once every lookup ran (resolve_attachments).

pkg::alloy::text::shaping::gsub

Glyph substitution (GSUB): single, multiple, alternate, ligature, contextual, chained contextual and reverse chained lookups, through extensions, applied as HarfBuzz applies them.

pkg::alloy::text::shaping::normalize

Normalizing a run's characters as HarfBuzz does for the face (hb-ot-shape-normalize.cc): each character decomposed where the face lacks it and has its parts (or always, for some shapers), marks put in canonical order, then each mark composed with its base where the face has the result; every character given the glyph the face maps it to.

pkg::alloy::text::shaping::opentype

What GSUB and GPOS share: the script, language and feature lists that pick lookups, coverage and class tables, lookup flags and GDEF's glyph classes.

pkg::alloy::text::shaping::plan

What shaping a run applies, compiled once for a face, script, language, direction and set of features (HarfBuzz's shape plan and feature map, hb-ot-map.cc and hb-ot-shape.cc): the script's shaper, the language system its features are read from, each feature's mask, and the lookups of GSUB and GPOS in stages, each stage ending in what the shaper does between them.

pkg::alloy::text::shaping::shaper

Shaping a run of text in one face, in one direction, as HarfBuzz's OpenType shaper does (hb-ot-shape.cc): characters given their Unicode props and grapheme clusters, prepared by their script's shaper, mirrored right to left, normalized and mapped to glyphs, then substituted and positioned by the plan's lookups in stages, default ignorables hidden at the end.

pkg::alloy::text::shaping::shapers

The script shapers HarfBuzz chooses between (hb-ot-shaper.hh): what each asks of normalization and positioning; the complex ones (pkg::alloy::text_scripts) add steps of shaping through a ComplexShaper their plan keeps, the default shaper's done here.

pkg::alloy::text::shaping::tags

OpenType's script tags for a run, as HarfBuzz gives them (hb-ot-tag.cc): a script's new tags (dev3, dev2) before its old one (deva). The language systems a BCP 47 tag names are text_scripts'.

pkg::alloy::text::unicode::graphemes

Extended grapheme clusters, by UAX #29's rules (Unicode 16.0): what a caret steps over and a selection takes whole.

pkg::alloy::text::unicode::lines

Line break opportunities, by UAX #14's rules (Unicode 16.0) with LB1's default resolution of classes.

pkg::alloy::text::unicode::properties

A code point's Unicode properties, from the generated tables, and UTF-8 decoding.

pkg::alloy::text::unicode::runs

Text split into runs a face shapes whole (decisions/F10.md, question 1): by script, each character's Script and Script_Extensions (UAX #24) resolved as HarfBuzz and ICU resolve them, Common and Inherited characters joining the run around them and a closing bracket the run of its opening one; and by emoji presentation (UTS #51), a grapheme cluster at a time, so a run never splits one.

pkg::alloy::text::unicode::tables

Generated by unicode/generate.alloy from the Unicode Character Database 16.0.0: do not edit. A code point's value is VALUES[BLOCKS[MIDDLE[TOP[c >> 9] * 32 + (c >> 4 & 31)] * 16 + (c & 15)]].

pkg::alloy::text::unicode::words

Word boundaries, by UAX #29's rules (Unicode 16.0): where a screen reader's and the caret's words start and end. Thai, Lao, Khmer and Myanmar have no dictionary here, so a run of them is one word.

pkg::alloy::ui

A retained, fine-grained reactive UI over pkg::alloy::draw (PLAN.md, stage F5): values the UI shows live in signals, elements are made once from option structs, and a binding remakes an element's options when a signal it read changes, so only that element is laid out or painted again.

pkg::alloy::ui::events

Input: the topmost interactive element under the pointer is hovered, a press captures the pointer to it until the release and focuses it when it takes the focus, and keys and text go to the focused element; input bubbles up the ancestors until one handles it. Tab and Shift+Tab move the focus in tree order.

pkg::alloy::ui::extensions

The Ui calling its extensions (REFOCUS.md, question 8A): each point of its work goes through the extensions in the order they were installed, by index, so one installed meanwhile is called too.

pkg::alloy::ui::fields

Text fields: a caret moving by graphemes, lines and the ends of lines with the arrows, Home and End, Left and Right as the text is shown where its direction changes, and by words (UAX #29) with Ctrl, Option on macOS; a selection by Shift or the pointer, a double click taking a word; typing, Enter, Backspace and Delete (by the text's order, a word with Ctrl or Option); Ctrl+C, Ctrl+X and Ctrl+V through the clipboard; an input method's compositions shown underlined at the caret. One line scrolls to keep the caret in view, on the right when it reads right to left; several wrap, each paragraph on its own side. A secret field shows a dot for each grapheme, its caret and selection moving among the dots, the offsets in the text taken to and from theirs (shown_at, text_at).

pkg::alloy::ui::hud

What Hud runs (F15.md): a Ui made, given events and drawn as an app's is, with the engine's window and device lent to each call.

pkg::alloy::ui::languages

Languages and directions (decisions/F14.md, F14a): the app's language chosen from the system's preferred ones as iOS chooses, the direction it is written in, and each element's direction, its own (directed), else its parent's, else the Ui's, resolved as layout goes down.

pkg::alloy::ui::layers

Layers (decisions/F11.md, F11a): element trees of their own over the window's content, in the order they open: dialogs, popups, menus, tooltips and toasts. A layer is a host element covering the window, drawing the scrim of a modal one, holding a panel placed by the layer's Place around the element its view made. The topmost takes the pointer first and a modal one keeps the pointer and the keyboard from what is below it. What a layer's view made belongs to an owner of the layer's, under the owner of the element whose handler opened it, and goes when the layer closes.

pkg::alloy::ui::layout

Layout: constraints down, sizes up. An element keeps the limits it was last laid out within and its size, and is laid out again only when marked or given other limits; rows, columns and stacks.

pkg::alloy::ui::motion

Motion (decisions/F11.md, F11e): easing curves, numbers moving to their targets (Animated), the hover and press amounts elements paint with, and frames. While something moves the app draws one frame after another, each first marking what moves (the bindings reading a moving number, the elements easing or settling, rooms revealing), then running the bindings, laying out and painting, then moving the canvas nodes of what comes and goes (transitions.alloy); when nothing moves no frame is asked for.

pkg::alloy::ui::painting

Painting: each element a canvas node under its parent's, moved by its position and painted again only when marked. Its edges are snapped to device pixels as browsers snap boxes: each rounded where it lies on the window, its size following, so nothing starts between two pixel rows while layout, hit tests and the accessibility tree keep fractions.

pkg::alloy::ui::running

The app: a window, a device and its surface, a canvas, and the loop turning the window's events into the Ui's input and its changes into frames; worker tasks running the Ui's background work, and a task for what a package serves beside them (pkg::alloy::ui_app's requests), which wake the loop when done.

pkg::alloy::ui::scrolling

Scrolling: a scroll moving its one child under a clip, and the virtualized list, which makes only the rows in view and around them, keeping its place on a row as it scrolls.

pkg::alloy::ui::store

Signals, the bindings reading them and the owners everything made belongs to.

pkg::alloy::ui::timers

Timers: functions run as handlers once a clock reaches their time, kept in a heap by time for each clock, the window's and the wall's; the app asks the window to wake it at the earliest (wake_at), at most 5 seconds ahead while one waits for the wall clock. A timer belongs to the owner making it and goes with it. The clocks ui.clock gives are signals of the wall clock, set at each event and ticking through a wall timer only while a binding shown reads them. The wall clock's heap and the clocks are an extension installed by the first at or clock, so a program using neither carries none of their code.

pkg::alloy::ui::transitions

What comes, goes and moves (decisions/F11.md, F11e): visuals, canvas nodes moved and faded each frame from one pose to another with no layout or painting, but for a room revealing. An element given a transition is held by a Moving element, whose canvas node the visual moves; when its owner goes, everything of it is freed as before but that canvas node, kept until the transition has played backwards, and with reveal a room of its size, shrinking, in its place. Layers, toasts, screens and switched views move the same way, by the theme's durations. Under reduced motion only fades are kept, at the short duration, unless a motion is essential.

pkg::alloy::ui::tree

The element tree: each element's widget, its children, its layout and its canvas node.

pkg::alloy::ui::views

Views kept hidden while another shows (decisions/F11.md, F11c, switch, and pkg::alloy::ui_app's screens): a hidden view's element is skipped by layout, painting, hit tests, the focus and the accessibility tree, its canvas node hidden with what it draws, and its owner's bindings wait for it to show. A view shown may take the focus once it is laid out.

pkg::alloy::ui::widgets

The base widgets: text, buttons, checkboxes, sliders and images, each describing itself to screen readers.

pkg::alloy::window

Windows, their events and input on every platform (PLAN.md, stage F1): Wayland on Linux, Win32 on Windows, AppKit on macOS (F7), a canvas in the browser, and a headless window for tests. A program gives run its state and a handler, which the platform's event loop calls with each event until the program closes the window.

pkg::alloy::window::appkit

The window on macOS, through AppKit (PLAN.md, F7): the frameworks open while running and every call is an Objective-C message (objc.alloy). AppKit's own loop runs ([NSApp run], F7 question 2A) and calls the program back through classes made here: AlloyView, the window's content, takes the mouse, the keyboard, input methods (as an NSTextInputClient), the Edit menu's commands, drops and the cursor, and answers VoiceOver (nsaccessibility.alloy); AlloyWindowDelegate the window's closing, resizing, scale and focus; AlloyApplicationDelegate the application's quitting. Each method is a block reaching this module's state through a cell in C's heap, so the classes, made once a process, serve every window run after. Redraws are paced by a CVDisplayLink, whose thread signals a run loop source on the main thread, as a Waker does; frames from the CPU go into the view's layer as a CGImage. The clipboard is the general NSPasteboard and file dialogs are NSOpenPanel and NSSavePanel, run modal. macOS 11 or later.

pkg::alloy::window::atspi

AT-SPI for the Wayland window (PLAN.md, F6c): when the session's accessibility is on (org.a11y.Status), the window joins the accessibility bus, embeds its application object in the registry's desktop and answers screen readers such as Orca from the tree the program sends: org.a11y.atspi.Accessible, Component, Action, Value, Text and EditableText, Table and TableCell, and the properties, on an object a node under /org/a11y/atspi/accessible/. Changes to the tree go out as the Event.Object signals Orca follows; what a screen reader asks comes back to the program as Event::Action.

pkg::alloy::window::browser

The window in a browser: a canvas, and the page's events, through the JavaScript beside this file (browser.web.js), which calls the program back for each one. run returns at once, leaving the program running in the browser's event loop. A canvas with the id alloy is used when the page has one, sized by its style; otherwise one is added to the page at the configured size. Closing the window stops its events. Input methods compose in a hidden textarea kept at the caret, which has the keyboard while the program asks for text input. Programs using tasks run in a worker, which has no page: their windows do not open yet.

pkg::alloy::window::cocoa

Foundation's values as AppKit passes them, for the macOS window (appkit.alloy) and its accessibility (nsaccessibility.alloy): points, sizes, rectangles and ranges by value, arrays, and the conversions between the view's pixels and the screen's points and between UTF-8 and the UTF-16 NSString counts in.

pkg::alloy::window::headless

A window with no platform behind it, for tests: a list of events replayed through the program's handler, and the frames it presents kept for the test to look at.

pkg::alloy::window::layer

The page's accessibility layer, which browser.alloy's start_layer starts once a program installs screen readers: hidden elements over the canvas, one a node, behind a "Turn on accessibility" button, made by the JavaScript beside this file (layer.web.js). Only the installed layer calls these externs, so only a program installing it bundles that JavaScript, which reaches the canvas, keys and focus through what browser.web.js puts in the glue's alloy.page.

pkg::alloy::window::loading

Functions of the system libraries the platforms load while running.

pkg::alloy::window::nsaccessibility

VoiceOver for the macOS window (PLAN.md, F7c), through NSAccessibility: the view stands for the tree's root and every other node gets an element, an AlloyAccessibilityElement (a subclass of NSAccessibilityElement made here) holding the node's id, made as VoiceOver reaches it and released once the node is gone. The view's and the elements' methods answer from the tree the program sent; a node of no role is left out, its children standing in for it. The first question about the view asks the program for its tree, and what VoiceOver asks of a node is queued for the window to give the program once the call returns, as on Windows; changes to the tree post NSAccessibility's notifications. A grid's cells go into rows made from their own, elements standing for no node. A node sent with a map of its text answers lines, ranges, their frames and attributed strings from it (text_ranges.alloy), in UTF-16 units.

pkg::alloy::window::portal

File dialogs on Linux through the desktop portal (PLAN.md, F6c): org.freedesktop.portal.FileChooser over the session bus, which every desktop answers with its own dialog, inside a Flatpak too. A call gives a request object at once; its Response signal, later, gives the chosen files as URIs. With no session bus or no portal, a dialog is answered at once with no files. The desktop's wish for less motion is read from org.freedesktop.portal.Settings (F11e), its SettingChanged signal telling a change. Reached once a program installs files or screen readers (window.alloy's install_files, install_access).

pkg::alloy::window::posix

The C library's functions the Linux window uses, apart from the window's own names.

pkg::alloy::window::shell

The Win32 window's file dialogs and drops (PLAN.md, F6b): the shell's IFileOpenDialog and IFileSaveDialog, shown modal to the window, and an IDropTarget registered with OLE, whose calls queue events the window gives the program after them.

pkg::alloy::window::text_ranges

What screen readers ask of a node's text, answered from its TextMap for every platform (decisions/F14.md, F14b): the unit holding an offset, moves by units, the boxes a range covers and the offset at a point. Offsets are bytes of the node's text on grapheme boundaries; each platform counts them its own way (unicode.alloy). Ranges are in the text's order, their boxes in the order they are drawn.

pkg::alloy::window::uia

UI Automation for the Win32 window (PLAN.md, F6b): the window answers WM_GETOBJECT with a provider for the root of the tree the program sends, and every node gets a provider as UI Automation asks for it. A provider is one COM object with a table of functions for each interface it answers, at fixed offsets within it: the simple provider, the fragment, the fragment root (the root's only) and the patterns (Invoke for buttons, Toggle for checkboxes, RangeValue for sliders, Value for fields, combo boxes and buttons with a value, ScrollItem for anything, ExpandCollapse for what opens, Selection for list boxes, radio groups, tab lists and calendars, SelectionItem for their options, radios, tabs and days, Grid and Table for calendars, GridItem for their days, Text and Text2 for what has a text map: fields and texts of several lines, whose ranges are COM objects of their own, a node and two byte offsets, answered from the map by text_ranges.alloy). Calls come on the window's thread (ProviderOptions_UseComThreading); what a screen reader asks goes to the program as Event::Action, and changes to the tree raise UI Automation's events while a client listens.

pkg::alloy::window::unicode

UTF-8, the text the program sees, and UTF-16, Windows' and Cocoa's, both ways; positions in one counted in the other.

pkg::alloy::window::wayland

The window on Linux, through Wayland: libwayland-client, loaded while running, speaks the protocols wayland_protocol.alloy reads from their XML, one dispatcher receiving every event. The window is an xdg-shell toplevel, decorated by the compositor where it offers to (xdg-decoration; GNOME does not), at the compositor's fractional scale where it gives one (fractional-scale and viewporter), else its integer one. Frames present gives go through shared memory, a GPU surface drawing into the wl_surface itself. Input methods speak through text-input-unstable-v3, which GNOME and KDE implement.

pkg::alloy::window::wayland_protocol

The Wayland protocols the window speaks, read from their XML while compiling. libwayland marshals each message by the signature and the argument types a wl_interface gives it. The tables here describe those as plain rows, every name and signature in NAMES, since a compile-time result holds no address; Protocol::build lays them out as the C structures when a window opens.

pkg::alloy::window::win32

The window on Windows, through Win32, whose system libraries every Windows program can call: a window procedure receives every message. The process is aware of each monitor's DPI (the scale is the DPI over 96), frames present gives go through GDI and a GPU surface's through its swapchain, and DWM paces redraws one after another to the display. Input methods speak through IMM32, the program drawing their compositions. Screen readers read the program's tree through UI Automation (uia.alloy), and the shell's file dialogs and OLE's drops come through COM (shell.alloy), the window's thread a single-threaded apartment. Needs Windows 10 1703 or later.

pkg::alloy::window::xkb

The keyboard on Wayland: the compositor sends its keymap in xkbcommon's text format, which libxkbcommon turns into keys, text and modifiers for each key code (loaded while running, like libwayland-client).

std::dispose

Values that must be released by a call, not only freed.

std::equal

Equality: the Equal interface.

std::ffi

Values C holds for Alloy (LANGUAGE_SPEC.md section 6.3): a C library that calls back through an extern (...) -> R function often passes along a void * its caller gave it. c_pointer is that pointer: made from a reference, read back as one by the callback, which names the type it was made from.

std::float_digits

The shortest decimal digits of a float that read back to the same value, by Ryu (Ulf Adams, "Ryu: fast float-to-string conversion", PLDI 2018), which std::format writes floats with (LANGUAGE_SPEC.md section 6.5). Integer arithmetic only, so compile-time code formats floats too.

std::format

Formatting values as text: the Format interface.

std::fs

The file system: directories, paths and what is at them.

std::hash

Hashing: the Key interface of hash map keys.

std::io

Console and file input/output.

std::iterable

The iteration interfaces driving for loops.

std::json

JSON values (RFC 8259): parsing, writing, reading and building.

std::language_data

Generated by cldr/generate.alloy from CLDR 48 (cldr-json 48.0.0): do not edit. std::languages reads it.

std::languages

The system's languages and which way a language is written, apart from std::locale so that a program asking only these loads none of CLDR's locale tables (alloy-ui's REFOCUS.md, R6e): what an app's language and direction are chosen by.

std::macros

The built-in compile-time macros (LANGUAGE_SPEC.md section 7.4).

std::map

The hash map.

std::math

Mathematics over floats (LANGUAGE_SPEC.md section 6.1a).

std::number

The numeric constraint interface.

std::option

The optional value: a payload (Some) or its absence (None).

std::process

The running process's environment.

std::result

The outcome of something that may fail: a value (Ok) or the error that took its place (Err).

std::sort

Sorting in place.

std::string

The owned, growable byte string.

std::sync

What tasks share (LANGUAGE_SPEC.md section 5.6).

std::text

Searching and parsing byte text.

std::time

Time: a monotonic clock for measuring, the wall clock, sleeping, and the calendar: days of the proleptic Gregorian calendar, times of day and the system's offset from UTC; time zones by name from the platform's database, dates and times on a zone's clocks, and ISO 8601, RFC 3339 and HTTP dates (F12e, notes at the end).

std::vector

The growable array.

std::web

The browser's side of a web-wasm32 program, whose event loop is the browser's: the program sets up what the browser calls back, such as animation frames and input events, then lets main return while it keeps running. Externs a module declares come from the JavaScript beside it, <module>.web.js (section 6.3), as this module's do.