Skip to content

Releases: peckadesign/pd-naja

2.2.0

28 May 11:51
Compare
Choose a tag to compare

What's Changed

  • ScrollToExtension allows to use custom ScrollIntoViewOptions (#20).
    As ScrollToExtension uses the element.scrollIntoView() method in the background, you can now pass options to the call by defining the data-naja-scroll-to-options attribute on the trigger element. This data attribute must contain JSON of type ScrollIntoViewOptions.
  • 🐞 Preserve pdModal in state on replaceInitialState (#23).
  • 🐞 Better detection of initial state (#21).
  • 🐞 Correctly dispatching the load event on popstate after snippets are restored by Naja (#22).
  • 🛠 Update github actions to node20 (#19).

Full Changelog: 2.1.0...2.2.0

2.1.0

18 Apr 13:20
Compare
Choose a tag to compare

What's Changed

  • SuggestExtension can take SpinnerExtension as a constructor (#18).
    You may now pass instance of SpinnerExtension into SuggestExtension constructor. If the spinnerExtension is passed and the latter two are omitted, they are set by the passed extension instance. In addition, the target element for the spinner is determined as in the SpinnerExtension algorithm (4). The fallback target is always the form element.
  • ✨ The SpinnerExtension method getTargetsByDOM is now public and used inside the SuggestExtension / Suggest class.
  • BC Break: The SpinnerExtension parameter ajaxSpinnerPlaceholderSelector has been renamed to ajaxSpinnerTargetSelector.
  • 🛠 The dev devependency for naja is now more general.

Full Changelog: 2.0.1...2.1.0

2.0.1

19 Mar 10:14
Compare
Choose a tag to compare

What's Changed

  • 🛠 ToggleClassExtension allows to modify class on interacted element itself via proprietary selector :self (#17).

Full Changelog: 2.0.0...2.0.1

2.0.0

26 Jan 10:19
Compare
Choose a tag to compare

What's Changed

  • ✨ New SuggestExtension for suggest box implementation (#16).
  • 🛠 Common methods for handling the spinner have been extracted to utils (#15).
  • BC Break: Naja moved to devDependencies (#14). As a result, the instantiated controlManager is no longer exported, only the ControlManager class is.
  • BC Break: The Control interface is now exported from a different path. The path @peckadesign/pd-naja/utils has been changed to @peckadesign/pd-naja/types.

Migrating to v2

ControlManager

The controlManager is no longer exported as an instance, but the ControlManager class is now exported. The previous code would look similar to this:

import controlManager from '@peckadesign/pd-naja' // The instance of ControlManager is imported
import SomeControl from '@/js/Controls/SomeControl' // `SomeControl` must implement `Control` interface

// Initialize control
controlManager.addControlOnLive(SomeControl)

After the update, it should be changed in a similar way:

import naja from 'naja'
import { ControlManager } from '@peckadesign/pd-naja' // The class ControlManager is imported
import SomeControl from '@/js/Controls/SomeControl' // `SomeControl` must implement `Control` interface

// Create instance of ControlManager
const controlManager = new ControlManager(naja)

// Initialize control
controlManager.addControlOnLive(SomeControl)

Control

When implementing custom controls in TypeScript, you need to change the import path for the Control interface. The path @peckadesign/pd-naja/utils has to be changed to @peckadesign/pd-naja/types.

Full Changelog: 1.6.0...2.0.0

1.6.0

22 Jan 17:25
Compare
Choose a tag to compare

What's Changed

  • ✨ Add ScrollToExtension for AJAX requests (#11).
  • ✨ Add ToggleClassExtension for changing the class names on ajax intearaction (#12).

Full Changelog: 1.5.2...1.6.0

1.5.2

21 Dec 15:54
Compare
Choose a tag to compare

What's Changed

  • 🐞 The AjaxModalExtension respects the AjaxModalPreventRedrawExtension (#10).

Full Changelog: 1.5.1...1.5.2

1.5.1

06 Dec 11:26
Compare
Choose a tag to compare

What's Changed

  • 🐞Fixed exports of new features (#9).

Full Changelog: 1.5.0...1.5.1

1.5.0

06 Dec 11:20
Compare
Choose a tag to compare

What's Changed

  • New extension BtnSpinnerExtension. The extension allowing you to use a spinner on a button element (0080623).
  • New extension SingleSubmitExtension. The extension that prevents multiple form submissions due to an error, such as double-clicking the button (697c99f).
  • New helper method isDatasetFalsy to evaluate if the extension should be disabled (697c99f).
  • SpinnerExtension and BtnSpinnerExtension toggled by single data attribute. SpinnerExtension can now be disabled with the data-naja-spinner="btn" attribute, which also enables BtnSpinnerExtension. This allows you to control these two extensions simultaneously using a single data attribute (747d274).
  • 🛠 ESLint settings (81474ef)

Full Changelog: 1.4.0...1.5.0

1.4.0

05 Dec 10:28
Compare
Choose a tag to compare

What's Changed

  • New extension SnippetFormPartExtension. This extension allows snippets to be used within form elements and ensures that forms are properly initialised
  • Export helper function isDatasetTruthy. The isDatasetTruthy method used by extensions is now exported, so that it can be used in custom extensions as well.

1.3.0

24 Oct 08:59
Compare
Choose a tag to compare

What's Changed

  • 🎉 new extensions added (#6):
    • AjaxModalPreventRedrawExtension to prevent modal redraw in certain requests.
    • AjaxOnceExtension to make specific requests only on the first interaction with the element.
    • ConfirmExtension to display a native browser confirmation dialogue before making a request.
    • FollowUpRequestExtension to chain multiple requests one after the other.
    • ForceRedirectExtension to initiate a force redirect from the backend.
    • ForceReplaceExtension allowing to change the snippet update operation from append/prepend to replace for specific request initiators.

Full Changelog: 1.2.0...1.3.0