Skip to content

v2.4.0

Choose a tag to compare

@github-actions github-actions released this 01 Oct 16:27
· 5 commits to main since this release

Highlights

  • Input works on mobile keyboards. Text no longer lags one key behind on Android (#257, #219), keyboard suggestions replace the word instead of duplicating its last letter (#253), and composition, autocorrect and paste are handled by the browser. The hidden native field now owns the text, caret and selection, so arrows, Shift-selection, Ctrl/Cmd+A, double/triple click, drag-selection and copy/cut/paste all work (#10), and overflowing text scrolls to keep the caret in view. Tested on Chromium, Firefox and Safari on macOS, iOS Safari and Android Chrome. New option: inputAttributes.
  • New Drawer component — a modal drawer, with container options support (#248, #273, #278).
  • Container options on elements (#260).
  • ScrollBox and List fixes — scroll limits follow the current size, content sizing, faster bulk addItems, and correct positioning of anchored or pivoted children.
  • No more typed-signals dependency — signals are now built in, so the UMD bundle (dist/pixi-ui.js) no longer needs a typedSignals global, and the ESM build tree-shakes. Signal and SignalConnection are exported from the package; onX.connect(...) works as before (#283).
    • Fixed in v2.4.1: the 2.4.0 UMD bundle expected tweedle.js as the global Tweedle, but tweedle.js registers tweedle_js, so it failed with Tweedle is not defined. Use 2.4.1, or on 2.4.0 add window.Tweedle = window.tweedle_js; between the tweedle.js and @pixi/ui scripts.
  • Robustness — a pass over crashes, argument guards, numeric validation and resource cleanup, with the test suite now covering 95% of the library.

Behaviour changes worth knowing

None of these change the documented public API, but code that relied on the old behaviour may notice:

  • Input, protected API — breaking for subclasses: typed text now comes from the hidden native field's input event, so the methods subclasses used to customise typing are no longer called for it. onKeyUp is renamed to onKeyDown (the event it was always bound to), onPaste and lastInputData are removed, _add() and _delete() still exist but typing no longer goes through them, and onInput() no longer receives the event. An Input subclass that overrides any of these now logs a one-time console warning naming the method (#282).
    • If you overrode onKeyUp as a workaround for #257, remove the override — it is no longer needed.
    • If you filtered or rewrote characters in _add(), move that into an onInput() override that adjusts this.input.value before calling super.onInput():
      class NoDigits extends Input
      {
          protected override onInput(): void
          {
              if (this.input) this.input.value = this.input.value.replace(/\d/g, '');
              super.onInput();
          }
      }
  • Signals: if you annotated fields with the Signal type imported from typed-signals, import Signal from @pixi/ui instead — the two classes are not assignable to each other. Calls such as onPress.connect(...) need no change (#283).
  • Input: setting value while the user is editing now updates the field being edited, and onChange is not emitted for it.
  • Button.view = null is ignored and keeps the current view, instead of throwing.
  • fitToView throws a clear error for an undefined child, instead of failing later.
  • ScrollBox sizes itself to its content, an explicit width/height wins over that, and 0 is treated as a real value rather than "not set". removeItems() now recomputes the scroll limits.
  • List positions children with an anchor or pivot by their visual corner; children without one are unaffected.

What's Changed

  • Improve safety checks in resize.ts & fit.ts by @jeth88 in #255
  • fix(FancyButton): Added missing null-check in fancy button by @CatchABus in #259
  • feat: added support for setting container opts to elements by @CatchABus in #260
  • Add a modal Drawer component by @afarber in #248
  • feat(Drawer): support container options, docs and story fixes by @CyberDex in #273
  • test: raise coverage to 95% and pin 45 known defects by @CyberDex in #265
  • docs(Drawer): improve docs and fix story controls by @CyberDex in #274
  • fix: repair five outright crashes and copy/paste errors by @CyberDex in #266
  • chore: fix lint in the test files from #265, and stop the eslint config cascade by @CyberDex in #275
  • fix: guard public entry points that dereference their argument by @CyberDex in #267
  • fix: validate numeric inputs before they reach arithmetic by @CyberDex in #276
  • fix: validate before mutating, not after by @CyberDex in #269
  • fix: release resources acquired in constructors by @CyberDex in #270
  • test: cover the Drawer component and pin three defects by @CyberDex in #277
  • fix: size ScrollBox to its content, and stop treating 0 as an absent value by @CyberDex in #279
  • fix: release Drawer resources, validate its background, re-anchor on resize by @CyberDex in #278
  • test: pin the reported symptoms from #226, #227 and #252 by @CyberDex in #280
  • fix: ScrollBox derives its scroll limits from its current size by @CyberDex in #261
  • fix: List positions children by their visual corner, not their origin by @CyberDex in #264
  • perf: add ScrollBox items in one pass instead of one at a time by @CyberDex in #263
  • fix: Input mirrors the native field instead of rebuilding text from keydown by @CyberDex in #262
  • chore: align Checkbox Use Html story with Use Graphics by @CyberDex in #281
  • feat: Input warns about subclass overrides that typing no longer calls by @CyberDex in #282
  • chore: replace typed-signals with an internal Signal by @CyberDex in #283
  • docs/fix: correct Input API docs, fix Drawer animation races, add release checklist and E2E runner by @CyberDex in #284

New Contributors

Full Changelog: v2.3.2...v2.4.0