Releases: Sv443-Network/UserUtils
Releases · Sv443-Network/UserUtils
v9.1.0
Minor Changes
- eb20132: Added the type
ListWithLengthto represent an array or object with a numericlength,countorsizeproperty. - eb20132: Added
autoPlural()support for generic objects with a numericlength,countorsizeproperty. - c9b13d8: Added
signal: AbortSignalandrejectOnAbort: booleanparams topauseFor()to allow for cutting the pause short - c66324b: Support for words with
-y/-iesextension inautoPlural() - c9b13d8: Added
getListLength()function to resolve a value of the newListWithLengthtype - c13e890:
autoPlural()now defaultspluralTypeto"auto"andnumto 2 ifpluralTypeis invalid ornumresolves to NaN
Patch Changes
- 3f86215: Fixed fetchAdvanced error "'abort' called on an object that does not implement interface AbortController"
v9.0.4
v9.0.3
v9.0.2
v9.0.1
v9.0.0
Major Changes
- 9abfc6b: BREAKING - Reworked translation system:
- Removed
tr(),tr.setLanguage()andtr.getLanguage() - Renamed function
tr.addLanguage()totr.addTranslations() - Removed
%n-based argument insertion by default (re-enable explicitly withtr.addTransform(tr.transforms.percent)). - Added ability for nested translation objects and object traversal via dot notation.
- Added functions:
tr.for()- translates a key for the specified language.tr.use()- creates a translation function for the specified language for much easier usage.tr.hasKey()- checks if a key exists in the given language.tr.setFallbackLanguage()- sets the fallback language used when a key is not found in the given language.tr.getFallbackLanguage()- returns the fallback language.tr.addTransform()- adds a transform function to the translation system, allowing for custom argument insertion and much more.tr.deleteTransform()- removes a transform function.
- Added ability to specify transform patterns and functions for arbitrary modification of the translation string.
- Added transform for template literal syntax (e.g.
${keyName}) withtr.addTransform(tr.transforms.templateLiteral). This transform supports positional argument injection, as well as named arguments via an object with the same keys as in the template literal pattern. See the documentation for more information and a code example. - Added transform for the old
%nsyntax withtr.addTransform(tr.transforms.percent). This transform behaves the exact same as the translation sytem before 9.0.0 (only supporting positional arguments).
- Added transform for template literal syntax (e.g.
- Added TS type
TrKeys<T>for extracting the keys of a translation object (both flat and nested). - Fixed bug with resolving translations for flat objects.
- Removed
- d0737dc: BREAKING - Reworked debounce system:
- Renamed
SelectorObserverOptions'sdefaultDebounceEdgetodefaultDebounceType - Renamed
SelectorListenerOptions'sdebounceEdgetodebounceType - Edge types
risingandfallinghave been replaced with new edge typesimmediateandidle, overhauling their behavior:immediate(default & recommended) will trigger immediately, then queue all subsequent calls until the timeout has passed.idlewill trigger the last queued call only after there haven't been any subsequent calls for the specified timeout.
- Added
Debouncerclass for more advanced control over debouncing, and with that the following changes:- Ability to attach and manage multiple listeners.
- Inherits from NanoEmitter, allowing event-based debouncing.
- Can be inherited by your own classes for built-in debouncing.
debounce()function can still be called as usual (after replacing the edge type names with the new ones). Internally, it will instantiate aDebouncerinstance, which is available via thedebouncerproperty on the returned function.- Reduced default timeout from 300ms to 200ms.
- Renamed
Minor Changes
- cd241b0: Added
additionalPropsparameter toopenInNewTab()to add or overwrite anchor element props (only ifGM.openInTab()is unavailable) - d0737dc: Moved documentation to separate file
docs.mdto speed upREADME.mdload time.
Patch Changes
v8.4.0
Minor Changes
- e10d629: Added function
digitCount()to calculate the amount of digits in the passed number - 949877a: Added support for nested objects in translations (e.g.
tr("foo.bar.baz")) - 52d392a: Added
ValueGenandStringGentypes with accompanyingconsumeGen()andconsumeStringGen()functions to allow for super flexible typing and declaration of values - bbce0e1: Added overload to
clamp()withoutminparameter