Skip to content

Commit

Permalink
chore: create new release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and Sv443 committed Jan 22, 2025
1 parent 14a9143 commit 65df5fc
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 57 deletions.
21 changes: 0 additions & 21 deletions .changeset/beige-dots-refuse.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/eighty-cooks-joke.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/great-donuts-roll.md

This file was deleted.

15 changes: 0 additions & 15 deletions .changeset/grumpy-toys-fry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/rude-trains-leave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shiny-icons-provide.md

This file was deleted.

43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# @sv443-network/userutils

## 9.0.0

### Major Changes

- 9abfc6b: **BREAKING** - Reworked translation system:
- Removed `tr()`, `tr.setLanguage()` and `tr.getLanguage()`
- Renamed function `tr.addLanguage()` to `tr.addTranslations()`
- Removed `%n`-based argument insertion by default (re-enable explicitly with `tr.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}`) with `tr.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 TS type `TrKeys<T>` for extracting the keys of a translation object (both flat and nested).
- Fixed bug with resolving translations for flat objects.
- d0737dc: **BREAKING** - Reworked debounce system:
- Edge types `rising` and `falling` have been removed.
- Added new edge types `immediate` and `idle` with new behavior.
- `immediate` (default & recommended) will trigger immediately, then queue all subsequent calls until the timeout has passed.
- `idle` will trigger the last queued call only after there haven't been any subsequent calls for the specified timeout.
- Added `Debouncer` class 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 a `Debouncer` instance, which is available via the `debouncer` property on the returned function.
- Reduced default timeout from 300ms to 200ms.

### Minor Changes

- cd241b0: Added `additionalProps` parameter to `openInNewTab()` to add or overwrite anchor element props (only if `GM.openInTab()` is unavailable)
- d0737dc: Moved documentation to separate file `docs.md` to speed up `README.md` load time.

### Patch Changes

- 1a754db: Fixed newlines being collapsed in TSDoc comments.
- d0737dc: Fixed `randRange()` with `enhancedEntropy = true` only returning the first digit.

## 8.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sv443-network/userutils",
"libName": "UserUtils",
"version": "8.4.0",
"version": "9.0.0",
"description": "Lightweight library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down

0 comments on commit 65df5fc

Please sign in to comment.