Web Runtime 0.11.0
Release notes for Web Runtime 0.11.0.
10 changes — 8 features, 2 fixes
Minor Changes
-
#201
54ed098Thanks @dm-balakin! - A resizable editor's limits are now what it asks for. By default it opens at its size and only grows, without a maximum:minWidth/minHeightdefault to the opening size, andmaxWidth/maxHeighttoInfinity(which a config may also write). The limits, and the aspect ratio of an editor that scales (editor.keepAspectRatio, defaulttrue), are offered to hosts that ask and kept by the Standalone and the web host's handle; a host that sets a larger window or another shape regardless (Ardour) gets it, the minimum only held.editor.fitdecides what the UI does in such a window, for every resizable editor:'contain', the default, lays it out at most at its maximum (or, scaling, at its zoom, capped by the maximum) in the middle, with bands of the editor's background;'cover'lays it out over the whole window,viewSize().safeArea(anduseViewSize()) saying where the part it was made for is. The web host applies the same rules in?embed, where the page owns the size, and hides its handle where the limits allow no other size.soundor:uiaddseditorSize()andsubscribeEditorSize(), the editor's actual size in its own logical pixels, told once per change whoever resized it.EditorConfigis now a union that allowsfitonly withresizable: trueandkeepAspectRatioonly withresize: 'scale'(validation rejectsfit: 'cover'andkeepAspectRatio: trueelsewhere), and reports a maximum below the opening size;ResolvedEditorConfigalways has both, andDEFAULT_EDITOR_LIMITSis gone. In tests,testView.resize({ safeArea })sets the safe area andtestEditor.resize()the editor's size. -
#201
bffc8eaThanks @dm-balakin! -soundor:uigainsrequestEditorSize(width, height): plugin code asks for another editor size, any finite one, held to the editor's limits (and, scaling, its aspect ratio), which the host gives or not; it returns the size asked of the host, ornullwhere none can be;editorSize().resizablesays whether it can ask (false for a fixed editor and in?embed). Pointer events gainscreenX/screenY, the pointer on the screen in the editor's pixels, so a resize grip drawn by the UI measures its drag in units the resize does not change. The JUCE editor applies requests withsetSize()after the UI's code ran, telling the host, and keeps later requests to a minimum or maximum the host showed by giving another size in place of one asked for (Ardour's window), so a grip does not spring back at every step; the Web host resizes its viewport as its handle does. The test runtime simulates requests (testEditor.requests(),editor: { resizable, minWidth, …, aspectRatio, applyRequests }). An editor that scales keeping its aspect ratio is given the size at its ratio nearest to the one asked for, by a request or by the Web host's handle, whatever its size is, so a corner dragged narrower and taller no longer grows and shrinks in turn. The Basic and Orbit examples draw a grip of their own. -
#193
36e2599Thanks @dm-balakin! -editor.resize: 'scale'makes a resizable editor zoom rather than lay its UI out again: the UI stays laid out atwidth×height, and resizing draws it larger or smaller, keeping its aspect ratio (default limits: half and twice the size). In JUCE the editor offers its aspect ratio to the host (and keeps it in the Standalone), takes whatever shape a host that ignores it gives (Ardour) with the UI letterboxed in the middle, and draws the surface at the zoom, converting pointer, wheel, pointer lock and accessibility coordinates; in the web host the handle sets the zoom, andembedfills the iframe at the editor's layout.useViewSize()keepswidthandheightand reports the zoom inscale. The default,resize: 'layout', is unchanged. -
#206
2a5caa9Thanks @dm-balakin! - Focus rings that show only for the keyboard, and outlines to draw them with.node.focusVisible(soundor:ui) is CSS's:focus-visible: focus a pointer press gave is not shown until a key is pressed (not a shortcut nor a modifier on its own), focus moved by Tab, assistive technology or code after a key is, and a text input's always is. Every runtime decides it by the same rules, the web runtime too rather than by the browser's. Afocusvisiblechangeevent (React:onFocusVisibleChange) fires whenever it changes,FocusEvent.focusVisiblesays what it is, andpressable()'s state and React'sPressableStatehavefocusVisible. The new stylesoutlineWidth,outlineColorandoutlineOffsetdraw a line around a node as CSS'soutline: outside its border, following its corners, taking no room in layout and not hit, so a ring can appear without moving anything. -
#194
003c103Thanks @dm-balakin! - Support bundled SVG assets through Image with the existing content-addressed asset IDs and TypeScript imports. Native images cache bounded Skia SVG documents and render them at the effective physical resolution; Web images use the browser's image decoder. Preserve Image sizing and resize modes, with documented SVG intrinsic-size fallbacks and compatibility limits. -
#194
6a677acThanks @dm-balakin! - Add soundor:ui createSvg and the bounded, atomic SVG scene protocol v1. SVG roots are Yoga leaves with normal input and accessibility. Native scenes retain Skia geometry with shared path caching and damage tracking; Web scenes use native SVG elements. Add scene update, path parse and draw counters to native benchmark reports. This protocol requires engine 0.6.0 or later; React components follow through the existing React package. -
#186
96ef938Thanks @dm-balakin! -useViewSize()in@soundor/reactreturns the plugin view's{ width, height }in logical pixels and itsscale(device pixels per logical pixel), and re-renders when they change: the user resized the editor, a web host's embedding iframe changed size, or the view moved to a display of another density. It never re-renders for an unchanged size and does not poll. Underneath,soundor:uihassubscribeViewSize(listener), andviewSize()is now the same frozen object until the size changes, so the pair works withuseSyncExternalStore. The JUCE runtime tells subscribers once per change, on the editor's tick before the frame at the new size; the web runtime measures the view with theResizeObserverthat already updates hover, follows the page's pixel density and the host's scaling. In tests the view starts at the project's editor size, andtestView.resize()changes it; the simulatedviewSize()no longer throws. -
#186
9eac514Thanks @dm-balakin! - The web host opens the plugin view at the config'seditorsize (800×600 by default, as before), which the manifest now carries, rather than a size of its own. A resizable editor (editor.resizable) gets a handle just outside the view's corner in thedemoanddevpresentations: dragging it (or the arrow keys, with it focused) changes the view's logical size within the editor's limits and the page's room, so the UI is laid out again rather than scaled; a drag the browser cancels puts the size back. A fixed editor is scaled down to fit a smaller page as before, and?embedstill fills its iframe, following it as the parent page resizes it.
Patch Changes
-
#192
c0420b2Thanks @dm-balakin! - The JUCE and web runtimes lay out more styles the same. Natively, a box with no room (in a container squeezed to zero) keeps its content's size rather than its padding's (Yoga's shortcut for it is patched out), and a fixedwidthorheightcounts in a parent sized by its content after itsmin*/max*clamp. In the browser,flex: n(or a fixedflexBasis) adds only its basis to a row sized by its content, andaspectRatiowins over the stretch as in Yoga (with both sizes given, the one along the parent's direction stays). In the browser, a hidden node's (or its children's)layoutis all zeros and itsgetBoundingClientRect()at its nearest shown ancestor, as natively, rather than at the page's corner. The cases that still differ are listed in the web runtime's guide, "Where layout differs". -
#197
128f5feThanks @dm-balakin! - Show the Soundor icon in the DevTools dashboard (header and favicon) and in the Web host's settings panel.