github nacular/doodle v0.12.0
0.12.0

6 hours ago

Features

Constraint Layout Improvements

Constraints got a major round of work in this release, with new building blocks and a lot of correctness and performance fixes in ConstraintLayout and the Solver.

  • prefers suggests a value for a constraint property without enforcing it or limiting the property's range. It supports Strength.
  • lerp interpolates between a number and an expression, or between two expressions. ColorPicker now uses it.
  • min/max constraint functions now use n + 1 constraints instead of 2n, and use Weak strength.
  • readonly replaces the previous snapshot-only behavior, and ideal width/height/size values are now supported in constraint layouts.
  • Constraints now have a position property that maps to top/left.
  • ConstraintLayout has new parentWidthPreservation and parentHeightPreservation properties that control how strongly parents preserve their size during preferredSize calls.
  • ConstraintLayoutImpl now enforces the parent size on layout. It uses suggestValue when a preferred value changes instead of removing and re-adding the constraint.
  • center helpers now treat the item's width/height as readonly.

AnnotatedString

StyledText is now AnnotatedString, and the feature set has grown.

  • Segments can be marked "selectable", which enables automatic text selection on platforms that support it.
  • AnnotatedString.Annotation supports URLs, and new link extension methods create URL sections. This works in the Browser as well.
  • TextDecoration.Line can be used directly in the AnnotatedString DSL.

Breaking Changes

  • StyledText → AnnotatedString
  • StyledTextVisualizer → AnnotatedStringVisualizer
  • Slider "tick(s)" → "mark(s)" throughout the slider APIs
  • Constraint hint → prefers
  • readOnly replaced with value in constraint Expression, Position, Area and Edges
  • BasicTabbedPanelBehavior now takes selected/unselected Colors and no longer takes selectedColorMapper
  • ScrollPanel's contentWidthConstraints and contentHeightConstraints replaced by a single contentConstraints property
  • Presenter.present and Presenter.distanceToNext no longer take an items parameter. Use the new Carousel.item extension API instead.
  • Size.coerceInAspect now takes a target Size instead of a min and max
  • TextMetrics no longer has a default lineSpacing
  • Most Rectangle methods moved to extensions. Add the extension imports where needed.
  • GridPanel now takes a GridPanelBehavior
  • Removed the deprecated Kodein binding and other old deprecations

APIs

  • General

    • Positionable has new properties for more ergonomic layout logic, including assume, which lets a Layout set size/min/max all at once
    • Polygon now has area and centroid properties
    • New ConvexPolygon.centroid extension property
    • New Size.coerceInAspect method that retains aspect ratio while coercing a Size into a min/max
    • Carousel.PresentedItem now has an idealSize method
    • New allNext and allPrevious methods for Presenter.Position that return iterators to the items after and before the current one
    • SlicerPresenter now takes a cutRelativeTo parameter to change how slices are constructed
    • TreeTableBehavior now has explicit header and footer cell generators for the tree column
    • BasicSliderBehavior and BasicRangeSliderBehavior now allow overriding their groove inset ratio
    • Label now allows disabling auto size suggestion
    • Resizer now notifies of changes to the bounds it suggests for its View
    • New vararg builder for SimpleMutableListModel
    • Methods that guarded against incorrect arity usage are replaced by varargs, with deprecated overloads in their place
  • Browser

    • New URL support within AnnotatedString

