Version Packages
This commit is contained in:
parent
13185da02a
commit
34390b269c
5 changed files with 66 additions and 72 deletions
|
|
@ -1,61 +0,0 @@
|
||||||
---
|
|
||||||
'@lion/ui': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Side-effect-free alternative for `localize` (the globally shared instance of LocalizeManager).
|
|
||||||
When this function is imported, no side-effect happened yet, i.e. no global instance was registered yet.
|
|
||||||
The side effect-free approach generates:
|
|
||||||
|
|
||||||
- smaller, optimized bundles
|
|
||||||
- a predictable loading order, that allows for:
|
|
||||||
- deduping strategies when multiple instances of the localizeManager are on a page
|
|
||||||
- providing a customized extension of LocalizeManager
|
|
||||||
|
|
||||||
Also see: https://github.com/ing-bank/lion/discussions/1861
|
|
||||||
|
|
||||||
Use it like this:
|
|
||||||
|
|
||||||
```js
|
|
||||||
function myFunction() {
|
|
||||||
// note that 'localizeManager' is the same as former 'localize'
|
|
||||||
const localizeManager = getLocalizeManger();
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
In a class, we advise a shared instance:
|
|
||||||
|
|
||||||
```js
|
|
||||||
class MyClass {
|
|
||||||
constructor() {
|
|
||||||
this._localizeManager = getLocalizeManger();
|
|
||||||
}
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Make sure to always call this method inside a function or class (otherwise side effects are created)
|
|
||||||
|
|
||||||
Do you want to register your own LocalizeManager?
|
|
||||||
Make sure it's registered before anyone called `getLocalizeManager()`
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { singletonManager } from 'singleton-manager';
|
|
||||||
import { getLocalizeManger } from '@lion/ui/localize-no-side-effects.js';
|
|
||||||
|
|
||||||
// First register your own LocalizeManager (for deduping or other reasons)
|
|
||||||
singletonManager.set('lion/ui::localize::0.x', class MyLocalizeManager extends LocalizeManager {});
|
|
||||||
|
|
||||||
// Now, all your code gets the right instance
|
|
||||||
export function myFn() {
|
|
||||||
const localizeManager = getLocalizeManager();
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
export class myClass() {
|
|
||||||
constructor() {
|
|
||||||
this._localizeManager = getLocalizeManager();
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'@lion/ui': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
[localize] parse negative numbers
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'@lion/ui': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
lion-select: added test to assert that modelValue of lion-select is updated when the value or text of one or more options are changed
|
|
||||||
|
|
@ -1,5 +1,70 @@
|
||||||
# @lion/ui
|
# @lion/ui
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- cee40e55: Side-effect-free alternative for `localize` (the globally shared instance of LocalizeManager).
|
||||||
|
When this function is imported, no side-effect happened yet, i.e. no global instance was registered yet.
|
||||||
|
The side effect-free approach generates:
|
||||||
|
|
||||||
|
- smaller, optimized bundles
|
||||||
|
- a predictable loading order, that allows for:
|
||||||
|
- deduping strategies when multiple instances of the localizeManager are on a page
|
||||||
|
- providing a customized extension of LocalizeManager
|
||||||
|
|
||||||
|
Also see: https://github.com/ing-bank/lion/discussions/1861
|
||||||
|
|
||||||
|
Use it like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myFunction() {
|
||||||
|
// note that 'localizeManager' is the same as former 'localize'
|
||||||
|
const localizeManager = getLocalizeManger();
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In a class, we advise a shared instance:
|
||||||
|
|
||||||
|
```js
|
||||||
|
class MyClass {
|
||||||
|
constructor() {
|
||||||
|
this._localizeManager = getLocalizeManger();
|
||||||
|
}
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to always call this method inside a function or class (otherwise side effects are created)
|
||||||
|
|
||||||
|
Do you want to register your own LocalizeManager?
|
||||||
|
Make sure it's registered before anyone called `getLocalizeManager()`
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { singletonManager } from 'singleton-manager';
|
||||||
|
import { getLocalizeManger } from '@lion/ui/localize-no-side-effects.js';
|
||||||
|
|
||||||
|
// First register your own LocalizeManager (for deduping or other reasons)
|
||||||
|
singletonManager.set('lion/ui::localize::0.x', class MyLocalizeManager extends LocalizeManager {});
|
||||||
|
|
||||||
|
// Now, all your code gets the right instance
|
||||||
|
export function myFn() {
|
||||||
|
const localizeManager = getLocalizeManager();
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
export class myClass() {
|
||||||
|
constructor() {
|
||||||
|
this._localizeManager = getLocalizeManager();
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- 0efce8e1: [localize] parse negative numbers
|
||||||
|
- a47a6e61: lion-select: added test to assert that modelValue of lion-select is updated when the value or text of one or more options are changed
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lion/ui",
|
"name": "@lion/ui",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "A package of extendable web components",
|
"description": "A package of extendable web components",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "ing-bank",
|
"author": "ing-bank",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue