Releases: peckadesign/pd-naja
Releases · peckadesign/pd-naja
2.2.0
What's Changed
- ✨
ScrollToExtension
allows to use customScrollIntoViewOptions
(#20).
AsScrollToExtension
uses theelement.scrollIntoView()
method in the background, you can now pass options to the call by defining thedata-naja-scroll-to-options
attribute on the trigger element. This data attribute must contain JSON of type ScrollIntoViewOptions. - 🐞 Preserve
pdModal
in state onreplaceInitialState
(#23). - 🐞 Better detection of initial state (#21).
- 🐞 Correctly dispatching the
load
event onpopstate
after snippets are restored by Naja (#22). - 🛠 Update github actions to node20 (#19).
Full Changelog: 2.1.0...2.2.0
2.1.0
What's Changed
- ✨
SuggestExtension
can takeSpinnerExtension
as a constructor (#18).
You may now pass instance ofSpinnerExtension
intoSuggestExtension
constructor. If thespinnerExtension
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 theSpinnerExtension
algorithm (4). The fallback target is always the form element. - ✨ The
SpinnerExtension
methodgetTargetsByDOM
is now public and used inside theSuggestExtension
/Suggest
class. - ⚠ BC Break: The
SpinnerExtension
parameterhas been renamed toajaxSpinnerPlaceholderSelector
ajaxSpinnerTargetSelector
. - 🛠 The dev devependency for naja is now more general.
Full Changelog: 2.0.1...2.1.0
2.0.1
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
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 instantiatedcontrolManager
is no longer exported, only theControlManager
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
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
What's Changed
- 🐞 The
AjaxModalExtension
respects theAjaxModalPreventRedrawExtension
(#10).
Full Changelog: 1.5.1...1.5.2
1.5.1
1.5.0
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
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
. TheisDatasetTruthy
method used by extensions is now exported, so that it can be used in custom extensions as well.
1.3.0
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 fromappend
/prepend
toreplace
for specific request initiators.
Full Changelog: 1.2.0...1.3.0