Merge branch 'release/3.5.1'

This commit is contained in:
Baptiste Grob
2020-11-02 10:28:35 +01:00
289 changed files with 46182 additions and 12016 deletions

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,54 @@
/// <reference types="angular" />
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: (app: WebApplication) => 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 {};

View File

@@ -0,0 +1,26 @@
/// <reference types="angular" />
import { WebApplication } from './application';
declare type AppManagerChangeCallback = () => void;
export declare class ApplicationManager {
$compile: ng.ICompileService;
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
applications: WebApplication[];
changeObservers: AppManagerChangeCallback[];
activeApplication?: WebApplication;
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService);
private createDefaultApplication;
/** @callback */
onApplicationDeinit(application: WebApplication): void;
private createNewApplication;
get application(): WebApplication | undefined;
getApplications(): WebApplication[];
/**
* Notifies observer when the active application has changed.
* Any application which is no longer active is destroyed, and
* must be removed from the interface.
*/
addApplicationChangeObserver(callback: AppManagerChangeCallback): void;
private notifyObserversOfAppChange;
}
export {};

View File

@@ -0,0 +1,36 @@
/// <reference types="angular" />
import { WebApplication } from './../../application';
import { ApplicationEvent } from 'snjs';
export declare type CtrlState = Partial<Record<string, any>>;
export declare type CtrlProps = Partial<Record<string, any>>;
export declare class PureCtrl {
$timeout: ng.ITimeoutService;
/** Passed through templates */
application?: WebApplication;
props: CtrlProps;
state: CtrlState;
private unsubApp;
private unsubState;
private stateTimeout;
constructor($timeout: ng.ITimeoutService);
$onInit(): void;
deinit(): void;
$onDestroy(): void;
get appState(): import("../../services/state").AppState;
/** @private */
resetState(): Promise<void>;
/** @override */
getInitialState(): {};
setState(state: CtrlState): Promise<unknown>;
updateUI(func: () => void): Promise<void>;
initProps(props: CtrlProps): void;
addAppStateObserver(): void;
onAppStateEvent(eventName: any, data: any): void;
addAppEventObserver(): void;
onAppEvent(eventName: ApplicationEvent): void;
/** @override */
onAppStart(): Promise<void>;
onAppLaunch(): Promise<void>;
onAppKeyChange(): Promise<void>;
onAppSync(): void;
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../types';
export declare class ApplicationView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,2 @@
export declare const PANEL_NAME_NOTES = "notes";
export declare const PANEL_NAME_TAGS = "tags";

View File

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

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../types';
export declare class Footer extends WebDirective {
constructor();
}

View 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';

View File

@@ -0,0 +1,10 @@
import { SNNote, SNTag } from 'snjs';
export declare enum NoteSortKey {
CreatedAt = "created_at",
UpdatedAt = "updated_at",
ClientUpdatedAt = "client_updated_at",
Title = "title"
}
export declare function filterAndSortNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string, sortBy: string, reverse: boolean): SNNote[];
export declare function filterNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): SNNote[];
export declare function sortNotes(notes: SNNote[] | undefined, sortBy: string, reverse: boolean): SNNote[];

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class NotesPanel extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../types';
export declare class Root extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../types';
export declare class TagsPanel extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,29 @@
import { SNAlertService } from "snjs/dist/@types";
export declare class Database {
databaseName: string;
private alertService;
private locked;
private db?;
constructor(databaseName: string, alertService: SNAlertService);
deinit(): void;
/**
* Relinquishes the lock and allows db operations to proceed
*/
unlock(): void;
/**
* Opens the database natively, or returns the existing database object if already opened.
* @param 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?: () => void): Promise<IDBDatabase | undefined>;
getAllPayloads(): Promise<any[]>;
savePayload(payload: any): Promise<void>;
savePayloads(payloads: any[]): Promise<void>;
private putItems;
deletePayload(uuid: string): Promise<void>;
clearAllPayloads(): Promise<void>;
private showAlert;
private showGenericError;
private displayOfflineAlert;
}

View File

@@ -0,0 +1,8 @@
/// <reference types="angular" />
export declare function autofocus($timeout: ng.ITimeoutService): {
restrict: string;
scope: {
shouldFocus: string;
};
link: ($scope: ng.IScope, $element: JQLite) => void;
};

View File

@@ -0,0 +1,6 @@
/// <reference types="angular" />
export declare function clickOutside($document: ng.IDocumentService): {
restrict: string;
replace: boolean;
link($scope: ng.IScope, $element: JQLite, attrs: any): void;
};

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
/// <reference types="angular" />
export declare function fileChange(): {
restrict: string;
scope: {
handler: string;
};
link: (scope: ng.IScope, element: JQLite) => void;
};

View 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 { selectOnFocus } from './selectOnFocus';
export { snEnter } from './snEnter';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class AccountMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class ActionsMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class ChallengeModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,24 @@
/// <reference types="angular" />
import { WebApplication } from '@/ui_models/application';
import { SNComponent, LiveItem } from 'snjs';
import { WebDirective } from './../../types';
export declare type ComponentModalScope = {
componentUuid: string;
onDismiss: () => void;
application: WebApplication;
};
export declare class ComponentModalCtrl implements ComponentModalScope {
$element: JQLite;
componentUuid: string;
onDismiss: () => void;
application: WebApplication;
liveComponent: LiveItem<SNComponent>;
component: SNComponent;
constructor($element: JQLite);
$onInit(): void;
$onDestroy(): void;
dismiss(): void;
}
export declare class ComponentModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class ComponentView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class EditorMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '../../types';
export declare class HistoryMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,15 @@
export { AccountMenu } from './accountMenu';
export { ActionsMenu } from './actionsMenu';
export { ComponentModal } from './componentModal';
export { ComponentView } from './componentView';
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 { HistoryMenu } from './historyMenu';
export { SyncResolutionMenu } from './syncResolutionMenu';

View File

@@ -0,0 +1,11 @@
/// <reference types="angular" />
import { WebDirective } from './../../types';
export interface InputModalScope extends Partial<ng.IScope> {
type: string;
title: string;
message: string;
callback: (value: string) => void;
}
export declare class InputModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class MenuRow extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class PanelResizer extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class PasswordWizard extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class PermissionsModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class PrivilegesAuthModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class PrivilegesManagementModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class RevisionPreviewModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class SessionHistoryMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class SyncResolutionMenu extends WebDirective {
constructor();
}

View File

@@ -0,0 +1 @@
export { trusted } from './trusted';

View File

@@ -0,0 +1,2 @@
/// <reference types="angular" />
export declare function trusted($sce: ng.ISCEService): (url: string) => any;

View File

@@ -0,0 +1,9 @@
import 'sn-stylekit/dist/stylekit.css';
import '../stylesheets/index.css.scss';
import 'angular';
import '../../../vendor/assets/javascripts/angular-sanitize';
import '../../../vendor/assets/javascripts/zip/deflate';
import '../../../vendor/assets/javascripts/zip/inflate';
import '../../../vendor/assets/javascripts/zip/zip';
import '../../../vendor/assets/javascripts/zip/z-worker';
import './app';

View File

@@ -0,0 +1,31 @@
import { DeviceInterface, SNApplication } from 'snjs';
import { Platform } from './services/platform';
export declare class WebDeviceInterface extends DeviceInterface {
private platform;
private database;
constructor(namespace: string, timeout: any, platform: Platform);
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<void>;
saveRawDatabasePayloads(payloads: any[]): Promise<void>;
removeRawDatabasePayloadWithId(id: string): Promise<void>;
removeAllRawDatabasePayloads(): Promise<void>;
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
openUrl(url: string): void;
}

View File

@@ -0,0 +1,4 @@
export declare enum RootScopeMessages {
ReloadExtendedData = "reload-ext-data",
NewUpdateAvailable = "new-update-available"
}

View File

@@ -0,0 +1,2 @@
/// <reference types="angular" />
export declare function configRoutes($locationProvider: ng.ILocationProvider): void;

View File

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

View File

@@ -0,0 +1,14 @@
import { WebApplication } from '@/ui_models/application';
export declare class ArchiveManager {
private readonly application;
private textFile?;
constructor(application: WebApplication);
downloadBackup(encrypted: boolean): Promise<void>;
private formattedDate;
private itemsData;
private get zip();
private loadZip;
private downloadZippedItems;
private hrefForData;
private downloadData;
}

View File

@@ -0,0 +1,27 @@
import { ApplicationService } from 'snjs';
export declare class AutolockService extends ApplicationService {
private unsubState;
private pollFocusInterval;
private lastFocusState?;
private lockAfterDate?;
private lockTimeout?;
onAppLaunch(): Promise<void>;
observeVisibility(): void;
deinit(): void;
private lockApplication;
setAutoLockInterval(interval: number): Promise<void>;
getAutoLockInterval(): Promise<any>;
deleteAutolockPreference(): Promise<void>;
/**
* 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;
getAutoLockIntervalOptions(): {
value: number;
label: string;
}[];
documentVisibilityChanged(visible: boolean): Promise<void>;
beginAutoLockTimer(): Promise<void>;
cancelAutoLockTimer(): void;
}

View File

@@ -0,0 +1,26 @@
import { PurePayload, Environment } from "snjs";
/** Platform-specific (i-e Electron/browser) behavior is handled by a Bridge object. */
export interface Bridge {
environment: Environment;
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
extensionsServerHost?: string;
syncComponents(payloads: PurePayload[]): void;
onMajorDataChange(): void;
onInitialDataLoad(): void;
onSearch(text?: string): void;
downloadBackup(): void;
}
export declare class BrowserBridge implements Bridge {
environment: Environment;
getKeychainValue(): Promise<unknown>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): Promise<void>;
/** No-ops */
syncComponents(): void;
onMajorDataChange(): void;
onInitialDataLoad(): void;
onSearch(): void;
downloadBackup(): void;
}