Fixes | Improvements

  • General

    • Constraint layout failures when parent constraints change based on limits imposed by a grandparent
    • Solver.updateConstant not working for non-Required strength
    • Solver not tracking and cleaning up negative guards
    • Solver range computation, isUnderConstrained accuracy, and readonly/ideal handling
    • Solver now clamps values very close to 0 to 0
    • Constraint hashCode changing after being added to a context, or going stale when strength is updated
    • Constraint updates across layouts now track only adds/removes instead of a list diff
    • Constraint properties not updating when only modified by a single prefers call
    • Bugs with offset constraints and internal constraint variable equality checks
    • Layout bugs in List, GridPanel, FlexLayout, Table, Carousel, PopupManager, InteractiveLayout, ListItem, SplitPanel and ColorPicker
    • ListLayout now lets items take any size within constraints instead of bounding them to their ideal size
    • Table contents not extending to the parent size when the ideal size was smaller
    • Layout issues in BasicTabbedPanelBehavior and TreeRow, plus a more accurate internal rendering of BasicTabbedPanelBehavior
    • BasicTreeTableBehavior now trims the header/footer tree column cell region so it aligns with the icon width
    • TableBehavior and TreeTableBehavior column renderers now get expanded canvases that stretch to the bottom of the table
    • Visual tweaks and preferred-size handling for BasicSpinButtonBehavior, BasicMutableSpinButtonBehavior and BasicButtonBehavior
    • View giving a stale current size when calling Layout.preferredSize
    • View resetting its children incorrectly during layout, and calculating preferred size changing children's bounds
    • Top-level Views not being laid out when their preferred size changed
    • Size not being set properly during layout, and Display.relayout not updating positionables properly
    • View.visibilityChanged firing even when set to the same value
    • Better View sync when bounds are suggested during render/bounds syncing
    • Label issues with preferredSize
    • Removed the phantom View used by ScrollPanel in its internal layout
    • AnimatingTabContainer updating tab locations a frame early, which looked like phantom pointer events
    • paused event firing incorrectly for grouped animations
    • DampedTransitioner animation accuracy
    • Carousel not performing subsequent updates if its model was empty on the first one
    • Carousel render issue when an item's clipPath is used
    • SlicerPresenter not calculating the next item's size correctly
    • Concurrent modification in the render pipeline
    • List selection allowing items outside firstSelectable and lastSelectable
    • Vector3D.as2d() still returning a 3D vector
    • Rectangle constructor not allowing defaults
    • TreeColumnRow default
    • Constraint usage in the switchList form control
    • Conflicting overloads in Vector2D
    • Misspelled API names
  • Browser

    • Native ScrollPanel behavior now disables scrolling when the panel is disabled
    • Apps nested within DOM elements now lazy load when the element has a valid offsetParent
    • Native control detection issues that regressed drag-and-drop and broke key event handling
    • Regression in drag-drop visualization
    • NativeScrollPanel incorrectly discarding elements for old content it no longer contains
    • Canvas clip regions being clipped to the canvas bounds, limiting how large they could be
    • TextMetricsImpl interfering with view ordering because it adds elements to the DOM
    • TextMetricsImpl not cleaning up its cached node for measuring wrapped text
    • Sub-pixel element measurement
    • Text measurement being incorrect when a null Font was provided
    • Font not being reset on reused elements
    • Default line-height not being used correctly, which caused text clipping
    • Text width measurement for AnnotatedString
    • First Display size change being missed in some cases
    • Concurrent modification bug in SchedulerImpl
    • WASM casting bug
    • Issue with incorrect default lineHeight
  • Desktop

    • Updated deprecated needRedraw calls for Skiko

Performance

  • General

    • Various performance improvements across the framework, some more significant for Browser
    • Fewer constraints needed for min and max (2n → n + 1)
    • Less reflection in ConstraintLayoutImpl, Solver and other hot spots, which matters most for browser targets
    • Less object creation in Solver by using forEach directly on maps
    • Less object creation within Rectangle and Size
    • Explicit Double versions of functions that previously took Number
    • View only requests layout for its parent when its layout size differs from its current size while using layout-based preferredSize, which cuts duplicate preferred-size calls
    • Less overhead in View layout and preferred-size calls
    • RenderManagerImpl uses sets more efficiently, along with other changes that improve render performance
    • LinearPresenter no longer accesses items unnecessarily
    • basicVerticalListBehavior uses a ColorPaint instead of a PatternPaint when the even and odd colors are the same
    • Constraint exceptions are no longer thrown for some cases
  • Browser

    • Replaced the box-sizing: inherit CSS style with box-sizing: border-box, which has the same effect without referencing parent nodes
    • Replaced the DisplayImpl.layout delegate with a simple property
    • AnimationSchedulerImpl avoids multiple requestAnimationFrame calls in a single frame
    • Better font serialization caching
    • TextMetricsImpl uses the canvas more heavily when supported
    • TextFactoryImpl reuses more elements
    • PathMetricsImpl minimizes element add/remove cycles when measuring paths
    • FillHandler no longer clears children of SVGPatternElement, since they can be reused
    • Less use of observable in Label to avoid reflection
    • Check-before-set in DOM operations
    • viewPortOffset is only checked in Safari, since it's in a hot path

Build

  • Re-added Kover through a convention plugin
  • Added a convention plugin to handle publishing
  • Moved Dokka external link config for Measured into the convention plugin
  • Migrated to the Dokka 2 API
  • Fixed a Gradle dependency issue with test-fixture
  • Fixed compiler issues caused by formerly lax code
  • Fixed nmcp publication logic

Tests

  • Expanded View test coverage
  • New Solver and InteractiveLayout unit tests
  • Fixed Solver, SchedulerImpl and other unit tests

Versions

  • Kotlin -> 2.4.21
  • Gradle -> 9.5.0
  • Dokka -> 2.1.0
  • JUnit -> 5.10.1
  • Measured -> 0.5.0
  • ncp -> 1.6.2

Don't miss a new doodle release

NewReleases is sending notifications on new releases.