Follow-up from https://github.com/webrecorder/browsertrix-cloud/pull/1546#discussion_r1529001599 (cc @SuaYoo) - Adds `eslint-plugin-import-x` and `@ianvs/prettier-plugin-sort-imports` and configures rules for them both so imports get sorted on format & on lint. - Runs both on everything!
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { html, LitElement } from "lit";
|
|
|
|
import appState, { use } from "./state";
|
|
|
|
import { APIController } from "@/controllers/api";
|
|
import { NavigateController } from "@/controllers/navigate";
|
|
import { NotifyController } from "@/controllers/notify";
|
|
|
|
export { html };
|
|
|
|
export default class LiteElement extends LitElement {
|
|
@use()
|
|
appState = appState;
|
|
|
|
private readonly apiController = new APIController(this);
|
|
private readonly notifyController = new NotifyController(this);
|
|
private readonly navigateController = new NavigateController(this);
|
|
|
|
protected get orgBasePath() {
|
|
return this.navigateController.orgBasePath;
|
|
}
|
|
|
|
createRenderRoot() {
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* @deprecated New components should use NavigateController directly
|
|
*/
|
|
navTo = (...args: Parameters<NavigateController["to"]>) =>
|
|
this.navigateController.to(...args);
|
|
|
|
/**
|
|
* @deprecated New components should use NavigateController directly
|
|
*/
|
|
navLink = (...args: Parameters<NavigateController["link"]>) =>
|
|
this.navigateController.link(...args);
|
|
|
|
/**
|
|
* @deprecated New components should use NotifyController directly
|
|
*/
|
|
notify = (...args: Parameters<NotifyController["toast"]>) =>
|
|
this.notifyController.toast(...args);
|
|
|
|
/**
|
|
* @deprecated New components should use APIController directly
|
|
*/
|
|
apiFetch = async <T = unknown>(...args: Parameters<APIController["fetch"]>) =>
|
|
this.apiController.fetch<T>(...args);
|
|
}
|