Skip to content

Commit 75abe2a

Browse files
committed
cs fix
1 parent e799e3b commit 75abe2a

File tree

13 files changed

+63
-216
lines changed

13 files changed

+63
-216
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## Unreleased
8+
### Changed
9+
- Refactor app plugin experimental to use app-core instead of web-sdk.
810

911
## 0.0.12 - 2024-12-16
1012
### Added

src/Decorator/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export * from './withGetServiceResolverMachine.js';
44
export * from './withServiceResolver.js';
55
export * from './withStateMachine.js';
66
export * from './withThemeVariables.js';
7-
export * from './withTranslation';
7+
export * from './withTranslation.js';
88
export * from './withUpdateOnThemeChange.js';

src/Decorator/withGetElementMachine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function withGetElementMachine(): <TBase extends Constructor<ElementCapableWebCo
3939
}
4040

4141
updated(changedProperties: PropertyValues): void {
42-
// @ts-ignore
42+
// @ts-expect-error TS2339
4343
super.updated?.();
4444
if (changedProperties.has('elementId')) {
4545
this.actor.send({

src/Decorator/withTranslation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import { EventDispatcher, ServiceResolver } from '@ember-nexus/app-core/Service'
22
import { EventInterface } from '@ember-nexus/app-core/Type/Definition';
33

44
import { LanguageChangeEvent } from '../Event/index.js';
5+
import { TranslationService } from '../Service/index.js';
56
import { Constructor, TranslationCapableWebComponent } from '../Type/Definition/index.js';
6-
import {TranslationService} from "../Service";
77

88
/* eslint @typescript-eslint/no-explicit-any: "off" */
9-
function withTranslation(): <TBase extends Constructor<TranslationCapableWebComponent>>(
10-
Base: TBase,
11-
) => any {
9+
function withTranslation(): <TBase extends Constructor<TranslationCapableWebComponent>>(Base: TBase) => any {
1210
return function <TBase extends Constructor<TranslationCapableWebComponent>>(Base: TBase): any {
1311
return class extends Base {
1412
private eventDispatcher: EventDispatcher;
1513

1614
onServiceResolverLoaded(serviceResolver: ServiceResolver): void {
1715
this.eventDispatcher = serviceResolver.getServiceOrFail<EventDispatcher>(EventDispatcher.identifier);
1816
this.eventDispatcher.addListener(LanguageChangeEvent.identifier, this);
19-
this.i18n = serviceResolver.getServiceOrFail<TranslationService>(TranslationService.identifier).getI18nInstance();
17+
this.i18n = serviceResolver
18+
.getServiceOrFail<TranslationService>(TranslationService.identifier)
19+
.getI18nInstance();
2020
super.onServiceResolverLoaded?.(serviceResolver);
2121
}
2222

@@ -25,7 +25,7 @@ function withTranslation(): <TBase extends Constructor<TranslationCapableWebComp
2525
this.requestUpdate?.();
2626
return;
2727
}
28-
// @ts-ignore
28+
// @ts-expect-error TS2339
2929
super.onEvent?.();
3030
}
3131

src/Decorator/withUpdateOnThemeChange.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function withUpdateOnThemeChange(): <TBase extends Constructor<ServiceResolverCa
2323
this.requestUpdate?.();
2424
return;
2525
}
26-
// @ts-ignore
26+
// @ts-expect-error TS2339
2727
super.onEvent?.();
2828
}
2929

src/Machine/Page/loginPageMachine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Token, UniqueUserIdentifier } from '@ember-nexus/app-core/Type/Definiti
33
import { assign, fromPromise, setup } from 'xstate';
44

55
import { resolveService } from '../../Decorator/index.js';
6-
import {LifecycleCapableWebComponent} from "../../Type/Definition";
6+
import { LifecycleCapableWebComponent } from '../../Type/Definition/index.js';
77

88
type HTMLElementWithOptionalOnServiceResolverLoaded = LifecycleCapableWebComponent & {
99
onServiceResolverLoaded?(serviceResolver: ServiceResolver): void;

src/Page/LoginPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { i18n } from 'i18next';
12
import { LitElement, TemplateResult, html, unsafeCSS } from 'lit';
23
import { customElement } from 'lit/decorators.js';
34
import { ActorRefFrom, SnapshotFrom } from 'xstate';
4-
import {i18n} from "i18next";
55

66
import { withStateMachine } from '../Decorator/index.js';
77
import { withTranslation } from '../Decorator/index.js';

src/Service/PropertyExtractorService.ts

Lines changed: 0 additions & 149 deletions
This file was deleted.

src/Service/TranslationService.ts

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
import { ServiceIdentifier } from '../Type/Enum/index.js';
2-
import i18next, {i18n} from 'i18next';
3-
import {LanguageService} from "./LanguageService";
4-
import {EventDispatcher, ServiceResolver} from "@ember-nexus/app-core/Service";
5-
6-
import en from "../Asset/Translation/en.json";
7-
import de from "../Asset/Translation/de.json";
8-
import no from "../Asset/Translation/no.json";
9-
import ko from "../Asset/Translation/ko.json";
1+
import { EventDispatcher, ServiceResolver } from '@ember-nexus/app-core/Service';
2+
import { EventInterface } from '@ember-nexus/app-core/Type/Definition';
3+
import i18next, { i18n } from 'i18next';
104

11-
import ar from "../Asset/Translation/ar.json";
12-
import es from "../Asset/Translation/es.json";
13-
import fr from "../Asset/Translation/fr.json";
14-
import hi from "../Asset/Translation/hi.json";
15-
import it from "../Asset/Translation/it.json";
16-
import ja from "../Asset/Translation/ja.json";
17-
import ru from "../Asset/Translation/ru.json";
18-
import sw from "../Asset/Translation/sw.json";
19-
import zhCN from "../Asset/Translation/zh-CN.json";
20-
import {LanguageChangeEvent} from "../Event";
21-
import {EventInterface} from "@ember-nexus/app-core/Type/Definition";
5+
import { LanguageService } from './LanguageService.js';
6+
import ar from '../Asset/Translation/ar.json';
7+
import de from '../Asset/Translation/de.json';
8+
import en from '../Asset/Translation/en.json';
9+
import es from '../Asset/Translation/es.json';
10+
import fr from '../Asset/Translation/fr.json';
11+
import hi from '../Asset/Translation/hi.json';
12+
import it from '../Asset/Translation/it.json';
13+
import ja from '../Asset/Translation/ja.json';
14+
import ko from '../Asset/Translation/ko.json';
15+
import no from '../Asset/Translation/no.json';
16+
import ru from '../Asset/Translation/ru.json';
17+
import sw from '../Asset/Translation/sw.json';
18+
import zhCN from '../Asset/Translation/zh-CN.json';
19+
import { LanguageChangeEvent } from '../Event/index.js';
20+
import { ServiceIdentifier } from '../Type/Enum/index.js';
2221

2322
class TranslationService {
2423
static identifier: ServiceIdentifier = ServiceIdentifier.translationService;
@@ -27,34 +26,34 @@ class TranslationService {
2726

2827
constructor(
2928
languageService: LanguageService,
30-
private eventDispatcher: EventDispatcher
29+
private eventDispatcher: EventDispatcher,
3130
) {
32-
this.i18nInstance = i18next.createInstance({
33-
lng: languageService.getActiveLanguage(),
34-
debug: true,
35-
fallbackLng: 'en',
36-
resources: {
37-
en: {translation: en},
38-
de: {translation: de},
39-
no: {translation: no},
40-
ko: {translation: ko},
31+
this.i18nInstance = i18next.createInstance(
32+
{
33+
lng: languageService.getActiveLanguage(),
34+
debug: true,
35+
fallbackLng: 'en',
36+
resources: {
37+
en: { translation: en },
38+
de: { translation: de },
39+
no: { translation: no },
40+
ko: { translation: ko },
4141

42-
ar: {translation: ar},
43-
es: {translation: es},
44-
fr: {translation: fr},
45-
hi: {translation: hi},
46-
it: {translation: it},
47-
ja: {translation: ja},
48-
ru: {translation: ru},
49-
sw: {translation: sw},
50-
'zh-CN': {translation: zhCN},
51-
}
52-
}, () => {
53-
this.eventDispatcher.addListener(
54-
LanguageChangeEvent.identifier,
55-
this
56-
);
57-
});
42+
ar: { translation: ar },
43+
es: { translation: es },
44+
fr: { translation: fr },
45+
hi: { translation: hi },
46+
it: { translation: it },
47+
ja: { translation: ja },
48+
ru: { translation: ru },
49+
sw: { translation: sw },
50+
'zh-CN': { translation: zhCN },
51+
},
52+
},
53+
() => {
54+
this.eventDispatcher.addListener(LanguageChangeEvent.identifier, this);
55+
},
56+
);
5857
}
5958

6059
static constructFromServiceResolver(serviceResolver: ServiceResolver): TranslationService {
@@ -66,18 +65,13 @@ class TranslationService {
6665

6766
onEvent(event: EventInterface): void {
6867
if (event.getIdentifier() === LanguageChangeEvent.identifier) {
69-
console.log('received language update in translation service');
70-
console.log(event);
71-
console.log((event as LanguageChangeEvent).getLanguage());
7268
this.i18nInstance.changeLanguage((event as LanguageChangeEvent).getLanguage());
7369
}
7470
}
7571

76-
getI18nInstance(): i18n
77-
{
72+
getI18nInstance(): i18n {
7873
return this.i18nInstance;
7974
}
80-
8175
}
8276

8377
export { TranslationService };

src/Service/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from './LanguageService.js';
2-
export * from './PropertyExtractorService.js';
32
export * from './ShikiJsonHighlighterService.js';
43
export * from './ThemeService.js';
54
export * from './TranslationService.js';

0 commit comments

Comments
 (0)