View File

@@ -0,0 +1,52 @@
/// <reference types="angular" />
import { SNComponent, PurePayload } from 'snjs';
import { WebApplication } from '@/ui_models/application';
import { ApplicationService, ApplicationEvent } from 'snjs';
import { Bridge } from './bridge';
declare type UpdateObserverCallback = (component: SNComponent) => void;
declare type ComponentActivationCallback = (payload: PurePayload) => void;
declare type ComponentActivationObserver = {
id: string;
callback: ComponentActivationCallback;
};
export declare class DesktopManager extends ApplicationService {
private bridge;
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
componentActivationObservers: ComponentActivationObserver[];
updateObservers: {
callback: UpdateObserverCallback;
}[];
isDesktop: boolean;
dataLoaded: boolean;
lastSearchedText?: string;
private removeComponentObserver?;
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication, bridge: Bridge);
get webApplication(): WebApplication;
deinit(): void;
onAppEvent(eventName: ApplicationEvent): Promise<void>;
saveBackup(): void;
getExtServerHost(): string | undefined;
/**
* 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: SNComponent): Promise<PurePayload>;
syncComponentsInstallation(components: SNComponent[]): void;
registerUpdateObserver(callback: UpdateObserverCallback): () => void;
searchText(text?: string): void;
redoSearch(): void;
desktop_windowGainedFocus(): void;
desktop_windowLostFocus(): void;
desktop_onComponentInstallationComplete(componentData: any, error: any): Promise<void>;
desktop_registerComponentActivationObserver(callback: ComponentActivationCallback): {
id: string;
callback: ComponentActivationCallback;
};
desktop_deregisterComponentActivationObserver(observer: ComponentActivationObserver): void;
notifyComponentActivation(component: SNComponent): Promise<void>;
desktop_requestBackupFile(): Promise<string | undefined>;
desktop_didBeginBackup(): void;
desktop_didFinishBackup(success: boolean): void;
}
export {};

View File

@@ -0,0 +1,9 @@
export { AlertService } from './alertService';
export { ArchiveManager } from './archiveManager';
export { DesktopManager } from './desktopManager';
export { KeyboardManager } from './keyboardManager';
export { AutolockService } from './autolock_service';
export { NativeExtManager } from './nativeExtManager';
export { PreferencesManager } from './preferencesManager';
export { StatusManager } from './statusManager';
export { ThemeManager } from './themeManager';

View File

@@ -0,0 +1,39 @@
export declare enum KeyboardKey {
Tab = "Tab",
Backspace = "Backspace",
Up = "ArrowUp",
Down = "ArrowDown"
}
export declare enum KeyboardModifier {
Shift = "Shift",
Ctrl = "Control",
/** ⌘ key on Mac, ⊞ key on Windows */
Meta = "Meta",
Alt = "Alt"
}
declare enum KeyboardKeyEvent {
Down = "KeyEventDown",
Up = "KeyEventUp"
}
declare type KeyboardObserver = {
key?: KeyboardKey | string;
modifiers?: KeyboardModifier[];
onKeyDown?: (event: KeyboardEvent) => void;
onKeyUp?: (event: KeyboardEvent) => void;
element?: HTMLElement;
elements?: HTMLElement[];
notElement?: HTMLElement;
notElementIds?: string[];
};
export declare class KeyboardManager {
private observers;
private handleKeyDown;
private handleKeyUp;
constructor();
deinit(): void;
modifiersForEvent(event: KeyboardEvent): KeyboardModifier[];
eventMatchesKeyAndModifiers(event: KeyboardEvent, key: KeyboardKey | string, modifiers?: KeyboardModifier[]): boolean;
notifyObserver(event: KeyboardEvent, keyEvent: KeyboardKeyEvent): void;
addKeyObserver(observer: KeyboardObserver): () => void;
}
export {};

