Actions Menu TS

This commit is contained in:
Mo Bitar
2020-04-12 17:38:18 -05:00
parent a379ea9f54
commit d38c14b1b4
74 changed files with 1450 additions and 30 deletions

View File

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

View 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: (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,25 @@
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,35 @@
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,4 @@
import { WebDirective } from './../types';
export declare class EditorPanel extends WebDirective {
constructor();
}

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,28 @@
import { SNAlertService } from "../../../../snjs/dist/@types";
export declare class Database {
private locked;
private alertService?;
private db?;
deinit(): void;
setAlertService(alertService: SNAlertService): 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,7 @@
export function autofocus($timeout: any): {
restrict: string;
scope: {
shouldFocus: string;
};
link: ($scope: any, $element: any) => void;
};

View File

@@ -0,0 +1,5 @@
export function clickOutside($document: any): {
restrict: string;
replace: boolean;
link: ($scope: any, $element: any, attrs: any) => void;
};

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

View File

@@ -0,0 +1,4 @@
export function elemReady($parse: any): {
restrict: string;
link: ($scope: any, elem: any, attrs: any) => void;
};

View File

@@ -0,0 +1,7 @@
export function fileChange(): {
restrict: string;
scope: {
handler: string;
};
link: (scope: any, element: any) => 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 { selectOnClick } from "./selectOnClick";
export { snEnter } from "./snEnter";

View File

@@ -0,0 +1,3 @@
export function infiniteScroll(): {
link: (scope: any, elem: any, attrs: any) => void;
};

View File

@@ -0,0 +1,4 @@
export function lowercase(): {
require: string;
link: (scope: any, element: any, attrs: any, modelCtrl: any) => void;
};

View File

@@ -0,0 +1,4 @@
export function selectOnClick($window: any): {
restrict: string;
link: (scope: any, element: any, attrs: any) => void;
};

View File

@@ -0,0 +1 @@
export function snEnter(): (scope: any, element: any, 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,25 @@
/// <reference types="pug" />
export class ActionsMenu {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,30 @@
/// <reference types="pug" />
export class ChallengeModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,20 @@
/// <reference types="pug" />
export class ComponentModalCtrl {
constructor($element: any);
$element: any;
dismiss(): void;
}
export class ComponentModal {
restrict: string;
template: import("pug").compileTemplate;
controller: typeof ComponentModalCtrl;
controllerAs: string;
bindToController: boolean;
scope: {
show: string;
component: string;
callback: string;
onDismiss: string;
application: string;
};
}

View File

@@ -0,0 +1,48 @@
/// <reference types="pug" />
export class ComponentView {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,30 @@
/// <reference types="pug" />
export class ConflictResolutionModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,28 @@
/// <reference types="pug" />
export class EditorMenu {
restrict: string;
template: import("pug").compileTemplate;
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 {};

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

View File

@@ -0,0 +1,23 @@
/// <reference types="pug" />
export class InputModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,31 @@
/// <reference types="pug" />
export class MenuRow {
restrict: string;
transclude: boolean;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,73 @@
/// <reference types="pug" />
export class PanelResizer {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

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

View File

@@ -0,0 +1,22 @@
/// <reference types="pug" />
export class PermissionsModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,33 @@
/// <reference types="pug" />
export class PrivilegesAuthModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,33 @@
/// <reference types="pug" />
export class PrivilegesManagementModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,27 @@
/// <reference types="pug" />
export class RevisionPreviewModal {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,29 @@
/// <reference types="pug" />
export class SessionHistoryMenu {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

@@ -0,0 +1,22 @@
/// <reference types="pug" />
export class SyncResolutionMenu {
restrict: string;
template: import("pug").compileTemplate;
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 {};

View File

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

View File

@@ -0,0 +1 @@
export function trusted($sce: any): (url: any) => 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 @@
export declare function configRoutes($locationProvider: ng.ILocationProvider): void;

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

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

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

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

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 './../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,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";

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

View File

@@ -0,0 +1,60 @@
import { WebApplication } from './../application';
import { SNTag, SNNote, SNUserPrefs } from 'snjs';
export declare enum AppStateEvent {
TagChanged = 1,
NoteChanged = 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;
selectedNote?: SNNote;
userPreferences?: SNUserPrefs;
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
deinit(): void;
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;
setSelectedNote(note?: SNNote): Promise<unknown>;
/** 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;
getSelectedNote(): SNNote | 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,17 @@
import { FooterStatus } from './../types';
declare type StatusCallback = (string: string) => void;
export declare class StatusManager {
private statuses;
private observers;
statusFromString(string: string): {
string: string;
};
replaceStatusWithString(status: FooterStatus, string: string): FooterStatus;
addStatusFromString(string: string): FooterStatus;
addStatus(status: FooterStatus): FooterStatus;
removeStatus(status: FooterStatus): undefined;
getStatusString(): string;
notifyObservers(): void;
addStatusObserver(callback: StatusCallback): () => void;
}
export {};

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

View File

@@ -0,0 +1,36 @@
/** @generic */
export declare 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 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_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;
/** @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.";

View File

@@ -0,0 +1,42 @@
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);
}
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 ModalComponentScope extends Partial<ng.IScope> {
component: SNComponent;
}
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,8 @@
export declare function getParameterByName(name: string, url: string): string | null;
export declare function isNullOrUndefined(value: any): boolean;
export declare function dictToArray(dict: any): any[];
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 isDesktopApplication(): any;

View 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<void>;
saveRawDatabasePayloads(payloads: any[]): Promise<void>;
removeRawDatabasePayloadWithId(id: string): Promise<void>;
removeAllRawDatabasePayloads(): Promise<void>;
getKeychainValue(): Promise<any>;
setKeychainValue(value: any): Promise<void>;
clearKeychainValue(): 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) => 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;

View File

@@ -297,7 +297,7 @@ class TagsPanelCtrl extends PureCtrl {
this.editingOriginalName = undefined;
const matchingTag = this.application.findTag(tag.title);
const matchingTag = this.application.findTagByTitle(tag.title);
const alreadyExists = matchingTag && matchingTag !== tag;
if (this.state.newTag === tag && alreadyExists) {
this.application.alertService!.alert(

View File

@@ -1,7 +1,7 @@
import { WebDirective } from './../../types';
import { isDesktopApplication, isNullOrUndefined } from '@/utils';
import template from '%/directives/account-menu.pug';
import { ProtectedAction, ContentType, SNComponent } from 'snjs';
import { ProtectedAction, ContentType } from 'snjs';
import { PureCtrl } from '@Controllers/abstract/pure_ctrl';
import {
STRING_ACCOUNT_MENU_UNCHECK_MERGE,

View File

@@ -1,10 +1,24 @@
import { WebApplication } from '@/application';
import { WebDirective } from './../../types';
import template from '%/directives/actions-menu.pug';
import { PureCtrl } from '@Controllers';
import { PureCtrl } from '@Controllers/abstract/pure_ctrl';
import { SNItem, Action, SNActionsExtension } from '@/../../../../snjs/dist/@types';
import { ActionResponse } from '@/../../../../snjs/dist/@types/services/actions_service';
type ActionsMenuScope = {
application: WebApplication
item: SNItem
}
class ActionsMenuCtrl extends PureCtrl implements ActionsMenuScope {
application!: WebApplication
item!: SNItem
public loadingState: Partial<Record<string, boolean>> = {}
class ActionsMenuCtrl extends PureCtrl {
/* @ngInject */
constructor(
$timeout
$timeout: ng.ITimeoutService
) {
super($timeout);
this.state = {
@@ -21,45 +35,46 @@ class ActionsMenuCtrl extends PureCtrl {
};
async loadExtensions() {
const extensions = this.application.actionsManager.getExtensions().sort((a, b) => {
const extensions = this.application.actionsManager!.getExtensions().sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
});
for (const extension of extensions) {
extension.loading = true;
await this.application.actionsManager.loadExtensionInContextOfItem(
this.loadingState[extension.uuid] = true;
await this.application.actionsManager!.loadExtensionInContextOfItem(
extension,
this.props.item
);
extension.loading = false;
this.loadingState[extension.uuid] = false;
}
this.setState({
extensions: extensions
});
}
async executeAction(action, extension) {
async executeAction(action: Action, extension: SNActionsExtension) {
if (action.verb === 'nested') {
if (!action.subrows) {
action.subrows = this.subRowsForAction(action, extension);
} else {
action.subrows = null;
action.subrows = undefined;
}
return;
}
action.running = true;
const result = await this.application.actionsManager.runAction({
action: action,
item: this.props.item,
passwordRequestHandler: () => {
const response = await this.application.actionsManager!.runAction(
action,
this.props.item,
async () => {
/** @todo */
return '';
}
});
);
if (action.error) {
return;
}
action.running = false;
this.handleActionResult(action, result);
await this.application.actionsManager.loadExtensionInContextOfItem(
this.handleActionResponse(action, response);
await this.application.actionsManager!.loadExtensionInContextOfItem(
extension,
this.props.item
);
@@ -68,7 +83,7 @@ class ActionsMenuCtrl extends PureCtrl {
});
}
handleActionResult(action, result) {
handleActionResponse(action: Action, result: ActionResponse) {
switch (action.verb) {
case 'render': {
const item = result.item;
@@ -80,25 +95,26 @@ class ActionsMenuCtrl extends PureCtrl {
}
}
subRowsForAction(parentAction, extension) {
subRowsForAction(parentAction: Action, extension: SNActionsExtension) {
if (!parentAction.subactions) {
return null;
return undefined;
}
return parentAction.subactions.map((subaction) => {
return {
onClick: () => {
this.executeAction(subaction, extension, parentAction);
this.executeAction(subaction, extension);
},
label: subaction.label,
subtitle: subaction.desc,
spinnerClass: subaction.running ? 'info' : null
spinnerClass: subaction.running ? 'info' : undefined
};
});
}
}
export class ActionsMenu {
export class ActionsMenu extends WebDirective {
constructor() {
super();
this.restrict = 'E';
this.template = template;
this.replace = true;

View File

@@ -1,6 +1,6 @@
import template from '%/directives/challenge-modal.pug';
import { ChallengeType, ChallengeValue, removeFromArray } from 'snjs';
import { PureCtrl } from '@Controllers';
import { PureCtrl } from '@Controllers/abstract/pure_ctrl';
class ChallengeModalCtrl extends PureCtrl {
/* @ngInject */

View File

@@ -1,6 +1,6 @@
import { isDesktopApplication } from '@/utils';
import template from '%/directives/editor-menu.pug';
import { PureCtrl } from '@Controllers';
import { PureCtrl } from '@Controllers/abstract/pure_ctrl';
class EditorMenuCtrl extends PureCtrl {
/* @ngInject */

View File

@@ -1,6 +1,6 @@
import template from '%/directives/privileges-management-modal.pug';
import { PrivilegeCredentials } from 'snjs';
import { PureCtrl } from '@Controllers';
import { PureCtrl } from '@Controllers/abstract/pure_ctrl';
class PrivilegesManagementModalCtrl extends PureCtrl {
/* @ngInject */

View File

@@ -7,7 +7,6 @@
"strict": true,
"isolatedModules": true,
"esModuleInterop": true,
"types": ["node"],
"declaration": true,
"declarationDir": "@types",
"emitDeclarationOnly": true,

View File

@@ -13,7 +13,7 @@
)
.sk-menu-panel-column
.sk-menu-panel-header-title {{extension.name}}
.sk-spinner.small.loading(ng-if='extension.loading')
.sk-spinner.small.loading(ng-if='self.loadingState[extension.uuid]')
div(ng-if='extension.hide') …
menu-row(
action='self.executeAction(action, extension);',