Incipient TypeScript
This commit is contained in:
1
app/assets/javascripts/@types/app/assets/javascripts/app.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/app.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
53
app/assets/javascripts/@types/app/assets/javascripts/application.d.ts
vendored
Normal file
53
app/assets/javascripts/@types/app/assets/javascripts/application.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
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<boolean>;
|
||||
presentPasswordWizard(type: PasswordWizardType): void;
|
||||
promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator): void;
|
||||
performProtocolUpgrade(): Promise<void>;
|
||||
presentPrivilegesModal(action: ProtectedAction, onSuccess: any, onCancel: any): Promise<void>;
|
||||
presentPrivilegesManagementModal(): void;
|
||||
authenticationInProgress(): boolean;
|
||||
presentPasswordModal(callback: () => void): void;
|
||||
presentRevisionPreviewModal(uuid: string, content: any): void;
|
||||
}
|
||||
export {};
|
||||
28
app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts
vendored
Normal file
28
app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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";
|
||||
28
app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts
vendored
Normal file
28
app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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<any>;
|
||||
stateTimeout: any;
|
||||
initProps(props: any): void;
|
||||
addAppStateObserver(): void;
|
||||
onAppStateEvent(eventName: any, data: any): void;
|
||||
addAppEventObserver(): void;
|
||||
onAppEvent(eventName: any): void;
|
||||
/** @override */
|
||||
onAppStart(): Promise<void>;
|
||||
onAppLaunch(): Promise<void>;
|
||||
onAppKeyChange(): Promise<void>;
|
||||
onAppSync(): void;
|
||||
}
|
||||
47
app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts
vendored
Normal file
47
app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
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<void>;
|
||||
onAppStart(): void;
|
||||
onAppLaunch(): void;
|
||||
onUpdateAvailable(): void;
|
||||
/** @override */
|
||||
onAppEvent(eventName: any): Promise<void>;
|
||||
syncStatus: any;
|
||||
completedInitialSync: boolean | undefined;
|
||||
/** @override */
|
||||
onAppStateEvent(eventName: any, data: any): Promise<void>;
|
||||
notesCollapsed: any;
|
||||
tagsCollapsed: any;
|
||||
updateLocalDataStatus(): void;
|
||||
updateSyncStatus(): void;
|
||||
showingDownloadStatus: boolean | undefined;
|
||||
uploadSyncStatus: any;
|
||||
overrideComponentManagerFunctions(): void;
|
||||
showInvalidSessionAlert(): void;
|
||||
lastShownDate: Date | undefined;
|
||||
addDragDropHandlers(): void;
|
||||
handleAutoSignInFromParams(): Promise<void>;
|
||||
}
|
||||
import { PureCtrl } from "./abstract/pure_ctrl";
|
||||
export {};
|
||||
2
app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts
vendored
Normal file
2
app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const PANEL_NAME_NOTES: "notes";
|
||||
export const PANEL_NAME_TAGS: "tags";
|
||||
122
app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts
vendored
Normal file
122
app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
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<void>;
|
||||
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<void>;
|
||||
performNoteDeletion(note: any): void;
|
||||
restoreTrashedNote(): void;
|
||||
deleteNotePermanantely(): void;
|
||||
getTrashCount(): any;
|
||||
emptyTrash(): void;
|
||||
togglePin(): void;
|
||||
toggleLockNote(): void;
|
||||
toggleProtectNote(): void;
|
||||
toggleNotePreview(): void;
|
||||
toggleArchiveNote(): void;
|
||||
reloadTagsString(): void;
|
||||
addTag(tag: any): void;
|
||||
removeTag(tag: any): void;
|
||||
saveTags({ strings }?: {
|
||||
strings: any;
|
||||
}): Promise<void>;
|
||||
onPanelResizeFinish: (width: any, left: any, isMaxWidth: any) => void;
|
||||
reloadPreferences(): void;
|
||||
reloadFont(): void;
|
||||
toggleKey(key: any): Promise<void>;
|
||||
registerComponentHandler(): void;
|
||||
reloadComponentStackArray(): void;
|
||||
reloadComponentContext(): void;
|
||||
toggleStackComponentForCurrentItem(component: any): void;
|
||||
disassociateComponentWithCurrentNote(component: any): void;
|
||||
associateComponentWithCurrentNote(component: any): void;
|
||||
registerKeyboardShortcuts(): void;
|
||||
altKeyObserver: any;
|
||||
trashKeyObserver: any;
|
||||
deleteKeyObserver: any;
|
||||
onSystemEditorLoad(): void;
|
||||
tabObserver: any;
|
||||
removeTabObserver(): void;
|
||||
}
|
||||
export {};
|
||||
69
app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts
vendored
Normal file
69
app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
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<void>;
|
||||
addRootScopeListeners(): void;
|
||||
/** @override */
|
||||
onAppStateEvent(eventName: any, data: any): void;
|
||||
backupStatus: any;
|
||||
/** @override */
|
||||
onAppKeyChange(): Promise<void>;
|
||||
/** @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<void>;
|
||||
clickOutsideAccountMenu(): void;
|
||||
}
|
||||
export {};
|
||||
7
app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts
vendored
Normal file
7
app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
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";
|
||||
23
app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts
vendored
Normal file
23
app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
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<void>;
|
||||
submitPasscodeForm(): Promise<void>;
|
||||
forgotPasscode(): void;
|
||||
beginDeleteData(): void;
|
||||
}
|
||||
import { PureCtrl } from "./abstract/pure_ctrl";
|
||||
export {};
|
||||
25
app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts
vendored
Normal file
25
app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
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";
|
||||
118
app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts
vendored
Normal file
118
app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
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<void>;
|
||||
/**
|
||||
* @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<any>;
|
||||
/**
|
||||
* 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<void>;
|
||||
streamNotesAndTags(): void;
|
||||
selectNote(note: any): Promise<any>;
|
||||
createNewNote(): Promise<void>;
|
||||
handleTagChange(tag: any, previousTag: any): Promise<void>;
|
||||
resetScrollPosition(): void;
|
||||
removeNoteFromList(note: any): Promise<void>;
|
||||
reloadNotes(): Promise<void>;
|
||||
reloadNotesPromise: Promise<void> | undefined;
|
||||
performPeloadNotes(): Promise<void>;
|
||||
setShowMenuFalse(): void;
|
||||
handleNoteSelection(note: any): Promise<void>;
|
||||
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<void>;
|
||||
clearFilterText(): Promise<void>;
|
||||
filterTextChanged(): Promise<void>;
|
||||
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 {};
|
||||
15
app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts
vendored
Normal file
15
app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
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 {};
|
||||
52
app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts
vendored
Normal file
52
app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
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<void>;
|
||||
reloadNoteCounts(): void;
|
||||
loadPreferences(): void;
|
||||
onPanelResize: (newWidth: any, lastLeft: any, isAtMaxWidth: any, isCollapsed: any) => void;
|
||||
registerComponentHandler(): void;
|
||||
component: any;
|
||||
selectTag(tag: any): Promise<void>;
|
||||
clickedAddNewTag(): Promise<void>;
|
||||
tagTitleDidChange(tag: any): void;
|
||||
saveTag($event: any, tag: any): Promise<void>;
|
||||
editingOriginalName: any;
|
||||
selectedRenameTag($event: any, tag: any): Promise<void>;
|
||||
selectedDeleteTag(tag: any): void;
|
||||
removeTag(tag: any): void;
|
||||
}
|
||||
export {};
|
||||
43
app/assets/javascripts/@types/app/assets/javascripts/database.d.ts
vendored
Normal file
43
app/assets/javascripts/@types/app/assets/javascripts/database.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
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<any>;
|
||||
/** @access public */
|
||||
getAllPayloads(): Promise<any>;
|
||||
/** @access public */
|
||||
savePayload(payload: any): Promise<any>;
|
||||
/** @access public */
|
||||
savePayloads(payloads: any): Promise<any>;
|
||||
/** @access private */
|
||||
putItems(objectStore: any, items: any): Promise<[any, any, any, any, any, any, any, any, any, any]>;
|
||||
/** @access public */
|
||||
deletePayload(uuid: any): Promise<any>;
|
||||
/** @access public */
|
||||
clearAllPayloads(): Promise<any>;
|
||||
/** @access private */
|
||||
showAlert(message: any): void;
|
||||
/**
|
||||
* @access private
|
||||
* @param {object} error - {code, name}
|
||||
*/
|
||||
showGenericError(error: object): void;
|
||||
/** @access private */
|
||||
displayOfflineAlert(): void;
|
||||
}
|
||||
7
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts
vendored
Normal file
7
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export function autofocus($timeout: any): {
|
||||
restrict: string;
|
||||
scope: {
|
||||
shouldFocus: string;
|
||||
};
|
||||
link: ($scope: any, $element: any) => void;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
export function clickOutside($document: any): {
|
||||
restrict: string;
|
||||
replace: boolean;
|
||||
link: ($scope: any, $element: any, attrs: any) => void;
|
||||
};
|
||||
8
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts
vendored
Normal file
8
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export function delayHide($timeout: any): {
|
||||
restrict: string;
|
||||
scope: {
|
||||
show: string;
|
||||
delay: string;
|
||||
};
|
||||
link: (scope: any, elem: any, attrs: any) => void;
|
||||
};
|
||||
4
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts
vendored
Normal file
4
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export function elemReady($parse: any): {
|
||||
restrict: string;
|
||||
link: ($scope: any, elem: any, attrs: any) => void;
|
||||
};
|
||||
7
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts
vendored
Normal file
7
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export function fileChange(): {
|
||||
restrict: string;
|
||||
scope: {
|
||||
handler: string;
|
||||
};
|
||||
link: (scope: any, element: any) => void;
|
||||
};
|
||||
9
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts
vendored
Normal file
9
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
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";
|
||||
@@ -0,0 +1,3 @@
|
||||
export function infiniteScroll(): {
|
||||
link: (scope: any, elem: any, attrs: any) => void;
|
||||
};
|
||||
4
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts
vendored
Normal file
4
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export function lowercase(): {
|
||||
require: string;
|
||||
link: (scope: any, element: any, attrs: any, modelCtrl: any) => void;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export function selectOnClick($window: any): {
|
||||
restrict: string;
|
||||
link: (scope: any, element: any, attrs: any) => void;
|
||||
};
|
||||
1
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export function snEnter(): (scope: any, element: any, attrs: any) => void;
|
||||
71
app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts
vendored
Normal file
71
app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
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<void>;
|
||||
onAppLaunch(): Promise<void>;
|
||||
refreshedCredentialState(): {
|
||||
user: any;
|
||||
canAddPasscode: boolean;
|
||||
hasPasscode: any;
|
||||
showPasscodeForm: boolean;
|
||||
};
|
||||
$onInit(): void;
|
||||
syncStatus: any;
|
||||
close(): void;
|
||||
loadHost(): Promise<void>;
|
||||
onHostInputChange(): void;
|
||||
loadBackupsAvailability(): Promise<void>;
|
||||
submitMfaForm(): void;
|
||||
blurAuthFields(): void;
|
||||
submitAuthForm(): void;
|
||||
setFormDataState(formData: any): Promise<any>;
|
||||
login(): Promise<void>;
|
||||
register(): Promise<void>;
|
||||
mergeLocalChanged(): void;
|
||||
openPasswordWizard(): void;
|
||||
openPrivilegesModal(): Promise<void>;
|
||||
destroyLocalData(): void;
|
||||
submitImportPassword(): Promise<void>;
|
||||
readFile(file: any): Promise<any>;
|
||||
/**
|
||||
* @template
|
||||
*/
|
||||
importFileSelected<(Missing)>(files: any): Promise<void>;
|
||||
performImport(data: any, password: any): Promise<void>;
|
||||
importJSONData(data: any, password: any): Promise<any>;
|
||||
downloadDataArchive(): Promise<void>;
|
||||
notesAndTagsCount(): any;
|
||||
encryptionStatusForNotes(): string;
|
||||
reloadAutoLockInterval(): Promise<void>;
|
||||
selectAutoLockInterval(interval: any): Promise<void>;
|
||||
hidePasswordForm(): void;
|
||||
hasPasscode(): any;
|
||||
addPasscodeClicked(): void;
|
||||
submitPasscodeForm(): void;
|
||||
changePasscodePressed(): Promise<void>;
|
||||
removePasscodePressed(): Promise<void>;
|
||||
isDesktopApplication(): any;
|
||||
}
|
||||
export {};
|
||||
24
app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts
vendored
Normal file
24
app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
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<void>;
|
||||
executeAction(action: any, extension: any): Promise<void>;
|
||||
handleActionResult(action: any, result: any): void;
|
||||
subRowsForAction(parentAction: any, extension: any): any;
|
||||
}
|
||||
export {};
|
||||
29
app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts
vendored
Normal file
29
app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
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<void>;
|
||||
dismiss(): void;
|
||||
}
|
||||
export {};
|
||||
19
app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts
vendored
Normal file
19
app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
};
|
||||
}
|
||||
47
app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts
vendored
Normal file
47
app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
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<void>;
|
||||
reloadStatus(doManualReload?: boolean): void;
|
||||
reloading: boolean | undefined;
|
||||
expired: boolean | undefined;
|
||||
loading: boolean | undefined;
|
||||
error: string | null | undefined;
|
||||
handleActivation(): void;
|
||||
loadTimeout: any;
|
||||
handleIframeLoadTimeout(): Promise<void>;
|
||||
issueLoading: boolean | undefined;
|
||||
didAttemptReload: boolean | undefined;
|
||||
handleIframeLoad(iframe: any): Promise<void>;
|
||||
disableActiveTheme(): void;
|
||||
getUrl(): any;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,29 @@
|
||||
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 {};
|
||||
27
app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts
vendored
Normal file
27
app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
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 {};
|
||||
17
app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts
vendored
Normal file
17
app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
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";
|
||||
22
app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts
vendored
Normal file
22
app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
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 {};
|
||||
30
app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts
vendored
Normal file
30
app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
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 {};
|
||||
72
app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts
vendored
Normal file
72
app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
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 {};
|
||||
28
app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts
vendored
Normal file
28
app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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<void>;
|
||||
setFormDataState(formData: any): Promise<any>;
|
||||
validateCurrentPassword(): Promise<any>;
|
||||
processPasswordChange(): Promise<boolean>;
|
||||
dismiss(): void;
|
||||
}
|
||||
export {};
|
||||
21
app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts
vendored
Normal file
21
app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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 {};
|
||||
32
app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts
vendored
Normal file
32
app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
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<void>;
|
||||
dismiss(): void;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,32 @@
|
||||
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<void>;
|
||||
reloadPrivileges(): Promise<void>;
|
||||
availableActions: any;
|
||||
availableCredentials: any;
|
||||
sessionExpirey: any;
|
||||
sessionExpired: boolean | undefined;
|
||||
credentialDisplayInfo: {} | undefined;
|
||||
privileges: any;
|
||||
checkboxValueChanged(action: any, credential: any): void;
|
||||
cancel(): void;
|
||||
dismiss(): void;
|
||||
}
|
||||
export {};
|
||||
26
app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts
vendored
Normal file
26
app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
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<void>;
|
||||
note: any;
|
||||
editor: any;
|
||||
restore(asCopy: any): void;
|
||||
dismiss(): void;
|
||||
}
|
||||
export {};
|
||||
28
app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts
vendored
Normal file
28
app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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 {};
|
||||
21
app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts
vendored
Normal file
21
app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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<void>;
|
||||
close(): void;
|
||||
}
|
||||
export {};
|
||||
1
app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { trusted } from "./trusted";
|
||||
1
app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export function trusted($sce: any): (url: any) => any;
|
||||
1
app/assets/javascripts/@types/app/assets/javascripts/index.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts
vendored
Normal file
1
app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function configRoutes($locationProvider: ng.ILocationProvider): void;
|
||||
6
app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts
vendored
Normal file
6
app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export class AlertService extends SNAlertService {
|
||||
constructor(deviceInterface: import("../../../../../snjs/dist/@types").DeviceInterface);
|
||||
alert(title: any, text: any, closeButtonText?: string, onClose: any): Promise<any>;
|
||||
confirm(title: any, text: any, confirmButtonText?: string, cancelButtonText?: string, onConfirm: any, onCancel: any, destructive?: boolean): Promise<any>;
|
||||
}
|
||||
import { SNAlertService } from "../../../../../snjs/dist/@types";
|
||||
21
app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts
vendored
Normal file
21
app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export class ArchiveManager {
|
||||
constructor(application: any);
|
||||
application: any;
|
||||
/** @public */
|
||||
public downloadBackup(encrypted: any): Promise<void>;
|
||||
/** @public */
|
||||
public downloadBackupOfItems(items: any, encrypted: any): Promise<void>;
|
||||
/** @private */
|
||||
private formattedDate;
|
||||
/** @private */
|
||||
private itemsData;
|
||||
/** @private */
|
||||
private loadZip;
|
||||
/** @private */
|
||||
private downloadZippedItems;
|
||||
/** @private */
|
||||
private hrefForData;
|
||||
textFile: string | undefined;
|
||||
/** @private */
|
||||
private downloadData;
|
||||
}
|
||||
49
app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts
vendored
Normal file
49
app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
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<any>;
|
||||
syncComponentsInstallation(components: any): void;
|
||||
installComponent(component: any): Promise<void>;
|
||||
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<void>;
|
||||
desktop_registerComponentActivationObserver(callback: any): {
|
||||
id: () => number;
|
||||
callback: any;
|
||||
};
|
||||
desktop_deregisterComponentActivationObserver(observer: any): void;
|
||||
notifyComponentActivation(component: any): Promise<void>;
|
||||
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<void>;
|
||||
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";
|
||||
10
app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts
vendored
Normal file
10
app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
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";
|
||||
42
app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts
vendored
Normal file
42
app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
25
app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts
vendored
Normal file
25
app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
export class LockManager {
|
||||
constructor(application: any);
|
||||
application: any;
|
||||
observeVisibility(): void;
|
||||
unsubState: any;
|
||||
deinit(): void;
|
||||
setAutoLockInterval(interval: any): Promise<any>;
|
||||
getAutoLockInterval(): Promise<any>;
|
||||
/**
|
||||
* 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<void>;
|
||||
beginAutoLockTimer(): Promise<void>;
|
||||
lockAfterDate: Date | null | undefined;
|
||||
lockTimeout: NodeJS.Timeout | undefined;
|
||||
cancelAutoLockTimer(): void;
|
||||
}
|
||||
17
app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts
vendored
Normal file
17
app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/** 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<void>;
|
||||
extensionsManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
|
||||
batchManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
|
||||
resolveBatchManager(): Promise<void>;
|
||||
}
|
||||
import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
||||
import { SNPredicate } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
||||
29
app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts
vendored
Normal file
29
app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
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<void>;
|
||||
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";
|
||||
56
app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts
vendored
Normal file
56
app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
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<any>;
|
||||
setSelectedTag(tag: any): void;
|
||||
selectedTag: any;
|
||||
setSelectedNote(note: any): Promise<any>;
|
||||
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;
|
||||
}
|
||||
15
app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts
vendored
Normal file
15
app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
||||
26
app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts
vendored
Normal file
26
app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export class ThemeManager extends ApplicationService {
|
||||
constructor(application: any);
|
||||
activeThemes: any[];
|
||||
unsubState: any;
|
||||
unregisterDesktop: any;
|
||||
unregisterComponent: any;
|
||||
/** @override */
|
||||
onAppStart(): void;
|
||||
/** @access private */
|
||||
activateCachedThemes(): Promise<void>;
|
||||
/** @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<void>;
|
||||
/** @access private */
|
||||
decacheThemes(): Promise<void>;
|
||||
/** @access private */
|
||||
getCachedThemes(): Promise<import("../../../../../snjs/dist/@types/models/core/item").SNItem[]>;
|
||||
}
|
||||
import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
||||
43
app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts
vendored
Normal file
43
app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
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.";
|
||||
4
app/assets/javascripts/@types/app/assets/javascripts/types.d.ts
vendored
Normal file
4
app/assets/javascripts/@types/app/assets/javascripts/types.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare enum PasswordWizardType {
|
||||
ChangePassword = 1,
|
||||
AccountUpgrade = 2
|
||||
}
|
||||
10
app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts
vendored
Normal file
10
app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
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;
|
||||
29
app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts
vendored
Normal file
29
app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
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<string | null>;
|
||||
getAllRawStorageKeyValues(): Promise<{
|
||||
key: string;
|
||||
value: any;
|
||||
}[]>;
|
||||
setRawStorageValue(key: string, value: any): Promise<void>;
|
||||
removeRawStorageValue(key: string): Promise<void>;
|
||||
removeAllRawStorageValues(): Promise<void>;
|
||||
openDatabase(): Promise<{
|
||||
isNewDatabase?: boolean | undefined;
|
||||
} | undefined>;
|
||||
private getDatabaseKeyPrefix;
|
||||
private keyForPayloadId;
|
||||
getAllRawDatabasePayloads(): Promise<any>;
|
||||
saveRawDatabasePayload(payload: any): Promise<any>;
|
||||
saveRawDatabasePayloads(payloads: any[]): Promise<any>;
|
||||
removeRawDatabasePayloadWithId(id: string): Promise<any>;
|
||||
removeAllRawDatabasePayloads(): Promise<any>;
|
||||
getKeychainValue(): Promise<any>;
|
||||
setKeychainValue(value: any): Promise<void>;
|
||||
clearKeychainValue(): Promise<void>;
|
||||
openUrl(url: string): void;
|
||||
}
|
||||
242
app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts
vendored
Normal file
242
app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/**
|
||||
* @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
|
||||
<example module="sanitizeExample" deps="angular-sanitize.js" name="sanitize-service">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
angular.module('sanitizeExample', ['ngSanitize'])
|
||||
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
||||
$scope.snippet =
|
||||
'<p style="color:blue">an html\n' +
|
||||
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
||||
'snippet</p>';
|
||||
$scope.deliberatelyTrustDangerousSnippet = function() {
|
||||
return $sce.trustAsHtml($scope.snippet);
|
||||
};
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="ExampleController">
|
||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Directive</td>
|
||||
<td>How</td>
|
||||
<td>Source</td>
|
||||
<td>Rendered</td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-sanitize">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Automatically uses $sanitize</td>
|
||||
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind-html="snippet"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-trust">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
|
||||
</div></pre>
|
||||
</td>
|
||||
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-default">
|
||||
<td>ng-bind</td>
|
||||
<td>Automatically escapes</td>
|
||||
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind="snippet"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should sanitize the html snippet by default', function() {
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
||||
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
|
||||
});
|
||||
|
||||
it('should inline raw snippet if bound to a trusted value', function() {
|
||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
|
||||
toBe("<p style=\"color:blue\">an html\n" +
|
||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
||||
"snippet</p>");
|
||||
});
|
||||
|
||||
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 <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
||||
toBe('new <b>text</b>');
|
||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
|
||||
'new <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
|
||||
"new <b onclick=\"alert(1)\">text</b>");
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* <p>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.</p>
|
||||
*
|
||||
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
|
||||
* tags within the sanitized content:</p>
|
||||
*
|
||||
* <br>
|
||||
*
|
||||
* <pre><code>
|
||||
* .rootOfTheIncludedContent svg {
|
||||
* overflow: hidden !important;
|
||||
* }
|
||||
* </code></pre>
|
||||
* </div>
|
||||
*
|
||||
* @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`.
|
||||
*
|
||||
* <div class="alert alert-info">
|
||||
* 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.
|
||||
* </div>
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* 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.
|
||||
* </div>
|
||||
*
|
||||
* @param {Array<String>|Object} elements - A list of valid HTML elements or an object with one or
|
||||
* more of the following properties:
|
||||
* - **htmlElements** - `{Array<String>}` - A list of elements to extend the current list of
|
||||
* HTML elements.
|
||||
* - **htmlVoidElements** - `{Array<String>}` - 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<String>}` - 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}.
|
||||
*
|
||||
* <div class="alert alert-info">
|
||||
* 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.
|
||||
* </div>
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* 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.
|
||||
* </div>
|
||||
*
|
||||
* @param {Array<String>} 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;
|
||||
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts
vendored
Normal file
0
app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts
vendored
Normal file
@@ -1,30 +1,61 @@
|
||||
import { PasswordWizardType } from './types';
|
||||
import {
|
||||
Environment,
|
||||
SNApplication,
|
||||
SNAlertService,
|
||||
Environments,
|
||||
platformFromString
|
||||
platformFromString,
|
||||
Challenge,
|
||||
ChallengeOrchestrator,
|
||||
ProtectedAction
|
||||
} from 'snjs';
|
||||
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';
|
||||
|
||||
type WebServices = {
|
||||
appState: AppState
|
||||
desktopService: DesktopManager
|
||||
lockService: LockManager
|
||||
archiveService: ArchiveManager
|
||||
nativeExtService: NativeExtManager
|
||||
statusService: StatusManager
|
||||
themeService: ThemeManager
|
||||
prefsService: PreferencesManager
|
||||
keyboardService: KeyboardManager
|
||||
}
|
||||
|
||||
export class WebApplication extends SNApplication {
|
||||
|
||||
private $compile?: ng.ICompileService
|
||||
private scope?: ng.IScope
|
||||
private onDeinit?: (app: SNApplication) => void
|
||||
private webServices!: WebServices
|
||||
private currentAuthenticationElement?: JQLite
|
||||
|
||||
/* @ngInject */
|
||||
constructor($compile, $timeout, scope, onDeinit) {
|
||||
const deviceInterface = new WebDeviceInterface({ timeout: $timeout });
|
||||
super({
|
||||
environment: Environments.Web,
|
||||
platform: platformFromString(getPlatformString()),
|
||||
namespace: '',
|
||||
deviceInterface: deviceInterface,
|
||||
swapClasses: [
|
||||
constructor(
|
||||
$compile: ng.ICompileService,
|
||||
$timeout: ng.ITimeoutService,
|
||||
scope: ng.IScope,
|
||||
onDeinit: () => void
|
||||
) {
|
||||
const namespace = '';
|
||||
const deviceInterface = new WebDeviceInterface(namespace, $timeout);
|
||||
super(
|
||||
Environment.Web,
|
||||
platformFromString(getPlatformString()),
|
||||
deviceInterface,
|
||||
namespace,
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
swap: SNAlertService,
|
||||
with: AlertService
|
||||
}
|
||||
]
|
||||
});
|
||||
);
|
||||
this.$compile = $compile;
|
||||
this.scope = scope;
|
||||
this.onDeinit = onDeinit;
|
||||
@@ -34,30 +65,23 @@ export class WebApplication extends SNApplication {
|
||||
/** @override */
|
||||
deinit() {
|
||||
for (const key of Object.keys(this.webServices)) {
|
||||
const service = this.webServices[key];
|
||||
if(service.deinit) {
|
||||
const service = (this.webServices as any)[key];
|
||||
if (service.deinit) {
|
||||
service.deinit();
|
||||
}
|
||||
service.application = null;
|
||||
delete this.webServices[key];
|
||||
service.application = undefined;
|
||||
}
|
||||
this.webServices = {};
|
||||
this.onDeinit(this);
|
||||
this.onDeinit = null;
|
||||
this.$compile = null;
|
||||
this.$timeout = null;
|
||||
this.scope.application = null;
|
||||
this.scope.$destroy();
|
||||
this.scope = null;
|
||||
this.webServices = {} as WebServices;
|
||||
this.onDeinit!(this);
|
||||
this.onDeinit = undefined;
|
||||
this.$compile = undefined;
|
||||
(this.scope! as any).application = undefined;
|
||||
this.scope!.$destroy();
|
||||
this.scope = undefined;
|
||||
super.deinit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param {object} services
|
||||
*/
|
||||
setWebServices(services) {
|
||||
setWebServices(services: WebServices) {
|
||||
this.webServices = services;
|
||||
}
|
||||
|
||||
@@ -110,20 +134,20 @@ export class WebApplication extends SNApplication {
|
||||
return this.protocolUpgradeAvailable();
|
||||
}
|
||||
|
||||
presentPasswordWizard(type) {
|
||||
const scope = this.scope.$new(true);
|
||||
presentPasswordWizard(type: PasswordWizardType) {
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.type = type;
|
||||
scope.application = this;
|
||||
const el = this.$compile("<password-wizard application='application' type='type'></password-wizard>")(scope);
|
||||
const el = this.$compile!("<password-wizard application='application' type='type'></password-wizard>")(scope);
|
||||
angular.element(document.body).append(el);
|
||||
}
|
||||
|
||||
promptForChallenge(challenge, orchestrator) {
|
||||
const scope = this.scope.$new(true);
|
||||
promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator) {
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.challenge = challenge;
|
||||
scope.orchestrator = orchestrator;
|
||||
scope.application = this;
|
||||
const el = this.$compile(
|
||||
const el = this.$compile!(
|
||||
"<challenge-modal " +
|
||||
"class='sk-modal' application='application' challenge='challenge' orchestrator='orchestrator'>" +
|
||||
"</challenge-modal>"
|
||||
@@ -133,19 +157,23 @@ export class WebApplication extends SNApplication {
|
||||
|
||||
async performProtocolUpgrade() {
|
||||
const errors = await this.upgradeProtocolVersion();
|
||||
if (errors.length === 0) {
|
||||
this.alertService.alert({
|
||||
text: "Success! Your encryption version has been upgraded." +
|
||||
" You'll be asked to enter your credentials again on other devices you're signed into."
|
||||
});
|
||||
if (!errors || errors.length === 0) {
|
||||
this.alertService!.alert(
|
||||
"Success! Your encryption version has been upgraded." +
|
||||
" You'll be asked to enter your credentials again on other devices you're signed into."
|
||||
);
|
||||
} else {
|
||||
this.alertService.alert({
|
||||
text: "Unable to upgrade encryption version. Please try again."
|
||||
});
|
||||
this.alertService!.alert(
|
||||
"Unable to upgrade encryption version. Please try again."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async presentPrivilegesModal(action, onSuccess, onCancel) {
|
||||
async presentPrivilegesModal(
|
||||
action: ProtectedAction,
|
||||
onSuccess: any,
|
||||
onCancel: any
|
||||
) {
|
||||
if (this.authenticationInProgress()) {
|
||||
onCancel && onCancel();
|
||||
return;
|
||||
@@ -153,19 +181,19 @@ export class WebApplication extends SNApplication {
|
||||
|
||||
const customSuccess = async () => {
|
||||
onSuccess && await onSuccess();
|
||||
this.currentAuthenticationElement = null;
|
||||
this.currentAuthenticationElement = undefined;
|
||||
};
|
||||
const customCancel = async () => {
|
||||
onCancel && await onCancel();
|
||||
this.currentAuthenticationElement = null;
|
||||
this.currentAuthenticationElement = undefined;
|
||||
};
|
||||
|
||||
const scope = this.scope.$new(true);
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.action = action;
|
||||
scope.onSuccess = customSuccess;
|
||||
scope.onCancel = customCancel;
|
||||
scope.application = this;
|
||||
const el = this.$compile(`
|
||||
const el = this.$compile!(`
|
||||
<privileges-auth-modal application='application' action='action' on-success='onSuccess'
|
||||
on-cancel='onCancel' class='sk-modal'></privileges-auth-modal>
|
||||
`)(scope);
|
||||
@@ -175,9 +203,9 @@ export class WebApplication extends SNApplication {
|
||||
}
|
||||
|
||||
presentPrivilegesManagementModal() {
|
||||
const scope = this.scope.$new(true);
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.application = this;
|
||||
const el = this.$compile("<privileges-management-modal application='application' class='sk-modal'></privileges-management-modal>")(scope);
|
||||
const el = this.$compile!("<privileges-management-modal application='application' class='sk-modal'></privileges-management-modal>")(scope);
|
||||
angular.element(document.body).append(el);
|
||||
}
|
||||
|
||||
@@ -185,26 +213,26 @@ export class WebApplication extends SNApplication {
|
||||
return this.currentAuthenticationElement != null;
|
||||
}
|
||||
|
||||
presentPasswordModal(callback) {
|
||||
const scope = this.scope.$new(true);
|
||||
presentPasswordModal(callback: () => void) {
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.type = "password";
|
||||
scope.title = "Decryption Assistance";
|
||||
scope.message = `Unable to decrypt this item with your current keys.
|
||||
Please enter your account password at the time of this revision.`;
|
||||
scope.callback = callback;
|
||||
const el = this.$compile(
|
||||
const el = this.$compile!(
|
||||
`<input-modal type='type' message='message'
|
||||
title='title' callback='callback'></input-modal>`
|
||||
)(scope);
|
||||
angular.element(document.body).append(el);
|
||||
}
|
||||
|
||||
presentRevisionPreviewModal(uuid, content) {
|
||||
const scope = this.scope.$new(true);
|
||||
presentRevisionPreviewModal(uuid: string, content: any) {
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.uuid = uuid;
|
||||
scope.content = content;
|
||||
scope.application = this;
|
||||
const el = this.$compile(
|
||||
const el = this.$compile!(
|
||||
`<revision-preview-modal application='application' uuid='uuid' content='content'
|
||||
class='sk-modal'></revision-preview-modal>`
|
||||
)(scope);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApplicationEvents } from 'snjs';
|
||||
import { ApplicationEvent } from 'snjs';
|
||||
|
||||
export class PureCtrl {
|
||||
/* @ngInject */
|
||||
@@ -84,13 +84,13 @@ export class PureCtrl {
|
||||
}
|
||||
this.unsubApp = this.application.addEventObserver(async (eventName) => {
|
||||
this.onAppEvent(eventName);
|
||||
if (eventName === ApplicationEvents.Started) {
|
||||
if (eventName === ApplicationEvent.Started) {
|
||||
await this.onAppStart();
|
||||
} else if (eventName === ApplicationEvents.Launched) {
|
||||
} else if (eventName === ApplicationEvent.Launched) {
|
||||
await this.onAppLaunch();
|
||||
} else if (eventName === ApplicationEvents.CompletedSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedSync) {
|
||||
this.onAppSync();
|
||||
} else if (eventName === ApplicationEvents.KeyStatusChanged) {
|
||||
} else if (eventName === ApplicationEvent.KeyStatusChanged) {
|
||||
this.onAppKeyChange();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getPlatformString } from '@/utils';
|
||||
import template from '%/application-view.pug';
|
||||
import { AppStateEvents } from '@/services/state';
|
||||
import { ApplicationEvents } from 'snjs';
|
||||
import { ApplicationEvent } from 'snjs';
|
||||
import angular from 'angular';
|
||||
import {
|
||||
PANEL_NAME_NOTES,
|
||||
@@ -91,34 +91,34 @@ class ApplicationViewCtrl extends PureCtrl {
|
||||
/** @override */
|
||||
async onAppEvent(eventName) {
|
||||
super.onAppEvent(eventName);
|
||||
if (eventName === ApplicationEvents.LocalDataIncrementalLoad) {
|
||||
if (eventName === ApplicationEvent.LocalDataIncrementalLoad) {
|
||||
this.updateLocalDataStatus();
|
||||
} else if (
|
||||
eventName === ApplicationEvents.SyncStatusChanged ||
|
||||
eventName === ApplicationEvents.FailedSync
|
||||
eventName === ApplicationEvent.SyncStatusChanged ||
|
||||
eventName === ApplicationEvent.FailedSync
|
||||
) {
|
||||
this.updateSyncStatus();
|
||||
} else if (eventName === ApplicationEvents.LocalDataLoaded) {
|
||||
} else if (eventName === ApplicationEvent.LocalDataLoaded) {
|
||||
this.updateLocalDataStatus();
|
||||
} else if (eventName === ApplicationEvents.WillSync) {
|
||||
} else if (eventName === ApplicationEvent.WillSync) {
|
||||
if (!this.completedInitialSync) {
|
||||
this.syncStatus = this.application.getStatusService().replaceStatusWithString(
|
||||
this.syncStatus,
|
||||
"Syncing..."
|
||||
);
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.CompletedSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedSync) {
|
||||
if (!this.completedInitialSync) {
|
||||
this.syncStatus = this.application.getStatusService().removeStatus(this.syncStatus);
|
||||
this.completedInitialSync = true;
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.InvalidSyncSession) {
|
||||
} else if (eventName === ApplicationEvent.InvalidSyncSession) {
|
||||
this.showInvalidSessionAlert();
|
||||
} else if (eventName === ApplicationEvents.LocalDatabaseReadError) {
|
||||
} else if (eventName === ApplicationEvent.LocalDatabaseReadError) {
|
||||
this.application.alertService.alert({
|
||||
text: 'Unable to load local database. Please restart the app and try again.'
|
||||
});
|
||||
} else if (eventName === ApplicationEvents.LocalDatabaseWriteError) {
|
||||
} else if (eventName === ApplicationEvent.LocalDatabaseWriteError) {
|
||||
this.application.alertService.alert({
|
||||
text: 'Unable to write to local database. Please restart the app and try again.'
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import angular from 'angular';
|
||||
import {
|
||||
ApplicationEvents,
|
||||
ApplicationEvent,
|
||||
isPayloadSourceRetrieved,
|
||||
ContentTypes,
|
||||
ProtectedActions
|
||||
@@ -113,9 +113,9 @@ class EditorCtrl extends PureCtrl {
|
||||
if (!this.state.note) {
|
||||
return;
|
||||
}
|
||||
if (eventName === ApplicationEvents.HighLatencySync) {
|
||||
if (eventName === ApplicationEvent.HighLatencySync) {
|
||||
this.setState({ syncTakingTooLong: true });
|
||||
} else if (eventName === ApplicationEvents.CompletedSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedSync) {
|
||||
this.setState({ syncTakingTooLong: false });
|
||||
if (this.state.note.dirty) {
|
||||
/** if we're still dirty, don't change status, a sync is likely upcoming. */
|
||||
@@ -126,7 +126,7 @@ class EditorCtrl extends PureCtrl {
|
||||
this.showAllChangesSavedStatus();
|
||||
}
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.FailedSync) {
|
||||
} else if (eventName === ApplicationEvent.FailedSync) {
|
||||
/**
|
||||
* Only show error status in editor if the note is dirty.
|
||||
* Otherwise, it means the originating sync came from somewhere else
|
||||
@@ -135,7 +135,7 @@ class EditorCtrl extends PureCtrl {
|
||||
if (this.state.note.dirty) {
|
||||
this.showErrorStatus();
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.LocalDatabaseWriteError) {
|
||||
} else if (eventName === ApplicationEvent.LocalDatabaseWriteError) {
|
||||
this.showErrorStatus({
|
||||
message: "Offline Saving Issue",
|
||||
desc: "Changes not saved"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { dateToLocalizedString } from '@/utils';
|
||||
import {
|
||||
ApplicationEvents,
|
||||
ApplicationEvent,
|
||||
TIMING_STRATEGY_FORCE_SPAWN_NEW,
|
||||
ProtectedActions,
|
||||
ContentTypes
|
||||
@@ -132,24 +132,24 @@ class FooterCtrl extends PureCtrl {
|
||||
|
||||
/** @override */
|
||||
onAppEvent(eventName) {
|
||||
if (eventName === ApplicationEvents.KeyStatusChanged) {
|
||||
if (eventName === ApplicationEvent.KeyStatusChanged) {
|
||||
this.reloadUpgradeStatus();
|
||||
} else if (eventName === ApplicationEvents.EnteredOutOfSync) {
|
||||
} else if (eventName === ApplicationEvent.EnteredOutOfSync) {
|
||||
this.setState({
|
||||
outOfSync: true
|
||||
});
|
||||
} else if (eventName === ApplicationEvents.ExitedOutOfSync) {
|
||||
} else if (eventName === ApplicationEvent.ExitedOutOfSync) {
|
||||
this.setState({
|
||||
outOfSync: false
|
||||
});
|
||||
} else if (eventName === ApplicationEvents.CompletedSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedSync) {
|
||||
if (this.offline && this.application.getNoteCount() === 0) {
|
||||
this.showAccountMenu = true;
|
||||
}
|
||||
this.syncUpdated();
|
||||
this.findErrors();
|
||||
this.updateOfflineStatus();
|
||||
} else if (eventName === ApplicationEvents.FailedSync) {
|
||||
} else if (eventName === ApplicationEvent.FailedSync) {
|
||||
this.findErrors();
|
||||
this.updateOfflineStatus();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import angular from 'angular';
|
||||
import template from '%/notes.pug';
|
||||
import { ApplicationEvents, ContentTypes, removeFromArray } from 'snjs';
|
||||
import { ApplicationEvent, ContentTypes, removeFromArray } from 'snjs';
|
||||
import { PureCtrl } from '@Controllers';
|
||||
import { AppStateEvents } from '@/services/state';
|
||||
import { KeyboardModifiers, KeyboardKeys } from '@/services/keyboardManager';
|
||||
@@ -103,14 +103,14 @@ class NotesCtrl extends PureCtrl {
|
||||
|
||||
/** @override */
|
||||
async onAppEvent(eventName) {
|
||||
if (eventName === ApplicationEvents.SignedIn) {
|
||||
if (eventName === ApplicationEvent.SignedIn) {
|
||||
/** Delete dummy note if applicable */
|
||||
if (this.state.selectedNote && this.state.selectedNote.dummy) {
|
||||
this.application.deleteItemLocally({ item: this.state.selectedNote });
|
||||
await this.selectNote(null);
|
||||
await this.reloadNotes();
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.CompletedSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedSync) {
|
||||
this.getMostValidNotes().then((notes) => {
|
||||
if (notes.length === 0) {
|
||||
this.createPlaceholderNote();
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
SNNote,
|
||||
SNSmartTag,
|
||||
ContentTypes,
|
||||
ApplicationEvents,
|
||||
ApplicationEvent,
|
||||
ComponentActions
|
||||
} from 'snjs';
|
||||
import template from '%/tags.pug';
|
||||
@@ -107,9 +107,9 @@ class TagsPanelCtrl extends PureCtrl {
|
||||
/** @override */
|
||||
async onAppEvent(eventName) {
|
||||
super.onAppEvent(eventName);
|
||||
if (eventName === ApplicationEvents.LocalDataIncrementalLoad) {
|
||||
if (eventName === ApplicationEvent.LocalDataIncrementalLoad) {
|
||||
this.reloadNoteCounts();
|
||||
} else if (eventName === ApplicationEvents.SyncStatusChanged) {
|
||||
} else if (eventName === ApplicationEvent.SyncStatusChanged) {
|
||||
const syncStatus = this.application.getSyncStatus();
|
||||
const stats = syncStatus.getStats();
|
||||
if (stats.downloadCount > 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { isDesktopApplication } from './utils';
|
||||
|
||||
/* @ngInject */
|
||||
export function configRoutes($locationProvider) {
|
||||
export function configRoutes($locationProvider: ng.ILocationProvider) {
|
||||
if (!isDesktopApplication()) {
|
||||
if (window.history && window.history.pushState) {
|
||||
$locationProvider.html5Mode({
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable camelcase */
|
||||
// An interface used by the Desktop app to interact with SN
|
||||
import { isDesktopApplication } from '@/utils';
|
||||
import { EncryptionIntents, ApplicationService, ApplicationEvents, removeFromArray } from 'snjs';
|
||||
import { EncryptionIntents, ApplicationService, ApplicationEvent, removeFromArray } from 'snjs';
|
||||
|
||||
const COMPONENT_DATA_KEY_INSTALL_ERROR = 'installError';
|
||||
const COMPONENT_CONTENT_KEY_PACKAGE_INFO = 'package_info';
|
||||
@@ -30,12 +30,12 @@ export class DesktopManager extends ApplicationService {
|
||||
/** @override */
|
||||
onAppEvent(eventName) {
|
||||
super.onAppEvent(eventName);
|
||||
if (eventName === ApplicationEvents.LocalDataLoaded) {
|
||||
if (eventName === ApplicationEvent.LocalDataLoaded) {
|
||||
this.dataLoaded = true;
|
||||
if (this.dataLoadHandler) {
|
||||
this.dataLoadHandler();
|
||||
}
|
||||
} else if (eventName === ApplicationEvents.MajorDataChange) {
|
||||
} else if (eventName === ApplicationEvent.MajorDataChange) {
|
||||
if (this.majorDataChangeHandler) {
|
||||
this.majorDataChangeHandler();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isDesktopApplication } from '@/utils';
|
||||
import pull from 'lodash/pull';
|
||||
import { ProtectedActions, ApplicationEvents } from 'snjs';
|
||||
import { ProtectedActions, ApplicationEvent } from 'snjs';
|
||||
|
||||
export const AppStateEvents = {
|
||||
TagChanged: 1,
|
||||
@@ -52,9 +52,9 @@ export class AppState {
|
||||
|
||||
addAppEventObserver() {
|
||||
this.unsubApp = this.application.addEventObserver(async (eventName) => {
|
||||
if (eventName === ApplicationEvents.Started) {
|
||||
if (eventName === ApplicationEvent.Started) {
|
||||
this.locked = true;
|
||||
} else if (eventName === ApplicationEvents.Launched) {
|
||||
} else if (eventName === ApplicationEvent.Launched) {
|
||||
this.locked = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
ApplicationEvents,
|
||||
ApplicationEvent,
|
||||
StorageValueModes,
|
||||
EncryptionIntents,
|
||||
ApplicationService,
|
||||
|
||||
26
app/assets/javascripts/tsconfig.json
Normal file
26
app/assets/javascripts/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["node", "../../../node_modules/snjs/dist/@types"],
|
||||
"declaration": true,
|
||||
"declarationDir": "@types",
|
||||
"emitDeclarationOnly": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"%/*": ["../templates/*"],
|
||||
"@/*": ["./*"],
|
||||
"@Controllers/*": ["./controllers/*"]
|
||||
}
|
||||
},
|
||||
"typeAcquisition": {
|
||||
"include": [
|
||||
"snjs"
|
||||
]
|
||||
}
|
||||
}
|
||||
4
app/assets/javascripts/types.ts
Normal file
4
app/assets/javascripts/types.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum PasswordWizardType {
|
||||
ChangePassword = 1,
|
||||
AccountUpgrade = 2
|
||||
}
|
||||
@@ -61,10 +61,9 @@ export function getPlatformString() {
|
||||
if (platform.indexOf('linux') !== -1) {
|
||||
trimmed = 'linux';
|
||||
}
|
||||
|
||||
return trimmed + (isDesktopApplication() ? '-desktop' : '-web');
|
||||
} catch (e) {
|
||||
return null;
|
||||
return 'unknown-platform';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,31 @@
|
||||
import { DeviceInterface, getGlobalScope } from 'snjs';
|
||||
import { DeviceInterface, getGlobalScope, SNApplication } from 'snjs';
|
||||
import { Database } from '@/database';
|
||||
|
||||
const KEYCHAIN_STORAGE_KEY = 'keychain';
|
||||
|
||||
export class WebDeviceInterface extends DeviceInterface {
|
||||
|
||||
constructor({
|
||||
namespace,
|
||||
timeout
|
||||
} = {}) {
|
||||
super({
|
||||
namespace,
|
||||
timeout: timeout || setTimeout.bind(getGlobalScope()),
|
||||
interval: setInterval.bind(getGlobalScope())
|
||||
});
|
||||
this.createDatabase();
|
||||
}
|
||||
private database: Database
|
||||
|
||||
createDatabase() {
|
||||
constructor(namespace: string, timeout: any) {
|
||||
super(
|
||||
namespace,
|
||||
timeout || setTimeout.bind(getGlobalScope()),
|
||||
setInterval.bind(getGlobalScope())
|
||||
);
|
||||
this.database = new Database();
|
||||
}
|
||||
|
||||
setApplication(application) {
|
||||
setApplication(application: SNApplication) {
|
||||
this.database.setApplication(application);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
deinit() {
|
||||
super.deinit();
|
||||
this.database.deinit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @value storage
|
||||
*/
|
||||
|
||||
async getRawStorageValue(key) {
|
||||
async getRawStorageValue(key: string) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
@@ -50,11 +40,11 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
return results;
|
||||
}
|
||||
|
||||
async setRawStorageValue(key, value) {
|
||||
async setRawStorageValue(key: string, value: any) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
async removeRawStorageValue(key) {
|
||||
async removeRawStorageValue(key: string) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
@@ -72,11 +62,10 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
}).catch((error => {
|
||||
reject(error);
|
||||
}));
|
||||
});
|
||||
}) as Promise<{ isNewDatabase?: boolean } | undefined>;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
getDatabaseKeyPrefix() {
|
||||
private getDatabaseKeyPrefix() {
|
||||
if (this.namespace) {
|
||||
return `${this.namespace}-item-`;
|
||||
} else {
|
||||
@@ -84,8 +73,7 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
}
|
||||
}
|
||||
|
||||
/** @private */
|
||||
keyForPayloadId(id) {
|
||||
private keyForPayloadId(id: string) {
|
||||
return `${this.getDatabaseKeyPrefix()}${id}`;
|
||||
}
|
||||
|
||||
@@ -93,15 +81,15 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
return this.database.getAllPayloads();
|
||||
}
|
||||
|
||||
async saveRawDatabasePayload(payload) {
|
||||
async saveRawDatabasePayload(payload: any) {
|
||||
return this.database.savePayload(payload);
|
||||
}
|
||||
|
||||
async saveRawDatabasePayloads(payloads) {
|
||||
async saveRawDatabasePayloads(payloads: any[]) {
|
||||
return this.database.savePayloads(payloads);
|
||||
}
|
||||
|
||||
async removeRawDatabasePayloadWithId(id) {
|
||||
async removeRawDatabasePayloadWithId(id: string) {
|
||||
return this.database.deletePayload(id);
|
||||
}
|
||||
|
||||
@@ -109,7 +97,6 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
return this.database.clearAllPayloads();
|
||||
}
|
||||
|
||||
/** @keychian */
|
||||
async getKeychainValue() {
|
||||
const value = localStorage.getItem(KEYCHAIN_STORAGE_KEY);
|
||||
if (value) {
|
||||
@@ -117,7 +104,7 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
}
|
||||
}
|
||||
|
||||
async setKeychainValue(value) {
|
||||
async setKeychainValue(value: any) {
|
||||
localStorage.setItem(KEYCHAIN_STORAGE_KEY, JSON.stringify(value));
|
||||
}
|
||||
|
||||
@@ -125,14 +112,10 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
localStorage.removeItem(KEYCHAIN_STORAGE_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @actions
|
||||
*/
|
||||
openUrl(url) {
|
||||
openUrl(url: string) {
|
||||
const win = window.open(url, '_blank');
|
||||
if (win) {
|
||||
win.focus();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user