View File

@@ -0,0 +1,26 @@
import { WebApplication } from '@/ui_models/application';
export declare class LockManager {
private application;
private unsubState;
private pollFocusInterval;
private lastFocusState?;
private lockAfterDate?;
private lockTimeout?;
constructor(application: WebApplication);
observeVisibility(): void;
deinit(): void;
setAutoLockInterval(interval: number): Promise<void>;
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;
getAutoLockIntervalOptions(): {
value: number;
label: string;
}[];
documentVisibilityChanged(visible: boolean): Promise<void>;
beginAutoLockTimer(): Promise<void>;
cancelAutoLockTimer(): void;
}

View File

@@ -0,0 +1,18 @@
import { SNPredicate, ApplicationService } from 'snjs';
import { PayloadContent } from 'snjs/dist/@types/protocol/payloads/generator';
/** A class for handling installation of system extensions */
export declare class NativeExtManager extends ApplicationService {
extManagerId: string;
batchManagerId: string;
/** @override */
onAppLaunch(): Promise<void>;
get extManagerPred(): SNPredicate;
get batchManagerPred(): SNPredicate;
get extMgrUrl(): any;
get batchMgrUrl(): any;
reload(): void;
resolveExtensionsManager(): Promise<void>;
extensionsManagerTemplateContent(): PayloadContent;
resolveBatchManager(): Promise<void>;
batchManagerTemplateContent(): PayloadContent;
}

