Repository navigation
Releases
v0.7.1 — sizes that follow content, a Switch with words, and calling the model from a check
0.7.1 settles what a view's content size is. A view's size from its content is what its
children bring with nothing in them giving way, and a layout that sizes its children now says
how long that is: place() may return { boxes, contentWidth } (contentHeight along a
column) instead of its bare boxes. shrinks always promised this ("the size its content gives
it"), but a container's content size had been counted from the sizes its own layout gave its
children, so it could depend on itself. A header looped at sign-in, a title laid out empty
stayed at its padding, and a group of tags that shrinks stayed one tag wide. They hold now.
class Strip extends Layout [
place() {
let x = 0
const boxes = this.laid().map((c) => { const b = { x: x }; x = x + c.width + 8; return b })
return { boxes: boxes, contentWidth: Math.max(0, x - 8) }
}
]
Controls size to their words. A Segmented with no width is as wide as its labels need, each
with its margin at either side; a Button given a width narrower than its label cuts it inside
its margins, with an ellipsis and the whole label as its accessible name. A
Switch takes a label, as a Checkbox does.
And a check can call the program's model directly: drive.call(path, method, …args) in a
verify script calls a method and returns its result, so the rules a dataset class keeps can be
tested case by case, beside the scripts that press what a person presses.
The flagship calendar is 177.7 KB gzipped at this tag.
Breaking: 7 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
A built-in color name declared as another type → declared Color
fill, textColor, textFill and tint mean a color on every class: a value set on one is
taken as a color whatever the class declares, so tint: string was handed a number and failed
with no report. A class's own declaration of one of these names is now refused unless it is a
Color (or a number, which is what a color is).
Find: /\b(?:tint|fill|textColor|textFill)\s*:\s*(?:string|boolean|object|array|any)\b/
class Avatar [ width = 32, height = 32, tint: string = "#80a7ff", fill = { Color.from(classroot.tint) } ]
class Avatar [ width = 32, height = 32, tint: Color = #80a7ff, fill = { classroot.tint } ]
Docs: Paint and themes · Color
Watch for: a value of your own that isn't a color takes another name: avatarTone, not tint.
A name both a member and a script binding → rename one
A bare name that an attribute or method and a top-level script function or value both answer
to was a warning, and the member silently won: an App method initialsOf(id) that meant to call
the script's initialsOf(name) called itself. It is now an error (DECLARE4045). A library
class's own member meeting a script name is still allowed.
script { function initialsOf(name: string): string { return name.slice(0, 1) } }
App [ width = 200, height = 100, initialsOf(id: string) -> string { return initialsOf(id) } ]
script { function initialsOfName(name: string): string { return name.slice(0, 1) } }
App [ width = 200, height = 100, initialsOf(id: string) -> string { return initialsOfName(id) } ]
Docs: Program structure · DECLARE4045
A size beside a computed flexes → flexes = true with a computed maxWidth
width = { … } beside flexes = { phone } was refused only at run time, in a state where
flexes was true. It is refused at compile time now, at the size's line. A size beside
flexes reads, to anyone from CSS, as the size it grows from; the form that says "grow, but
no wider than this" is flexes = true with a maxWidth (and minWidth for a floor).
side: View [ height = 100%, width = { app.phone ? 0 : 280 }, flexes = { app.phone } ]
side: View [ height = 100%, flexes = true, maxWidth = { app.phone ? 0 : 280 }, minWidth = { app.phone ? 0 : 280 } ]
Docs: Layout · View.flexes
A ResponsiveLayout view sized from its content → given a width
A ResponsiveLayout chooses its arrangement by the width it is given, so it has no width of
its own to offer. Its documentation always required a given width; a view that broke that
failed silently. Now a rule that reads such a view's contentWidth (a parent sizing it from its
content in any way) is refused where it reads, and so is the view when nothing gives it a
width; shrinks on it is refused at compile time. A WrappingLayout with columns is the same.
card: View [ shrinks = true,
layout: ResponsiveLayout [ plan = { [({ from: 600, flow: "row", gap: 20 }), ({ from: 0, flow: "stack", gap: 8 })] } ] ]
card: View [ width = 100%,
layout: ResponsiveLayout [ plan = { [({ from: 600, flow: "row", gap: 20 }), ({ from: 0, flow: "stack", gap: 8 })] } ] ]
Docs: Layout · ResponsiveLayout
A Segmented with no width → as wide as its labels
A Segmented divided segmentMinWidth × items evenly, so a long label was cut in a control
with room to spare. With no width it is now as wide as its labels need, each label whole with
its margin (the theme's segmentedLabelInset) at either side; given a width, its segments
share it, and a label that can't fit is cut with an ellipsis inside its margins.
Segmented [ items = { [ ({ id: "d", label: "Day" }), ({ id: "w", label: "Week" }) ] } ]
Segmented [ width = 200, items = { [ ({ id: "d", label: "Day" }), ({ id: "w", label: "Week" }) ] } ]
Docs: Controls · Segmented
Watch for: a Segmented with no width changes size with no error. Give it a width where the old size mattered.
A Switch's fill, stroke and cornerRadius → the theme's
A Switch was its pill, so its own fill, stroke and cornerRadius painted it. It now holds
a label beside the pill, which is a part of it, so those attributes no longer reach the pill.
Its colors come from the theme (accent when on, control or trackFill when off).
Find: /\bSwitch\s*\[[^\]]*?\b(?:fill|stroke|cornerRadius)\s*=/
Switch [ checked = true, fill = #2E6FE0, accessibilityLabel = "Wi-Fi" ]
Switch [ checked = true, label = "Wi-Fi" ]
Docs: Switch · Paint and themes
Watch for: a subclass of Switch that reads its own width for the pill: the pill is now narrower than the control when it has a label.
A DataSource's error on screen → the program's own words, chosen by failure
A production app shows a person no words the platform wrote. error is the platform's account
of a failure for a developer; in a production build it is now a code with its values, which
declare-help turns back into the sentence. What a person reads is the program's own words,
chosen by failure: why the request failed, as one of a closed set.
notice: Text [ visible = { app.weather.failed }, text = { "Couldn't load: " + app.weather.error } ]
notice: Text [ visible = { app.weather.failed },
text = { app.weather.failure == "offline" ? "You're offline." : "The forecast didn't load." } ]
Docs: DataSource.failure · Data
Watch for: a development build still shows the sentence, so the change shows only in a production build.
New
- A layout says its content length.
place()may return{ boxes, contentWidth }(or
contentHeightalong a column), the view's content size worked out from what its children
bring before the room is applied;nullsays it has none (aResponsiveLayout). A layout
that returns bare boxes leaves the content size to what it draws, as before.SimpleLayout
reports it when it flexes or shrinks a child,WrappingLayoutone row's length. Segmented'ssegmentWidths:equal(the default), every segment as wide as the
widest label needs, orproportional, each as wide as its own.Switch [ label = "Wi-Fi" ]: shown, part of what a press reaches, and its name to a
screen reader. The words come first and the switch after them, every platform's order for a
switch; given a wider width the switch keeps to the trailing edge, so a full-width labeled
switch is a settings row. Its focus ring circles the switch alone.- A
Buttoncuts its label inside its margins when given a width narrower than its words,
with an ellipsis and the whole label as its accessible name; verify reports a label cut short. Text.truncatedreports a last line cut short with an ellipsis, not only lines dropped
pastmaxLines, and aTextLabelhas it too.drive.call(path, method, …args)in a verify script calls a method on a live node and
returns its result: the way to test a model's rules directly. It goes around the controls, so
it says a rule is right, not that a person can reach it; the verdict counts calls apart from
input.expect(value).toMatchObject(…)joins the value matchers.- verify reports text cut short or spilling: a control's own words cut short, and text
drawn past the view it sits in when that view has a ground or the text lands on a neighbor.
Smaller changes
- A rule that closes an
existsgate while the views under it come in, or while a list
attaches its new rows, no longer attaches into the removed parent (it threw
"Cannot read properties of null (reading 'insertChild')"). - The dev server recom...
v0.7.0 — one name for each thing, colors as values, and data reads that are checked
0.7 is a naming release. Every name the platform puts in a program's scope is now
capitalized and is one of four kinds: a class (Button), a type (Stroke,
Color, Easing), a service (Clipboard, Keyboard) or a theme (SanFrancisco).
The platform adds no lowercase names of its own, so every lowercase word in a program is the
program's. Where the platform builds or works on a value, it does so through the value's
type: Stroke(1, red), Gradient.linear(…), VisualFilter.blur(3), Easing.steps(4),
Color.mix(a, b, 0.5).
card: View [ width = 160, height = 90, cornerRadius = 12,
fill = { Gradient.linear("90deg", Gradient.stop(0, #2E6FE0), Gradient.stop(1, #7B4FE0)) },
stroke = Stroke(1, #1D3F86), shadow = Shadow(0, 2, 10, #00000033),
visualFilter = [VisualFilter.blur(0)] ]
Alongside it, a pass over names that read like something else: a change is handed back to
commit(v) on every class that hands one back, every overlay opens with show, showFor and
showAt, a replicated record's identity is identityKey, and abbreviations are spelled out.
A Color is now one thing, a number in the runtime's encoding, and two colors compare with
==. Text becomes a color only where the program says so, with Color.from(s), and
Color.hex(c) turns one back into text. Data schemas keep JSON's field types, so a color in
data is a string like any other.
A :path read inside { } now has its field's type, so :done * 2 or a string headed for a
color is refused where it is written. And change handlers hear every change in a settle: a
settle runs in rounds, and nothing paints until a round assigns nothing.
The flagship calendar is 177.9 KB gzipped at this tag.
Breaking: 28 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
stroke(…), shadow(…) and the gradient builders → on their types: Stroke(…), Shadow(…), Gradient.linear(…)
A builder belongs to the type it builds, and is spelled the same in a bare value and inside
{ }. gradient, radialGradient, conicGradient and colorStop are now Gradient.linear,
Gradient.radial, Gradient.conic and Gradient.stop.
Find: /(?<![\w.$])(?:stroke|shadow|gradient|radialGradient|conicGradient|colorStop)\(/
card: View [ width = 120, height = 80, stroke = stroke(1, #1D3F86), shadow = shadow(0, 2, 8, #00000033),
fill = { gradient("90deg", colorStop(0, #2E6FE0), colorStop(1, #7B4FE0)) } ]
card: View [ width = 120, height = 80, stroke = Stroke(1, #1D3F86), shadow = Shadow(0, 2, 8, #00000033),
fill = { Gradient.linear("90deg", Gradient.stop(0, #2E6FE0), Gradient.stop(1, #7B4FE0)) } ]
Docs: Paint and themes · Stroke · Gradient
Watch for: a drawing's own d.stroke() and d.shadowBlur are the canvas context's and keep their names. The lowercase names are free for a program's own members.
The filter builders → VisualFilter.blur(…) and the rest; ImageFilter and FilterList → VisualFilter
Each filter is built through its type, as a stroke or a gradient is: VisualFilter.blur,
.brightness, .contrast, .saturate, .grayscale, .invert, .sepia, .hueRotate,
.colorize and .frost. The types ImageFilter and FilterList are one name, VisualFilter
(and VisualFilter[]), as the attribute is visualFilter.
Find: /[=\[,(]\s*(?:blur|brightness|saturate|grayscale|invert|sepia|hueRotate|colorize|frost)\s*\(|:\s*(?:ImageFilter|FilterList)\b/
card: View [ width = 120, height = 80, fill = #2E6FE0, visualFilter = [blur(4), brightness(0.8)] ]
card: View [ width = 120, height = 80, fill = #2E6FE0, visualFilter = [VisualFilter.blur(4), VisualFilter.brightness(0.8)] ]
Docs: Paint and themes · View.visualFilter
Watch for: a CSS filter string a drawing hands its context (d.filter = "blur(4px)") is the canvas's own and is unchanged.
The easing builders → Easing.steps(…) and the rest; EasingCurve → Easing
steps, cubicBezier, back and laszlo are built through Easing, and a built curve and a
named one (quadOut) are one type, Easing: easing = quadOut and easing = { Easing.steps(4) }
are values of the same type.
Find: /(?<![\w.$])(?:steps|cubicBezier|laszlo)\(|:\s*EasingCurve\b/
spin: Animator [ attribute = rotation, to = 360, duration = 800, easing = { cubicBezier(0.2, 0, 0, 1) } ]
spin: Animator [ attribute = rotation, to = 360, duration = 800, easing = { Easing.cubicBezier(0.2, 0, 0, 1) } ]
Docs: Motion · Easing
Watch for: back(…) is Easing.back(overshoot); it is not searched for here, since back is a common word.
colorWithAlpha(c, 0–255) → Color.withAlpha(c, 0–1); activeTone retired
A color's operations live on Color, and alpha is written as CSS writes it, from 0 to 1: the
old alpha divided by 255 (255 → 1, 128 → 0.5, 90 → 0.35, 64 → 0.25, 40 → 0.16). Beside
it: Color.mix(a, b, t), Color.lighter(c, k) and Color.darker(c, k) (in OKLCH),
Color.contrast(a, b) (the WCAG ratio) and Color.components(c). activeTone(accent, surface)
was a mix: it is Color.mix(surface, accent, 0.22).
Find: /\b(?:colorWithAlpha|activeTone)\s*\(/
veil: View [ width = 200, height = 120, fill = { colorWithAlpha(app.accent, 128) } ]
veil: View [ width = 200, height = 120, fill = { Color.withAlpha(app.accent, 0.5) } ]
Docs: Paint and themes · Color
Watch for: the alpha's scale. A value carried over unchanged (128) is far past 1 and is held at fully opaque; divide it by 255.
hostProvided(name, fallback) → app.hostProvided(name, fallback)
A value the host provides is the program's, the same from every node, so it is read from the
App. afterDelay, afterSettle and providedTextStyle are now methods of every node, so a
bare call in a body is unchanged, and row.afterDelay(…) works too.
Find: /(?<![\w.$])hostProvided\s*\(/
App [ program: string = { hostProvided("program", "") } ]
App [ program: string = { app.hostProvided("program", "") } ]
Docs: Embedding
Focus [ … ], Tooltips [ … ] and Keyboard [ … ] listeners → facts
What these relayed is now a fact to read: app.focusedView (the focused view, or null),
View.containsFocus (true while the focus is on the view or anything inside it),
app.focusGeometry (the focused control's outline) and app.tooltipRequest (the tooltip a
view is asking for). A fact is read by a constraint and heard by onChange. Focus and
Keyboard remain services (Focus.focus(v), Focus.holds(v)), not classes to place.
Find: /\b(?:Focus|Tooltips|Keyboard)\s*\[/
panel: View [ width = 240, height = 120,
Focus [ onFocusChange(v: View) { app.panel.lit = Focus.holds(app.panel) } ],
lit: boolean = false, fill = { this.lit ? #EEF4FF : #FFFFFF } ]
panel: View [ width = 240, height = 120, fill = { this.containsFocus ? #EEF4FF : #FFFFFF } ]
Docs: App.focusedView · View.containsFocus · Pointer and keyboard
Numerals → NumeralStyle (and numerals → numeralStyle); Axis → LayoutAxis
The shape of the digits pairs with numeralWidth; a layout's axis type is named for layouts,
leaving Axis free for a chart's. axis = y is written as before. Percent is internal: it
is how 50% is held, not a name a program writes.
Find: /\bnumerals\s*=|:\s*(?:Numerals|Axis|Percent)\b/
total: Text [ numerals = oldstyle, text = "1,234" ]
total: Text [ numeralStyle = oldstyle, text = "1,234" ]
Docs: Text
A color in a data schema → a string, read with Color.from(s)
A data schema's field types are JSON's: string, number, boolean, any, a schema, a literal union
or a nested record. A field typed Color is refused, as one typed Length is. A color in data
is text like any other, and becomes a color where the program says so: Color.from(s) reads
"#RGB", "#RRGGBB" or "#RRGGBBAA" (or gives null), and Color.hex(c) writes one back.
Find: /schema\s+\w+\s*\[[^\]]*:\s*Color\b/
schema Label [ name: string, tone: Color ]
schema Label [ name: string, tone: string ]
Docs: Schemas · Color
Watch for: a string in a color slot is refused with the fix, Color.from(s). A record built by
the program with a color in it holds the text the service expects: Color.hex(c).
Change handlers hear every change in a settle
A settle runs in rounds: constraints come to rest, then afterSettle steps, then change
events, and whatever a step or handler assigns is settled in the next round. Nothing paints
until a round assigns nothing. A handler is told, each round, every tracked value that differs
from what it was last told. Before, a handler heard each value once per chain, so a second
change in the same settle (a focus that moved twice) was missed.
App [ query: string = "", trackChanges = ["query"],
onChange(name: string) { app.query = app.query.trim() } ]
App [ typed: string = "", query: string = { app.typed.trim() } ]
Docs: Constraints
Watch for: a handler that assigns a value it tracks is refused at compile time wh...
v0.6.10 — a popover is never modal, Return goes on only when nothing answered it, and a click focuses what it lands on
A Popover now behaves the same on every screen: a press outside closes it and goes on
to what was pressed, the page behind stays where a screen reader reaches it, and in the Tab
order it sits right after what opened it. What must be finished before anything else is a
Sheet or a Dialog.
Return from a text field goes on to what holds the field — a dialog's default button, a
row's Save — only when nothing answered it: a field in a Form, or one whose
onEnter says what Return does, has answered it, and a key binding further out no
longer hears it too.
name: TextInput [ accessibilityLabel = "Name", onEnter() { app.rename(this.value) } ]
A press on a view that is focusable = true now gives it the focus, as the guide's own
examples always assumed: click a canvas-like editor, and its key bindings answer.
The flagship calendar is 171.4 KB gzipped at this tag.
Breaking: 2 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a Popover was modal on a phone → it is never modal
On a narrow screen a popover used to show as a sheet over a scrim: a press outside only
closed it, and the page behind was out of reach. It still shows as a sheet there, but it is
not modal: a press outside closes it and goes on to what was pressed, as on a desktop.
What must be finished before the person goes on was never a popover's job; it is a sheet's,
modal on every screen.
confirm: Popover [ anchorTo = { app.payButton },
Text [ text = "Pay $40?" ],
Button [ label = "Pay", primary = true, onClick() { app.pay(); app.confirm.close() } ] ]
confirm: Sheet [
Text [ text = "Pay $40?" ],
Button [ label = "Pay", primary = true, onClick() { app.pay(); app.confirm.close() } ] ]
Docs: Popover
Watch for: a popover whose content must be finished, or dismissed on purpose, before the
person goes on — on a phone that was a modal sheet. Make it a Sheet or a Dialog.
Return went on after a field answered it → it goes on only when nothing did
A field's Return used to run its onEnter and then go on through the key bindings around
it, so a field in a form submitted the form and an App's Enter binding ran as well; a
field whose onEnter did its own thing still set off the binding further out. Now the key
goes on only from a field outside a form whose onEnter is the built-in one.
App [ keyBindings = { [ ({ key: "Enter", command: "save" }) ] }, save() { app.store() },
name: TextInput [ onEnter() { app.check(this.value) } ] ]
App [ keyBindings = { [ ({ key: "Enter", command: "save" }) ] }, save() { app.store() },
name: TextInput [ onEnter() { app.check(this.value); app.save() } ] ]
Docs: TextInput.keyBindings
Watch for: an Enter binding on a container that a field with its own onEnter, or a field
in a form, used to set off too — it no longer hears that Return; do both in onEnter. A
Combobox follows the same rule: outside a form, with a choice made, Return goes on.
Smaller changes
- A press on a
focusable = trueview focuses it, once the press is through: a control,
a field or a link that focuses itself keeps that, and a command button keeps the focus
where it was, so its command reaches the focused view. - Tab leaves a
MenuBar's titles for the next control, and Shift-Tab comes back. - A button's menu offers commands for the view the focus is on: a row bound by
something further out is live, not greyed, while the menu is open. - A focused row removed from its list leaves its place: the next Tab goes on from where
it stood. A row deleted from its own confirm dialog hands the focus to the row after it. - A view with a
linknever covers what paints above it: a menu or popover over a link
takes its own clicks. - Escape in an editor inside a grid's or list's cell cancels the edit and leaves the
cell, by the cell group's own default, so an override further in still comes first. Focus.next(past)andFocus.prev(past)are in the type scaffold.declare-verifysays when Tab goes back against reading order — to a control above,
or left of it on the same row — naming both and the fix: declare them in the order they
are read, or say the order in their container'stabOrder(). Overlays and bars held over
the page (ignoreScroll) are their own business.
v0.6.9 — a grid holds its own header, a range takes two thumbs, and a combobox takes a new name
A DataGrid's header row is now the top of the grid's own box, pinned there while the
rows scroll up under it — so a grid placed by a layout covers nothing beside it. What the
Ledger builds made by hand is now in the library: a RangeSlider for a range on one
track, a Combobox that offers what was typed as a new item (creates), grid cells
that commit once on Enter and go to a service through editInput, and a
Stepper you can type a number into.
amount: RangeSlider [ min = 0, max = 500, step = 5, accessibilityLabel = "Amount",
low = { app.lo }, high = { app.hi },
commit(low: number, high: number) { app.lo = low; app.hi = high } ]
Hold ⌘ (Ctrl elsewhere) a moment, and a program that labels its key bindings shows them: the
ShortcutsPanel comes with the library, the keys spelled as the person's keyboard spells
them.
The flagship calendar is 171.3 KB gzipped at this tag.
Breaking: 1 change to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a DataGrid's header stands above its box → it is the top of the box
The header row used to paint above the grid, in the space before it, so a grid needed room
left above it — and in a layout it covered whatever came before. It is now inside the box:
the grid's height is its header and its rows.
grid: DataGrid [ x = 20, y = 50, width = 400, height = 130, items = { app.rows },
columns = { [ { id: "title", title: "Title", width: 240 } ] } ]
grid: DataGrid [ x = 20, y = 20, width = 400, height = 160, items = { app.rows },
columns = { [ { id: "title", title: "Title", width: 240 } ] } ]
Docs: DataGrid.headerH
Watch for: a grid placed with room left above it for its header now shows a gap there, and
its rows start lower; move it up by the header's height (gridHeaderHeight, 30) and make it
that much taller. A wrapper whose top padding made room for the header no longer needs it.
Smaller changes
- A press into a
Combobox's field opens its list, as a select does — on a phone, the
choices show before a word is typed. Tab arriving stays quiet. - A boot failure inside the library names where in the program it happened —
while working out Dataset.contents at app.when._pop.cal._model— so the use site whose values
to check is in the message, not only the library's lines. - A press of the pointer ends a ⌘ hold: a ⌘-click or a ⌘-drag never shows the
shortcuts panel. Keyboard.shortcutsInForce()records carrykeyLabel, the key as the platform spells it.- A
DataGridcell class shared by several columns reads which it is in as
provided("column")—{ id, title }. - A failed
expect.requestnames what came closest — the same call with another body,
then the same verb — and counts the rest, rather than listing every request of the run.
v0.6.8 — a failure says why, a silent request gives up, and a save is never lost to a closing sheet
A request that fails now says why, from one closed set — and so whether a write went
through. failure is rejected when the server said no (nothing was done),
unreadable when it said yes but its reply couldn't be read (it was done), and timedOut,
networkError, offline or serverError when no answer came (unknown — check before
sending it again). onError reads it to choose: try a read again, report a refusal.
feed: DataSource [ url = "/api/feed", timeout = 20,
onError() { if (this.failure == "timedOut" || this.failure == "networkError") afterDelay(5000, () => this.fetch()) } ]
A request that goes silent — no connection, no reply, a gap in a reply that is arriving —
for timeout seconds is given up, so nothing waits forever and a form's pending
always ends. A Form says what a failure means for what it sent: "may or may not have been
saved" when no answer came, "that went through" when the reply couldn't be read. And while
a form inside a sheet, a dialog or a window is sending, the overlay's own ways of closing —
Escape, a press outside, a swipe — wait for the answer, which would otherwise land nowhere.
Live connections get the same vocabulary, and a retry that behaves: a Socket or
EventStream gives up a connection that never opens (connectTimeout) or has gone
silent (idleTimeout), names a WebSocket's closeCode, doesn't ask again after a
refusal, waits longer after each failure in a row, and dials at once when the network
comes back.
The flagship calendar is 171.0 KB gzipped at this tag.
Breaking: 3 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a request that goes silent waits forever → it gives up after timeout seconds
A DataSource request with nothing arriving for 60 seconds now fails with failure = timedOut. A long poll, a large upload or an endpoint that thinks for minutes says how long
it may take.
report: DataSource [ url = "/api/report", method = "POST", body = { { year: 2026 } } ]
report: DataSource [ url = "/api/report", method = "POST", body = { { year: 2026 } }, timeout = 300 ]
Docs: DataSource.timeout · DataSource.failure
Watch for: a request that used to succeed after more than a minute of silence now fails;
timeout = 0 waits without limit. A page cannot see an upload's progress, so a write's
wait includes sending its body.
a Form's failedMessage for every failure → a message for what the failure means
A form whose send got no answer says uncertainMessage ("may or may not have been
saved"), one sent while offline offlineMessage, and one the server took but whose reply
couldn't be read unreadableMessage. failedMessage is said when nothing was sent, or the
server refused without saying why.
f: Form [ failedMessage = "Couldn't save the entry." ]
f: Form [ failedMessage = "Couldn't save the entry.",
uncertainMessage = "No answer came back — check the list before saving again." ]
Docs: Form.uncertainMessage
Watch for: a form that set its own failedMessage shows the library's wording when the
network fails or a request times out; set the new messages in the program's words too.
a stream's retry waits the same each time → the wait grows, and a refusal isn't retried
retry is now the first wait: it doubles after each failure in a row, to a minute, and
starts over once a connection has stayed open. A refusal — a WebSocket's policy close, an
event stream's 4xx, a reply that is not an event stream — is not retried. A connection that
doesn't open in 30 seconds is given up.
live: Socket [ url = "wss://api.example.com/feed", retry = 2 ]
live: Socket [ url = "wss://api.example.com/feed", retry = 2, connectTimeout = 10, idleTimeout = 45 ]
Docs: Stream.retry · Stream.failure
Watch for: a stream that relied on retrying every few seconds through a long outage now
retries less often; one whose server refuses it now rests at failed. Read closeCode in
onClose for an application's own codes (4000–4999), and turn active off there to stop.
Smaller changes
- A
Controltakes its Space, Enter and arrows only while it has the focus. Since 0.6.7
they were bindings, and a key from a view inside a clickable control — Enter in a field in
a row — pressed the control. - Escape in an editor entered inside a list or grid reaches what the row holds, then the
list's own Escape, before it leaves the row; it left the row first. - A DOM focus on a view first shown after it was built — a screen reader's, a test
script's — reaches the focus service; the view's keys never reached it. - Only
layout = nullturns an inherited layout off: any other class-typed attribute set
at a use site (restoresFocusTo, a program's owneditor: Editor?) did, silently. - An override written at a use site inside another class may read through its own
classroot; it was refused (DECLARE7001) with a message pointing into the library. - A
DataGridrow with no record builds no cell over a null record: a cell class
reading its record crashed when filters left no rows. - A
DataSourceremoved while its write is in flight says so in development: the write
may be carried out, but its answer is lost. A read is stopped; a write superseded by a newer
fetch()is no longer stopped (stopping it would not un-send it). - A 304 keeps the value a source had; an empty 2xx is a
nullvalue, not a failure. - Docs: a
DataGrid's header stands above its box; a field'sonKeyDownhears Return only
afteronEnterhas run.
v0.6.7 — a drag is a gesture of its own, and a key walks outward
A drag is what a press becomes when it wanders, as a click is what it becomes when it stays
put — and a press is now one or the other, never both, with nothing reported as a drag until
it is one. Three events say it: onDragStart, onDrag, onDragEnd. Declaring any of them
claims the gesture, so on a phone a finger moving on the view drags it instead of scrolling
the list it sits in. onPointerMove goes back to meaning what it says: every move of the
pointer over the view, hovering included.
card: View [ startX: number = 0,
onDragStart() { startX = x },
onDrag(e: PointerEvent) { x = startX + e.deltaX },
onDragEnd(e: DragEndEvent) { if (e.canceled) x = startX } ]
A view that takes no clicks drags from the moment it is pressed; one that also takes clicks
(onClick, onDblClick, onHold, a link) drags once the press has wandered a few
pixels, so a tap stays a tap. Escape and the window losing focus end a drag canceled.
A key goes to the focused view and then outward, through each container to the App, and the
first view that binds it takes it — so a focused slider's arrows come before an App's, and a
field that binds Tab gets Tab. A view says which keys it answers with keyBindings: records
naming a key and the method it runs. The library's controls answer theirs the same way, so a
use site's own bindings add to a Button's Space and Enter rather than replace them. A
command returns false to hand the key on. Menus and buttons run commands the same way:
command: "bold" on a menu item or a Button walks from where the person was working, so
Edit › Copy and ⌘C reach the same view, and an item no view answers is greyed.
editor: View [ focusable = true,
keyBindings = { [ ({ key: "Ctrl+B", command: "bold", label: "Bold" }),
({ key: "Escape", command: "clearAndPass" }) ] },
bold() { app.bolded = !app.bolded },
clearAndPass() { app.query = ""; return false } ]
Keys are spelled the Windows way — "Ctrl+S" is ⌘S on a Mac, Ctrl+S elsewhere — and the
Mac's glyphs ("⌘S") still mean the same.
The flagship calendar is 169.8 KB gzipped at this tag.
Breaking: 4 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a drag in onPointerMove → onDragStart, onDrag, onDragEnd
onPointerMove now hears every move, hovering included, and claims nothing; a drag is its
own resolved gesture.
handle: View [ startX: number = 0,
onPointerDown(e: PointerEvent) { startX = x },
onPointerMove(e: PointerEvent) { x = startX + e.deltaX },
onPointerUp(e: PointerUpEvent) { if (e.canceled) x = startX } ]
handle: View [ startX: number = 0,
onDragStart(e: PointerEvent) { startX = x },
onDrag(e: PointerEvent) { x = startX + e.deltaX },
onDragEnd(e: DragEndEvent) { if (e.canceled) x = startX } ]
Docs: Dragging · View.onDragStart · View.onPointerMove
Watch for: an onPointerMove that moves something now does so on hover too, and on a phone
the view no longer takes the finger, so the page scrolls instead. A subclass of Slider,
Switch, Splitter, Carousel, Sheet or DataGrid that overrides its pointer handlers:
their drags are the drag events now. A view that also takes clicks starts its drag a few
pixels into the press (the Slider, Switch and Splitter among them), and a mouse press
on a control inside a draggable view becomes that view's drag once it wanders, not once it
leaves the control.
Tab reaches the focused view's onKeyDown
Tab used to move focus before any handler saw it. It now arrives like any key, and moves
focus when it is handed on — an onKeyDown that takes the keys it wants and hands the rest
to super.onKeyDown(e) keeps Tab working; one that hands nothing on now stops Tab at the
view.
search: TextInput [
onKeyDown(e: KeyEvent) {
if (e.key == "Escape") app.query = ""
} ]
search: TextInput [
onKeyDown(e: KeyEvent) {
if (e.key == "Escape") app.query = ""
else super.onKeyDown(e)
} ]
Docs: Key bindings · View.onKeyDown · View.keyBindings
Watch for: DECLARE4031 now warns on any view's onKeyDown that never calls super, not
only a Control's. A view that means every key — a game, a terminal — says
takesAllKeys = true.
Keys → KeyListener and Keyboard
The keyboard's member and the keyboard you ask now have a name each: a KeyListener hears
every key down and up, and Keyboard answers isDown, held and shortcutsInForce.
keys: Keys [ onKeyDown(e: KeyEvent) { if (Keys.isDown("ShiftLeft")) app.fast = true } ]
keys: KeyListener [ onKeyDown(e: KeyEvent) { if (Keyboard.isDown("ShiftLeft")) app.fast = true } ]
Find: Keys [ · Keys.isDown · Keys.held · Keys.shortcutsInForce · Keys.navClaim
Docs: KeyListener · Keyboard
Watch for: a class that extends Keys extends KeyListener now; Keyboard is no tag or base.
"Ctrl" in a shortcut's key means the command key
Shortcuts and keyBindings spell keys the Windows way: "Ctrl+S" is ⌘S on a Mac. A Mac's
own Control key is "MacCtrl".
keys: Shortcuts [ items = { [ ({ id: "t", key: "Ctrl+T", label: "Terminal" }) ] } ]
keys: Shortcuts [ items = { [ ({ id: "t", key: "MacCtrl+T", label: "Terminal" }) ] } ]
Docs: View.keyBindings
Watch for: a key written with Ctrl that meant the Mac's Control key — it now fires on ⌘.
Smaller changes
- A focused control's own keys come before any App shortcut of the same key: an arrow
Shortcutson the App no longer takes the arrows from a focused slider. - Escape in a dialog's field cancels the field's edit first; the next Escape closes the
dialog. One Escape closes the overlay nearest the focus. - An arrow a focused view doesn't take scrolls the scroller around it, and a scroller at
its edge hands the key on to the one outside it. - On the Mac host a program's bindings get ⌘ chords before the host's menu — ⌘F, ⌘L and
the rest — except ⌘Q, ⌘W, ⌘H and ⌘M; Escape typed in a native field reaches the program;
⌃T and ⌃D are debug builds' only. - The hold-⌘ panel lists labelled key bindings with the shortcuts.
- New warnings: a binding whose command names no method (DECLARE4037), a key no press can
match (DECLARE4038), the clipboard's keys taken from the platform (DECLARE4039), a standard
key bound on the App withouteverywhere(DECLARE4040). - A second finger during a press is not a press. It used to take the press: the view
under it clicked mid-drag, and the drag heard nothing more. - Edge scrolling moves a pane only once a drag has travelled toward its edge — a slider
dragged sideways near a pane's bottom used to scroll the pane away — and reaches the pane
the drag is carried into and, past the end of one, the pane around it. - On the canvas backend a pane inside a draggable view scrolls by touch, as on the DOM
backend, and a row that drags sideways in a list no longer stops the list scrolling. - The Mac host sends the secondary and middle buttons as themselves, and right-click
and Control-click openonContextMenu; a right-click used to be a left press that never
ended. - A view reached through an argument the compiler cannot name stays live: a method
reading a view's attribute through a parameter passed a? :or a local went stale. - Media seeks under
declare-verifyland as on a real server. - Tools:
--semanticsnames headings;__declare.evaluate(expr)takes one argument;
__declare.stale()lists constraints whose value has gone stale; a press that follows a
link out of the program says so; a list written bare that reads a value says to brace it;
declare-helplistsfocusRingColorand View'saccessibility…attributes. - Docs, each established by experiment: over and out belong
to the topmost view; a drawing is not clipped and its text never wraps;Dataset.set
lands in place;Focus.focusscrolls its target into view; a disabled control still
covers what is beneath it;existskeeps its view while its condition holds.
v0.6.5 — three-part versions again, wrapping without a width, clearer checks
v0.6.4.1 numbered a release with a fourth part, and npm reads package.json's version as
semver, which has three: after npm install, npx declare-help, declare-verify and the
other tools stopped with "Invalid Version". This release returns to three parts, and carries
what building Ledger and Conduit (RealWorld) turned up.
The flagship calendar is 164.4 KB gzipped at this tag.
Breaking: 1 change to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a WrappingLayout with no width stacks its children → lays them in one row
A view whose width comes from what it holds has no edge to wrap at, so it stacked every child on a row of its own; it now lays them in one row, as wide as they are.
pages: View [ layout: WrappingLayout [ spacing = 4 ],
View [ width = 30, height = 30 ], View [ width = 30, height = 30 ] ]
pages: View [ width = 100%, layout: WrappingLayout [ spacing = 4 ],
View [ width = 30, height = 30 ], View [ width = 30, height = 30 ] ]
Docs: WrappingLayout
Watch for: a row of tags, page numbers or words that used to stack now runs across, and may run past the edge of what holds it; give the view a width (width = 100%) for it to wrap there.
New
A control's onClick and onPointerDown take the event at any override, in a class or
where it is used: onClick(e: PointerEvent) says where the click landed, in the control's
own coordinates. Before, only a subclass could, and an override where the control is used
was refused as an incompatible signature.
Smaller changes
- A method that writes an attribute its own element binds with a constraint is refused where
it is written:value = { src }besidecommit(t) { value = t }compiled, and threw at the
first keystroke. The message names the form that does what was meant — a declared attribute
that starts from the same value (edited: string = { src }), withvalue = { edited }.
It found the same mistake, left by 0.6.0's migration, in the homepage's and the docs'
live examples, the sampler's rename field and the source viewer's editor, all of which
threw as soon as someone typed; they take edits again. - A program method named like a built-in (
split,find) no longer makes the library's own
call of that built-in refused: aDatePickerin a program with asplit()method reported
DECLARE7001 at a line inside the library. - Focus given back to a container when the focused view goes away (a cell's editor closing on
Return) shows the keyboard ring only if the focus that went away showed it. - Overriding a child's method where an element is used (
remove.press() { … }) is refused
with a message that says so, and names the two ways to write it, instead of the rule for
attributes and a parse error after it. link's reference says plainly which links the build checks: a name ashowsor an
anchordeclares; one with a/in it is a location the program parses, which the crawl
checks.- declare-verify: a behaviour script runs in the laptop window rung 4 boots in (1280×800)
unless it exports a device; a path written with a class name (app.main.HomePage) is told
which child that is (0);expect.textno longer says a row's words twice; and a locator
that matched nothing while motion was in flight says motion may be why, rather than that it
is.
v0.6.4.1 — choices of your own, styled tags, the clipboard
The first step release, between patches. Most of it comes from a day of building apps with
Declare and fixing what they ran into: a choice control you draw yourself, rich text whose
tags take your own styles, copy and paste at any view, and a text field that sits on its
label's baseline. Two refusals are new, each for code that compiled before and drew
something other than what it said.
The flagship calendar is 164.4 KB gzipped at this tag.
Breaking: 2 changes to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a null fontFamily → provided("fontFamily")
A family has no null meaning: null drew the browser's default serif, not the face from above, so the face from above is now read by name.
Find: /\bfontFamily\s*=\s*{[^}]*\bnull\b/
Text [ text = "Title", fontFamily = { app.big ? "Georgia" : null } ]
Text [ text = "Title", fontFamily = { app.big ? "Georgia" : provided("fontFamily") } ]
Docs: View.fontFamily
Watch for: codeFamily keeps null, which is its own default, the house monospace face.
a width on a flexing child of a WrappingLayout → minWidth, or a child that does not flex
A wrapping run gives a flexing child its width along the row, so a width written beside flexes was never the width it got; it is now refused at its line.
View [ width = 400, layout: WrappingLayout [ spacing = 6 ],
View [ flexes = true, width = 80, height = 30 ] ]
View [ width = 400, layout: WrappingLayout [ spacing = 6 ],
View [ flexes = true, minWidth = 80, height = 30 ] ]
Docs: WrappingLayout · View.flexes
Watch for: for a fixed width, take flexes off the child; a class that flexes (a Spacer) cannot be given one.
New
ChoiceControl and ChoiceItem make a choice among several, drawn entirely as your own.
ChoiceControl holds value for one of several, or values with multiple = true for
several at once, either bound with <->. Its direct children that are ChoiceItems are the
options: each has a choice, knows whether it is on, and chooses itself when pressed. The
control is one Tab stop, the arrows move between the options, and a screen reader hears a list
of options. RadioGroup and Radio are now these two with the radio look, unchanged for
programs that use them.
ChoiceControl [ value <-> app.size, layout: SimpleLayout [ axis = x, spacing = 4 ],
ChoiceItem [ choice = "S", width = 40, height = 32, cornerRadius = 6,
fill = { on ? "steelblue" : "gainsboro" }, Text [ x = center, y = center, text = "S" ] ],
ChoiceItem [ choice = "M", width = 40, height = 32, cornerRadius = 6,
fill = { on ? "steelblue" : "gainsboro" }, Text [ x = center, y = center, text = "M" ] ] ]
tagStyles gives each element of rich text a style of your own. <b>, <i>, a link or
a heading in loaded HTML or Markdown could only ever look bold, italic or underlined, because
a textStyles entry matches a span's class, never a tag. Now
tagStyles = { { strong: "Figure", link: "Ref", h2: "Section" } } names, for strong, em,
strike, code, link, quote and h1–h6, a style from the palette or a top-level style. Nested
tags compose: <b><i> wears the strong style, then the em style over it.
Copy, cut and paste at any view. ⌘C, ⌘X and ⌘V, and the Edit menu, go to the focused
view if it declares onClipboardCopy, onClipboardCut or onClipboardPaste, or else to its
nearest ancestor that does. The clipboard holds one thing in several representations, by MIME
type: a copy puts as many as it likes, and a paste reads the best one it understands.
Clipboard.copy(text) writes from a button. A focused text field keeps the clipboard for
itself, as before.
board: View [ focusable = true,
onClipboardCopy(e: ClipboardEvent) {
e.put(app.selected.title)
e.put("application/x-card", JSON.stringify(app.selected))
},
onClipboardPaste(e: ClipboardEvent) {
const card = e.get("application/x-card")
app.add(card !== null ? JSON.parse(card) : { title: e.text })
} ]
textAlign on rich text. HTMLText and Markdown center or end-align their paragraphs
and headings: start, center, end, left or right.
A text field has a baseline. TextInput declares where its line sits, so a label and a
field in a row with align = baseline share one line, on the web and on the Mac.
Smaller changes
- A hidden child that flexes keeps the size its layout last gave it. Hiding one released it to
its content's size, and a screen sized from its own content could re-run without end. [*]followed by a name replicates the records::columns[*].items[]is every item of every
column, not one empty instance per column.- A link built as
base + "#comments"is that URL's fragment, no longer refused as an unknown
anchor in the app. Media.playingno longer echoes the element's own play and pause reports back to it, a loop
that could freeze the page.- An editable that grows from one line to several keeps its focus, and reports no blur.
- On the Mac, rich text draws
black,extrabold,thinandextralightat their weights. - A
Sheet's content scrolls inside it when taller than the sheet. - The checker: a child 0 wide in a
columnsgrid is named, withflexes = trueas the cure; a
program outside the Declare tree is served whole, with its data files, and a request it makes
that fails is named; a locator'sfillsets a value in one input event, as a paste does. - DECLARE4022 and DECLARE4026 keep the controls you drew, pointing to
ChoiceControl;
DECLARE4036 reports aChoiceItemoutside aChoiceControl. declare-helpanswers each name when given several, and a namespace member.- The guide: a custom control written start to finish (chapter 17), fitting a line to its room
withmeasureText(chapter 12), and copy and paste (chapter 9).
v0.6.4 — a layout goes with the children it is written with
This release undoes 0.6.3's breaking change, which was a mistake, and fixes the bug that
prompted it. A class that names a defaultPlacement (a Sheet, a Popover, a class of your
own) puts the children a subclass or a use site writes into the child it names, and a
layout: written with those children goes there too and arranges them. That was the rule
before 0.6.3, and it is the rule again. The class's own children keep the layout the class
gives them: that is the fix. Before 0.6.3 a layout written with the placed children took the
class's own layout with it, and the class's own children were left unarranged.
The flagship calendar is 163.2 KB gzipped at this tag.
Breaking: 1 change to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
a View around placed children for their layout → the layout: written with them
A layout: written with the children a class places arranges them where they go; 0.6.3 made it arrange the class's own children instead.
Popover [
View [ layout: SimpleLayout [ axis = x, spacing = 8 ],
Text [ text = "One" ], Text [ text = "Two" ] ] ]
Popover [ layout: SimpleLayout [ axis = x, spacing = 8 ],
Text [ text = "One" ], Text [ text = "Two" ] ]
Docs: View.defaultPlacement · View.layout
Watch for: nothing to change if you moved to 0.6.3 by wrapping your content in a View, which still works. A layout: you wrote under 0.6.3 to arrange a class's own children now arranges the children you placed instead.
Smaller changes
- A class with a layout of its own keeps it when a subclass or a use site writes a layout for
the children it places. A message row stacking its bubble above its time, whose subclass laid
out its own controls in a row, lost its column and drew the time over the bubble.
v0.6.3 — a layout belongs to the element it is written on
One rule, said plainly and now kept everywhere: an object has one set of children, arranged by
one layout. A layout: is the layout of the element it is written on, whether a class, a
subclass or a use site writes it. defaultPlacement moves children into a class's content
view, and only children; that view arranges them with its own layout. Since 0.6.0, a layout
written beside placed children moved into the content view instead, and a frame with a
layout of its own was left with none. That is the one breaking change. The rest are fixes.
The flagship calendar is 163.3 KB gzipped at this tag.
Breaking: 1 change to make — npx declare-changes app.declare lists the ones in your program.
Breaking changes
layout: beside placed children → a View with that layout around them
A layout: arranges the element it is written on; content a class places is arranged by the view it is placed in.
Popover [ layout: SimpleLayout [ axis = x, spacing = 8 ],
Text [ text = "One" ], Text [ text = "Two" ] ]
Popover [
View [ layout: SimpleLayout [ axis = x, spacing = 8 ],
Text [ text = "One" ], Text [ text = "Two" ] ] ]
Docs: View.defaultPlacement · View.layout
Watch for: a subclass of a class that names a defaultPlacement (a Sheet, a Dialog, a frame of your own) and writes layout: to arrange the children it adds. That layout now arranges the frame itself. Where the frame's own children state positions, boot says so ("the layout written on the … is …'s own"); where they don't, the frame rearranges without an error.
Smaller changes
- A form sends once. A second
submit()before the first has sent (two in one turn) does
nothing, as one whilependingdoes. Both used to reachsend(), so a form with a service
posted twice. TheFormreference also says whatsuperdoes inrefusal()and
refusedWith(). - A combobox keeps the focus. A row picked with the mouse left the focus on nothing, so the
next Tab started from the top. The focus stays in the field. declare-look --wait-real MSlets the program run live for real time, for what arrives on
the world's clock (a socket's or a service's timed messages).--waitsays it is the
program's own time, which is held between steps.- Docs:
app.keyboardHeightbeside the bar at the window's foot (Scrolling); a sign-in whose
fields say theirpurpose, in aFormthat sends through aDataSource, is offered for
saving by the browser's password manager (Accessibility).