diff --git a/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts deleted file mode 100644 index ae8cd4046..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { PasswordWizardType } from './types'; -import { SNApplication, Challenge, ChallengeOrchestrator, ProtectedAction } from 'snjs'; -import { AppState, DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from './services'; -declare type WebServices = { - appState: AppState; - desktopService: DesktopManager; - lockService: LockManager; - archiveService: ArchiveManager; - nativeExtService: NativeExtManager; - statusService: StatusManager; - themeService: ThemeManager; - prefsService: PreferencesManager; - keyboardService: KeyboardManager; -}; -export declare class WebApplication extends SNApplication { - private $compile?; - private scope?; - private onDeinit?; - private webServices; - private currentAuthenticationElement?; - constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: () => void); - /** @override */ - deinit(): void; - setWebServices(services: WebServices): void; - /** @access public */ - getAppState(): AppState; - /** @access public */ - getDesktopService(): DesktopManager; - /** @access public */ - getLockService(): LockManager; - /** @access public */ - getArchiveService(): ArchiveManager; - /** @access public */ - getNativeExtService(): NativeExtManager; - /** @access public */ - getStatusService(): StatusManager; - /** @access public */ - getThemeService(): ThemeManager; - /** @access public */ - getPrefsService(): PreferencesManager; - /** @access public */ - getKeyboardService(): KeyboardManager; - checkForSecurityUpdate(): Promise; - presentPasswordWizard(type: PasswordWizardType): void; - promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator): void; - performProtocolUpgrade(): Promise; - presentPrivilegesModal(action: ProtectedAction, onSuccess: any, onCancel: any): Promise; - presentPrivilegesManagementModal(): void; - authenticationInProgress(): boolean; - presentPasswordModal(callback: () => void): void; - presentRevisionPreviewModal(uuid: string, content: any): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts deleted file mode 100644 index 12aeed088..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export class ApplicationManager { - constructor($compile: any, $rootScope: any, $timeout: any); - $compile: any; - $timeout: any; - $rootScope: any; - applications: any[]; - changeObservers: any[]; - /** @callback */ - onApplicationDeinit(application: any): void; - /** @access private */ - createDefaultApplication(): void; - activeApplication: WebApplication | null | undefined; - /** @access private */ - createNewApplication(): WebApplication; - get application(): WebApplication | null | undefined; - /** @access public */ - getApplications(): any[]; - /** - * Notifies observer when the active application has changed. - * Any application which is no longer active is destroyed, and - * must be removed from the interface. - * @access public - * @param {function} callback - */ - addApplicationChangeObserver(callback: Function): void; - notifyObserversOfAppChange(): void; -} -import { WebApplication } from "./application"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts deleted file mode 100644 index 04f225476..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export class PureCtrl { - constructor($timeout: any); - $timeout: any; - props: any; - state: any; - $onInit(): void; - deinit(): void; - unsubApp: any; - unsubState: any; - application: any; - $onDestroy(): void; - /** @private */ - private resetState; - /** @override */ - getInitialState(): {}; - setState(state: any): Promise; - stateTimeout: any; - initProps(props: any): void; - addAppStateObserver(): void; - onAppStateEvent(eventName: any, data: any): void; - addAppEventObserver(): void; - onAppEvent(eventName: any): void; - /** @override */ - onAppStart(): Promise; - onAppLaunch(): Promise; - onAppKeyChange(): Promise; - onAppSync(): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts deleted file mode 100644 index da4795c16..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -export class ApplicationView { - template: any; - controller: typeof ApplicationViewCtrl; - replace: boolean; - controllerAs: string; - bindToController: { - application: string; - }; -} -declare class ApplicationViewCtrl extends PureCtrl { - constructor($compile: any, $location: any, $rootScope: any, $timeout: any); - $location: any; - $rootScope: any; - $compile: any; - platformString: string; - state: { - appClass: string; - }; - onDragDrop(event: any): void; - onDragOver(event: any): void; - openModalComponent(component: any): void; - presentPermissionsDialog(dialog: any): void; - lockScreenPuppet: any; - loadApplication(): Promise; - onAppStart(): void; - onAppLaunch(): void; - onUpdateAvailable(): void; - /** @override */ - onAppEvent(eventName: any): Promise; - syncStatus: any; - completedInitialSync: boolean | undefined; - /** @override */ - onAppStateEvent(eventName: any, data: any): Promise; - notesCollapsed: any; - tagsCollapsed: any; - updateLocalDataStatus(): void; - updateSyncStatus(): void; - showingDownloadStatus: boolean | undefined; - uploadSyncStatus: any; - overrideComponentManagerFunctions(): void; - showInvalidSessionAlert(): void; - lastShownDate: Date | undefined; - addDragDropHandlers(): void; - handleAutoSignInFromParams(): Promise; -} -import { PureCtrl } from "./abstract/pure_ctrl"; -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts deleted file mode 100644 index 35f38d001..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const PANEL_NAME_NOTES: "notes"; -export const PANEL_NAME_TAGS: "tags"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts deleted file mode 100644 index 23a9038f0..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -export class EditorPanel { - restrict: string; - scope: { - application: string; - }; - template: any; - replace: boolean; - controller: typeof EditorCtrl; - controllerAs: string; - bindToController: boolean; -} -declare class EditorCtrl { - constructor($timeout: any); - leftPanelPuppet: { - onReady: () => void; - }; - rightPanelPuppet: { - onReady: () => void; - }; - /** Used by .pug template */ - prefKeyMonospace: string; - prefKeySpellcheck: string; - prefKeyMarginResizers: string; - deinit(): void; - /** @components */ - onEditorLoad: (editor: any) => void; - unregisterComponent: any; - $onInit(): void; - /** @override */ - getInitialState(): { - componentStack: never[]; - editorDebounce: number; - isDesktop: any; - spellcheck: boolean; - mutable: { - tagsString: string; - }; - }; - onAppLaunch(): void; - /** @override */ - onAppStateEvent(eventName: any, data: any): void; - /** @override */ - onAppEvent(eventName: any): void; - /** - * Because note.locked accesses note.content.appData, - * we do not want to expose the template to direct access to note.locked, - * otherwise an exception will occur when trying to access note.locked if the note - * is deleted. There is potential for race conditions to occur with setState, where a - * previous setState call may have queued a digest cycle, and the digest cycle triggers - * on a deleted note. - */ - get noteLocked(): any; - streamItems(): void; - handleNoteSelectionChange(note: any, previousNote: any): Promise; - 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; - 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: number | null | undefined; - focusTitle(): void; - clickedTextArea(): void; - onNameFocus(): void; - editingName: boolean | undefined; - onContentFocus(): void; - onNameBlur(): void; - selectedMenuItem(hide: any): void; - deleteNote(permanently: any): Promise; - 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; - }): Promise; - onPanelResizeFinish: (width: any, left: any, isMaxWidth: any) => void; - reloadPreferences(): void; - reloadFont(): void; - toggleKey(key: any): Promise; - 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; - tabObserver: any; - removeTabObserver(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts deleted file mode 100644 index 007635308..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -export class Footer { - restrict: string; - template: any; - controller: typeof FooterCtrl; - replace: boolean; - controllerAs: string; - bindToController: { - application: string; - }; -} -declare class FooterCtrl { - constructor($rootScope: any, $timeout: any); - $rootScope: any; - rooms: any[]; - themesWithIcons: any[]; - showSyncResolution: any; - deinit(): void; - unregisterComponent: any; - rootScopeListener1: any; - rootScopeListener2: any; - closeAccountMenu: () => void; - toggleSyncResolutionMenu: () => void; - $onInit(): void; - arbitraryStatusMessage: any; - getInitialState(): { - hasPasscode: boolean; - }; - reloadUpgradeStatus(): void; - onAppLaunch(): void; - user: any; - reloadPasscodeStatus(): Promise; - addRootScopeListeners(): void; - /** @override */ - onAppStateEvent(eventName: any, data: any): void; - backupStatus: any; - /** @override */ - onAppKeyChange(): Promise; - /** @override */ - onAppEvent(eventName: any): void; - showAccountMenu: any; - streamItems(): void; - queueExtReload: boolean | undefined; - registerComponentHandler(): void; - reloadExtendedData(): void; - reloadInProgress: boolean | undefined; - updateOfflineStatus(): void; - offline: any; - openSecurityUpdate(): void; - findErrors(): void; - error: any; - accountMenuPressed(): void; - lockApp(): void; - refreshData(): void; - isRefreshing: boolean | undefined; - syncUpdated(): void; - lastSyncDate: any; - onNewUpdateAvailable(): void; - newUpdateAvailable: boolean | undefined; - clickedNewUpdateAnnouncement(): void; - reloadDockShortcuts(): void; - dockShortcuts: any; - initSvgForShortcut(shortcut: any): void; - selectShortcut(shortcut: any): void; - onRoomDismiss(room: any): void; - closeAllRooms(): void; - selectRoom(room: any): Promise; - clickOutsideAccountMenu(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts deleted file mode 100644 index d9ccabbd6..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { PureCtrl } from "./abstract/pure_ctrl"; -export { EditorPanel } from "./editor"; -export { Footer } from "./footer"; -export { NotesPanel } from "./notes/notes"; -export { TagsPanel } from "./tags"; -export { Root } from "./root"; -export { ApplicationView } from "./applicationView"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts deleted file mode 100644 index 0cdbd0f47..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export class LockScreen { - restrict: string; - template: any; - controller: typeof LockScreenCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - onValue: string; - puppet: string; - }; -} -declare class LockScreenCtrl extends PureCtrl { - constructor($timeout: any); - formData: {}; - get passcodeInput(): HTMLElement | null; - /** @override */ - onAppStateEvent(eventName: any, data: any): Promise; - submitPasscodeForm(): Promise; - forgotPasscode(): void; - beginDeleteData(): void; -} -import { PureCtrl } from "./abstract/pure_ctrl"; -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts deleted file mode 100644 index c769e82ad..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export function filterAndSortNotes({ notes, selectedTag, showArchived, hidePinned, filterText, sortBy, reverse }: { - notes: any; - selectedTag: any; - showArchived: any; - hidePinned: any; - filterText: any; - sortBy: any; - reverse: any; -}): any[]; -export function filterNotes({ notes, selectedTag, showArchived, hidePinned, filterText }: { - notes: any; - selectedTag: any; - showArchived: any; - hidePinned: any; - filterText: any; -}): any; -export function sortNotes({ notes, sortBy, reverse }: { - notes?: any[] | undefined; - sortBy: any; - reverse: any; -}): any[]; -export const SORT_KEY_CREATED_AT: "created_at"; -export const SORT_KEY_UPDATED_AT: "updated_at"; -export const SORT_KEY_CLIENT_UPDATED_AT: "client_updated_at"; -export const SORT_KEY_TITLE: "title"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts deleted file mode 100644 index 0c5382c44..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -export class NotesPanel { - template: any; - replace: boolean; - controller: typeof NotesCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - application: string; - }; -} -declare class NotesCtrl { - constructor($timeout: any); - $onInit(): void; - panelPuppet: { - onReady: () => void; - } | null | undefined; - onWindowResize(): void; - deinit(): void; - onPanelResize: (newWidth: any, lastLeft: any, isAtMaxWidth: any, isCollapsed: any) => void; - getInitialState(): { - notes: never[]; - renderedNotes: never[]; - selectedNote: null; - tag: null; - sortBy: null; - showArchived: null; - hidePinned: null; - sortReverse: null; - panelTitle: null; - mutable: { - showMenu: boolean; - }; - noteFilter: { - text: string; - }; - }; - onAppLaunch(): void; - /** @override */ - onAppStateEvent(eventName: any, data: any): void; - /** @override */ - onAppEvent(eventName: any): Promise; - /** - * @access private - * Access the current state notes without awaiting any potential reloads - * that may be in progress. This is the sync alternative to `async getMostValidNotes` - */ - getPossiblyStaleNotes(): any; - /** - * @access private - * Access the current state notes after waiting for any pending reloads. - * This returns the most up to date notes, but is the asyncronous counterpart - * to `getPossiblyStaleNotes` - */ - getMostValidNotes(): Promise; - /** - * Triggered programatically to create a new placeholder note - * when conditions allow for it. This is as opposed to creating a new note - * as part of user interaction (pressing the + button). - * @access private - */ - createPlaceholderNote(): Promise; - streamNotesAndTags(): void; - selectNote(note: any): Promise; - createNewNote(): Promise; - handleTagChange(tag: any, previousTag: any): Promise; - resetScrollPosition(): void; - removeNoteFromList(note: any): Promise; - reloadNotes(): Promise; - reloadNotesPromise: Promise | undefined; - performPeloadNotes(): Promise; - setShowMenuFalse(): void; - handleNoteSelection(note: any): Promise; - selectedIndex: number | undefined; - reloadPreferences(): void; - paginate(): void; - resetPagination({ keepCurrentIfLarger }?: { - keepCurrentIfLarger: any; - }): void; - pageSize: number | undefined; - notesToDisplay: number | undefined; - reloadPanelTitle(): void; - optionsSubtitle(): string; - loadFlagsForNote(note: any): { - text: string; - class: string; - }[]; - displayableNotes(): any; - getFirstNonProtectedNote(): any; - selectFirstNote(): void; - selectNextNote(): void; - selectNextOrCreateNew(): void; - selectPreviousNote(): boolean; - isFiltering(): boolean; - setNoteFilterText(text: any): Promise; - clearFilterText(): Promise; - filterTextChanged(): Promise; - searchSubmitted: boolean | undefined; - onFilterEnter(): void; - selectedMenuItem(): void; - togglePrefKey(key: any): void; - selectedSortByCreated(): void; - selectedSortByUpdated(): void; - selectedSortByTitle(): void; - toggleReverseSort(): void; - setSortBy(type: any): void; - shouldShowTagsForNote(note: any): boolean; - getSearchBar(): HTMLElement | null; - registerKeyboardShortcuts(): void; - /** - * In the browser we're not allowed to override cmd/ctrl + n, so we have to - * use Control modifier as well. These rules don't apply to desktop, but - * probably better to be consistent. - */ - newNoteKeyObserver: any; - nextNoteKeyObserver: any; - searchKeyObserver: any; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts deleted file mode 100644 index d5aef945c..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export class Root { - template: any; - controller: typeof RootCtrl; - replace: boolean; - controllerAs: string; - bindToController: boolean; -} -declare class RootCtrl { - constructor($timeout: any, applicationManager: any); - $timeout: any; - applicationManager: any; - reload(): void; - applications: any; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts deleted file mode 100644 index 1b23a8ea8..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export class TagsPanel { - restrict: string; - scope: { - application: string; - }; - template: any; - replace: boolean; - controller: typeof TagsPanelCtrl; - controllerAs: string; - bindToController: boolean; -} -declare class TagsPanelCtrl { - constructor($timeout: any); - panelPuppet: { - onReady: () => void; - }; - deinit(): void; - unregisterComponent: any; - getInitialState(): { - tags: never[]; - smartTags: never[]; - noteCounts: {}; - }; - onAppStart(): void; - onAppLaunch(): void; - /** @override */ - onAppSync(): void; - /** - * Returns all officially saved tags as reported by the model manager. - * @access private - */ - getMappedTags(): any; - beginStreamingItems(): void; - /** @override */ - onAppStateEvent(eventName: any, data: any): void; - /** @override */ - onAppEvent(eventName: any): Promise; - reloadNoteCounts(): void; - loadPreferences(): void; - onPanelResize: (newWidth: any, lastLeft: any, isAtMaxWidth: any, isCollapsed: any) => void; - registerComponentHandler(): void; - component: any; - selectTag(tag: any): Promise; - clickedAddNewTag(): Promise; - tagTitleDidChange(tag: any): void; - saveTag($event: any, tag: any): Promise; - editingOriginalName: any; - selectedRenameTag($event: any, tag: any): Promise; - selectedDeleteTag(tag: any): void; - removeTag(tag: any): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts deleted file mode 100644 index d94c95583..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export class Database { - locked: boolean; - /** @access public */ - deinit(): void; - alertService: any; - db: any; - /** @access public */ - setApplication(application: any): void; - /** - * Relinquishes the lock and allows db operations to proceed - * @access public - */ - unlock(): void; - /** - * Opens the database natively, or returns the existing database object if already opened. - * @access public - * @param {function} onNewDatabase - Callback to invoke when a database has been created - * as part of the open process. This can happen on new application sessions, or if the - * browser deleted the database without the user being aware. - */ - openDatabase(onNewDatabase: Function): Promise; - /** @access public */ - getAllPayloads(): Promise; - /** @access public */ - savePayload(payload: any): Promise; - /** @access public */ - savePayloads(payloads: any): Promise; - /** @access private */ - putItems(objectStore: any, items: any): Promise<[any, any, any, any, any, any, any, any, any, any]>; - /** @access public */ - deletePayload(uuid: any): Promise; - /** @access public */ - clearAllPayloads(): Promise; - /** @access private */ - showAlert(message: any): void; - /** - * @access private - * @param {object} error - {code, name} - */ - showGenericError(error: object): void; - /** @access private */ - displayOfflineAlert(): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts deleted file mode 100644 index 159a60450..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function autofocus($timeout: any): { - restrict: string; - scope: { - shouldFocus: string; - }; - link: ($scope: any, $element: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts deleted file mode 100644 index b74259c26..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function clickOutside($document: any): { - restrict: string; - replace: boolean; - link: ($scope: any, $element: any, attrs: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts deleted file mode 100644 index 91c9ad5d7..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function delayHide($timeout: any): { - restrict: string; - scope: { - show: string; - delay: string; - }; - link: (scope: any, elem: any, attrs: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts deleted file mode 100644 index bda2d4c42..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function elemReady($parse: any): { - restrict: string; - link: ($scope: any, elem: any, attrs: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts deleted file mode 100644 index 3a284104b..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function fileChange(): { - restrict: string; - scope: { - handler: string; - }; - link: (scope: any, element: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts deleted file mode 100644 index 3a2852dec..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { autofocus } from "./autofocus"; -export { clickOutside } from "./click-outside"; -export { delayHide } from "./delay-hide"; -export { elemReady } from "./elemReady"; -export { fileChange } from "./file-change"; -export { infiniteScroll } from "./infiniteScroll"; -export { lowercase } from "./lowercase"; -export { selectOnClick } from "./selectOnClick"; -export { snEnter } from "./snEnter"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts deleted file mode 100644 index 6f9500126..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function infiniteScroll(): { - link: (scope: any, elem: any, attrs: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts deleted file mode 100644 index b2df15723..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function lowercase(): { - require: string; - link: (scope: any, element: any, attrs: any, modelCtrl: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts deleted file mode 100644 index ed23ff5b1..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function selectOnClick($window: any): { - restrict: string; - link: (scope: any, element: any, attrs: any) => void; -}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts deleted file mode 100644 index a4faa7f1d..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function snEnter(): (scope: any, element: any, attrs: any) => void; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts deleted file mode 100644 index 91da180f9..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -export class AccountMenu { - restrict: string; - template: any; - controller: typeof AccountMenuCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - closeFunction: string; - application: string; - }; -} -declare class AccountMenuCtrl { - constructor($timeout: any, appVersion: any); - appVersion: any; - /** @override */ - getInitialState(): { - appVersion: string; - passcodeAutoLockOptions: any; - user: any; - formData: { - mergeLocal: boolean; - ephemeral: boolean; - }; - mutable: {}; - }; - onAppKeyChange(): Promise; - onAppLaunch(): Promise; - refreshedCredentialState(): { - user: any; - canAddPasscode: boolean; - hasPasscode: any; - showPasscodeForm: boolean; - }; - $onInit(): void; - syncStatus: any; - close(): void; - loadHost(): Promise; - onHostInputChange(): void; - loadBackupsAvailability(): Promise; - submitMfaForm(): void; - blurAuthFields(): void; - submitAuthForm(): void; - setFormDataState(formData: any): Promise; - login(): Promise; - register(): Promise; - mergeLocalChanged(): void; - openPasswordWizard(): void; - openPrivilegesModal(): Promise; - destroyLocalData(): void; - submitImportPassword(): Promise; - readFile(file: any): Promise; - /** - * @template - */ - importFileSelected<(Missing)>(files: any): Promise; - performImport(data: any, password: any): Promise; - importJSONData(data: any, password: any): Promise; - downloadDataArchive(): Promise; - notesAndTagsCount(): any; - encryptionStatusForNotes(): string; - reloadAutoLockInterval(): Promise; - selectAutoLockInterval(interval: any): Promise; - hidePasswordForm(): void; - hasPasscode(): any; - addPasscodeClicked(): void; - submitPasscodeForm(): void; - changePasscodePressed(): Promise; - removePasscodePressed(): Promise; - isDesktopApplication(): any; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts deleted file mode 100644 index f31ae0e68..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export class ActionsMenu { - restrict: string; - template: any; - replace: boolean; - controller: typeof ActionsMenuCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - item: string; - application: string; - }; -} -declare class ActionsMenuCtrl { - constructor($timeout: any); - state: { - extensions: never[]; - }; - $onInit(): void; - loadExtensions(): Promise; - executeAction(action: any, extension: any): Promise; - handleActionResult(action: any, result: any): void; - subRowsForAction(parentAction: any, extension: any): any; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts deleted file mode 100644 index 1151642a4..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export class ChallengeModal { - restrict: string; - template: any; - controller: typeof ChallengeModalCtrl; - controllerAs: string; - bindToController: { - challenge: string; - orchestrator: string; - application: string; - }; -} -declare class ChallengeModalCtrl { - constructor($element: any, $timeout: any); - $element: any; - processingTypes: any[]; - $onInit(): void; - deinit(): void; - application: any; - orchestrator: any; - challenge: any; - reloadProcessingStatus(): void; - promptForChallenge(challenge: any): "Enter your application passcode" | "Enter your account password"; - cancel(): void; - onTextValueChange(challenge: any): void; - validate(): boolean; - submit(): Promise; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts deleted file mode 100644 index c64eb91e6..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export class ComponentModalCtrl { - constructor($element: any); - $element: any; - dismiss(): void; -} -export class ComponentModal { - restrict: string; - template: any; - controller: typeof ComponentModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - show: string; - component: string; - callback: string; - onDismiss: string; - application: string; - }; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts deleted file mode 100644 index 11bc5e78d..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -export class ComponentView { - restrict: string; - template: any; - scope: { - component: string; - onLoad: string; - manualDealloc: string; - application: string; - }; - controller: typeof ComponentViewCtrl; - controllerAs: string; - bindToController: boolean; -} -declare class ComponentViewCtrl { - constructor($scope: any, $rootScope: any, $timeout: any); - $rootScope: any; - $timeout: any; - componentValid: boolean; - cleanUpOn: any; - onVisibilityChange(): void; - $onDestroy(): void; - unregisterComponentHandler: any; - unregisterDesktopObserver: any; - component: any; - onLoad: any; - application: any; - $onChanges(): void; - didRegisterObservers: boolean | undefined; - lastComponentValue: any; - registerPackageUpdateObserver(): void; - registerComponentHandlers(): void; - reloadComponent(): Promise; - reloadStatus(doManualReload?: boolean): void; - reloading: boolean | undefined; - expired: boolean | undefined; - loading: boolean | undefined; - error: string | null | undefined; - handleActivation(): void; - loadTimeout: any; - handleIframeLoadTimeout(): Promise; - issueLoading: boolean | undefined; - didAttemptReload: boolean | undefined; - handleIframeLoad(iframe: any): Promise; - disableActiveTheme(): void; - getUrl(): any; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts deleted file mode 100644 index 41fd17121..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export class ConflictResolutionModal { - restrict: string; - template: any; - controller: typeof ConflictResolutionCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - item1: string; - item2: string; - callback: string; - application: string; - }; -} -declare class ConflictResolutionCtrl { - constructor($element: any); - $element: any; - $onInit(): void; - contentType: any; - item1Content: string | undefined; - item2Content: string | undefined; - createContentString(item: any): string; - keepItem1(): void; - keepItem2(): void; - keepBoth(): void; - export(): void; - triggerCallback(): void; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts deleted file mode 100644 index 299ad3eb8..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export class EditorMenu { - restrict: string; - template: any; - controller: typeof EditorMenuCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - callback: string; - selectedEditor: string; - currentItem: string; - application: string; - }; -} -declare class EditorMenuCtrl { - constructor($timeout: any); - state: { - isDesktop: any; - }; - $onInit(): void; - selectComponent(component: any): void; - toggleDefaultForEditor(editor: any): void; - offlineAvailableForComponent(component: any): any; - makeEditorDefault(component: any): void; - removeEditorDefault(component: any): void; - shouldDisplayRunningLocallyLabel(component: any): boolean; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts deleted file mode 100644 index f3f785f9f..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export { AccountMenu } from "./accountMenu"; -export { ActionsMenu } from "./actionsMenu"; -export { ChallengeModal } from "./challengeModal"; -export { ComponentModal } from "./componentModal"; -export { ComponentView } from "./componentView"; -export { ConflictResolutionModal } from "./conflictResolutionModal"; -export { EditorMenu } from "./editorMenu"; -export { InputModal } from "./inputModal"; -export { MenuRow } from "./menuRow"; -export { PanelResizer } from "./panelResizer"; -export { PasswordWizard } from "./passwordWizard"; -export { PermissionsModal } from "./permissionsModal"; -export { PrivilegesAuthModal } from "./privilegesAuthModal"; -export { PrivilegesManagementModal } from "./privilegesManagementModal"; -export { RevisionPreviewModal } from "./revisionPreviewModal"; -export { SessionHistoryMenu } from "./sessionHistoryMenu"; -export { SyncResolutionMenu } from "./syncResolutionMenu"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts deleted file mode 100644 index a4559694f..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export class InputModal { - restrict: string; - template: any; - controller: typeof InputModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - type: string; - title: string; - message: string; - placeholder: string; - callback: string; - }; -} -declare class InputModalCtrl { - constructor($element: any); - $element: any; - formData: {}; - dismiss(): void; - submit(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts deleted file mode 100644 index a7914ebd7..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export class MenuRow { - restrict: string; - transclude: boolean; - template: any; - controller: typeof MenuRowCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - action: string; - buttonAction: string; - buttonClass: string; - buttonText: string; - desc: string; - disabled: string; - circle: string; - circleAlign: string; - faded: string; - hasButton: string; - label: string; - spinnerClass: string; - stylekitClass: string; - subRows: string; - subtitle: string; - }; -} -declare class MenuRowCtrl { - onClick($event: any): void; - clickAccessoryButton($event: any): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts deleted file mode 100644 index fceae3702..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -export class PanelResizer { - restrict: string; - template: any; - controller: typeof PanelResizerCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - alwaysVisible: string; - collapsable: string; - control: string; - defaultWidth: string; - hoverable: string; - index: string; - minWidth: string; - onResizeFinish: string; - panelId: string; - property: string; - }; -} -declare class PanelResizerCtrl { - constructor($compile: any, $element: any, $timeout: any); - $compile: any; - $element: any; - $timeout: any; - handleResize(): void; - onMouseMove(event: any): void; - onMouseUp(): void; - onMouseDown(event: any): void; - $onInit(): void; - $onDestroy(): void; - onResizeFinish: any; - control: any; - configureControl(): void; - configureDefaults(): void; - panel: HTMLElement | null | undefined; - resizerColumn: any; - currentMinWidth: any; - pressed: boolean | undefined; - startWidth: any; - lastDownX: any; - collapsed: boolean | undefined; - lastWidth: any; - startLeft: number | undefined; - lastLeft: any; - appFrame: DOMRect | null | undefined; - widthBeforeLastDblClick: any; - configureRightPanel(): void; - getParentRect(): any; - reloadDefaultValues(): void; - addDoubleClickHandler(): void; - addMouseDownListener(): void; - addMouseMoveListener(): void; - handleWidthEvent(event: any): void; - handleLeftEvent(event: any): void; - addMouseUpListener(): void; - isAtMaxWidth(): any; - isCollapsed(): boolean; - setWidth(width: any, finish: any): void; - setLeft(left: any): void; - finishSettingWidth(): void; - /** - * If an iframe is displayed adjacent to our panel, and the mouse exits over the iframe, - * document[onmouseup] is not triggered because the document is no longer the same over - * the iframe. We add an invisible overlay while resizing so that the mouse context - * remains in our main document. - */ - addInvisibleOverlay(): void; - overlay: any; - removeInvisibleOverlay(): void; - flash(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts deleted file mode 100644 index f92a102d0..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export class PasswordWizard { - restrict: string; - template: any; - controller: typeof PasswordWizardCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - type: string; - application: string; - }; -} -declare class PasswordWizardCtrl { - constructor($element: any, $timeout: any); - $element: any; - $timeout: any; - $onInit(): void; - $onDestroy(): void; - /** Confirms with user before closing tab */ - registerWindowUnloadStopper(): void; - resetContinueState(): void; - isContinuing: boolean | undefined; - nextStep(): Promise; - setFormDataState(formData: any): Promise; - validateCurrentPassword(): Promise; - processPasswordChange(): Promise; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts deleted file mode 100644 index cfe077aeb..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export class PermissionsModal { - restrict: string; - template: any; - controller: typeof PermissionsModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - show: string; - component: string; - permissionsString: string; - callback: string; - }; -} -declare class PermissionsModalCtrl { - constructor($element: any); - $element: any; - dismiss(): void; - accept(): void; - deny(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts deleted file mode 100644 index a8dd657df..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export class PrivilegesAuthModal { - restrict: string; - template: any; - controller: typeof PrivilegesAuthModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - action: string; - onSuccess: string; - onCancel: string; - application: string; - }; -} -declare class PrivilegesAuthModalCtrl { - constructor($element: any, $timeout: any); - $element: any; - $timeout: any; - $onInit(): void; - authParameters: {} | undefined; - sessionLengthOptions: any; - selectedSessionLength: any; - requiredCredentials: any; - selectSessionLength(length: any): void; - promptForCredential(credential: any): any; - cancel(): void; - isCredentialInFailureState(credential: any): boolean; - validate(): boolean; - failedCredentials: any; - submit(): Promise; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts deleted file mode 100644 index 50852202b..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export class PrivilegesManagementModal { - restrict: string; - template: any; - controller: typeof PrivilegesManagementModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - application: string; - }; -} -declare class PrivilegesManagementModalCtrl { - constructor($timeout: any, $element: any); - $element: any; - onAppLaunch(): void; - hasPasscode: any; - hasAccount: boolean | undefined; - displayInfoForCredential(credential: any): any; - displayInfoForAction(action: any): any; - isCredentialRequiredForAction(action: any, credential: any): any; - clearSession(): Promise; - reloadPrivileges(): Promise; - availableActions: any; - availableCredentials: any; - sessionExpirey: any; - sessionExpired: boolean | undefined; - credentialDisplayInfo: {} | undefined; - privileges: any; - checkboxValueChanged(action: any, credential: any): void; - cancel(): void; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts deleted file mode 100644 index 9569f65b7..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export class RevisionPreviewModal { - restrict: string; - template: any; - controller: typeof RevisionPreviewModalCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - uuid: string; - content: string; - application: string; - }; -} -declare class RevisionPreviewModalCtrl { - constructor($element: any, $timeout: any); - $element: any; - $timeout: any; - $onInit(): void; - $onDestroy(): void; - unregisterComponent: any; - configure(): Promise; - note: any; - editor: any; - restore(asCopy: any): void; - dismiss(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts deleted file mode 100644 index 614c9e6c7..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export class SessionHistoryMenu { - restrict: string; - template: any; - controller: typeof SessionHistoryMenuCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - item: string; - application: string; - }; -} -declare class SessionHistoryMenuCtrl { - constructor($timeout: any); - $timeout: any; - $onInit(): void; - diskEnabled: any; - autoOptimize: any; - reloadHistory(): void; - entries: any; - history: any; - openRevision(revision: any): void; - classForRevision(revision: any): "default" | "success" | "danger" | undefined; - clearItemHistory(): void; - clearAllHistory(): void; - toggleDiskSaving(): void; - toggleAutoOptimize(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts deleted file mode 100644 index 2fe1255df..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export class SyncResolutionMenu { - restrict: string; - template: any; - controller: typeof SyncResolutionMenuCtrl; - controllerAs: string; - bindToController: boolean; - scope: { - closeFunction: string; - application: string; - }; -} -declare class SyncResolutionMenuCtrl { - constructor($timeout: any); - $timeout: any; - status: {}; - downloadBackup(encrypted: any): void; - skipBackup(): void; - performSyncResolution(): Promise; - close(): void; -} -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts deleted file mode 100644 index 28238231f..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { trusted } from "./trusted"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts deleted file mode 100644 index 4a1324ee5..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function trusted($sce: any): (url: any) => any; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts deleted file mode 100644 index 3247c0201..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function configRoutes($locationProvider: ng.ILocationProvider): void; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts deleted file mode 100644 index bd3b618ce..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class AlertService extends SNAlertService { - constructor(deviceInterface: import("../../../../../snjs/dist/@types").DeviceInterface); - alert(title: any, text: any, closeButtonText?: string, onClose: any): Promise; - confirm(title: any, text: any, confirmButtonText?: string, cancelButtonText?: string, onConfirm: any, onCancel: any, destructive?: boolean): Promise; -} -import { SNAlertService } from "../../../../../snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts deleted file mode 100644 index 7442f11d5..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export class ArchiveManager { - constructor(application: any); - application: any; - /** @public */ - public downloadBackup(encrypted: any): Promise; - /** @public */ - public downloadBackupOfItems(items: any, encrypted: any): Promise; - /** @private */ - private formattedDate; - /** @private */ - private itemsData; - /** @private */ - private loadZip; - /** @private */ - private downloadZippedItems; - /** @private */ - private hrefForData; - textFile: string | undefined; - /** @private */ - private downloadData; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts deleted file mode 100644 index d45215ef4..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export class DesktopManager extends ApplicationService { - constructor($rootScope: any, $timeout: any, application: any); - $rootScope: any; - $timeout: any; - componentActivationObservers: any[]; - updateObservers: any[]; - isDesktop: any; - /** @override */ - onAppEvent(eventName: any): void; - dataLoaded: boolean | undefined; - saveBackup(): void; - getExtServerHost(): any; - /** - * Sending a component in its raw state is really slow for the desktop app - * Keys are not passed into ItemParams, so the result is not encrypted - */ - convertComponentForTransmission(component: any): Promise; - syncComponentsInstallation(components: any): void; - installComponent(component: any): Promise; - registerUpdateObserver(callback: any): () => void; - searchText(text: any): void; - lastSearchedText: any; - redoSearch(): void; - desktop_setSearchHandler(handler: any): void; - searchHandler: any; - desktop_windowGainedFocus(): void; - desktop_windowLostFocus(): void; - desktop_onComponentInstallationComplete(componentData: any, error: any): Promise; - desktop_registerComponentActivationObserver(callback: any): { - id: () => number; - callback: any; - }; - desktop_deregisterComponentActivationObserver(observer: any): void; - notifyComponentActivation(component: any): Promise; - desktop_setExtServerHost(host: any): void; - extServerHost: any; - desktop_setComponentInstallationSyncHandler(handler: any): void; - installationSyncHandler: any; - desktop_setInstallComponentHandler(handler: any): void; - installComponentHandler: any; - desktop_setInitialDataLoadHandler(handler: any): void; - dataLoadHandler: any; - desktop_requestBackupFile(callback: any): Promise; - desktop_setMajorDataChangeHandler(handler: any): void; - majorDataChangeHandler: any; - desktop_didBeginBackup(): void; - desktop_didFinishBackup(success: any): void; -} -import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts deleted file mode 100644 index 7558e5de1..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { AlertService } from "./alertService"; -export { ArchiveManager } from "./archiveManager"; -export { DesktopManager } from "./desktopManager"; -export { KeyboardManager } from "./keyboardManager"; -export { LockManager } from "./lockManager"; -export { NativeExtManager } from "./nativeExtManager"; -export { PreferencesManager } from "./preferencesManager"; -export { StatusManager } from "./statusManager"; -export { ThemeManager } from "./themeManager"; -export { AppState } from "./state"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts deleted file mode 100644 index d8f1cedf0..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export namespace KeyboardKeys { - export const Tab: string; - export const Backspace: string; - export const Up: string; - export const Down: string; -} -export namespace KeyboardModifiers { - export const Shift: string; - export const Ctrl: string; - export const Meta: string; - export const Alt: string; -} -export class KeyboardManager { - observers: any[]; - handleKeyDown(event: any): void; - handleKeyUp(event: any): void; - /** @access public */ - deinit(): void; - modifiersForEvent(event: any): any[]; - eventMatchesKeyAndModifiers(event: any, key: any, modifiers?: any[]): boolean; - notifyObserver(event: any, keyEventType: any): void; - addKeyObserver({ key, modifiers, onKeyDown, onKeyUp, element, elements, notElement, notElementIds }: { - key: any; - modifiers: any; - onKeyDown: any; - onKeyUp: any; - element: any; - elements: any; - notElement: any; - notElementIds: any; - }): { - key: any; - modifiers: any; - onKeyDown: any; - onKeyUp: any; - element: any; - elements: any; - notElement: any; - notElementIds: any; - }; - removeKeyObserver(observer: any): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts deleted file mode 100644 index 7470cb337..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export class LockManager { - constructor(application: any); - application: any; - observeVisibility(): void; - unsubState: any; - deinit(): void; - setAutoLockInterval(interval: any): Promise; - getAutoLockInterval(): Promise; - /** - * Verify document is in focus every so often as visibilitychange event is - * not triggered on a typical window blur event but rather on tab changes. - */ - beginWebFocusPolling(): void; - pollFocusInterval: NodeJS.Timeout | undefined; - lastFocusState: string | undefined; - getAutoLockIntervalOptions(): { - value: number; - label: string; - }[]; - documentVisibilityChanged(visible: any): Promise; - beginAutoLockTimer(): Promise; - lockAfterDate: Date | null | undefined; - lockTimeout: NodeJS.Timeout | undefined; - cancelAutoLockTimer(): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts deleted file mode 100644 index df6d08911..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** A class for handling installation of system extensions */ -export class NativeExtManager extends ApplicationService { - constructor(application: any); - extManagerId: string; - batchManagerId: string; - /** @override */ - onAppLaunch(): void; - get extManagerPred(): SNPredicate; - get batchManagerPred(): SNPredicate; - reload(): void; - resolveExtensionsManager(): Promise; - extensionsManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined; - batchManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined; - resolveBatchManager(): Promise; -} -import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; -import { SNPredicate } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts deleted file mode 100644 index 09416a0ee..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export namespace PrefKeys { - export const TagsPanelWidth: string; - export const NotesPanelWidth: string; - export const EditorWidth: string; - export const EditorLeft: string; - export const EditorMonospaceEnabled: string; - export const EditorSpellcheck: string; - export const EditorResizersEnabled: string; - export const SortNotesBy: string; - export const SortNotesReverse: string; - export const NotesShowArchived: string; - export const NotesHidePinned: string; - export const NotesHideNotePreview: string; - export const NotesHideDate: string; - export const NotesHideTags: string; -} -export class PreferencesManager extends ApplicationService { - constructor(application: import("../../../../../snjs/dist/@types/application").SNApplication); - /** @override */ - onAppLaunch(): void; - streamPreferences(): void; - loadSingleton(): Promise; - userPreferences: any; - preferencesDidChange(): void; - syncUserPreferences(): void; - getValue(key: any, defaultValue: any): any; - setUserPrefValue(key: any, value: any, sync: any): void; -} -import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts deleted file mode 100644 index a7b672f6b..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -export namespace AppStateEvents { - export const TagChanged: number; - export const NoteChanged: number; - export const PreferencesChanged: number; - export const PanelResized: number; - export const EditorFocused: number; - export const BeganBackupDownload: number; - export const EndedBackupDownload: number; - export const DesktopExtsReady: number; - export const WindowDidFocus: number; - export const WindowDidBlur: number; -} -export namespace EventSources { - export const UserInteraction: number; - export const Script: number; -} -export class AppState { - constructor($rootScope: any, $timeout: any, application: any); - $timeout: any; - $rootScope: any; - application: any; - observers: any[]; - locked: boolean; - deinit(): void; - unsubApp: any; - rootScopeCleanup1: any; - rootScopeCleanup2: any; - onVisibilityChange(): void; - addAppEventObserver(): void; - isLocked(): boolean; - registerVisibilityObservers(): void; - /** @returns A function that unregisters this observer */ - addObserver(callback: any): () => void; - notifyEvent(eventName: any, data: any): Promise; - setSelectedTag(tag: any): void; - selectedTag: any; - setSelectedNote(note: any): Promise; - selectedNote: any; - getSelectedTag(): any; - getSelectedNote(): any; - setUserPreferences(preferences: any): void; - userPreferences: any; - panelDidResize({ name, collapsed }: { - name: any; - collapsed: any; - }): void; - editorDidFocus(eventSource: any): void; - beganBackupDownload(): void; - endedBackupDownload({ success }: { - success: any; - }): void; - /** - * When the desktop appplication extension server is ready. - */ - desktopExtensionsReady(): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts deleted file mode 100644 index adc5ce52d..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export class StatusManager { - statuses: any[]; - observers: any[]; - statusFromString(string: any): { - string: any; - }; - replaceStatusWithString(status: any, string: any): any; - addStatusFromString(string: any): any; - addStatus(status: any): any; - removeStatus(status: any): null; - getStatusString(): string; - notifyObservers(): void; - addStatusObserver(callback: any): void; - removeStatusObserver(callback: any): void; -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts deleted file mode 100644 index 4d34eabe1..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export class ThemeManager extends ApplicationService { - constructor(application: any); - activeThemes: any[]; - unsubState: any; - unregisterDesktop: any; - unregisterComponent: any; - /** @override */ - onAppStart(): void; - /** @access private */ - activateCachedThemes(): Promise; - /** @access private */ - registerObservers(): void; - /** @access public */ - deactivateAllThemes(): void; - /** @access private */ - activateTheme(theme: any, writeToCache?: boolean): void; - /** @access private */ - deactivateTheme(theme: any): void; - /** @access private */ - cacheThemes(): Promise; - /** @access private */ - decacheThemes(): Promise; - /** @access private */ - getCachedThemes(): Promise; -} -import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts deleted file mode 100644 index 00116bf4a..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export function StringSyncException(data: any): string; -export function StringDeleteNote({ title, permanently }: { - title: any; - permanently: any; -}): string; -export function StringEmptyTrash({ count }: { - count: any; -}): string; -export function StringImportError({ errorCount }: { - errorCount: any; -}): string; -/** @generic */ -export const STRING_SESSION_EXPIRED: "Your session has expired. New changes will not be pulled in. Please sign out and sign back in to refresh your session."; -export const STRING_DEFAULT_FILE_ERROR: "Please use FileSafe or the Bold Editor to attach images and files. Learn more at standardnotes.org/filesafe."; -export const STRING_GENERIC_SYNC_ERROR: "There was an error syncing. Please try again. If all else fails, try signing out and signing back in."; -/** @footer */ -export const STRING_NEW_UPDATE_READY: "A new update is ready to install. Please use the top-level 'Updates' menu to manage installation."; -/** @tags */ -export const STRING_DELETE_TAG: "Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes."; -/** @editor */ -export const STRING_DELETED_NOTE: "The note you are attempting to edit has been deleted, and is awaiting sync. Changes you make will be disregarded."; -export const STRING_INVALID_NOTE: "The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note."; -export const STRING_ELLIPSES: "..."; -export const STRING_GENERIC_SAVE_ERROR: "There was an error saving your note. Please try again."; -export const STRING_DELETE_PLACEHOLDER_ATTEMPT: "This note is a placeholder and cannot be deleted. To remove from your list, simply navigate to a different note."; -export const STRING_DELETE_LOCKED_ATTEMPT: "This note is locked. If you'd like to delete it, unlock it, and try again."; -/** @account */ -export const STRING_ACCOUNT_MENU_UNCHECK_MERGE: "Unchecking this option means any of the notes you have written while you were signed out will be deleted. Are you sure you want to discard these notes?"; -export const STRING_SIGN_OUT_CONFIRMATION: "Are you sure you want to end your session? This will delete all local items and extensions."; -export const STRING_ERROR_DECRYPTING_IMPORT: "There was an error decrypting your items. Make sure the password you entered is correct and try again."; -export const STRING_E2E_ENABLED: "End-to-end encryption is enabled. Your data is encrypted on your device first, then synced to your private cloud."; -export const STRING_LOCAL_ENC_ENABLED: "Encryption is enabled. Your data is encrypted using your passcode before it is saved to your device storage."; -export const STRING_ENC_NOT_ENABLED: "Encryption is not enabled. Sign in, register, or add a passcode lock to enable encryption."; -export const STRING_IMPORT_SUCCESS: "Your data has been successfully imported."; -export const STRING_REMOVE_PASSCODE_CONFIRMATION: "Are you sure you want to remove your application passcode?"; -export const STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM: " This will remove encryption from your local data."; -export const STRING_NON_MATCHING_PASSCODES: "The two passcodes you entered do not match. Please try again."; -export const STRING_NON_MATCHING_PASSWORDS: "The two passwords you entered do not match. Please try again."; -export const STRING_GENERATING_LOGIN_KEYS: "Generating Login Keys..."; -export const STRING_GENERATING_REGISTER_KEYS: "Generating Account Keys..."; -export const STRING_INVALID_IMPORT_FILE: "Unable to open file. Ensure it is a proper JSON file and try again."; -/** @password_change */ -export 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."; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts deleted file mode 100644 index b76181d93..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare enum PasswordWizardType { - ChangePassword = 1, - AccountUpgrade = 2 -} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts deleted file mode 100644 index 5501470ac..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function getParameterByName(name: any, url: any): string | null; -export function parametersFromURL(url: any): {}; -export function isNullOrUndefined(value: any): boolean; -export function dictToArray(dict: any): any[]; -export function humanReadableList(array: any): string; -export function getPlatformString(): string; -export function dateToLocalizedString(date: any): any; -/** Via https://davidwalsh.name/javascript-debounce-function */ -export function debounce(func: any, wait: any, immediate: any): (...args: any[]) => void; -export function isDesktopApplication(): any; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts deleted file mode 100644 index 640546166..000000000 --- a/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { DeviceInterface, SNApplication } from 'snjs'; -export declare class WebDeviceInterface extends DeviceInterface { - private database; - constructor(namespace: string, timeout: any); - setApplication(application: SNApplication): void; - deinit(): void; - getRawStorageValue(key: string): Promise; - getAllRawStorageKeyValues(): Promise<{ - key: string; - value: any; - }[]>; - setRawStorageValue(key: string, value: any): Promise; - removeRawStorageValue(key: string): Promise; - removeAllRawStorageValues(): Promise; - openDatabase(): Promise<{ - isNewDatabase?: boolean | undefined; - } | undefined>; - private getDatabaseKeyPrefix; - private keyForPayloadId; - getAllRawDatabasePayloads(): Promise; - saveRawDatabasePayload(payload: any): Promise; - saveRawDatabasePayloads(payloads: any[]): Promise; - removeRawDatabasePayloadWithId(id: string): Promise; - removeAllRawDatabasePayloads(): Promise; - getKeychainValue(): Promise; - setKeychainValue(value: any): Promise; - clearKeychainValue(): Promise; - openUrl(url: string): void; -} diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts deleted file mode 100644 index 7f565f6f2..000000000 --- a/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts +++ /dev/null @@ -1,242 +0,0 @@ -/** - * @ngdoc module - * @name ngSanitize - * @description - * - * The `ngSanitize` module provides functionality to sanitize HTML. - * - * See {@link ngSanitize.$sanitize `$sanitize`} for usage. - */ -/** - * @ngdoc service - * @name $sanitize - * @kind function - * - * @description - * Sanitizes an html string by stripping all potentially dangerous tokens. - * - * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are - * then serialized back to a properly escaped HTML string. This means that no unsafe input can make - * it into the returned string. - * - * The whitelist for URL sanitization of attribute values is configured using the functions - * `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link $compileProvider}. - * - * The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}. - * - * @param {string} html HTML input. - * @returns {string} Sanitized HTML. - * - * @example - - - -
- Snippet: - - - - - - - - - - - - - - - - - - - - - - - - - -
DirectiveHowSourceRendered
ng-bind-htmlAutomatically uses $sanitize
<div ng-bind-html="snippet">
</div>
ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value -
<div ng-bind-html="deliberatelyTrustDangerousSnippet()">
-</div>
-
ng-bindAutomatically escapes
<div ng-bind="snippet">
</div>
-
-
- - it('should sanitize the html snippet by default', function() { - expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')). - toBe('

an html\nclick here\nsnippet

'); - }); - - it('should inline raw snippet if bound to a trusted value', function() { - expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')). - toBe("

an html\n" + - "click here\n" + - "snippet

"); - }); - - it('should escape snippet without any filter', function() { - expect(element(by.css('#bind-default div')).getAttribute('innerHTML')). - toBe("<p style=\"color:blue\">an html\n" + - "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + - "snippet</p>"); - }); - - it('should update', function() { - element(by.model('snippet')).clear(); - element(by.model('snippet')).sendKeys('new text'); - expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')). - toBe('new text'); - expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe( - 'new text'); - expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe( - "new <b onclick=\"alert(1)\">text</b>"); - }); -
-
- */ -/** - * @ngdoc provider - * @name $sanitizeProvider - * @this - * - * @description - * Creates and configures {@link $sanitize} instance. - */ -declare function $SanitizeProvider(): void; -declare class $SanitizeProvider { - $get: (string | (($$sanitizeUri: any) => (html: any) => string))[]; - /** - * @ngdoc method - * @name $sanitizeProvider#enableSvg - * @kind function - * - * @description - * Enables a subset of svg to be supported by the sanitizer. - * - *
- *

By enabling this setting without taking other precautions, you might expose your - * application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned - * outside of the containing element and be rendered over other elements on the page (e.g. a login - * link). Such behavior can then result in phishing incidents.

- * - *

To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg - * tags within the sanitized content:

- * - *
- * - *

-     *   .rootOfTheIncludedContent svg {
-     *     overflow: hidden !important;
-     *   }
-     *   
- *
- * - * @param {boolean=} flag Enable or disable SVG support in the sanitizer. - * @returns {boolean|$sanitizeProvider} Returns the currently configured value if called - * without an argument or self for chaining otherwise. - */ - enableSvg: (enableSvg: any) => any; - /** - * @ngdoc method - * @name $sanitizeProvider#addValidElements - * @kind function - * - * @description - * Extends the built-in lists of valid HTML/SVG elements, i.e. elements that are considered safe - * and are not stripped off during sanitization. You can extend the following lists of elements: - * - * - `htmlElements`: A list of elements (tag names) to extend the current list of safe HTML - * elements. HTML elements considered safe will not be removed during sanitization. All other - * elements will be stripped off. - * - * - `htmlVoidElements`: This is similar to `htmlElements`, but marks the elements as - * "void elements" (similar to HTML - * [void elements](https://rawgit.com/w3c/html/html5.1-2/single-page.html#void-elements)). These - * elements have no end tag and cannot have content. - * - * - `svgElements`: This is similar to `htmlElements`, but for SVG elements. This list is only - * taken into account if SVG is {@link ngSanitize.$sanitizeProvider#enableSvg enabled} for - * `$sanitize`. - * - *
- * This method must be called during the {@link angular.Module#config config} phase. Once the - * `$sanitize` service has been instantiated, this method has no effect. - *
- * - *
- * Keep in mind that extending the built-in lists of elements may expose your app to XSS or - * other vulnerabilities. Be very mindful of the elements you add. - *
- * - * @param {Array|Object} elements - A list of valid HTML elements or an object with one or - * more of the following properties: - * - **htmlElements** - `{Array}` - A list of elements to extend the current list of - * HTML elements. - * - **htmlVoidElements** - `{Array}` - A list of elements to extend the current list of - * void HTML elements; i.e. elements that do not have an end tag. - * - **svgElements** - `{Array}` - A list of elements to extend the current list of SVG - * elements. The list of SVG elements is only taken into account if SVG is - * {@link ngSanitize.$sanitizeProvider#enableSvg enabled} for `$sanitize`. - * - * Passing an array (`[...]`) is equivalent to passing `{htmlElements: [...]}`. - * - * @return {$sanitizeProvider} Returns self for chaining. - */ - addValidElements: (elements: Object | string[]) => any; - /** - * @ngdoc method - * @name $sanitizeProvider#addValidAttrs - * @kind function - * - * @description - * Extends the built-in list of valid attributes, i.e. attributes that are considered safe and are - * not stripped off during sanitization. - * - * **Note**: - * The new attributes will not be treated as URI attributes, which means their values will not be - * sanitized as URIs using `$compileProvider`'s - * {@link ng.$compileProvider#aHrefSanitizationWhitelist aHrefSanitizationWhitelist} and - * {@link ng.$compileProvider#imgSrcSanitizationWhitelist imgSrcSanitizationWhitelist}. - * - *
- * This method must be called during the {@link angular.Module#config config} phase. Once the - * `$sanitize` service has been instantiated, this method has no effect. - *
- * - *
- * Keep in mind that extending the built-in list of attributes may expose your app to XSS or - * other vulnerabilities. Be very mindful of the attributes you add. - *
- * - * @param {Array} attrs - A list of valid attributes. - * - * @returns {$sanitizeProvider} Returns self for chaining. - */ - addValidAttrs: (attrs: string[]) => any; -} -declare function sanitizeText(chars: any): string; -declare var $sanitizeMinErr: any; -declare var bind: any; -declare var extend: any; -declare var forEach: any; -declare var isArray: any; -declare var isDefined: any; -declare var lowercase: any; -declare var noop: any; -declare var nodeContains: any; -declare var htmlParser: any; -declare var htmlSanitizeWriter: any; diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/assets/javascripts/application.ts b/app/assets/javascripts/application.ts index 08b875929..48c3557cc 100644 --- a/app/assets/javascripts/application.ts +++ b/app/assets/javascripts/application.ts @@ -1,4 +1,4 @@ -import { PasswordWizardType } from './types'; +import { PasswordWizardType, PasswordWizardScope } from './types'; import { Environment, SNApplication, @@ -12,7 +12,17 @@ import angular from 'angular'; import { getPlatformString } from '@/utils'; import { AlertService } from '@/services/alertService'; import { WebDeviceInterface } from '@/web_device_interface'; -import { AppState, DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from './services'; +import { + AppState, + DesktopManager, + LockManager, + ArchiveManager, + NativeExtManager, + StatusManager, + ThemeManager, + PreferencesManager, + KeyboardManager +} from './services'; type WebServices = { appState: AppState @@ -135,7 +145,7 @@ export class WebApplication extends SNApplication { } presentPasswordWizard(type: PasswordWizardType) { - const scope: any = this.scope!.$new(true); + const scope = this.scope!.$new(true) as PasswordWizardScope; scope.type = type; scope.application = this; const el = this.$compile!("")(scope); @@ -171,8 +181,8 @@ export class WebApplication extends SNApplication { async presentPrivilegesModal( action: ProtectedAction, - onSuccess: any, - onCancel: any + onSuccess?: any, + onCancel?: any ) { if (this.authenticationInProgress()) { onCancel && onCancel(); diff --git a/app/assets/javascripts/controllers/abstract/pure_ctrl.js b/app/assets/javascripts/controllers/abstract/pure_ctrl.ts similarity index 65% rename from app/assets/javascripts/controllers/abstract/pure_ctrl.js rename to app/assets/javascripts/controllers/abstract/pure_ctrl.ts index 9a1a9765b..1515b5246 100644 --- a/app/assets/javascripts/controllers/abstract/pure_ctrl.js +++ b/app/assets/javascripts/controllers/abstract/pure_ctrl.ts @@ -1,20 +1,28 @@ +import { WebApplication } from './../../application'; import { ApplicationEvent } from 'snjs'; +export type CtrlState = Partial> +export type CtrlProps = Partial> + export class PureCtrl { + $timeout: ng.ITimeoutService + /** Passed through templates */ + application?: WebApplication + props: CtrlProps = {} + state: CtrlState = {} + private unsubApp: any + private unsubState: any + private stateTimeout: any + /* @ngInject */ - constructor($timeout) { - if(!$timeout) { - throw Error('$timeout must not be null'); - } + constructor($timeout: ng.ITimeoutService) { this.$timeout = $timeout; - this.props = {}; - this.state = {}; /* Allow caller constructor to finish setting instance variables */ setImmediate(() => { this.state = this.getInitialState(); }); } - + $onInit() { this.addAppEventObserver(); this.addAppStateObserver(); @@ -23,9 +31,9 @@ export class PureCtrl { deinit() { this.unsubApp(); this.unsubState(); - this.unsubApp = null; - this.unsubState = null; - this.application = null; + this.unsubApp = undefined; + this.unsubState = undefined; + this.application = undefined; if (this.stateTimeout) { this.$timeout.cancel(this.stateTimeout); } @@ -46,8 +54,8 @@ export class PureCtrl { return {}; } - async setState(state) { - if(!this.$timeout) { + async setState(state: CtrlState) { + if (!this.$timeout) { return; } return new Promise((resolve) => { @@ -58,7 +66,7 @@ export class PureCtrl { }); } - initProps(props) { + initProps(props: CtrlProps) { if (Object.keys(this.props).length > 0) { throw 'Already init-ed props.'; } @@ -66,23 +74,24 @@ export class PureCtrl { } addAppStateObserver() { - this.unsubState = this.application.getAppState().addObserver((eventName, data) => { - this.onAppStateEvent(eventName, data); - }); + this.unsubState = this.application!.getAppState() + .addObserver((eventName: any, data: any) => { + this.onAppStateEvent(eventName, data); + }); } - onAppStateEvent(eventName, data) { + onAppStateEvent(eventName: any, data: any) { /** Optional override */ } addAppEventObserver() { - if (this.application.isStarted()) { + if (this.application!.isStarted()) { this.onAppStart(); } - if (this.application.isLaunched()) { + if (this.application!.isLaunched()) { this.onAppLaunch(); } - this.unsubApp = this.application.addEventObserver(async (eventName) => { + this.unsubApp = this.application!.addEventObserver(async (eventName) => { this.onAppEvent(eventName); if (eventName === ApplicationEvent.Started) { await this.onAppStart(); @@ -96,7 +105,7 @@ export class PureCtrl { }); } - onAppEvent(eventName) { + onAppEvent(eventName: ApplicationEvent) { /** Optional override */ } diff --git a/app/assets/javascripts/controllers/applicationView.js b/app/assets/javascripts/controllers/applicationView.js index 99a3e75ae..8247e91c3 100644 --- a/app/assets/javascripts/controllers/applicationView.js +++ b/app/assets/javascripts/controllers/applicationView.js @@ -1,6 +1,6 @@ import { getPlatformString } from '@/utils'; import template from '%/application-view.pug'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; import { ApplicationEvent } from 'snjs'; import angular from 'angular'; import { @@ -127,7 +127,7 @@ class ApplicationViewCtrl extends PureCtrl { /** @override */ async onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.PanelResized) { + if (eventName === AppStateEvent.PanelResized) { if (data.panel === PANEL_NAME_NOTES) { this.notesCollapsed = data.collapsed; } @@ -138,7 +138,7 @@ class ApplicationViewCtrl extends PureCtrl { if (this.notesCollapsed) { appClass += "collapsed-notes"; } if (this.tagsCollapsed) { appClass += " collapsed-tags"; } this.setState({ appClass }); - } else if (eventName === AppStateEvents.WindowDidFocus) { + } else if (eventName === AppStateEvent.WindowDidFocus) { if (!(await this.application.isLocked())) { this.application.sync(); } diff --git a/app/assets/javascripts/controllers/editor.js b/app/assets/javascripts/controllers/editor.js index 8fdb21375..bcabbc170 100644 --- a/app/assets/javascripts/controllers/editor.js +++ b/app/assets/javascripts/controllers/editor.js @@ -3,14 +3,14 @@ import { ApplicationEvent, isPayloadSourceRetrieved, ContentTypes, - ProtectedActions + ProtectedAction } from 'snjs'; import find from 'lodash/find'; import { isDesktopApplication } from '@/utils'; import { KeyboardModifiers, KeyboardKeys } from '@/services/keyboardManager'; import template from '%/editor.pug'; import { PureCtrl } from '@Controllers'; -import { AppStateEvents, EventSources } from '@/services/state'; +import { AppStateEvent, EventSource } from '@/services/state'; import { STRING_DELETED_NOTE, STRING_INVALID_NOTE, @@ -98,12 +98,12 @@ class EditorCtrl extends PureCtrl { /** @override */ onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.NoteChanged) { + if (eventName === AppStateEvent.NoteChanged) { this.handleNoteSelectionChange( this.application.getAppState().getSelectedNote(), data.previousNote ); - } else if (eventName === AppStateEvents.PreferencesChanged) { + } else if (eventName === AppStateEvent.PreferencesChanged) { this.reloadPreferences(); } } @@ -496,7 +496,7 @@ class EditorCtrl extends PureCtrl { focusEditor() { const element = document.getElementById(ElementIds.NoteTextEditor); if (element) { - this.lastEditorFocusEventSource = EventSources.Script; + this.lastEditorFocusEventSource = EventSource.Script; element.focus(); } } @@ -568,11 +568,11 @@ class EditorCtrl extends PureCtrl { }); }; const requiresPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.DeleteNote + ProtectedAction.DeleteNote ); if (requiresPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.DeleteNote, + ProtectedAction.DeleteNote, () => { run(); } @@ -656,7 +656,7 @@ class EditorCtrl extends PureCtrl { /** Show privileges manager if protection is not yet set up */ this.application.privilegesService.actionHasPrivilegesConfigured( - ProtectedActions.ViewProtectedNotes + ProtectedAction.ViewProtectedNotes ).then((configured) => { if (!configured) { this.application.presentPrivilegesManagementModal(); diff --git a/app/assets/javascripts/controllers/footer.js b/app/assets/javascripts/controllers/footer.js index 0d2a99921..eb8018590 100644 --- a/app/assets/javascripts/controllers/footer.js +++ b/app/assets/javascripts/controllers/footer.js @@ -2,11 +2,11 @@ import { dateToLocalizedString } from '@/utils'; import { ApplicationEvent, TIMING_STRATEGY_FORCE_SPAWN_NEW, - ProtectedActions, + ProtectedAction, ContentTypes } from 'snjs'; import template from '%/footer.pug'; -import { AppStateEvents, EventSources } from '@/services/state'; +import { AppStateEvent, EventSource } from '@/services/state'; import { STRING_GENERIC_SYNC_ERROR, STRING_NEW_UPDATE_READY @@ -96,16 +96,16 @@ class FooterCtrl extends PureCtrl { /** @override */ onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.EditorFocused) { - if (data.eventSource === EventSources.UserInteraction) { + if (eventName === AppStateEvent.EditorFocused) { + if (data.eventSource === EventSource.UserInteraction) { this.closeAllRooms(); this.closeAccountMenu(); } - } else if (eventName === AppStateEvents.BeganBackupDownload) { + } else if (eventName === AppStateEvent.BeganBackupDownload) { this.backupStatus = this.application.getStatusService().addStatusFromString( "Saving local backup..." ); - } else if (eventName === AppStateEvents.EndedBackupDownload) { + } else if (eventName === AppStateEvent.EndedBackupDownload) { if (data.success) { this.backupStatus = this.application.getStatusService().replaceStatusWithString( this.backupStatus, @@ -363,11 +363,11 @@ class FooterCtrl extends PureCtrl { if (!room.showRoom) { const requiresPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManageExtensions + ProtectedAction.ManageExtensions ); if (requiresPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManageExtensions, + ProtectedAction.ManageExtensions, run ); } else { diff --git a/app/assets/javascripts/controllers/lockScreen.depr.js b/app/assets/javascripts/controllers/lockScreen.depr.js index f505ea587..15418e918 100644 --- a/app/assets/javascripts/controllers/lockScreen.depr.js +++ b/app/assets/javascripts/controllers/lockScreen.depr.js @@ -1,5 +1,5 @@ import template from '%/lock-screen.pug'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; import { PureCtrl } from './abstract/pure_ctrl'; const ELEMENT_ID_PASSCODE_INPUT = 'passcode-input'; @@ -28,7 +28,7 @@ class LockScreenCtrl extends PureCtrl { /** @override */ async onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.WindowDidFocus) { + if (eventName === AppStateEvent.WindowDidFocus) { const input = this.passcodeInput; if (input) { input.focus(); diff --git a/app/assets/javascripts/controllers/notes/notes.js b/app/assets/javascripts/controllers/notes/notes.js index 4e0a0083e..bb7fcfe6a 100644 --- a/app/assets/javascripts/controllers/notes/notes.js +++ b/app/assets/javascripts/controllers/notes/notes.js @@ -2,7 +2,7 @@ import angular from 'angular'; import template from '%/notes.pug'; import { ApplicationEvent, ContentTypes, removeFromArray } from 'snjs'; import { PureCtrl } from '@Controllers'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; import { KeyboardModifiers, KeyboardKeys } from '@/services/keyboardManager'; import { PrefKeys @@ -89,14 +89,14 @@ class NotesCtrl extends PureCtrl { /** @override */ onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.TagChanged) { + if (eventName === AppStateEvent.TagChanged) { this.handleTagChange(this.application.getAppState().getSelectedTag(), data.previousTag); - } else if (eventName === AppStateEvents.NoteChanged) { + } else if (eventName === AppStateEvent.NoteChanged) { this.handleNoteSelection(this.application.getAppState().getSelectedNote()); - } else if (eventName === AppStateEvents.PreferencesChanged) { + } else if (eventName === AppStateEvent.PreferencesChanged) { this.reloadPreferences(); this.reloadNotes(); - } else if (eventName === AppStateEvents.EditorFocused) { + } else if (eventName === AppStateEvent.EditorFocused) { this.setShowMenuFalse(); } } @@ -384,10 +384,10 @@ class NotesCtrl extends PureCtrl { if (width && this.panelPuppet.ready) { this.panelPuppet.setWidth(width); if (this.panelPuppet.isCollapsed()) { - this.application.getAppState().panelDidResize({ - name: PANEL_NAME_NOTES, - collapsed: this.panelPuppet.isCollapsed() - }); + this.application.getAppState().panelDidResize( + PANEL_NAME_NOTES, + this.panelPuppet.isCollapsed() + ); } } } @@ -398,10 +398,10 @@ class NotesCtrl extends PureCtrl { newWidth ); this.application.getPrefsService().syncUserPreferences(); - this.application.getAppState().panelDidResize({ - name: PANEL_NAME_NOTES, - collapsed: isCollapsed - }); + this.application.getAppState().panelDidResize( + PANEL_NAME_NOTES, + isCollapsed + ); } paginate() { diff --git a/app/assets/javascripts/controllers/tags.js b/app/assets/javascripts/controllers/tags.js index e200b7189..21e8e4c61 100644 --- a/app/assets/javascripts/controllers/tags.js +++ b/app/assets/javascripts/controllers/tags.js @@ -6,7 +6,7 @@ import { ComponentActions } from 'snjs'; import template from '%/tags.pug'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; import { PANEL_NAME_TAGS } from '@/controllers/constants'; import { PrefKeys } from '@/services/preferencesManager'; import { STRING_DELETE_TAG } from '@/strings'; @@ -94,9 +94,9 @@ class TagsPanelCtrl extends PureCtrl { /** @override */ onAppStateEvent(eventName, data) { - if (eventName === AppStateEvents.PreferencesChanged) { + if (eventName === AppStateEvent.PreferencesChanged) { this.loadPreferences(); - } else if (eventName === AppStateEvents.TagChanged) { + } else if (eventName === AppStateEvent.TagChanged) { this.setState({ selectedTag: this.application.getAppState().getSelectedTag() }); @@ -146,10 +146,10 @@ class TagsPanelCtrl extends PureCtrl { if (width) { this.panelPuppet.setWidth(width); if (this.panelPuppet.isCollapsed()) { - this.application.getAppState().panelDidResize({ - name: PANEL_NAME_TAGS, - collapsed: this.panelPuppet.isCollapsed() - }); + this.application.getAppState().panelDidResize( + PANEL_NAME_TAGS, + this.panelPuppet.isCollapsed() + ); } } } @@ -160,10 +160,10 @@ class TagsPanelCtrl extends PureCtrl { newWidth, true ); - this.application.getAppState().panelDidResize({ - name: PANEL_NAME_TAGS, - collapsed: isCollapsed - }); + this.application.getAppState().panelDidResize( + PANEL_NAME_TAGS, + isCollapsed + ); } registerComponentHandler() { diff --git a/app/assets/javascripts/directives/views/accountMenu.js b/app/assets/javascripts/directives/views/accountMenu.js index 437435b32..7f87960e6 100644 --- a/app/assets/javascripts/directives/views/accountMenu.js +++ b/app/assets/javascripts/directives/views/accountMenu.js @@ -1,6 +1,6 @@ import { isDesktopApplication, isNullOrUndefined } from '@/utils'; import template from '%/directives/account-menu.pug'; -import { ProtectedActions } from 'snjs'; +import { ProtectedAction } from 'snjs'; import { PureCtrl } from '@Controllers'; import { STRING_ACCOUNT_MENU_UNCHECK_MERGE, @@ -278,11 +278,11 @@ class AccountMenuCtrl extends PureCtrl { this.application.presentPrivilegesManagementModal(); }; const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManagePrivileges + ProtectedAction.ManagePrivileges ); if (needsPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManagePrivileges, + ProtectedAction.ManagePrivileges, () => { run(); } @@ -355,11 +355,11 @@ class AccountMenuCtrl extends PureCtrl { } }; const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManageBackups + ProtectedAction.ManageBackups ); if (needsPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManageBackups, + ProtectedAction.ManageBackups, run ); } else { @@ -438,11 +438,11 @@ class AccountMenuCtrl extends PureCtrl { this.reloadAutoLockInterval(); }; const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManagePasscode + ProtectedAction.ManagePasscode ); if (needsPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManagePasscode, + ProtectedAction.ManagePasscode, () => { run(); } @@ -497,11 +497,11 @@ class AccountMenuCtrl extends PureCtrl { this.addPasscodeClicked(); }; const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManagePasscode + ProtectedAction.ManagePasscode ); if (needsPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManagePasscode, + ProtectedAction.ManagePasscode, run ); } else { @@ -525,11 +525,11 @@ class AccountMenuCtrl extends PureCtrl { }); }; const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ManagePasscode + ProtectedAction.ManagePasscode ); if (needsPrivilege) { this.application.presentPrivilegesModal( - ProtectedActions.ManagePasscode, + ProtectedAction.ManagePasscode, run ); } else { diff --git a/app/assets/javascripts/directives/views/passwordWizard.js b/app/assets/javascripts/directives/views/passwordWizard.ts similarity index 68% rename from app/assets/javascripts/directives/views/passwordWizard.js rename to app/assets/javascripts/directives/views/passwordWizard.ts index df16742fa..5ab7b735a 100644 --- a/app/assets/javascripts/directives/views/passwordWizard.js +++ b/app/assets/javascripts/directives/views/passwordWizard.ts @@ -1,5 +1,7 @@ +import { WebApplication } from './../../application'; +import { PasswordWizardScope, PasswordWizardType, WebDirective } from './../../types'; import template from '%/directives/password-wizard.pug'; -import { PureCtrl } from '@Controllers'; +import { PureCtrl } from '@Controllers/abstract/pure_ctrl'; const DEFAULT_CONTINUE_TITLE = "Continue"; const Steps = { @@ -7,15 +9,19 @@ const Steps = { FinishStep: 2 }; -class PasswordWizardCtrl extends PureCtrl { +class PasswordWizardCtrl extends PureCtrl implements PasswordWizardScope { + $element: JQLite + application!: WebApplication + type!: PasswordWizardType + isContinuing = false + /* @ngInject */ constructor( - $element, - $timeout, + $element: JQLite, + $timeout: ng.ITimeoutService, ) { super($timeout); this.$element = $element; - this.$timeout = $timeout; this.registerWindowUnloadStopper(); } @@ -23,8 +29,8 @@ class PasswordWizardCtrl extends PureCtrl { super.$onInit(); this.initProps({ type: this.type, - changePassword: this.type === 'change-pw', - securityUpdate: this.type === 'upgrade-security' + changePassword: this.type === PasswordWizardType.ChangePassword, + securityUpdate: this.type === PasswordWizardType.AccountUpgrade }); this.setState({ formData: {}, @@ -41,7 +47,7 @@ class PasswordWizardCtrl extends PureCtrl { /** Confirms with user before closing tab */ registerWindowUnloadStopper() { - window.onbeforeunload = (e) => { + window.onbeforeunload = () => { return true; }; } @@ -86,7 +92,7 @@ class PasswordWizardCtrl extends PureCtrl { }); } - async setFormDataState(formData) { + async setFormDataState(formData: any) { return this.setState({ formData: { ...this.state.formData, @@ -99,42 +105,42 @@ class PasswordWizardCtrl extends PureCtrl { const currentPassword = this.state.formData.currentPassword; const newPass = this.props.securityUpdate ? currentPassword : this.state.formData.newPassword; if (!currentPassword || currentPassword.length === 0) { - this.application.alertService.alert({ - text: "Please enter your current password." - }); + this.application.alertService!.alert( + "Please enter your current password." + ); return false; } if (this.props.changePassword) { if (!newPass || newPass.length === 0) { - this.application.alertService.alert({ - text: "Please enter a new password." - }); + this.application.alertService!.alert( + "Please enter a new password." + ); return false; } if (newPass !== this.state.formData.newPasswordConfirmation) { - this.application.alertService.alert({ - text: "Your new password does not match its confirmation." - }); + this.application.alertService!.alert( + "Your new password does not match its confirmation." + ); this.state.formData.status = null; return false; } } - if (!this.application.getUser().email) { - this.application.alertService.alert({ - text: "We don't have your email stored. Please log out then log back in to fix this issue." - }); + if (!this.application.getUser()?.email) { + this.application.alertService!.alert( + "We don't have your email stored. Please log out then log back in to fix this issue." + ); this.state.formData.status = null; return false; } /** Validate current password */ - const success = await this.application.validateAccountPassword({ - password: this.state.formData.currentPassword - }); + const success = await this.application.validateAccountPassword( + this.state.formData.currentPassword + ); if (!success) { - this.application.alertService.alert({ - text: "The current password you entered is not correct. Please try again." - }); + this.application.alertService!.alert( + "The current password you entered is not correct. Please try again." + ); } return success; } @@ -150,21 +156,21 @@ class PasswordWizardCtrl extends PureCtrl { const newPassword = this.props.securityUpdate ? this.state.formData.currentPassword : this.state.formData.newPassword; - const response = await this.application.changePassword({ - currentPassword: this.state.formData.currentPassword, - newPassword: newPassword - }); - const success = !response.error; + const response = await this.application.changePassword( + this.state.formData.currentPassword, + newPassword + ); + const success = !response || !response.error; this.setFormDataState({ statusError: !success, processing: success }); if (!success) { - this.application.alertService.alert({ - text: response.error.message - ? response.error.message + this.application.alertService!.alert( + response!.error.message + ? response!.error.message : "There was an error changing your password. Please try again." - }); + ); this.setFormDataState({ status: "Unable to process your password. Please try again." }); @@ -184,9 +190,9 @@ class PasswordWizardCtrl extends PureCtrl { dismiss() { if (this.state.lockContinue) { - this.application.alertService.alert({ - text: "Cannot close window until pending tasks are complete." - }); + this.application.alertService!.alert( + "Cannot close window until pending tasks are complete." + ); } else { const elem = this.$element; const scope = elem.scope(); @@ -196,8 +202,9 @@ class PasswordWizardCtrl extends PureCtrl { } } -export class PasswordWizard { +export class PasswordWizard extends WebDirective { constructor() { + super(); this.restrict = 'E'; this.template = template; this.controller = PasswordWizardCtrl; diff --git a/app/assets/javascripts/services/archiveManager.js b/app/assets/javascripts/services/archiveManager.js index 966d431c5..1e5d503a5 100644 --- a/app/assets/javascripts/services/archiveManager.js +++ b/app/assets/javascripts/services/archiveManager.js @@ -1,4 +1,4 @@ -import { EncryptionIntents, ProtectedActions } from 'snjs'; +import { EncryptionIntents, ProtectedAction } from 'snjs'; export class ArchiveManager { constructor(application) { @@ -30,8 +30,8 @@ export class ArchiveManager { }); }; - if (await this.application.privilegesService.actionRequiresPrivilege(ProtectedActions.ManageBackups)) { - this.application.presentPrivilegesModal(ProtectedActions.ManageBackups, () => { + if (await this.application.privilegesService.actionRequiresPrivilege(ProtectedAction.ManageBackups)) { + this.application.presentPrivilegesModal(ProtectedAction.ManageBackups, () => { run(); }); } else { diff --git a/app/assets/javascripts/services/desktopManager.js b/app/assets/javascripts/services/desktopManager.js index 8e8234bbb..e84411d35 100644 --- a/app/assets/javascripts/services/desktopManager.js +++ b/app/assets/javascripts/services/desktopManager.js @@ -210,8 +210,6 @@ export class DesktopManager extends ApplicationService { } desktop_didFinishBackup(success) { - this.application.getAppState().endedBackupDownload({ - success: success - }); + this.application.getAppState().endedBackupDownload(success); } } diff --git a/app/assets/javascripts/services/lockManager.js b/app/assets/javascripts/services/lockManager.js index af560dc89..1da7d4123 100644 --- a/app/assets/javascripts/services/lockManager.js +++ b/app/assets/javascripts/services/lockManager.js @@ -1,5 +1,5 @@ import { isDesktopApplication } from '@/utils'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; const MILLISECONDS_PER_SECOND = 1000; const FOCUS_POLL_INTERVAL = 1 * MILLISECONDS_PER_SECOND; @@ -21,9 +21,9 @@ export class LockManager { observeVisibility() { this.unsubState = this.application.getAppState().addObserver((eventName) => { - if(eventName === AppStateEvents.WindowDidBlur) { + if(eventName === AppStateEvent.WindowDidBlur) { this.documentVisibilityChanged(false); - } else if(eventName === AppStateEvents.WindowDidFocus) { + } else if(eventName === AppStateEvent.WindowDidFocus) { this.documentVisibilityChanged(true); } }); diff --git a/app/assets/javascripts/services/state.js b/app/assets/javascripts/services/state.ts similarity index 57% rename from app/assets/javascripts/services/state.js rename to app/assets/javascripts/services/state.ts index d49b2a1a8..f4b4c7d56 100644 --- a/app/assets/javascripts/services/state.js +++ b/app/assets/javascripts/services/state.ts @@ -1,53 +1,76 @@ +import { WebApplication } from './../application'; import { isDesktopApplication } from '@/utils'; import pull from 'lodash/pull'; -import { ProtectedActions, ApplicationEvent } from 'snjs'; +import { ProtectedAction, ApplicationEvent, SNTag, SNNote, SNUserPrefs } from 'snjs'; -export const AppStateEvents = { - TagChanged: 1, - NoteChanged: 2, - PreferencesChanged: 3, - PanelResized: 4, - EditorFocused: 5, - BeganBackupDownload: 6, - EndedBackupDownload: 7, - DesktopExtsReady: 8, - WindowDidFocus: 9, - WindowDidBlur: 10, +export enum AppStateEvent { + TagChanged = 1, + NoteChanged = 2, + PreferencesChanged = 3, + PanelResized = 4, + EditorFocused = 5, + BeganBackupDownload = 6, + EndedBackupDownload = 7, + DesktopExtsReady = 8, + WindowDidFocus = 9, + WindowDidBlur = 10, }; -export const EventSources = { - UserInteraction: 1, - Script: 2 +export enum EventSource { + UserInteraction = 1, + Script = 2 }; +type ObserverCallback = (event: AppStateEvent, data?: any) => Promise + export class AppState { + $rootScope: ng.IRootScopeService + $timeout: ng.ITimeoutService + application: WebApplication + observers: ObserverCallback[] = [] + locked = true + unsubApp: any + rootScopeCleanup1: any + rootScopeCleanup2: any + onVisibilityChange: any + selectedTag?: SNTag + selectedNote?: SNNote + userPreferences?: SNUserPrefs + /* @ngInject */ constructor( - $rootScope, - $timeout, - application + $rootScope: ng.IRootScopeService, + $timeout: ng.ITimeoutService, + application: WebApplication ) { this.$timeout = $timeout; this.$rootScope = $rootScope; this.application = application; - this.observers = []; - this.locked = true; this.registerVisibilityObservers(); this.addAppEventObserver(); + + const onVisibilityChange = () => { + const visible = document.visibilityState === "visible"; + const event = visible + ? AppStateEvent.WindowDidFocus + : AppStateEvent.WindowDidBlur; + this.notifyEvent(event); + } + this.onVisibilityChange = onVisibilityChange.bind(this); } deinit() { this.unsubApp(); - this.unsubApp = null; + this.unsubApp = undefined; this.observers.length = 0; if (this.rootScopeCleanup1) { this.rootScopeCleanup1(); this.rootScopeCleanup2(); - this.rootScopeCleanup1 = null; - this.rootScopeCleanup2 = null; + this.rootScopeCleanup1 = undefined; + this.rootScopeCleanup2 = undefined; } document.removeEventListener('visibilitychange', this.onVisibilityChange); - this.onVisibilityChange = null; + this.onVisibilityChange = undefined; } addAppEventObserver() { @@ -67,10 +90,10 @@ export class AppState { registerVisibilityObservers() { if (isDesktopApplication()) { this.rootScopeCleanup1 = this.$rootScope.$on('window-lost-focus', () => { - this.notifyEvent(AppStateEvents.WindowDidBlur); + this.notifyEvent(AppStateEvent.WindowDidBlur); }); this.rootScopeCleanup2 = this.$rootScope.$on('window-gained-focus', () => { - this.notifyEvent(AppStateEvents.WindowDidFocus); + this.notifyEvent(AppStateEvent.WindowDidFocus); }); } else { /* Tab visibility listener, web only */ @@ -79,23 +102,15 @@ export class AppState { } } - onVisibilityChange() { - const visible = document.visibilityState === "visible"; - const event = visible - ? AppStateEvents.WindowDidFocus - : AppStateEvents.WindowDidBlur; - this.notifyEvent(event); - } - /** @returns A function that unregisters this observer */ - addObserver(callback) { + addObserver(callback: ObserverCallback) { this.observers.push(callback); return () => { pull(this.observers, callback); }; } - async notifyEvent(eventName, data) { + async notifyEvent(eventName: AppStateEvent, data?: any) { /** * Timeout is particullary important so we can give all initial * controllers a chance to construct before propogting any events * @@ -110,14 +125,14 @@ export class AppState { }); } - setSelectedTag(tag) { + setSelectedTag(tag: SNTag) { if (this.selectedTag === tag) { return; } const previousTag = this.selectedTag; this.selectedTag = tag; this.notifyEvent( - AppStateEvents.TagChanged, + AppStateEvent.TagChanged, { tag: tag, previousTag: previousTag @@ -125,22 +140,22 @@ export class AppState { ); } - async setSelectedNote(note) { + async setSelectedNote(note: SNNote) { const run = async () => { const previousNote = this.selectedNote; this.selectedNote = note; await this.notifyEvent( - AppStateEvents.NoteChanged, + AppStateEvent.NoteChanged, { previousNote: previousNote } ); }; - if (note && note.content.protected && - await this.application.application.privilegesService.actionRequiresPrivilege( - ProtectedActions.ViewProtectedNotes + if (note && note.safeContent.protected && + await this.application.privilegesService!.actionRequiresPrivilege( + ProtectedAction.ViewProtectedNotes )) { return new Promise((resolve) => { this.application.presentPrivilegesModal( - ProtectedActions.ViewProtectedNotes, + ProtectedAction.ViewProtectedNotes, () => { run().then(resolve); } @@ -159,16 +174,16 @@ export class AppState { return this.selectedNote; } - setUserPreferences(preferences) { + setUserPreferences(preferences: SNUserPrefs) { this.userPreferences = preferences; this.notifyEvent( - AppStateEvents.PreferencesChanged + AppStateEvent.PreferencesChanged ); } - panelDidResize({ name, collapsed }) { + panelDidResize(name: string, collapsed: boolean) { this.notifyEvent( - AppStateEvents.PanelResized, + AppStateEvent.PanelResized, { panel: name, collapsed: collapsed @@ -176,22 +191,22 @@ export class AppState { ); } - editorDidFocus(eventSource) { + editorDidFocus(eventSource: EventSource) { this.notifyEvent( - AppStateEvents.EditorFocused, + AppStateEvent.EditorFocused, { eventSource: eventSource } ); } beganBackupDownload() { this.notifyEvent( - AppStateEvents.BeganBackupDownload + AppStateEvent.BeganBackupDownload ); } - endedBackupDownload({ success }) { + endedBackupDownload(success: boolean) { this.notifyEvent( - AppStateEvents.EndedBackupDownload, + AppStateEvent.EndedBackupDownload, { success: success } ); } @@ -201,8 +216,7 @@ export class AppState { */ desktopExtensionsReady() { this.notifyEvent( - AppStateEvents.DesktopExtsReady + AppStateEvent.DesktopExtsReady ); } - } diff --git a/app/assets/javascripts/services/themeManager.js b/app/assets/javascripts/services/themeManager.js index c94e9a32f..fdc01924d 100644 --- a/app/assets/javascripts/services/themeManager.js +++ b/app/assets/javascripts/services/themeManager.js @@ -5,7 +5,7 @@ import { EncryptionIntents, ApplicationService, } from 'snjs'; -import { AppStateEvents } from '@/services/state'; +import { AppStateEvent } from '@/services/state'; const CACHED_THEMES_KEY = 'cachedThemes'; @@ -15,7 +15,7 @@ export class ThemeManager extends ApplicationService { this.activeThemes = []; setImmediate(() => { this.unsubState = this.application.getAppState().addObserver((eventName, data) => { - if (eventName === AppStateEvents.DesktopExtsReady) { + if (eventName === AppStateEvent.DesktopExtsReady) { this.activateCachedThemes(); } }); diff --git a/app/assets/javascripts/tsconfig.json b/app/assets/javascripts/tsconfig.json index d6a0eb4ff..8b041cdd6 100644 --- a/app/assets/javascripts/tsconfig.json +++ b/app/assets/javascripts/tsconfig.json @@ -7,7 +7,7 @@ "strict": true, "isolatedModules": true, "esModuleInterop": true, - "types": ["node", "../../../node_modules/snjs/dist/@types"], + "types": ["node"], "declaration": true, "declarationDir": "@types", "emitDeclarationOnly": true, @@ -17,10 +17,5 @@ "@/*": ["./*"], "@Controllers/*": ["./controllers/*"] } - }, - "typeAcquisition": { - "include": [ - "snjs" - ] -} + } } diff --git a/app/assets/javascripts/types.ts b/app/assets/javascripts/types.ts index 96888c091..c7b4f9538 100644 --- a/app/assets/javascripts/types.ts +++ b/app/assets/javascripts/types.ts @@ -1,4 +1,18 @@ +export class WebDirective implements ng.IDirective { + controller?: string | ng.Injectable; + controllerAs?: string; + bindToController?: boolean | { [boundProperty: string]: string }; + restrict?: string; + scope?: boolean | { [boundProperty: string]: string }; + template?: string | ((tElement: any, tAttrs: any) => string); +} + export enum PasswordWizardType { ChangePassword = 1, AccountUpgrade = 2 +} + +export interface PasswordWizardScope extends Partial { + type: PasswordWizardType, + application: any } \ No newline at end of file diff --git a/app/assets/javascripts/typings/pug.d.ts b/app/assets/javascripts/typings/pug.d.ts new file mode 100644 index 000000000..8005eaa90 --- /dev/null +++ b/app/assets/javascripts/typings/pug.d.ts @@ -0,0 +1,5 @@ +declare module "*.pug" { + import { compileTemplate } from 'pug' + const content: compileTemplate; + export default content; +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 31c2f4e33..813f0df54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1670,6 +1670,12 @@ "integrity": "sha512-ASYsaKecA7TUsDrqIGPNk3JeEox0z/0XR/WsJJ8BIX/9+SkMSImQXKWfU/yBrSyc7ZSE/NPqLu36Nur0miCFfQ==", "dev": true }, + "@types/pug": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.4.tgz", + "integrity": "sha1-h3L80EGOPNLMFxVV1zAHQVBR9LI=", + "dev": true + }, "@typescript-eslint/eslint-plugin": { "version": "2.27.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz", diff --git a/package.json b/package.json index eacc6511e..1f94afc16 100644 --- a/package.json +++ b/package.json @@ -22,13 +22,14 @@ "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-transform-runtime": "^7.8.3", "@babel/preset-env": "^7.8.7", - "@babel/runtime": "^7.8.7", "@babel/preset-typescript": "^7.8.3", + "@babel/runtime": "^7.8.7", "@types/angular": "^1.7.0", "@types/chai": "^4.2.11", "@types/lodash": "^4.14.149", "@types/mocha": "^7.0.2", "@types/node": "^12.12.30", + "@types/pug": "^2.0.4", "@typescript-eslint/eslint-plugin": "^2.23.0", "@typescript-eslint/parser": "^2.23.0", "angular": "1.7.9",