View File

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

View File

@@ -0,0 +1,16 @@
import { WebApplication } from '@/ui_models/application';
import { ApplicationService, WebPrefKey } from 'snjs';
export declare class PreferencesManager extends ApplicationService {
private userPreferences;
private loadingPrefs;
private unubscribeStreamItems?;
/** @override */
onAppLaunch(): Promise<void>;
deinit(): void;
get webApplication(): WebApplication;
streamPreferences(): void;
private reloadSingleton;
syncUserPreferences(): void;
getValue(key: WebPrefKey, defaultValue?: any): any;
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>;
}

View File

@@ -0,0 +1,72 @@
/// <reference types="angular" />
import { SNTag, SNNote, SNUserPrefs } from 'snjs';
import { WebApplication } from '@/ui_models/application';
import { Editor } from '@/ui_models/editor';
export declare enum AppStateEvent {
TagChanged = 1,
ActiveEditorChanged = 2,
PreferencesChanged = 3,
PanelResized = 4,
EditorFocused = 5,
BeganBackupDownload = 6,
EndedBackupDownload = 7,
DesktopExtsReady = 8,
WindowDidFocus = 9,
WindowDidBlur = 10
}
export declare enum EventSource {
UserInteraction = 1,
Script = 2
}
declare type ObserverCallback = (event: AppStateEvent, data?: any) => Promise<void>;
export declare class AppState {
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
application: WebApplication;
observers: ObserverCallback[];
locked: boolean;
unsubApp: any;
rootScopeCleanup1: any;
rootScopeCleanup2: any;
onVisibilityChange: any;
selectedTag?: SNTag;
userPreferences?: SNUserPrefs;
multiEditorEnabled: boolean;
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
deinit(): void;
/**
* Creates a new editor if one doesn't exist. If one does, we'll replace the
* editor's note with an empty one.
*/
createEditor(title?: string): void;
openEditor(noteUuid: string): Promise<unknown>;
getActiveEditor(): Editor;
getEditors(): Editor[];
closeEditor(editor: Editor): void;
closeActiveEditor(): void;
closeAllEditors(): void;
editorForNote(note: SNNote): Editor | undefined;
streamNotesAndTags(): void;
addAppEventObserver(): void;
isLocked(): boolean;
registerVisibilityObservers(): void;
/** @returns A function that unregisters this observer */
addObserver(callback: ObserverCallback): () => void;
notifyEvent(eventName: AppStateEvent, data?: any): Promise<unknown>;
setSelectedTag(tag: SNTag): void;
/** Returns the tags that are referncing this note */
getNoteTags(note: SNNote): SNTag[];
/** Returns the notes this tag references */
getTagNotes(tag: SNTag): SNNote[];
getSelectedTag(): SNTag | undefined;
setUserPreferences(preferences: SNUserPrefs): void;
panelDidResize(name: string, collapsed: boolean): void;
editorDidFocus(eventSource: EventSource): void;
beganBackupDownload(): void;
endedBackupDownload(success: boolean): void;
/**
* When the desktop appplication extension server is ready.
*/
desktopExtensionsReady(): void;
}
export {};

View File

@@ -0,0 +1,10 @@
declare type StatusCallback = (string: string) => void;
export declare class StatusManager {
private _message;
private observers;
get message(): string;
setMessage(message: string): void;
onStatusChange(callback: StatusCallback): () => void;
private notifyObservers;
}
export {};

View File

@@ -0,0 +1,21 @@
import { WebApplication } from '@/ui_models/application';
import { ApplicationService, ApplicationEvent } from 'snjs';
export declare class ThemeManager extends ApplicationService {
private activeThemes;
private unregisterDesktop;
private unregisterStream;
onAppEvent(event: ApplicationEvent): Promise<void>;
get webApplication(): WebApplication;
deinit(): void;
/** @override */
onAppStart(): Promise<void>;
private activateCachedThemes;
private registerObservers;
private clearAppThemeState;
private deactivateAllThemes;
private activateTheme;
private deactivateTheme;
private cacheThemes;
private decacheThemes;
private getCachedThemes;
}

View File

