fix: typescript errors

This commit is contained in:
Baptiste Grob
2020-08-12 14:43:56 +02:00
parent 0c1f3d43d1
commit 2fb6adb6ea
31 changed files with 233 additions and 1463 deletions

View File

@@ -1,4 +1,116 @@
import { WebDirective } from './../types';
export declare class EditorPanel extends WebDirective {
constructor();
/// <reference types="pug" />
export class EditorPanel {
restrict: string;
scope: {};
template: import("pug").compileTemplate;
replace: boolean;
controller: typeof EditorCtrl;
controllerAs: string;
bindToController: boolean;
}
declare class EditorCtrl {
constructor($timeout: any, $rootScope: any, alertManager: any, appState: any, authManager: any, actionsManager: any, componentManager: any, desktopManager: any, keyboardManager: any, modelManager: any, preferencesManager: any, privilegesManager: any, sessionHistory: any, syncManager: any);
$rootScope: any;
alertManager: any;
appState: any;
actionsManager: any;
authManager: any;
componentManager: any;
desktopManager: any;
keyboardManager: any;
modelManager: any;
preferencesManager: any;
privilegesManager: any;
syncManager: any;
state: {
componentStack: never[];
editorDebounce: number;
isDesktop: any;
spellcheck: boolean;
mutable: {
tagsString: string;
};
};
leftResizeControl: {};
rightResizeControl: {};
/** Used by .pug template */
prefKeyMonospace: any;
prefKeySpellcheck: any;
prefKeyMarginResizers: any;
addAppStateObserver(): void;
handleNoteSelectionChange(note: any, previousNote: any): Promise<void>;
addMappingObservers(): void;
addSyncEventHandler(): void;
addSyncStatusObserver(): void;
syncStatusObserver: any;
editorForNote(note: any): any;
setMenuState(menu: any, state: any): void;
toggleMenu(menu: any): void;
closeAllMenus({ exclude }?: {
exclude: any;
}): void;
editorMenuOnSelect: (component: any) => void;
hasAvailableExtensions(): boolean;
performFirefoxPinnedTabFix(): void;
saveNote({ bypassDebouncer, updateClientModified, dontUpdatePreviews }: {
bypassDebouncer: any;
updateClientModified: any;
dontUpdatePreviews: any;
}): void;
saveTimeout: any;
didShowErrorAlert: boolean | undefined;
showSavingStatus(): void;
showAllChangesSavedStatus(): void;
showErrorStatus(error: any): void;
setStatus(status: any, wait?: boolean): void;
statusTimeout: any;
contentChanged(): void;
onTitleEnter($event: any): void;
onTitleChange(): void;
focusEditor(): void;
lastEditorFocusEventSource: any;
focusTitle(): void;
clickedTextArea(): void;
onNameFocus(): void;
editingName: boolean | undefined;
onContentFocus(): void;
onNameBlur(): void;
selectedMenuItem(hide: any): void;
deleteNote(permanently: any): Promise<void>;
performNoteDeletion(note: any): void;
restoreTrashedNote(): void;
deleteNotePermanantely(): void;
getTrashCount(): any;
emptyTrash(): void;
togglePin(): void;
toggleLockNote(): void;
toggleProtectNote(): void;
toggleNotePreview(): void;
toggleArchiveNote(): void;
reloadTagsString(): void;
addTag(tag: any): void;
removeTag(tag: any): void;
saveTags({ strings }?: {
strings: any;
}): void;
onPanelResizeFinish: (width: any, left: any, isMaxWidth: any) => void;
loadPreferences(): void;
reloadFont(): void;
toggleKey(key: any): Promise<void>;
/** @components */
onEditorLoad: (editor: any) => void;
registerComponentHandler(): void;
reloadComponentStackArray(): void;
reloadComponentContext(): void;
toggleStackComponentForCurrentItem(component: any): void;
disassociateComponentWithCurrentNote(component: any): void;
associateComponentWithCurrentNote(component: any): void;
registerKeyboardShortcuts(): void;
altKeyObserver: any;
trashKeyObserver: any;
deleteKeyObserver: any;
onSystemEditorLoad(): void;
loadedTabListener: boolean | undefined;
tabObserver: any;
}
export {};

View File

@@ -4,5 +4,5 @@ export declare function autofocus($timeout: ng.ITimeoutService): {
scope: {
shouldFocus: string;
};
link: ($scope: import("angular").IScope, $element: JQLite) => void;
link: ($scope: ng.IScope, $element: JQLite) => void;
};

View File

@@ -2,5 +2,5 @@
export declare function clickOutside($document: ng.IDocumentService): {
restrict: string;
replace: boolean;
link: ($scope: import("angular").IScope, $element: JQLite, attrs: any) => void;
link($scope: ng.IScope, $element: JQLite, attrs: any): void;
};

View File

@@ -1,9 +1,9 @@
import angular from 'angular';
/// <reference types="angular" />
export declare function delayHide($timeout: ng.ITimeoutService): {
restrict: string;
scope: {
show: string;
delay: string;
};
link: (scope: angular.IScope, elem: JQLite) => void;
link: (scope: ng.IScope, elem: JQLite) => void;
};

View File

@@ -1,5 +1,5 @@
/// <reference types="angular" />
export declare function elemReady($parse: ng.IParseService): {
restrict: string;
link: ($scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
link: ($scope: ng.IScope, elem: JQLite, attrs: any) => void;
};

View File

@@ -4,5 +4,5 @@ export declare function fileChange(): {
scope: {
handler: string;
};
link: (scope: import("angular").IScope, element: JQLite) => void;
link: (scope: ng.IScope, element: JQLite) => void;
};

View File

@@ -1,4 +1,4 @@
/// <reference types="angular" />
export declare function infiniteScroll(): {
link: (scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
link: (scope: ng.IScope, elem: JQLite, attrs: any) => void;
};

View File

@@ -1,5 +1,5 @@
/// <reference types="angular" />
export declare function lowercase(): {
require: string;
link: (scope: import("angular").IScope, _: JQLite, attrs: any, ctrl: any) => void;
link: (scope: ng.IScope, _: JQLite, attrs: any, ctrl: any) => void;
};

View File

@@ -1,5 +1,5 @@
/// <reference types="angular" />
export declare function selectOnFocus($window: ng.IWindowService): {
restrict: string;
link: (scope: import("angular").IScope, element: JQLite) => void;
link: (scope: ng.IScope, element: JQLite) => void;
};

View File

@@ -1,2 +1,2 @@
/// <reference types="angular" />
export declare function snEnter(): (scope: import("angular").IScope, element: JQLite, attrs: any) => void;
export declare function snEnter(): (scope: ng.IScope, element: JQLite, attrs: any) => void;

View File

@@ -1,7 +1,9 @@
import { DeviceInterface, SNApplication } from 'snjs';
import { Platform } from './services/platform';
export declare class WebDeviceInterface extends DeviceInterface {
private platform;
private database;
constructor(namespace: string, timeout: any);
constructor(namespace: string, timeout: any, platform: Platform);
setApplication(application: SNApplication): void;
deinit(): void;
getRawStorageValue(key: string): Promise<string | null>;
@@ -22,7 +24,7 @@ export declare class WebDeviceInterface extends DeviceInterface {
saveRawDatabasePayloads(payloads: any[]): Promise<void>;
removeRawDatabasePayloadWithId(id: string): Promise<void>;
removeAllRawDatabasePayloads(): Promise<void>;
getKeychainValue(): Promise<any>;
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
openUrl(url: string): void;

View File

@@ -1,5 +1,22 @@
import { SNAlertService } from 'snjs';
export declare class AlertService extends SNAlertService {
alert(text: string, title: string, closeButtonText: string | undefined, onClose: () => void): Promise<unknown>;
confirm(text: string, title: string, confirmButtonText: string | undefined, cancelButtonText: string | undefined, onConfirm: () => void, onCancel: () => void, destructive?: boolean): Promise<unknown>;
import { SNAlertService, ButtonType } from 'snjs';
/** @returns a promise resolving to true if the user confirmed, false if they canceled */
export declare function confirmDialog({ text, title, confirmButtonText, cancelButtonText, confirmButtonStyle, }: {
text: string;
title?: string;
confirmButtonText?: string;
cancelButtonText?: string;
confirmButtonStyle?: 'danger' | 'info';
}): Promise<boolean>;
export declare function alertDialog({ title, text, closeButtonText, }: {
title?: string;
text: string;
closeButtonText?: string;
}): Promise<void>;
export declare class AlertService implements SNAlertService {
/**
* @deprecated use the standalone `alertDialog` function instead
*/
alert(text: string, title?: string, closeButtonText?: string): Promise<void>;
confirm(text: string, title?: string, confirmButtonText?: string, confirmButtonType?: ButtonType, cancelButtonText?: string): Promise<boolean>;
blockingDialog(text: string): () => void;
}

View File

@@ -1,11 +1,9 @@
import { WebApplication } from '@/ui_models/application';
import { SNItem } from 'snjs';
export declare class ArchiveManager {
private readonly application;
private textFile?;
constructor(application: WebApplication);
downloadBackup(encrypted: boolean): Promise<void>;
downloadBackupOfItems(items: SNItem[], encrypted: boolean): Promise<void>;
private formattedDate;
private itemsData;
private get zip();

View File

@@ -0,0 +1,11 @@
/** Platform-specific (i-e desktop/web) behavior is handled by a Platform object. */
export interface Platform {
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
}
export declare class WebPlatform implements Platform {
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
}

View File

@@ -7,7 +7,7 @@ export declare class PreferencesManager extends ApplicationService {
onAppLaunch(): Promise<void>;
get webApplication(): WebApplication;
streamPreferences(): void;
private loadSingleton;
private reloadSingleton;
syncUserPreferences(): void;
getValue(key: WebPrefKey, defaultValue?: any): any;
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>;

View File

@@ -2,7 +2,7 @@ import { WebApplication } from '@/ui_models/application';
import { ApplicationService, ApplicationEvent } from 'snjs';
export declare class ThemeManager extends ApplicationService {
private activeThemes;
private unsubState;
private unsubState?;
private unregisterDesktop;
private unregisterComponent;
/** @override */

View File

@@ -32,5 +32,11 @@ export declare const STRING_GENERATING_LOGIN_KEYS = "Generating Login Keys...";
export declare const STRING_GENERATING_REGISTER_KEYS = "Generating Account Keys...";
export declare const STRING_INVALID_IMPORT_FILE = "Unable to open file. Ensure it is a proper JSON file and try again.";
export declare function StringImportError(errorCount: number): string;
export declare const STRING_ENTER_ACCOUNT_PASSCODE = "Enter your application passcode";
export declare const STRING_ENTER_ACCOUNT_PASSWORD = "Enter your account password";
export declare const STRING_ENTER_PASSCODE_FOR_MIGRATION = "Your application passcode is required to perform an upgrade of your local data storage structure.";
export declare const STRING_STORAGE_UPDATE = "Storage Update";
export declare const STRING_AUTHENTICATION_REQUIRED = "Authentication Required";
/** @password_change */
export declare const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
export declare const STRING_CONFIRM_APP_QUIT_DURING_UPGRADE: string;

View File

@@ -2,9 +2,10 @@
import { ComponentGroup } from './component_group';
import { EditorGroup } from '@/ui_models/editor_group';
import { PasswordWizardType } from '@/types';
import { SNApplication, Challenge, ChallengeOrchestrator, ProtectedAction } from 'snjs';
import { SNApplication, Challenge, ProtectedAction } from 'snjs';
import { DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
import { AppState } from '@/ui_models/app_state';
import { Platform } from '@/services/platform';
declare type WebServices = {
appState: AppState;
desktopService: DesktopManager;
@@ -24,7 +25,7 @@ export declare class WebApplication extends SNApplication {
private currentAuthenticationElement?;
editorGroup: EditorGroup;
componentGroup: ComponentGroup;
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void);
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void, platform: Platform);
/** @override */
deinit(): void;
setWebServices(services: WebServices): void;
@@ -39,7 +40,7 @@ export declare class WebApplication extends SNApplication {
getKeyboardService(): KeyboardManager;
checkForSecurityUpdate(): Promise<boolean>;
presentPasswordWizard(type: PasswordWizardType): void;
promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator): void;
promptForChallenge(challenge: Challenge): void;
performProtocolUpgrade(): Promise<void>;
presentPrivilegesModal(action: ProtectedAction, onSuccess?: any, onCancel?: any): Promise<void>;
presentPrivilegesManagementModal(): void;

View File

@@ -1,14 +1,16 @@
/// <reference types="angular" />
import { WebApplication } from './application';
import { Platform } from '@/services/platform';
declare type AppManagerChangeCallback = () => void;
export declare class ApplicationGroup {
private platform;
$compile: ng.ICompileService;
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
applications: WebApplication[];
changeObservers: AppManagerChangeCallback[];
activeApplication?: WebApplication;
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService);
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, platform: Platform);
private createDefaultApplication;
/** @callback */
onApplicationDeinit(application: WebApplication): void;
@@ -20,7 +22,7 @@ export declare class ApplicationGroup {
* Any application which is no longer active is destroyed, and
* must be removed from the interface.
*/
addApplicationChangeObserver(callback: AppManagerChangeCallback): void;
addApplicationChangeObserver(callback: AppManagerChangeCallback): () => void;
private notifyObserversOfAppChange;
}
export {};

View File

@@ -20,6 +20,7 @@ export declare class Editor {
* Register to be notified when the editor's note changes.
*/
onNoteChange(callback: () => void): void;
clearNoteChangeListener(): void;
/**
* Register to be notified when the editor's note's values change
* (and thus a new object reference is created)
@@ -28,5 +29,5 @@ export declare class Editor {
/**
* Sets the editor contents by setting its note.
*/
setNote(note: SNNote): void;
setNote(note: SNNote, isTemplate?: boolean): void;
}

View File

@@ -1,3 +1,4 @@
export declare const isDev: boolean;
export declare function getParameterByName(name: string, url: string): string | null;
export declare function isNullOrUndefined(value: any): boolean;
export declare function getPlatformString(): string;

View File

@@ -3,16 +3,16 @@ import { ApplicationEvent } from 'snjs';
import { WebApplication } from '@/ui_models/application';
export declare type CtrlState = Partial<Record<string, any>>;
export declare type CtrlProps = Partial<Record<string, any>>;
export declare class PureViewCtrl {
export declare class PureViewCtrl<P = CtrlProps, S = CtrlState> {
props: P;
$timeout: ng.ITimeoutService;
/** Passed through templates */
application: WebApplication;
props: CtrlProps;
state: CtrlState;
state: S;
private unsubApp;
private unsubState;
private stateTimeout;
constructor($timeout: ng.ITimeoutService);
private stateTimeout?;
constructor($timeout: ng.ITimeoutService, props?: P);
$onInit(): void;
deinit(): void;
$onDestroy(): void;
@@ -20,8 +20,8 @@ export declare class PureViewCtrl {
/** @private */
resetState(): Promise<void>;
/** @override */
getInitialState(): {};
setState(state: CtrlState): Promise<unknown>;
getInitialState(): S;
setState(state: Partial<S>): Promise<unknown>;
updateUI(func: () => void): Promise<void>;
initProps(props: CtrlProps): void;
addAppStateObserver(): void;

View File

@@ -149,7 +149,7 @@ declare class $SanitizeProvider {
* @returns {boolean|$sanitizeProvider} Returns the currently configured value if called
* without an argument or self for chaining otherwise.
*/
enableSvg: (enableSvg: any) => any;
enableSvg: (enableSvg: any) => boolean | any;
/**
* @ngdoc method
* @name $sanitizeProvider#addValidElements
@@ -196,7 +196,7 @@ declare class $SanitizeProvider {
*
* @return {$sanitizeProvider} Returns self for chaining.
*/
addValidElements: (elements: Object | string[]) => any;
addValidElements: (elements: Array<string> | Object) => any;
/**
* @ngdoc method
* @name $sanitizeProvider#addValidAttrs
@@ -226,7 +226,7 @@ declare class $SanitizeProvider {
*
* @returns {$sanitizeProvider} Returns self for chaining.
*/
addValidAttrs: (attrs: string[]) => any;
addValidAttrs: (attrs: Array<string>) => any;
}
declare function sanitizeText(chars: any): string;
declare var $sanitizeMinErr: any;