# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2026-08-24

### Changed

- Update the license terms so that MicroEJ SDK licensees can, at their option, apply the MicroEJ SDK
  EULA to the executable software delivered by MicroEJ Corp., while the source code stays under the
  open-source license.

## [1.0.0] - 2026-08-19

### Changed

- Discard the page replaced by `replaceWith(int)` instead of keeping it in a one-entry backstack.
  The history depth is still unchanged by the replacement, but the replaced page is dropped, so the
  next `navigateBack()` reveals the entry beneath the replacing one.
  - Before, with a history of `[HOME, LIST]`: `replaceWith(DETAILS)` gave `[HOME, DETAILS]` and
    stashed `LIST`, so `navigateBack()` returned to `LIST`. Any other navigation cleared that slot.
  - Now, with the same history: `replaceWith(DETAILS)` gives `[HOME, DETAILS]` and `LIST` is gone,
    so `navigateBack()` goes to `HOME`.
  - Migration: use `navigateTo(int)` instead of `replaceWith(int)` wherever the replaced page must
    stay reachable by back navigation.

## [0.2.0] - 2026-08-18

Version 0.2.0 keeps the whole v1 navigation model — the multi-level history, back navigation, page
lifecycle, and listeners — and layers page-key identity, a factory, in-place replacement,
transitions, and a single application-wide navigator on top. The removals are `removeFromHistory`
and `setStylesheet`.

### Added

- Add `PageFactory`, the single static, non-cached factory that builds a `Page` from its `int` key and
  the argument the navigation carried, through `create(int, Object)`.
- Add `replaceWith(int)` / `replaceWith(int, Transition)`: replace the active page in place, keeping
  the replaced page in a **one-entry backstack** so the next `navigateBack()` returns to it.
- Add a transitions API in the `ej.navigation.transition` package: `Transition` (with the `IMMEDIATE`
  default), `TransitionListener`, `TransitionContext`, and the shipped `FadeTransition` and
  `SlideTransition`, rendering through the `TransitionContext` they receive; set the default with
  `setTransition(Transition)`, and pass a transition to any navigation via its overload.
- Add `getActiveKey()` and `getHistoryKeys()` alongside `getActivePage()` / `getHistory()`.
- Add argument-carrying navigation on the two operations that build a page: `navigateTo(int, Object)` /
  `navigateTo(int, Object, Transition)` and `replaceWith(int, Object)` /
  `replaceWith(int, Object, Transition)`. The argument is forwarded to `PageFactory.create(int, Object)`,
  which injects it into the page's constructor; the navigator keeps no reference to it. Back navigation
  has no such form, as it never consults the factory.
- Defer a navigation requested reentrantly, from a `Page` lifecycle callback or a `NavigationListener`
  callback of the navigation in progress, with `MicroUI.callSerially(Runnable)` instead of running it
  inline; the deferred operation reaches the factory with the argument of the original call.

### Changed

- Navigation identifies pages by `int` key resolved through the `PageFactory` instead of by `Page`
  instance: `navigateTo(int)` / `navigateBackTo(int)` replace `navigateTo(Page)` /
  `navigateBackTo(Page)`. `navigateBack()`, `getActivePage()`, `getHistory()`, and
  `NavigationListener` are unchanged. Migration: build the pages in a `PageFactory` and replace
  `navigator.navigateTo(new HomePage(navigator))` with `navigator.navigateTo(Pages.HOME)`.
- Make `Navigator` a single application-wide instance, initialized once with the `Desktop` it drives
  and the `PageFactory` that builds its pages, and rejecting any operation requested before
  initialization. Migration: replace `new Navigator(desktop)` with
  `Navigator.initialize(desktop, factory)`, then obtain the navigator with `Navigator.getInstance()`.
- History identity is now per **entry**: the same key may appear more than once in the history.

### Removed

- Remove `removeFromHistory(Page)`; history entries are now managed only through navigation
  operations (`navigateTo` / `navigateBack` / `navigateBackTo` / `replaceWith`), so out-of-band
  removal of a non-active page is no longer supported.
- Remove `setStylesheet(Stylesheet)`; the application applies the stylesheet on the `Desktop` it
  supplies to the `Navigator`.

## [0.1.0] - 2026-07-06

### Added

- Add `Navigator` controller owning the navigation history and driving a MWT `Desktop`, created with
  a default `Desktop` (`Navigator()`) or an application-supplied one (`Navigator(Desktop)`) to
  customize the render policy or input handling.
- Add `Page` base class with `getContent`, `onEntered`, and `onExited` lifecycle callbacks;
  a page carries its per-navigation data through its own constructor.
- Add instance-based navigation operations `navigateTo(Page)`, `navigateBack()`, and
  `navigateBackTo(Page)`; the application constructs the page and hands the instance to the navigator.
- Add history queries `getActivePage()` and `getHistory()` (pages oldest-first), and
  `removeFromHistory(Page)` to drop a non-active page without navigating.
- Add `setStylesheet(Stylesheet)` to apply one stylesheet to the widgets of every page.
- Add `NavigationListener` with a single `onNavigation(exitedPage, enteredPage)` callback, notified
  once per navigation of the outgoing and incoming page (`exitedPage` is `null` on the first
  navigation).

_Copyright 2026 MicroEJ Corp. All rights reserved._\
_This library is provided in source code for use, modification and test, subject to license terms._\
_Any modification of the source code will break MicroEJ Corp. warranties on the whole library._\
_Build: 7E4D1F7C_