@@ -0,0 +1,44 @@
/** @generic */
export declare const STRING_SESSION_EXPIRED = "Your session has expired. New changes will not be pulled in. Please sign in to refresh your session.";
export declare const STRING_DEFAULT_FILE_ERROR = "Please use FileSafe or the Bold Editor to attach images and files. Learn more at standardnotes.org/filesafe.";
export declare const STRING_GENERIC_SYNC_ERROR = "There was an error syncing. Please try again. If all else fails, try signing out and signing back in.";
export declare function StringSyncException(data: any): string;
/** @footer */
export declare const STRING_NEW_UPDATE_READY = "A new update is ready to install. Please use the top-level 'Updates' menu to manage installation.";
/** @tags */
export declare const STRING_DELETE_TAG = "Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes.";
/** @editor */
export declare const STRING_SAVING_WHILE_DOCUMENT_HIDDEN = "Attempting to save an item while the application is hidden. To protect data integrity, please refresh the application window and try again.";
export declare 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 declare 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 declare const STRING_ELLIPSES = "...";
export declare const STRING_GENERIC_SAVE_ERROR = "There was an error saving your note. Please try again.";
export declare 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 declare const STRING_DELETE_LOCKED_ATTEMPT = "This note is locked. If you'd like to delete it, unlock it, and try again.";
export declare function StringDeleteNote(title: string, permanently: boolean): string;
export declare function StringEmptyTrash(count: number): string;
/** @account */
export declare 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 declare const STRING_SIGN_OUT_CONFIRMATION = "Are you sure you want to end your session? This will delete all local items and extensions.";
export declare const STRING_ERROR_DECRYPTING_IMPORT = "There was an error decrypting your items. Make sure the password you entered is correct and try again.";
export declare 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 declare const STRING_LOCAL_ENC_ENABLED = "Encryption is enabled. Your data is encrypted using your passcode before it is saved to your device storage.";
export declare const STRING_ENC_NOT_ENABLED = "Encryption is not enabled. Sign in, register, or add a passcode lock to enable encryption.";
export declare const STRING_IMPORT_SUCCESS = "Your data has been successfully imported.";
export declare const STRING_REMOVE_PASSCODE_CONFIRMATION = "Are you sure you want to remove your application passcode?";
export declare const STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM = " This will remove encryption from your local data.";
export declare const STRING_NON_MATCHING_PASSCODES = "The two passcodes you entered do not match. Please try again.";
export declare const STRING_NON_MATCHING_PASSWORDS = "The two passwords you entered do not match. Please try again.";
export declare const STRING_GENERATING_LOGIN_KEYS = "Generating Login Keys...";
export declare const STRING_GENERATING_REGISTER_KEYS = "Generating Account Keys...";
export declare const STRING_INVALID_IMPORT_FILE = "Unable to open file. Ensure it is a proper JSON file and try again.";
export declare function StringImportError(errorCount: number): string;
export declare const STRING_UNSUPPORTED_BACKUP_FILE_VERSION = "This backup file was created using an unsupported version of the application and cannot be imported here. Please update your application and try again.";
/** @password_change */
export declare const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
export declare const STRING_CONFIRM_APP_QUIT_DURING_UPGRADE: string;
export declare const STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_CHANGE: string;
export declare const STRING_CONFIRM_APP_QUIT_DURING_PASSCODE_REMOVAL: string;
export declare const STRING_UPGRADE_ACCOUNT_CONFIRM_TITLE = "Encryption upgrade available";
export declare const STRING_UPGRADE_ACCOUNT_CONFIRM_TEXT: string;
export declare const STRING_UPGRADE_ACCOUNT_CONFIRM_BUTTON = "Upgrade";

View File

@@ -0,0 +1,44 @@
/// <reference types="angular" />
import { SNComponent } from 'snjs';
export declare class WebDirective implements ng.IDirective {
controller?: string | ng.Injectable<ng.IControllerConstructor>;
controllerAs?: string;
bindToController?: boolean | {
[boundProperty: string]: string;
};
restrict?: string;
replace?: boolean;
scope?: boolean | {
[boundProperty: string]: string;
};
template?: string | ((tElement: any, tAttrs: any) => string);
transclude?: boolean;
}
export declare enum PasswordWizardType {
ChangePassword = 1,
AccountUpgrade = 2
}
export interface PasswordWizardScope extends Partial<ng.IScope> {
type: PasswordWizardType;
application: any;
}
export interface PermissionsModalScope extends Partial<ng.IScope> {
application: any;
component: SNComponent;
permissionsString: string;
callback: (approved: boolean) => void;
}
export interface AccountSwitcherScope extends Partial<ng.IScope> {
application: any;
}
export declare type PanelPuppet = {
onReady?: () => void;
ready?: boolean;
setWidth?: (width: number) => void;
setLeft?: (left: number) => void;
isCollapsed?: () => boolean;
flash?: () => void;
};
export declare type FooterStatus = {
string: string;
};

View File

