Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@weavedev/lit-i18next",
"version": "2.0.0-rc.0",
"version": "2.0.0-rc.1",
"description": "i18next implementation for Lit",
"scripts": {
"prepare": "tsc"
Expand Down Expand Up @@ -32,10 +32,11 @@
},
"homepage": "https://github.com/weavedev/lit-i18next#readme",
"peerDependencies": {
"@lit/reactive-element": "^1.0.0",
"@lit/reactive-element": "^1.0.0 || ^2.0.0",
"i18next": ">=19.5.0 < 23.0.0"
},
"devDependencies": {
"typescript": "~4.3.5"
"@lit/reactive-element": "^2.0.0",
"typescript": "~5.3.3"
}
}
20 changes: 19 additions & 1 deletion src/localized-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@
*/

import type { ReactiveElement } from '@lit/reactive-element';
import type { ClassDescriptor } from '@lit/reactive-element/decorators/base';
import type { Constructor } from '@lit/reactive-element/decorators/base';
import { LocalizeOptions, updateWhenLocaleChanges } from './localized-controller';

// From the TC39 Decorators proposal
interface ClassDescriptor {
kind: 'class';
elements: ClassElement[];
finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;
}

// From the TC39 Decorators proposal
interface ClassElement {
kind: 'field' | 'method';
key: PropertyKey;
placement: 'static' | 'prototype' | 'own';
initializer?: Function;
extras?: ClassElement[];
finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;
descriptor?: PropertyDescriptor;
}

/**
* Class decorator to enable re-rendering the given LitElement whenever a new
* active loaded locale has been set.
Expand Down