Expand description
day-spec: the toolkit specification (DESIGN.md §8).
Backends depend only on this crate (never on day-core). One backend is linked per binary;
day-core is monomorphized over the concrete Toolkit.
Re-exports§
pub use controls::datetime::DayDate;pub use controls::datetime::DayTime;pub use resource::AssetDir;pub use resource::AssetName;pub use resource::FontFamily;pub use resource::ImageName;pub use resource::Resource;pub use resource::ResourceOpener;pub use resource::VectorName;pub use resource::resolve_asset_dir;pub use resource::resolve_image_file;pub use resource::resource;pub use resource::set_resource_opener;pub use styled::ListStyle;pub use styled::ParagraphAlign;pub use styled::ParagraphRun;pub use styled::ParagraphStyle;pub use styled::RunStyle;pub use styled::StyledText;pub use styled::Underline;pub use styled::coalesce_runs;pub use styled::paragraph_bounds;pub use styled::paragraphs_are_valid;pub use styled_codec::DocStyle;pub use styled_codec::html_to_styled;pub use styled_codec::markdown_to_styled;pub use styled_codec::rtf_to_styled;pub use styled_codec::styled_to_html;pub use styled_codec::styled_to_markdown;pub use styled_codec::styled_to_rtf;pub use day_fonts as fonts;
Modules§
- applications
- System application associations. Identifiers are opaque, platform-owned values.
- bridge
- The wire table for backends whose native side reaches Rust through one numeric-kind
trampoline (Android’s JNI
nativeOnEvent, ArkUI’sday_arkui_on_event). This enum defines those kind numbers; the Java and C++ sides carry mirrored constants that parity tests check against these discriminants (so a collision or drift failscargo teston the host instead of silently mis-decoding events on a device). AppKit/UIKit/GTK/Qt emitEventvalues directly and never use these numbers; XAML uses per-event callbacks with its own small local codes. - capture
- Screenshot checkpoints. A revision identifies one ordered request, not a timer or an image hash. Completion of an older request cannot release a newer checkpoint.
- controls
- Shared protocols for the standard controls.
- ffi_
guard - Containment for FFI entry points: native callbacks, JNI up-calls, posted-closure
trampolines. A Rust panic unwinding out of an
extern "C"frame is undefined behavior (an abort), so every backend trampoline runs its body throughffi_guard::contain: a caught panic is reported, the installed recovery hook restores runtime coherence (day-core installs the reactive runtime’srecover_from_panicat boot), and the given default is returned. - keys
- Which nodes handle the non-text keys (docs/menus.md). Keys follow focus (the focused piece hears them and nobody else), so a backend whose focused view would have to claim a key from the platform’s own dispatch (AppKit’s responder chain, the DOM’s default action) has to know whether the app wants it before swallowing it. An unclaimed arrow has to keep traveling, or a canvas inside a scroll view would silently eat the keys that scroll it.
- kinds
- The built-in piece keys as plain strings, for the registry and the
PieceKindAPI. - markdown
- Inline markdown → styled runs (docs/markdown.md). Lives here rather than in day-pieces
because it produces
TextRuns, and every format codec beside it reads the same model. Inline markdown → styled runs, parsed at RUNTIME (docs/markdown.md). - placeholder
- Placeholder leaves: the one hole in Day’s rendering that is invisible to a screenshot.
- present
- props
- resource
- Bundled-resource random-access API + the per-backend
ResourceOpenerhook (§18.3). Bundled resources: efficient random read-only access to app-declared data, backed by each toolkit’s native resource mechanism (DESIGN.md §18.3). - sidetable
- Pointer-keyed per-view side tables with an automatic release sweep.
- styled
- Styled text: the document model
label().runs(…)renders andday-piece-text-editoredits, with the Markdown / HTML / RTF codecs over it (docs/texteditor.md). Styled text: the documentlabel().runs(…)renders andday-piece-text-editoredits (docs/texteditor.md). - styled_
codec - Import and export for
StyledText: Markdown, HTML and RTF (docs/texteditor.md). Import and export forStyledText: Markdown, HTML, and RTF (docs/texteditor.md). - transfer
- Native drag data and synchronous destination policy. No clipboard or process-local transport.
Structs§
- A11y
Props - Affine
- A 2-D affine transform (CoreGraphics row-vector convention): a point
pmaps to(a·p.x + c·p.y + tx, b·p.x + d·p.y + ty). Used by canvas transform ops for shape rotate/scale/offset; every native 2-D context concatenates it onto its CTM identically. - Anim
Spec - Animation intent (§8.4). Native-widget backends map it onto their own animator (Core Animation,
ViewPropertyAnimator, XAML Composition,OH_ArkUI_AnimateTo, …); the canvas/self-driven path samplescurveviaCurve::fraction. Threaded throughToolkit::update/set_frame/set_opacity/set_transform. - Bitmap
Id - A decoded image the toolkit holds, addressed by an id day-core mints.
- Bitmap
Info - What a decoded image is, in the terms every backend can answer
(
Toolkit::image_info, docs/images.md). - Canvas
Font - What canvas text is drawn with beyond its size (docs/canvas.md “Text”): a family, a weight and a slant. The default is the platform’s own UI face, regular, upright, which is what every backend drew before the field existed, so a default font encodes to nothing on the wire.
- Color
- sRGB color, 0.0–1.0 components. Semantic theme tokens (§6.3) resolve to these in the backend.
- Corner
Radii - A radius for each corner of a rectangle, clockwise from the top left (docs/canvas.md “Rounded corners”). The shape a bar in a chart wants (rounded at its value end, square against its axis), a tab (rounded on top), or a card joined to its neighbor.
- Edges
- A set of screen edges, for the
defers_system_gesturesmodifier (docs/cover.md). Mirrors SwiftUI’sEdge.Set: on iOS these map toUIRectEdgeforpreferredScreenEdgesDeferringSystemGestures; on Android any non-empty set enters swipe-to-reveal immersive mode (the closest platform analogue). - Edit
State - What the app’s edit bridge can currently do, mirrored into the toolkit
(
Toolkit::set_edit_state) so native menu validation enables the stock items.can_pasteis the app’s half (“a paste handler is installed”); the toolkit combines it with its own clipboard-has-text check where one exists. - Encode
Spec - What
Toolkit::encode_imageshould produce (docs/images.md). - Font
Face - One face a font family ships (docs/fonts.md): its display name (“Bold Italic”), weight and
slant. What
FontFamilyInfo::faceslists and what a font menu’s style picker offers. - Font
Family Info - A platform (or bundled) font family and the faces it can draw canvas text in
(
Toolkit::font_families, docs/fonts.md). - Font
Spec - The full font descriptor a label carries: a semantic (or custom)
Fontstyle plus an optional weight override, an italic flag, and the tabular-figures request. Backends resolve this to one native font. - Frame
Stamp - Timing supplied by a native display scheduler. Seconds on a monotonic clock; its epoch
is platform-specific.
target_timestampis absent when the platform cannot predict presentation. - Image
Properties - The metadata an image file carries beyond its pixels (
Toolkit::image_properties). - Input
Traits - How a text field takes its text (docs/textfield.md): the whole set travels together through
Toolkit::set_input_traits, so a backend that has to rebuild the widget for one member has every other member in hand to dress the replacement. - Insets
- Logical insets:
leading/trailingresolve against the layout direction at place time (§7.8). - KeyEvent
- Launcher
Shortcut - A launcher shortcut the app sets while it runs (docs/deep-links.md “Launcher shortcuts”): a route to open and the label the launcher shows, already localized.
- Linear
Gradient - A linear gradient (docs/shapes.md §3.2 / §7): color stops along the line from
starttoend, both in the unit space of the filled shape’s bounding box. Stops are(offset 0..=1, color), ascending. - List
Delete - The synchronous swipe-to-delete half of
ListSource(docs/list.md), shaped exactly likeListReorder: both closures are called on the UI thread from inside native swipe callbacks, outside any day-core borrow, and run to completion synchronously. - List
Reorder - The synchronous drag-to-reorder half of
ListSource(docs/list.md). Both closures followbind_row’s discipline: called on the UI thread from inside native drag callbacks, outside any day-core borrow, and they run to completion synchronously. - List
Source - The synchronous row-pull closures for recycling lists (docs/list.md, §10). day-core injects one
per
LISThost viaToolkit::attach_list; a recycling backend stores it and calls it from its native data-source (on the UI thread, outside any day-core borrow). Each closure re-enters day-core, so, unlikeEventSink, these run to completion synchronously (bind_roweven flushes + lays out the row before returning, so the host can measure the cell immediately). - List
Swipe - The synchronous swipe-actions half of
ListSource(docs/list.md), the generalized sibling ofListDelete: reveal-as-you-swipe buttons on either row edge. The offer is pulled per row at gesture time, so labels follow row state (“Mark Read” on an unread row, “Mark Unread” on a read one); the commit defers to the event drain like every closure here. - List
Swipe Action - One offered swipe action (docs/list.md): pure data. The pieces layer keeps the handlers;
the backend answers a tap through
ListSwipe::performby index into the offer. - Modifiers
- The keyboard modifiers held at an interaction, queryable ambiently
(
Toolkit::modifiers):primaryis the platform’s command key (⌘ on Apple platforms, Ctrl elsewhere, the same conventionShortcut::primaryuses). Touch-only backends answer all-false. - Monitor
- One display (docs/windows.md “Monitors”), in points on the desktop’s coordinate space: top-left origin at the primary display’s top-left corner.
- Native
Snapshot - A widget’s actual native state, read back from the platform by
Toolkit::read_native(docs/testing.md): what the widget itself shows and reports, independently of Day’s tree, soa11y_auditandassert_native(§14.2) can diff it against Day’s expectation. - NodeId
- Realized-node identity as seen by backends (day-core’s slotmap key, FFI-encoded).
- Path
- An arbitrary 2-D path: any number of contours, straight or curved, with a fill rule.
- PdfInfo
- The document information a PDF carries. A backend whose writer has no metadata API (Android’s
PdfDocument) ignores it. - PdfPage
- One page of a PDF
Toolkit::render_pdfwrites: the page size in PDF points (1/72 inch, the same unit as canvas points) and the ops to replay onto it, origin top-left. - Point
- Pointer
Event - Proposal
- The layout proposal:
None= unconstrained on that axis (§7.2). - Radial
Gradient - A radial gradient (docs/shapes.md §3.2 / §7): color stops from
centeroutward. Both the center and the radius live in the unit space of the filled shape’s bounding box, so the gradient stretches into an ellipse when the bounds aren’t square (the XAML relative-brush behavior; the other backends reproduce it with a local matrix on a circular gradient). Aradiusof0.5from the default center touches the edge midpoints of the bounds. - Rect
- Registry
- Renderer
- A third-party piece’s per-toolkit implementation.
makereceives the concrete backend (public helper surface) and returns a native handle the backend then owns like any built-in. - RowMetrics
- The margins and minimum height a native list gives each row (
Toolkit::list_row_metrics, docs/list.md “Row metrics”): aUITableViewcell’s layout margins, a Material list item’s 16dp sides and 56dp height. - Shortcut
- A keyboard shortcut for a menu item.
primaryis the platform’s command modifier (⌘ on Apple, Ctrl on GTK/Qt/XAML) so one declaration reads correctly everywhere.keyis a single character ("s",".") or a named key ("Return","Delete","Left","F1"). - Size
- Size
Class - A window’s size class (docs/size-classes.md), reported by the backend and read by apps
through
day::size_class(). - Stamp
- The payload of
DrawOp::Stamp: one shape drawn at every position inat. - Status
Image - A small runtime RGBA image for a status item: charts, meters, or a grid of results.
- Status
Item Spec - One status item: an icon in the menu bar (macOS), the notification area (Windows) or a StatusNotifierItem host’s tray (Linux), with a menu (docs/status-item.md).
- Stroke
Style - Everything about a stroke except its paint.
- Text
Anchor - How canvas text hangs on its
atpoint: one placement per axis (docs/canvas.md “Text”). - Text
Metrics - Single-line text measurement in canvas points (
Toolkit::measure_text, docs/fonts.md). - TextRun
- One styled span of a label’s text (docs/text-runs.md).
- Toolbar
Item - One item in a window’s toolbar (docs/toolbars.md).
- Toolbar
Mirror - A backend’s copy of one window’s toolbar, kept in step with the
ToolbarOps andToolbarPatches that reach it, and the one place a backend works out where a new item goes (docs/toolbars.md). - Toolbar
Segment - One choice inside a
ToolbarItemKind::Segmentedcontrol. - Transform
- A cheap per-node visual transform (§8.4 animation): translation, uniform/non-uniform scale, and
rotation about a unit anchor (
0.0..1.0within the node’s bounds; default center). Distinct from the layout frame: animating aTransformnever triggers relayout, so it is the vehicle for movement/scaling animation. Each backend composes it onto the node’s laid-out frame via its native transform channel (CALayer/GskTransform/RenderTransform/NODE_TRANSFORM/…). - Tree
Moves - The synchronous drag half of
TreeSource(docs/tree.md). Both closures followbind_row’s discipline: called on the UI thread from inside native drag callbacks. - Tree
Source - The synchronous row-pull closures for hierarchical trees (docs/tree.md):
ListSource’s shape, addressed by token instead of row index, because expanding a row renumbers every index below it while tokens hold still. day-core injects one perTREEhost viaToolkit::attach_tree; the backend answers its native data-source from it. The same synchronous discipline asListSource: UI thread, outside any day-core borrow;bind_rowflushes and lays the row out before returning. - Undo
State - The undo stack’s face, as a native front mirrors it (
Toolkit::set_undo_state): what is possible and what the menu titles should say. Labels arrive already localized: a toolkit cannot invent translated text, the same rule as every other label in this file. - Unit
Point - A point in the unit space of a shape’s bounding box: (0,0) = top-leading, (1,1) = bottom-trailing. Gradient geometry is expressed in unit points so one paint value works for any shape size (docs/shapes.md §3.2).
- Window
Options
Enums§
- AppBadge
- What to show on the app’s icon in the Dock, launcher, home screen, or taskbar (docs/badge.md).
- AppProgress
- A progress indicator on the app’s Dock or taskbar icon (
Toolkit::set_app_progress, docs/status-item.md). - Attention
- How strongly a window asks for the user’s attention (
WindowChange::RequestAttention). - Builtin
- Every piece kind Day itself defines (§5.3). Backends match on this exhaustively in
realize; anything outside it is an extension piece resolved through theRegistryby its stringPieceKind. - Cap
- Cursor
- The pointer’s shape over a piece (the
.cursor()decorator, docs/cursor.md). - Curve
- The timing curve of an animation (§8.4). Native backends map each variant onto their own
easing (
CAMediaTimingFunction,QEasingCurve, ArkUIARKUI_CURVE_*, spring animators); the canvas/self-driven path samples it viaCurve::fraction.Springmatches SwiftUI’s.spring(response:dampingFraction:). - Drag
Phase - The phase of a drag gesture (docs/shapes.md).
- DrawOp
- EditOp
- A standard edit command a platform route delivered (
Event::Edit). - Event
- Export
Error - Why a canvas export could not answer (docs/canvas.md “Exporting”).
- Fill
Rule - Which points count as inside when a path’s contours overlap (docs/canvas.md).
- Font
- A semantic (logical) text style. Each maps to the platform’s native text style where the
toolkit has one:
UIFont/NSFont.preferredFont(forTextStyle:)on Apple (Dynamic Type), the*TextBlockStyleresources on XAML. A Day app thus matches the OS’s own typography and inherits its accessibility text scaling with no extra work. Backends without semantic styles (GTK/Qt/Android) approximate with sizes that still track the platform’s text-scale / font-scale accessibility setting. - Font
Weight - Font weight, matching
UIFont.Weight/ SwiftUIFont.Weight(lightest → heaviest). Ordered by heaviness, so backends can e.g. map>= Semiboldto a synthesized bold face. - Gesture
Kind - A gesture a node wants delivered. Backends attach the matching native recognizer when day-core
calls
Toolkit::enable_gesture; the default is no gesture (recognizers cost, so opt-in). - Height
Class - How tall a window is (docs/size-classes.md). Consulted far less than
WidthClass: it is what tells a phone in landscape (wide enough for two panes, too short for a tall list) that it should not grow vertical chrome. - Icon
- A button or toolbar item’s picture: a standard
Symbol(drawn with the platform’s own icon set) or a bundled image fromresource/imagesfor something only this app has. - Image
Error - Why an image operation could not answer.
- Image
Format - An encoded image format: what
BitmapInfo::formatreports andEncodeSpec::formatasks for. Not every backend encodes every one: askToolkit::encode_formats(theCap::ImageEncodepair ofToolkit::font_families/Cap::FontList) rather than assuming. - Image
Source - Where a raster image’s pixels come from (docs/images.md).
- Input
Purpose - What a text field collects (
text_field(..).input_purpose(_), docs/textfield.md). - Label
Style - Which halves of an item’s label a platform draws, where it can draw more than one.
- Layout
Direction - Lifecycle
- An app-lifecycle phase (docs/lifecycle.md). Each backend maps these onto its OS’s native app /
activity delegate. Some phases only exist on some platforms (a mobile app enters the
background and can be low on memory, a desktop app cannot), so
Lifecycle::is_universalmarks the ones every backend delivers, andToolkit::supports_lifecyclereports per-backend truth. - LineCap
- How a stroked line ends (docs/canvas.md). Names match PDF’s
J, SVG’sstroke-linecap, and every native 2-D API. - Line
Join - How two stroked segments meet (docs/canvas.md). Matches PDF’s
jand SVG’sstroke-linejoin. - Markup
Dialect - Which markup dialect
runs_to_markupshould emit. - Menu
BarRole - A standard menu-bar slot (macOS’s File/Edit/View/Window/Help, and their counterparts elsewhere). A backend that has a house style for the menu bar fills every slot an app did not claim with its own stock menu, so an app never has to restate the platform’s furniture, and can still replace any of it by tagging its own submenu with the matching role.
- Menu
Item - One entry in a menu (recursive: a
Submenunests). - Menu
Role - A standard/system command. The backend supplies the native item, a selector on AppKit/UIKit
(
cut:/copy:/paste:…) or a stock action on GTK/Qt/XAML, so it targets the focused control, gets the platform’s default label + shortcut, and enables/disables itself automatically. This is how default items (Edit ▸ Cut/Copy/Paste, the app’s Quit/About) are accommodated without the app re-implementing them. - Move
Verdict - A tree move guard’s verdict (docs/tree.md). No
Retargetyet: the drop vocabulary is already positional, so a guard that wants a different target denies and the user drops where it is allowed. - OpCode
- The canvas wire op codes (§11, §15.3): slot 0 of every 9-number record in
encode_ops’s output. The numeric values are the frozen wire contract: the JNI, C++, and JS decoders each hand-write these as constants, so a value here may never be reused or renumbered; new ops append.ALLdrives the density test that keeps this enum and the encoder in step. - Paint
- A fill source: a solid color, or a linear/radial gradient (docs/shapes.md §3.2; angular and
semantic tokens are later phases).
From<Color>keeps every existingfill(shape, color)call site compiling unchanged. - PathSeg
- One step of a
Path. Points are absolute, in the canvas’s coordinate space. - Role
- Shape
- Subcontrol
- One addressable widget within a composite native backing (docs/tree.md,
docs/tweaks.md), Qt’s name for the concept (
QStyle::SubControl). Alist’s ortree’s node handle is its scroller;Subcontrol::Contentis the widget inside it. Backends resolve an unknown subcontrol toNone, never to the host. - Submit
Label - The on-screen keyboard’s action key (
text_field(..).submit_label(_), docs/textfield.md). - Support
- Surface
Role - Default navigation sidebar width (split presentation) until the pane reports its size.
Semantic container surfaces (see
ContainerProps::role): each backend maps a role to its own theme-adaptive material so the fill tracks light/dark mode without app code. - Swipe
Edge - Which edge of a row a swipe action rides (docs/list.md). Semantic, not geometric:
Leadingfollows the reading direction (the left edge in LTR, the right in RTL), the mapping every platform’s swipe API already makes. - Symbol
- A standard icon, named by what it means rather than by how it looks, so each backend can draw the platform’s own glyph for it: an SF Symbol on macOS, a freedesktop icon name on GTK and Qt, a Fluent glyph on Windows. This is the only way an icon looks native on every desktop at once; a bundled PNG cannot, because it is one artist’s take on all four.
- TextV
Align - Where
atsits vertically.Top,MiddleandBottomare edges of the line box (ascent + descent at the font’s size, the boxToolkit::measure_textreports);Baselineis the typographic baseline itself. - Toolbar
Column - Which pane of a window’s navigation a toolbar item was declared in (docs/toolbars.md).
- Toolbar
Item Kind - What a toolbar item is. The variants are the vocabulary every desktop toolbar shares; each backend realizes one with its native control, never with a drawn imitation.
- Toolbar
Op - One step of an edit to a window’s toolbar (docs/toolbars.md).
- Toolbar
Patch - A targeted update to one live toolbar item: the path that keeps a bound signal in sync without rebuilding the bar (which would drop the search field’s focus mid-keystroke).
- Toolbar
Placement - Where an item sits on the chrome that carries it (docs/toolbars.md).
- Toolbar
Value - A value a toolbar item produced.
- Width
Class - How wide a window is, in coarse buckets (docs/size-classes.md).
- Window
Background - What shows behind a window’s content (docs/window-chrome.md).
- Window
Change - One change to one window (docs/windows.md “Window properties”), carried by
Toolkit::apply_window. Each variant names theCapthat reports whether the running toolkit makes it. - Window
Chrome - The frame a window wears (docs/window-chrome.md), set once when it opens.
- Window
Kind - What a secondary window is, so backends can apply platform conventions (docs/windows.md).
- Window
Level - How a window stacks against other apps’ windows (
WindowChange::Level,Cap::WindowLevel). - Window
Material - The system materials a window background can use (
WindowBackground::Material). - Window
Open Reply - A backend’s answer to
Toolkit::open_window(docs/windows.md). - Window
Placement - Where a window opens (
WindowOptions::placement). - Window
Role - Whether a window keeps the app alive (docs/windows.md close policy).
- Window
State - How a window is shown (docs/windows.md “Window properties”): what the window’s
state()signal holds and whatWindowChange::Stateasks for. - Window
Tabbing - Whether and how a window joins macOS window tabs (
WindowOptions::tabbing,Cap::WindowTabbing). Other platforms have no system window tabs and ignore it.
Constants§
- EXPORT_
MAX_ PIXELS - The most pixels a rendered bitmap may hold in total: 64 megapixels, 256 MB at four bytes a pixel, which is already more than the tightest per-app heap (Android’s) comfortably holds.
- EXPORT_
MAX_ SIDE - The largest side, in pixels, a rendered bitmap may have (docs/canvas.md “Exporting”).
day-core answers
ExportError::TooLargeabove it before any toolkit allocates. - FONT_
LIST_ FAMILY - Family separator of the shim-side font list (
parse_font_list). - FONT_
LIST_ FIELD - Field separator inside one family of the shim-side font list (
parse_font_list). - NAV_
LIST_ MAX_ W - NAV_
LIST_ MIN_ W - Drag limits for the content-list pane, around the app’s preferred width; the same split of duties as the sidebar’s.
- NAV_
LIST_ WIDTH - Default preferred width of a navigation host’s content-list pane
(
props::NavProps::list_width, docs/navigation.md), Mail’s message-list proportion. - NAV_
SIDEBAR_ MAX_ W - NAV_
SIDEBAR_ MIN_ W - Drag limits for a navigation host’s sidebar pane, around
NAV_SIDEBAR_WIDTH. Shared by the desktops whose divider the user can drag (docs/navigation.md): AppKit enforces both through itsNSSplitViewItem; Qt honors the minimum through the pane’s own minimum size and leaves the maximum to the user. - NAV_
SIDEBAR_ WIDTH - SEARCH_
ITEM_ ID - The reserved id of a
.searchable()surface’s field (docs/search.md): theToolbarItema desktop bar draws for it, and the name dayscript’stoolbar:step drives it by wherever the platform put it — on the bar, or inline on the navigation surface where the bar holds no field, in which case day-core resolves the id to that host instead. - SIDEBAR_
TOGGLE_ ID - The reserved id of the sidebar affordance a
nav(Sidebar)supplies for itself (docs/toolbars.md). Backends with a system item for the job (AppKit’sNSToolbarToggleSidebarItem) recognize it by this id and draw theirs instead; dayscript recognizes it to drive the toolkit’s own duty rather than an app closure. - WINDOW_
NODE - Reserved id for window-level events (resize, lifecycle): day-core routes it to the root.
Traits§
- Animatable
- Linear interpolation of animatable values (
tin0.0..1.0). This drives the canvas / self-driven animation path (docs/shapes.md §5) and Qt’s sampled spring; native-widget animation does not use it; the toolkit interpolates on its own compositor. - Platform
- A platform backend: owns the native main loop and exactly one window in v1 (§8.1).
- Toolkit
Functions§
- arc_
cubics - A circular arc as cubic beziers:
sweep_degof a circle ofradiusaboutcenter, fromstart_deg(arc_point’s convention). The segments start from the arc’s first point, which the caller reaches itself (a move or a line); nothing for a zero or non-finite radius or sweep. - arc_
point - The point
angle_deground a circle: degrees,0= the +x axis, positive clockwise in device space (y down), the conventionShape::Arcand every arc helper here use. - capture_
scale - The scale a window snapshot is rendered at, when a scripted run states one
(
DAY_CAPTURE_SCALE=2, set byday launch --scriptfrom Day.toml[screenshots]). - encode_
ops - encode_
path - export_
pixels - The pixel size a drawing of
sizepoints renders to atscalepixels per point: each side rounded up, so a drawing never loses its last partial pixel. Shared by day-core’s limit check and every backend, so the bitmap a backend allocates is the one day-core approved. - frame_
timestamp - Seconds on a monotonic clock since the first call: the frame timestamp for a backend that
does not expose a native timestamp (§8.4). The origin is arbitrary. Not for the web
build, where
Instantis unavailable andrequestAnimationFramestamps the frame itself. - geometry_
key - Flat numeric encoding of a display list for shim/JNI boundaries (§11, §15.3): per op
9 numbers [kind, a, b, c, d, e, f, g, rgba-bits]; text payloads ride separately in order.
The kind slot carries an
OpCode; its doc comments are the per-slot contract. - kind_
has_ baseline - Whether a kind is worth asking
Toolkit::first_baselineabout (docs/baseline.md). - parse_
font_ list - Decode the text a non-Rust font enumerator hands back (the Qt, XAML and ArkUI shims, the
Android bridge, the web shim all produce this one format): families separated by U+001E;
inside a family, U+001F-separated fields: the family name, then one (name, CSS weight,
italic
0/1) triple per face. Tolerant: a malformed face or family is skipped, an empty face name is synthesized from its weight and slant, and a family with no faces is kept with none (the caller decides what a face-less family means). - posix_
locale_ hints - The user’s language preference from the POSIX environment, newest-first, as BCP-47 tags.
- props_
of - Downcast a realize/update payload to the props/patch type a backend arm expects,
warning (once per kind, via
placeholder::report) instead of panicking on a mismatch. A mismatch means a piece registered under a builtin key or a day-core regression; degrade to the placeholder path, never abort: most backend arms run inside native up-calls, where a panic is a process kill. - rounded_
rect_ segs - The closed contour of a rectangle rounded corner by corner, clockwise from the top left, with the radii fitted first. A square corner is a sharp point, not a zero-length curve.
- route_
of_ url - The route inside a deep-link URL (docs/deep-links.md): everything after
scheme://, query included (notes://mail/inbox?hint=x⇒mail/inbox?hint=x). A string with no scheme passes through unchanged (it is already a route). One definition, shared by every platform’s intake and the dayscriptdeep_linkstep, so a URL maps to the same route bytes everywhere; percent-decoding stays with the route parser (docs/navigation.md). - runs_
are_ valid - Are these runs well formed for
text: ascending, non-overlapping, inside the string, and on character boundaries? - runs_
to_ markup - Serialize a label’s text + runs as markup, for the two backends whose text widgets take a
string in their own dialect rather than a structured attributed string: GTK (Pango markup)
and Qt (its HTML subset). Shared so the escaping is written and tested once: a translated
string containing
&or<corrupts the whole label otherwise, and it will be a translated string that finds the bug. - sf_
symbol_ name - The SF Symbol each standard symbol draws as. The system’s own glyphs match the user’s device: weight, optical size, accent color and all. Shared by both Apple backends (toolbars on macOS, menus on both).
Type Aliases§
- AppLocales
- An app’s generated locale catalog:
(DEFAULT, CATALOG), exactly whatday-buildemits asres::locales::{DEFAULT, CATALOG}(§18.5). Carried inWindowOptions::localesso the framework can install it at the one moment that is correct. - Cancel
Frame - Cancels a pending callback and releases its native registration. UI-thread only, idempotent in effect, and safe during/after delivery. Dropping without calling is allowed after delivery.
- Context
Menu Fn - A summon-time context-menu provider (docs/menus.md): local-point in, menu out.
- Event
Sink - The event sink: enqueue-only. It may be invoked re-entrantly from inside any Toolkit method; day-core drains queued events at safe points, each as a fresh batch (§3.3).
- Frame
Callback - A one-shot native frame callback, always delivered asynchronously on the UI thread.
- Measure
Fn - Optional custom measure for a third-party piece (§8.2).
- Piece
Kind - Interned piece-kind key, e.g.
"day.label"or"acme.combobox". - RawHandle
- Raw foreign native handle for polyglot adoption (§15.3).