@@ -0,0 +1,67 @@
/// <reference types="angular" />
import { SNTag, SNNote, SNUserPrefs } from 'snjs';
import { WebApplication } from '@/ui_models/application';
import { Editor } from '@/ui_models/editor';
export declare enum AppStateEvent {
TagChanged = 1,
ActiveEditorChanged = 2,
PreferencesChanged = 3,
PanelResized = 4,
EditorFocused = 5,
BeganBackupDownload = 6,
EndedBackupDownload = 7,
WindowDidFocus = 9,
WindowDidBlur = 10
}
export declare enum EventSource {
UserInteraction = 1,
Script = 2
}
declare type ObserverCallback = (event: AppStateEvent, data?: any) => Promise<void>;
export declare class AppState {
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
application: WebApplication;
observers: ObserverCallback[];
locked: boolean;
unsubApp: any;
rootScopeCleanup1: any;
rootScopeCleanup2: any;
onVisibilityChange: any;
selectedTag?: SNTag;
userPreferences?: SNUserPrefs;
multiEditorEnabled: boolean;
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
deinit(): void;
/**
* Creates a new editor if one doesn't exist. If one does, we'll replace the
* editor's note with an empty one.
*/
createEditor(title?: string): Promise<void>;
openEditor(noteUuid: string): Promise<unknown>;
getActiveEditor(): Editor;
getEditors(): Editor[];
closeEditor(editor: Editor): void;
closeActiveEditor(): void;
closeAllEditors(): void;
editorForNote(note: SNNote): Editor | undefined;
streamNotesAndTags(): void;
addAppEventObserver(): void;
isLocked(): boolean;
registerVisibilityObservers(): void;
/** @returns A function that unregisters this observer */
addObserver(callback: ObserverCallback): () => void;
notifyEvent(eventName: AppStateEvent, data?: any): Promise<unknown>;
setSelectedTag(tag: SNTag): void;
/** Returns the tags that are referncing this note */
getNoteTags(note: SNNote): SNTag[];
/** Returns the notes this tag references */
getTagNotes(tag: SNTag): SNNote[];
getSelectedTag(): SNTag | undefined;
setUserPreferences(preferences: SNUserPrefs): void;
panelDidResize(name: string, collapsed: boolean): void;
editorDidFocus(eventSource: EventSource): void;
beganBackupDownload(): void;
endedBackupDownload(success: boolean): void;
}
export {};

View File

@@ -0,0 +1,58 @@
/// <reference types="angular" />
import { PermissionDialog } from 'snjs/dist/@types/services/component_manager';
import { ComponentGroup } from './component_group';
import { EditorGroup } from '@/ui_models/editor_group';
import { PasswordWizardType } from '@/types';
import { SNApplication, Challenge, ProtectedAction, SNComponent } from 'snjs';
import { WebDeviceInterface } from '@/web_device_interface';
import { DesktopManager, AutolockService, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from '@/services';
import { AppState } from '@/ui_models/app_state';
import { Bridge } from '@/services/bridge';
import { DeinitSource } from 'snjs/dist/@types/types';
declare type WebServices = {
appState: AppState;
desktopService: DesktopManager;
autolockService: AutolockService;
archiveService: ArchiveManager;
nativeExtService: NativeExtManager;
statusManager: StatusManager;
themeService: ThemeManager;
prefsService: PreferencesManager;
keyboardService: KeyboardManager;
};
export declare class WebApplication extends SNApplication {
private $compile;
private bridge;
private scope?;
private webServices;
private currentAuthenticationElement?;
editorGroup: EditorGroup;
componentGroup: ComponentGroup;
constructor(deviceInterface: WebDeviceInterface, identifier: string, $compile: ng.ICompileService, scope: ng.IScope, defaultSyncServerHost: string, bridge: Bridge);
/** @override */
deinit(source: DeinitSource): void;
onStart(): void;
setWebServices(services: WebServices): void;
getAppState(): AppState;
getDesktopService(): DesktopManager;
getAutolockService(): AutolockService;
getArchiveService(): ArchiveManager;
getNativeExtService(): NativeExtManager;
getStatusManager(): StatusManager;
getThemeService(): ThemeManager;
getPrefsService(): PreferencesManager;
getKeyboardService(): KeyboardManager;
checkForSecurityUpdate(): Promise<boolean>;
presentPasswordWizard(type: PasswordWizardType): void;
promptForChallenge(challenge: Challenge): void;
presentPrivilegesModal(action: ProtectedAction, onSuccess?: any, onCancel?: any): Promise<void>;
presentPrivilegesManagementModal(): void;
authenticationInProgress(): boolean;
get applicationElement(): JQLite;
presentPasswordModal(callback: () => void): void;
presentRevisionPreviewModal(uuid: string, content: any): void;
openAccountSwitcher(): void;
openModalComponent(component: SNComponent): void;
presentPermissionsDialog(dialog: PermissionDialog): void;
}
export {};

View File

@@ -0,0 +1,13 @@
/// <reference types="angular" />
import { SNApplicationGroup } from 'snjs';
import { Bridge } from '@/services/bridge';
export declare class ApplicationGroup extends SNApplicationGroup {
private defaultSyncServerHost;
private bridge;
$compile: ng.ICompileService;
$rootScope: ng.IRootScopeService;
$timeout: ng.ITimeoutService;
constructor($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, defaultSyncServerHost: string, bridge: Bridge);
initialize(callback?: any): Promise<void>;
private createApplication;
}

View File

@@ -0,0 +1,23 @@
import { SNComponent, ComponentArea } from 'snjs';
import { WebApplication } from './application';
import { UuidString } from 'snjs/dist/@types/types';
export declare class ComponentGroup {
private application;
changeObservers: any[];
activeComponents: UuidString[];
constructor(application: WebApplication);
get componentManager(): import("snjs/dist/@types").SNComponentManager;
deinit(): void;
activateComponent(component: SNComponent): Promise<void>;
deactivateComponent(component: SNComponent, notify?: boolean): Promise<void>;
deactivateComponentForArea(area: ComponentArea): Promise<void>;
activeComponentForArea(area: ComponentArea): SNComponent;
activeComponentsForArea(area: ComponentArea): SNComponent[];
allComponentsForArea(area: ComponentArea): SNComponent[];
private allActiveComponents;
/**
* Notifies observer when the active editor has changed.
*/
addChangeObserver(callback: () => void): () => void;
private notifyObservers;
}

View File

@@ -0,0 +1,34 @@
import { SNNote, PayloadSource } from 'snjs';
import { WebApplication } from './application';
export declare class Editor {
note: SNNote;
private application;
private _onNoteChange?;
private _onNoteValueChange?;
private removeStreamObserver?;
isTemplateNote: boolean;
constructor(application: WebApplication, noteUuid?: string, noteTitle?: string);
private streamItems;
deinit(): void;
private handleNoteStream;
insertTemplatedNote(): Promise<import("snjs/dist/@types").SNItem>;
/**
* Reverts the editor to a blank state, removing any existing note from view,
* and creating a placeholder note.
*/
reset(noteTitle?: string): Promise<void>;
/**
* Register to be notified when the editor's note changes.
*/
onNoteChange(callback: () => void): void;
clearNoteChangeListener(): void;
/**
* Register to be notified when the editor's note's values change
* (and thus a new object reference is created)
*/
onNoteValueChange(callback: (note: SNNote, source?: PayloadSource) => void): void;
/**
* Sets the editor contents by setting its note.
*/
setNote(note: SNNote, isTemplate?: boolean): void;
}

View File

@@ -0,0 +1,22 @@
import { Editor } from './editor';
import { WebApplication } from './application';
declare type EditorGroupChangeCallback = () => void;
export declare class EditorGroup {
editors: Editor[];
private application;
changeObservers: EditorGroupChangeCallback[];
constructor(application: WebApplication);
deinit(): void;
createEditor(noteUuid?: string, noteTitle?: string): void;
deleteEditor(editor: Editor): void;
closeEditor(editor: Editor): void;
closeActiveEditor(): void;
closeAllEditors(): void;
get activeEditor(): Editor;
/**
* Notifies observer when the active editor has changed.
*/
addChangeObserver(callback: EditorGroupChangeCallback): () => void;
private notifyObservers;
}
export {};

View File

@@ -0,0 +1,7 @@
export declare const isDev: boolean;
export declare function getPlatformString(): string;
export declare function dateToLocalizedString(date: Date): string;
/** Via https://davidwalsh.name/javascript-debounce-function */
export declare function debounce(this: any, func: any, wait: number, immediate?: boolean): () => void;
export declare function preventRefreshing(message: string, operation: () => Promise<void> | void): Promise<void>;
export declare function isDesktopApplication(): boolean;

View File

@@ -0,0 +1,44 @@
/// <reference types="angular" />
import { ApplicationEvent } from 'snjs';
import { WebApplication } from '@/ui_models/application';
export declare type CtrlState = Partial<Record<string, any>>;
export declare type CtrlProps = Partial<Record<string, any>>;
export declare class PureViewCtrl<P = CtrlProps, S = CtrlState> {
props: P;
$timeout: ng.ITimeoutService;
/** Passed through templates */
application: WebApplication;
state: S;
private unsubApp;
private unsubState;
private stateTimeout?;
/**
* Subclasses can optionally add an ng-if=ctrl.templateReady to make sure that
* no Angular handlebars/syntax render in the UI before display data is ready.
*/
protected templateReady: boolean;
constructor($timeout: ng.ITimeoutService, props?: P);
$onInit(): void;
deinit(): void;
$onDestroy(): void;
get appState(): import("../../ui_models/app_state").AppState;
/** @private */
resetState(): Promise<void>;
/** @override */
getInitialState(): S;
setState(state: Partial<S>): Promise<unknown>;
/** @returns a promise that resolves after the UI has been updated. */
flushUI(): import("angular").IPromise<void>;
initProps(props: CtrlProps): void;
addAppStateObserver(): void;
onAppStateEvent(eventName: any, data: any): void;
addAppEventObserver(): void;
onAppEvent(eventName: ApplicationEvent): void;
/** @override */
onAppStart(): Promise<void>;
onLocalDataLoaded(): void;
onAppLaunch(): Promise<void>;
onAppKeyChange(): Promise<void>;
onAppIncrementalSync(): void;
onAppFullSync(): void;
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class AccountSwitcher extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ApplicationView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ApplicationGroupView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ApplicationGroupView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ChallengeModal extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,2 @@
export declare const PANEL_NAME_NOTES = "notes";
export declare const PANEL_NAME_TAGS = "tags";

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class EditorView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class EditorGroupView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class EditorGroupView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class FooterView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,9 @@
export { PureViewCtrl } from './abstract/pure_view_ctrl';
export { ApplicationGroupView } from './application_group/application_group_view';
export { ApplicationView } from './application/application_view';
export { EditorGroupView } from './editor_group/editor_group_view';
export { EditorView } from './editor/editor_view';
export { FooterView } from './footer/footer_view';
export { NotesView } from './notes/notes_view';
export { TagsView } from './tags/tags_view';
export { ChallengeModal } from './challenge_modal/challenge_modal';

View File

@@ -0,0 +1,11 @@
import { SNNote } from 'snjs';
export declare enum NoteSortKey {
CreatedAt = "created_at",
UserUpdatedAt = "userModifiedDate",
Title = "title",
/** @legacy Use UserUpdatedAt instead */
UpdatedAt = "updated_at",
/** @legacy Use UserUpdatedAt instead */
ClientUpdatedAt = "client_updated_at"
}
export declare function notePassesFilter(note: SNNote, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;

View File

@@ -0,0 +1,4 @@
import { WebDirective } from './../../types';
export declare class NotesView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class TagsView extends WebDirective {
constructor();
}

View File

@@ -0,0 +1,32 @@
import { DeviceInterface, SNApplication, ApplicationIdentifier } from 'snjs';
import { Bridge } from './services/bridge';
export declare class WebDeviceInterface extends DeviceInterface {
private bridge;
private databases;
constructor(timeout: any, bridge: Bridge);
setApplication(application: SNApplication): void;
private databaseForIdentifier;
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(identifier: ApplicationIdentifier): Promise<{
isNewDatabase?: boolean | undefined;
} | undefined>;
getAllRawDatabasePayloads(identifier: ApplicationIdentifier): Promise<any[]>;
saveRawDatabasePayload(payload: any, identifier: ApplicationIdentifier): Promise<void>;
saveRawDatabasePayloads(payloads: any[], identifier: ApplicationIdentifier): Promise<void>;
removeRawDatabasePayloadWithId(id: string, identifier: ApplicationIdentifier): Promise<void>;
removeAllRawDatabasePayloads(identifier: ApplicationIdentifier): Promise<void>;
getNamespacedKeychainValue(identifier: ApplicationIdentifier): Promise<any>;
setNamespacedKeychainValue(value: any, identifier: ApplicationIdentifier): Promise<void>;
clearNamespacedKeychainValue(identifier: ApplicationIdentifier): Promise<void>;
getRawKeychainValue(): Promise<any>;
clearRawKeychainValue(): Promise<void>;
openUrl(url: string): void;
}

View 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>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</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>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
&lt;/div&gt;</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>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</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("&lt;p style=\"color:blue\"&gt;an html\n" +
"&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
"snippet&lt;/p&gt;");
});
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 &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
});
</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) => boolean | 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: Array<string> | Object) => 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: Array<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;

View File

View File

View File

Binary file not shown.

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2019-4-11: Created with FontForge (http://fontforge.org)
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<metadata>
Created by FontForge 20190318 at Thu Apr 11 10:47:26 2019
By Mo Bitar
Copyright (c) 2019, Mo Bitar
</metadata>
<defs>
<font id="Ionicons" horiz-adv-x="384" >
<font-face
font-family="Ionicons"
font-weight="400"
font-stretch="normal"
units-per-em="512"
panose-1="2 0 5 9 0 0 0 0 0 0"
ascent="448"
descent="-64"
bbox="0 -32 384 416"
underline-thickness="25.6"
underline-position="-51.2"
unicode-range="U+F200-F266"
/>
<missing-glyph />
<glyph glyph-name="ion-arrow-return-right" unicode="&#xf266;"
d="M384 256l-128 -96v64h-192v-128h248c4 0 8 -4 8 -8v-48c0 -4 -4 -8 -8 -8h-304c-4 0 -8 4 -8 8v240c0 4 4 8 8 8h248v64z" />
<glyph glyph-name="ion-arrow-return-left" unicode="&#xf265;"
d="M128 352v-64h248c4 0 8 -4 8 -8v-240c0 -4 -4 -8 -8 -8h-304c-4 0 -8 4 -8 8v48c0 4 4 8 8 8h248v128h-192v-64l-128 96z" />
<glyph glyph-name="ion-plus" unicode="&#xf218;"
d="M384 224v-64h-160v-160h-64v160h-160v64h160v160h64v-160h160z" />
<glyph glyph-name="ion-locked" unicode="&#xf200;"
d="M22 -32c-12 0 -22 10 -22 22v212c0 12 10 22 22 22h3h19v31c0 42 17 87 43 115s64 46 105 46v0v0c41 0 79 -18 105 -46s43 -73 43 -115v-31h22c12 0 22 -10 22 -22v-212c0 -12 -10 -22 -22 -22h-340zM97 255v-31h17h155h18v31c0 27 -10 61 -28 80v0v1
c-18 19 -42 29 -67 29v0v0c-25 0 -49 -10 -67 -29v-1v0c-18 -19 -28 -53 -28 -80z" />
</font>
</defs></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long