TS complete
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
export function autofocus($timeout: any): {
|
export declare function autofocus($timeout: ng.ITimeoutService): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
scope: {
|
scope: {
|
||||||
shouldFocus: string;
|
shouldFocus: string;
|
||||||
};
|
};
|
||||||
link: ($scope: any, $element: any) => void;
|
link: ($scope: import("angular").IScope, $element: JQLite) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export function clickOutside($document: any): {
|
export declare function clickOutside($document: ng.IDocumentService): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
replace: boolean;
|
replace: boolean;
|
||||||
link: ($scope: any, $element: any, attrs: any) => void;
|
link: ($scope: import("angular").IScope, $element: JQLite, attrs: any) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
export function delayHide($timeout: any): {
|
import angular from 'angular';
|
||||||
|
export declare function delayHide($timeout: ng.ITimeoutService): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
scope: {
|
scope: {
|
||||||
show: string;
|
show: string;
|
||||||
delay: string;
|
delay: string;
|
||||||
};
|
};
|
||||||
link: (scope: any, elem: any, attrs: any) => void;
|
link: (scope: angular.IScope, elem: JQLite) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function elemReady($parse: any): {
|
export declare function elemReady($parse: ng.IParseService): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
link: ($scope: any, elem: any, attrs: any) => void;
|
link: ($scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export function fileChange(): {
|
export declare function fileChange(): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
scope: {
|
scope: {
|
||||||
handler: string;
|
handler: string;
|
||||||
};
|
};
|
||||||
link: (scope: any, element: any) => void;
|
link: (scope: import("angular").IScope, element: JQLite) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export { autofocus } from "./autofocus";
|
export { autofocus } from './autofocus';
|
||||||
export { clickOutside } from "./click-outside";
|
export { clickOutside } from './click-outside';
|
||||||
export { delayHide } from "./delay-hide";
|
export { delayHide } from './delay-hide';
|
||||||
export { elemReady } from "./elemReady";
|
export { elemReady } from './elemReady';
|
||||||
export { fileChange } from "./file-change";
|
export { fileChange } from './file-change';
|
||||||
export { infiniteScroll } from "./infiniteScroll";
|
export { infiniteScroll } from './infiniteScroll';
|
||||||
export { lowercase } from "./lowercase";
|
export { lowercase } from './lowercase';
|
||||||
export { selectOnClick } from "./selectOnClick";
|
export { selectOnClick } from './selectOnClick';
|
||||||
export { snEnter } from "./snEnter";
|
export { snEnter } from './snEnter';
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export function infiniteScroll(): {
|
export declare function infiniteScroll(): {
|
||||||
link: (scope: any, elem: any, attrs: any) => void;
|
link: (scope: import("angular").IScope, elem: JQLite, attrs: any) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function lowercase(): {
|
export declare function lowercase(): {
|
||||||
require: string;
|
require: string;
|
||||||
link: (scope: any, element: any, attrs: any, modelCtrl: any) => void;
|
link: (scope: import("angular").IScope, _: JQLite, attrs: any, ctrl: any) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function selectOnClick($window: any): {
|
export declare function selectOnClick($window: ng.IWindowService): {
|
||||||
restrict: string;
|
restrict: string;
|
||||||
link: (scope: any, element: any, attrs: any) => void;
|
link: (scope: import("angular").IScope, element: JQLite) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export function snEnter(): (scope: any, element: any, attrs: any) => void;
|
export declare function snEnter(): (scope: import("angular").IScope, element: JQLite, attrs: any) => void;
|
||||||
|
|||||||
@@ -1,27 +1,4 @@
|
|||||||
/// <reference types="pug" />
|
import { WebDirective } from './../../types';
|
||||||
export class EditorMenu {
|
export declare class EditorMenu extends WebDirective {
|
||||||
restrict: string;
|
constructor();
|
||||||
template: import("pug").compileTemplate;
|
|
||||||
controller: typeof EditorMenuCtrl;
|
|
||||||
controllerAs: string;
|
|
||||||
bindToController: boolean;
|
|
||||||
scope: {
|
|
||||||
callback: string;
|
|
||||||
selectedEditor: string;
|
|
||||||
currentItem: string;
|
|
||||||
application: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
declare class EditorMenuCtrl extends PureCtrl {
|
|
||||||
constructor($timeout: any);
|
|
||||||
state: {
|
|
||||||
isDesktop: any;
|
|
||||||
};
|
|
||||||
selectComponent(component: any): void;
|
|
||||||
toggleDefaultForEditor(editor: any): void;
|
|
||||||
offlineAvailableForComponent(component: any): any;
|
|
||||||
makeEditorDefault(component: any): void;
|
|
||||||
removeEditorDefault(component: any): void;
|
|
||||||
}
|
|
||||||
import { PureCtrl } from "../../controllers/abstract/pure_ctrl";
|
|
||||||
export {};
|
|
||||||
|
|||||||
@@ -1,73 +1,4 @@
|
|||||||
/// <reference types="pug" />
|
import { WebDirective } from './../../types';
|
||||||
export class PanelResizer {
|
export declare class PanelResizer extends WebDirective {
|
||||||
restrict: string;
|
constructor();
|
||||||
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 {};
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export { trusted } from "./trusted";
|
export { trusted } from './trusted';
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export function trusted($sce: any): (url: any) => any;
|
export declare function trusted($sce: ng.ISCEService): (url: string) => any;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
export class AlertService extends SNAlertService {
|
import { SNAlertService } from 'snjs';
|
||||||
constructor(deviceInterface: import("../../../../../snjs/dist/@types").DeviceInterface);
|
export declare class AlertService extends SNAlertService {
|
||||||
alert(title: any, text: any, closeButtonText?: string, onClose: any): Promise<any>;
|
alert(title: string, text: string, closeButtonText: string | undefined, onClose: () => void): Promise<unknown>;
|
||||||
confirm(title: any, text: any, confirmButtonText?: string, cancelButtonText?: string, onConfirm: any, onCancel: any, destructive?: boolean): Promise<any>;
|
confirm(title: string, text: string, confirmButtonText: string | undefined, cancelButtonText: string | undefined, onConfirm: () => void, onCancel: () => void, destructive?: boolean): Promise<unknown>;
|
||||||
}
|
}
|
||||||
import { SNAlertService } from "../../../../../snjs/dist/@types";
|
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
export class ArchiveManager {
|
import { WebApplication } from '@/application';
|
||||||
constructor(application: any);
|
import { SNItem } from 'snjs';
|
||||||
application: any;
|
export declare class ArchiveManager {
|
||||||
/** @public */
|
private readonly application;
|
||||||
public downloadBackup(encrypted: any): Promise<void>;
|
private textFile?;
|
||||||
/** @public */
|
constructor(application: WebApplication);
|
||||||
public downloadBackupOfItems(items: any, encrypted: any): Promise<void>;
|
downloadBackup(encrypted: boolean): Promise<void>;
|
||||||
/** @private */
|
downloadBackupOfItems(items: SNItem[], encrypted: boolean): Promise<void>;
|
||||||
private formattedDate;
|
private formattedDate;
|
||||||
/** @private */
|
|
||||||
private itemsData;
|
private itemsData;
|
||||||
/** @private */
|
private get zip();
|
||||||
private loadZip;
|
private loadZip;
|
||||||
/** @private */
|
|
||||||
private downloadZippedItems;
|
private downloadZippedItems;
|
||||||
/** @private */
|
|
||||||
private hrefForData;
|
private hrefForData;
|
||||||
textFile: string | undefined;
|
|
||||||
/** @private */
|
|
||||||
private downloadData;
|
private downloadData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,61 @@
|
|||||||
export class DesktopManager extends ApplicationService {
|
import { SNComponent, PurePayload } from 'snjs';
|
||||||
constructor($rootScope: any, $timeout: any, application: any);
|
import { WebApplication } from '@/application';
|
||||||
$rootScope: any;
|
import { ApplicationService, ApplicationEvent } from 'snjs';
|
||||||
$timeout: any;
|
declare type UpdateObserverCallback = (component: SNComponent) => void;
|
||||||
componentActivationObservers: any[];
|
declare type ComponentActivationCallback = (payload: PurePayload) => void;
|
||||||
updateObservers: any[];
|
declare type ComponentActivationObserver = {
|
||||||
|
id: string;
|
||||||
|
callback: ComponentActivationCallback;
|
||||||
|
};
|
||||||
|
export declare class DesktopManager extends ApplicationService {
|
||||||
|
$rootScope: ng.IRootScopeService;
|
||||||
|
$timeout: ng.ITimeoutService;
|
||||||
|
componentActivationObservers: ComponentActivationObserver[];
|
||||||
|
updateObservers: {
|
||||||
|
callback: UpdateObserverCallback;
|
||||||
|
}[];
|
||||||
isDesktop: any;
|
isDesktop: any;
|
||||||
/** @override */
|
dataLoaded: boolean;
|
||||||
onAppEvent(eventName: any): void;
|
dataLoadHandler?: () => void;
|
||||||
dataLoaded: boolean | undefined;
|
majorDataChangeHandler?: () => void;
|
||||||
|
extServerHost?: string;
|
||||||
|
installationSyncHandler?: (payloads: PurePayload[]) => void;
|
||||||
|
installComponentHandler?: (payload: PurePayload) => void;
|
||||||
|
lastSearchedText?: string;
|
||||||
|
searchHandler?: (text?: string) => void;
|
||||||
|
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
|
||||||
|
get webApplication(): WebApplication;
|
||||||
|
deinit(): void;
|
||||||
|
onAppEvent(eventName: ApplicationEvent): Promise<void>;
|
||||||
saveBackup(): void;
|
saveBackup(): void;
|
||||||
getExtServerHost(): any;
|
getExtServerHost(): string | undefined;
|
||||||
/**
|
/**
|
||||||
* Sending a component in its raw state is really slow for the desktop app
|
* 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
|
* Keys are not passed into ItemParams, so the result is not encrypted
|
||||||
*/
|
*/
|
||||||
convertComponentForTransmission(component: any): Promise<any>;
|
convertComponentForTransmission(component: SNComponent): Promise<PurePayload>;
|
||||||
syncComponentsInstallation(components: any): void;
|
syncComponentsInstallation(components: SNComponent[]): void;
|
||||||
installComponent(component: any): Promise<void>;
|
installComponent(component: SNComponent): Promise<void>;
|
||||||
registerUpdateObserver(callback: any): () => void;
|
registerUpdateObserver(callback: UpdateObserverCallback): () => void;
|
||||||
searchText(text: any): void;
|
searchText(text?: string): void;
|
||||||
lastSearchedText: any;
|
|
||||||
redoSearch(): void;
|
redoSearch(): void;
|
||||||
desktop_setSearchHandler(handler: any): void;
|
desktop_setSearchHandler(handler: (text?: string) => void): void;
|
||||||
searchHandler: any;
|
|
||||||
desktop_windowGainedFocus(): void;
|
desktop_windowGainedFocus(): void;
|
||||||
desktop_windowLostFocus(): void;
|
desktop_windowLostFocus(): void;
|
||||||
desktop_onComponentInstallationComplete(componentData: any, error: any): Promise<void>;
|
desktop_onComponentInstallationComplete(componentData: any, error: any): Promise<void>;
|
||||||
desktop_registerComponentActivationObserver(callback: any): {
|
desktop_registerComponentActivationObserver(callback: ComponentActivationCallback): {
|
||||||
id: () => number;
|
id: string;
|
||||||
callback: any;
|
callback: ComponentActivationCallback;
|
||||||
};
|
};
|
||||||
desktop_deregisterComponentActivationObserver(observer: any): void;
|
desktop_deregisterComponentActivationObserver(observer: ComponentActivationObserver): void;
|
||||||
notifyComponentActivation(component: any): Promise<void>;
|
notifyComponentActivation(component: SNComponent): Promise<void>;
|
||||||
desktop_setExtServerHost(host: any): void;
|
desktop_setExtServerHost(host: string): void;
|
||||||
extServerHost: any;
|
desktop_setComponentInstallationSyncHandler(handler: (payloads: PurePayload[]) => void): void;
|
||||||
desktop_setComponentInstallationSyncHandler(handler: any): void;
|
desktop_setInstallComponentHandler(handler: (payload: PurePayload) => void): void;
|
||||||
installationSyncHandler: any;
|
desktop_setInitialDataLoadHandler(handler: () => void): void;
|
||||||
desktop_setInstallComponentHandler(handler: any): void;
|
desktop_requestBackupFile(callback: (data: any) => void): Promise<void>;
|
||||||
installComponentHandler: any;
|
desktop_setMajorDataChangeHandler(handler: () => void): void;
|
||||||
desktop_setInitialDataLoadHandler(handler: any): void;
|
|
||||||
dataLoadHandler: any;
|
|
||||||
desktop_requestBackupFile(callback: any): Promise<void>;
|
|
||||||
desktop_setMajorDataChangeHandler(handler: any): void;
|
|
||||||
majorDataChangeHandler: any;
|
|
||||||
desktop_didBeginBackup(): void;
|
desktop_didBeginBackup(): void;
|
||||||
desktop_didFinishBackup(success: any): void;
|
desktop_didFinishBackup(success: boolean): void;
|
||||||
}
|
}
|
||||||
import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
export {};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export { AlertService } from "./alertService";
|
export { AlertService } from './alertService';
|
||||||
export { ArchiveManager } from "./archiveManager";
|
export { ArchiveManager } from './archiveManager';
|
||||||
export { DesktopManager } from "./desktopManager";
|
export { DesktopManager } from './desktopManager';
|
||||||
export { KeyboardManager } from "./keyboardManager";
|
export { KeyboardManager } from './keyboardManager';
|
||||||
export { LockManager } from "./lockManager";
|
export { LockManager } from './lockManager';
|
||||||
export { NativeExtManager } from "./nativeExtManager";
|
export { NativeExtManager } from './nativeExtManager';
|
||||||
export { PreferencesManager } from "./preferencesManager";
|
export { PreferencesManager } from './preferencesManager';
|
||||||
export { StatusManager } from "./statusManager";
|
export { StatusManager } from './statusManager';
|
||||||
export { ThemeManager } from "./themeManager";
|
export { ThemeManager } from './themeManager';
|
||||||
export { AppState } from "./state";
|
export { AppState } from './state';
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
|
import { SNPredicate, ApplicationService } from 'snjs';
|
||||||
|
import { PayloadContent } from '@/../../../../snjs/dist/@types/protocol/payloads/generator';
|
||||||
/** A class for handling installation of system extensions */
|
/** A class for handling installation of system extensions */
|
||||||
export class NativeExtManager extends ApplicationService {
|
export declare class NativeExtManager extends ApplicationService {
|
||||||
constructor(application: any);
|
|
||||||
extManagerId: string;
|
extManagerId: string;
|
||||||
batchManagerId: string;
|
batchManagerId: string;
|
||||||
/** @override */
|
/** @override */
|
||||||
onAppLaunch(): void;
|
onAppLaunch(): Promise<void>;
|
||||||
get extManagerPred(): SNPredicate;
|
get extManagerPred(): SNPredicate;
|
||||||
get batchManagerPred(): SNPredicate;
|
get batchManagerPred(): SNPredicate;
|
||||||
|
get extMgrUrl(): any;
|
||||||
|
get batchMgrUrl(): any;
|
||||||
reload(): void;
|
reload(): void;
|
||||||
resolveExtensionsManager(): Promise<void>;
|
resolveExtensionsManager(): Promise<void>;
|
||||||
extensionsManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
|
extensionsManagerTemplateContent(): PayloadContent;
|
||||||
batchManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined;
|
|
||||||
resolveBatchManager(): Promise<void>;
|
resolveBatchManager(): Promise<void>;
|
||||||
|
batchManagerTemplateContent(): PayloadContent;
|
||||||
}
|
}
|
||||||
import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
|
||||||
import { SNPredicate } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
|
||||||
|
|||||||
@@ -1,29 +1,14 @@
|
|||||||
export namespace WebPrefKey {
|
import { WebApplication } from '@/application';
|
||||||
export const TagsPanelWidth: string;
|
import { ApplicationService, WebPrefKey } from 'snjs';
|
||||||
export const NotesPanelWidth: string;
|
export declare class PreferencesManager extends ApplicationService {
|
||||||
export const EditorWidth: string;
|
private userPreferences;
|
||||||
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 */
|
/** @override */
|
||||||
onAppLaunch(): void;
|
onAppLaunch(): Promise<void>;
|
||||||
|
get webApplication(): WebApplication;
|
||||||
streamPreferences(): void;
|
streamPreferences(): void;
|
||||||
loadSingleton(): Promise<void>;
|
loadSingleton(): Promise<void>;
|
||||||
userPreferences: any;
|
|
||||||
preferencesDidChange(): void;
|
preferencesDidChange(): void;
|
||||||
syncUserPreferences(): void;
|
syncUserPreferences(): void;
|
||||||
getValue(key: any, defaultValue: any): any;
|
getValue(key: WebPrefKey, defaultValue?: any): any;
|
||||||
setUserPrefValue(key: any, value: any, sync: any): void;
|
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): void;
|
||||||
}
|
}
|
||||||
import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types";
|
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
export class ThemeManager extends ApplicationService {
|
import { WebApplication } from '@/application';
|
||||||
constructor(application: any);
|
import { ApplicationService } from 'snjs';
|
||||||
activeThemes: any[];
|
export declare class ThemeManager extends ApplicationService {
|
||||||
unsubState: any;
|
private activeThemes;
|
||||||
unregisterDesktop: any;
|
private unsubState;
|
||||||
unregisterComponent: any;
|
private unregisterDesktop;
|
||||||
|
private unregisterComponent;
|
||||||
|
constructor(application: WebApplication);
|
||||||
|
get webApplication(): WebApplication;
|
||||||
|
deinit(): void;
|
||||||
/** @override */
|
/** @override */
|
||||||
onAppStart(): void;
|
onAppStart(): Promise<void>;
|
||||||
/** @access private */
|
private activateCachedThemes;
|
||||||
activateCachedThemes(): Promise<void>;
|
private registerObservers;
|
||||||
/** @access private */
|
|
||||||
registerObservers(): void;
|
|
||||||
/** @access public */
|
|
||||||
deactivateAllThemes(): void;
|
deactivateAllThemes(): void;
|
||||||
/** @access private */
|
private activateTheme;
|
||||||
activateTheme(theme: any, writeToCache?: boolean): void;
|
private deactivateTheme;
|
||||||
/** @access private */
|
private cacheThemes;
|
||||||
deactivateTheme(theme: any): void;
|
private decacheThemes;
|
||||||
/** @access private */
|
private getCachedThemes;
|
||||||
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";
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ export declare function dictToArray(dict: any): any[];
|
|||||||
export declare function getPlatformString(): string;
|
export declare function getPlatformString(): string;
|
||||||
export declare function dateToLocalizedString(date: Date): string;
|
export declare function dateToLocalizedString(date: Date): string;
|
||||||
/** Via https://davidwalsh.name/javascript-debounce-function */
|
/** Via https://davidwalsh.name/javascript-debounce-function */
|
||||||
export declare function debounce(this: any, func: any, wait: number, immediate: boolean): () => void;
|
export declare function debounce(this: any, func: any, wait: number, immediate?: boolean): () => void;
|
||||||
export declare function isDesktopApplication(): any;
|
export declare function isDesktopApplication(): any;
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ class EditorCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleWebPrefKey(key: string) {
|
async toggleWebPrefKey(key: WebPrefKey) {
|
||||||
(this as any)[key] = !(this as any)[key];
|
(this as any)[key] = !(this as any)[key];
|
||||||
this.application.getPrefsService().setUserPrefValue(
|
this.application.getPrefsService().setUserPrefValue(
|
||||||
key,
|
key,
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ class NotesCtrl extends PureCtrl {
|
|||||||
this.setShowMenuFalse();
|
this.setShowMenuFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleWebPrefKey(key: string) {
|
toggleWebPrefKey(key: WebPrefKey) {
|
||||||
this.application!.getPrefsService().setUserPrefValue(key, !this.state[key]);
|
this.application!.getPrefsService().setUserPrefValue(key, !this.state[key]);
|
||||||
this.application!.getPrefsService().syncUserPreferences();
|
this.application!.getPrefsService().syncUserPreferences();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function lowercase() {
|
|||||||
scope: ng.IScope,
|
scope: ng.IScope,
|
||||||
_: JQLite,
|
_: JQLite,
|
||||||
attrs: any,
|
attrs: any,
|
||||||
ctrl: ng.IController
|
ctrl: any
|
||||||
) {
|
) {
|
||||||
const lowercase = (inputValue: string) => {
|
const lowercase = (inputValue: string) => {
|
||||||
if (inputValue === undefined) inputValue = '';
|
if (inputValue === undefined) inputValue = '';
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class DesktopManager extends ApplicationService {
|
|||||||
installationSyncHandler?: (payloads: PurePayload[]) => void
|
installationSyncHandler?: (payloads: PurePayload[]) => void
|
||||||
installComponentHandler?: (payload: PurePayload) => void
|
installComponentHandler?: (payload: PurePayload) => void
|
||||||
lastSearchedText?: string
|
lastSearchedText?: string
|
||||||
searchHandler?: (text: string) => void
|
searchHandler?: (text?: string) => void
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
$rootScope: ng.IRootScopeService,
|
$rootScope: ng.IRootScopeService,
|
||||||
@@ -118,7 +118,7 @@ export class DesktopManager extends ApplicationService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
searchText(text: string) {
|
searchText(text?: string) {
|
||||||
if (!this.isDesktop) {
|
if (!this.isDesktop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ export class DesktopManager extends ApplicationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pass null to cancel search
|
// Pass null to cancel search
|
||||||
desktop_setSearchHandler(handler: (text: string) => void) {
|
desktop_setSearchHandler(handler: (text?: string) => void) {
|
||||||
this.searchHandler = handler;
|
this.searchHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
import { isDesktopApplication, dictToArray } from '@/utils';
|
|
||||||
import {
|
|
||||||
SNPredicate,
|
|
||||||
ContentType,
|
|
||||||
CreateMaxPayloadFromAnyObject,
|
|
||||||
ApplicationService
|
|
||||||
} from 'snjs';
|
|
||||||
|
|
||||||
const STREAM_ITEMS_PERMISSION = 'stream-items';
|
|
||||||
|
|
||||||
/** A class for handling installation of system extensions */
|
|
||||||
export class NativeExtManager extends ApplicationService {
|
|
||||||
/* @ngInject */
|
|
||||||
constructor(application) {
|
|
||||||
super(application);
|
|
||||||
this.extManagerId = 'org.standardnotes.extensions-manager';
|
|
||||||
this.batchManagerId = 'org.standardnotes.batch-manager';
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @override */
|
|
||||||
onAppLaunch() {
|
|
||||||
super.onAppLaunch();
|
|
||||||
this.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
get extManagerPred() {
|
|
||||||
const extManagerId = 'org.standardnotes.extensions-manager';
|
|
||||||
return SNPredicate.CompoundPredicate([
|
|
||||||
new SNPredicate('content_type', '=', ContentType.Component),
|
|
||||||
new SNPredicate('package_info.identifier', '=', extManagerId)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
get batchManagerPred() {
|
|
||||||
const batchMgrId = 'org.standardnotes.batch-manager';
|
|
||||||
return SNPredicate.CompoundPredicate([
|
|
||||||
new SNPredicate('content_type', '=', ContentType.Component),
|
|
||||||
new SNPredicate('package_info.identifier', '=', batchMgrId)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
this.application.singletonManager.registerPredicate(this.extManagerPred);
|
|
||||||
this.application.singletonManager.registerPredicate(this.batchManagerPred);
|
|
||||||
this.resolveExtensionsManager();
|
|
||||||
this.resolveBatchManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
async resolveExtensionsManager() {
|
|
||||||
const extensionsManager = await this.application.singletonManager.findOrCreateSingleton({
|
|
||||||
predicate: this.extManagerPred,
|
|
||||||
createPayload: this.extensionsManagerTemplatePayload()
|
|
||||||
});
|
|
||||||
let needsSync = false;
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
if (!extensionsManager.local_url) {
|
|
||||||
extensionsManager.local_url = window._extensions_manager_location;
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!extensionsManager.hosted_url) {
|
|
||||||
extensionsManager.hosted_url = window._extensions_manager_location;
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle addition of SN|ExtensionRepo permission
|
|
||||||
const permission = extensionsManager.content.permissions.find((p) => p.name === STREAM_ITEMS_PERMISSION);
|
|
||||||
if (!permission.content_types.includes(ContentType.ExtensionRepo)) {
|
|
||||||
permission.content_types.push(ContentType.ExtensionRepo);
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
if (needsSync) {
|
|
||||||
this.application.saveItem({ item: extensionsManager });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extensionsManagerTemplatePayload() {
|
|
||||||
const url = window._extensions_manager_location;
|
|
||||||
if (!url) {
|
|
||||||
console.error('window._extensions_manager_location must be set.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const packageInfo = {
|
|
||||||
name: 'Extensions',
|
|
||||||
identifier: this.extManagerId
|
|
||||||
};
|
|
||||||
const content = {
|
|
||||||
name: packageInfo.name,
|
|
||||||
area: 'rooms',
|
|
||||||
package_info: packageInfo,
|
|
||||||
permissions: [
|
|
||||||
{
|
|
||||||
name: STREAM_ITEMS_PERMISSION,
|
|
||||||
content_types: [
|
|
||||||
ContentType.Component,
|
|
||||||
ContentType.Theme,
|
|
||||||
ContentType.ServerExtension,
|
|
||||||
ContentType.ActionsExtension,
|
|
||||||
ContentType.Mfa,
|
|
||||||
ContentType.Editor,
|
|
||||||
ContentType.ExtensionRepo
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
content.local_url = window._extensions_manager_location;
|
|
||||||
} else {
|
|
||||||
content.hosted_url = window._extensions_manager_location;
|
|
||||||
}
|
|
||||||
const payload = CreateMaxPayloadFromAnyObject({
|
|
||||||
object: {
|
|
||||||
content_type: ContentType.Component,
|
|
||||||
content: content
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
batchManagerTemplatePayload() {
|
|
||||||
const url = window._batch_manager_location;
|
|
||||||
if (!url) {
|
|
||||||
console.error('window._batch_manager_location must be set.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const packageInfo = {
|
|
||||||
name: 'Batch Manager',
|
|
||||||
identifier: this.batchManagerId
|
|
||||||
};
|
|
||||||
const allContentType = dictToArray(ContentType);
|
|
||||||
const content = {
|
|
||||||
name: packageInfo.name,
|
|
||||||
area: 'modal',
|
|
||||||
package_info: packageInfo,
|
|
||||||
permissions: [
|
|
||||||
{
|
|
||||||
name: STREAM_ITEMS_PERMISSION,
|
|
||||||
content_types: allContentType
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
content.local_url = window._batch_manager_location;
|
|
||||||
} else {
|
|
||||||
content.hosted_url = window._batch_manager_location;
|
|
||||||
}
|
|
||||||
const payload = CreateMaxPayloadFromAnyObject({
|
|
||||||
object: {
|
|
||||||
content_type: ContentType.Component,
|
|
||||||
content: content
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
async resolveBatchManager() {
|
|
||||||
const batchManager = await this.application.singletonManager.findOrCreateSingleton({
|
|
||||||
predicate: this.batchManagerPred,
|
|
||||||
createPayload: this.batchManagerTemplatePayload()
|
|
||||||
});
|
|
||||||
let needsSync = false;
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
if (!batchManager.local_url) {
|
|
||||||
batchManager.local_url = window._batch_manager_location;
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!batchManager.hosted_url) {
|
|
||||||
batchManager.hosted_url = window._batch_manager_location;
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle addition of SN|ExtensionRepo permission
|
|
||||||
const permission = batchManager.content.permissions.find((p) => p.name === STREAM_ITEMS_PERMISSION);
|
|
||||||
if (!permission.content_types.includes(ContentType.ExtensionRepo)) {
|
|
||||||
permission.content_types.push(ContentType.ExtensionRepo);
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
if (needsSync) {
|
|
||||||
this.application.saveItem({ item: batchManager });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
203
app/assets/javascripts/services/nativeExtManager.ts
Normal file
203
app/assets/javascripts/services/nativeExtManager.ts
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
import { isDesktopApplication, dictToArray } from '@/utils';
|
||||||
|
import {
|
||||||
|
SNPredicate,
|
||||||
|
ContentType,
|
||||||
|
SNComponent,
|
||||||
|
ApplicationService,
|
||||||
|
ComponentAction
|
||||||
|
} from 'snjs';
|
||||||
|
import { PayloadContent } from '@/../../../../snjs/dist/@types/protocol/payloads/generator';
|
||||||
|
import { FillItemContent } from '@/../../../../snjs/dist/@types/models/generator';
|
||||||
|
import { ComponentMutator } from '@/../../../../snjs/dist/@types/models';
|
||||||
|
|
||||||
|
/** A class for handling installation of system extensions */
|
||||||
|
export class NativeExtManager extends ApplicationService {
|
||||||
|
extManagerId = 'org.standardnotes.extensions-manager';
|
||||||
|
batchManagerId = 'org.standardnotes.batch-manager';
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async onAppLaunch() {
|
||||||
|
super.onAppLaunch();
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
get extManagerPred() {
|
||||||
|
const extManagerId = 'org.standardnotes.extensions-manager';
|
||||||
|
return SNPredicate.CompoundPredicate([
|
||||||
|
new SNPredicate('content_type', '=', ContentType.Component),
|
||||||
|
new SNPredicate('package_info.identifier', '=', extManagerId)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
get batchManagerPred() {
|
||||||
|
const batchMgrId = 'org.standardnotes.batch-manager';
|
||||||
|
return SNPredicate.CompoundPredicate([
|
||||||
|
new SNPredicate('content_type', '=', ContentType.Component),
|
||||||
|
new SNPredicate('package_info.identifier', '=', batchMgrId)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
get extMgrUrl() {
|
||||||
|
return (window as any)._extensions_manager_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
get batchMgrUrl() {
|
||||||
|
return (window as any)._batch_manager_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
|
||||||
|
this.application!.singletonManager!.registerPredicate(this.batchManagerPred);
|
||||||
|
this.resolveExtensionsManager();
|
||||||
|
this.resolveBatchManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
async resolveExtensionsManager() {
|
||||||
|
const extensionsManager = (await this.application!.singletonManager!.findOrCreateSingleton(
|
||||||
|
this.extManagerPred,
|
||||||
|
ContentType.Component,
|
||||||
|
this.extensionsManagerTemplateContent()
|
||||||
|
)) as SNComponent;
|
||||||
|
let needsSync = false;
|
||||||
|
if (isDesktopApplication()) {
|
||||||
|
if (!extensionsManager.local_url) {
|
||||||
|
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.local_url = this.extMgrUrl;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!extensionsManager.hosted_url) {
|
||||||
|
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.hosted_url = this.extMgrUrl;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Handle addition of SN|ExtensionRepo permission
|
||||||
|
const permissions = extensionsManager!.permissions.slice();
|
||||||
|
const permission = permissions.find((p) => {
|
||||||
|
return p.name === ComponentAction.StreamItems
|
||||||
|
});
|
||||||
|
if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
|
||||||
|
permission.content_types!.push(ContentType.ExtensionRepo);
|
||||||
|
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.permissions = permissions;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
if (needsSync) {
|
||||||
|
this.application!.saveItem(extensionsManager.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionsManagerTemplateContent() {
|
||||||
|
const url = this.extMgrUrl;
|
||||||
|
if (!url) {
|
||||||
|
throw Error('this.extMgrUrl must be set.');
|
||||||
|
}
|
||||||
|
const packageInfo = {
|
||||||
|
name: 'Extensions',
|
||||||
|
identifier: this.extManagerId
|
||||||
|
};
|
||||||
|
const content = FillItemContent({
|
||||||
|
name: packageInfo.name,
|
||||||
|
area: 'rooms',
|
||||||
|
package_info: packageInfo,
|
||||||
|
permissions: [
|
||||||
|
{
|
||||||
|
name: ComponentAction.StreamItems,
|
||||||
|
content_types: [
|
||||||
|
ContentType.Component,
|
||||||
|
ContentType.Theme,
|
||||||
|
ContentType.ServerExtension,
|
||||||
|
ContentType.ActionsExtension,
|
||||||
|
ContentType.Mfa,
|
||||||
|
ContentType.Editor,
|
||||||
|
ContentType.ExtensionRepo
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}) as PayloadContent;
|
||||||
|
if (isDesktopApplication()) {
|
||||||
|
content.local_url = this.extMgrUrl;
|
||||||
|
} else {
|
||||||
|
content.hosted_url = this.extMgrUrl;
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
async resolveBatchManager() {
|
||||||
|
const batchManager = (await this.application!.singletonManager!.findOrCreateSingleton(
|
||||||
|
this.batchManagerPred,
|
||||||
|
ContentType.Component,
|
||||||
|
this.batchManagerTemplateContent()
|
||||||
|
)) as SNComponent;
|
||||||
|
let needsSync = false;
|
||||||
|
if (isDesktopApplication()) {
|
||||||
|
if (!batchManager.local_url) {
|
||||||
|
await this.application!.changeItem(batchManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.local_url = this.batchMgrUrl;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!batchManager.hosted_url) {
|
||||||
|
await this.application!.changeItem(batchManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.hosted_url = this.batchMgrUrl;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Handle addition of SN|ExtensionRepo permission
|
||||||
|
const permissions = batchManager!.permissions.slice();
|
||||||
|
const permission = permissions.find((p) => {
|
||||||
|
return p.name === ComponentAction.StreamItems
|
||||||
|
});
|
||||||
|
if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
|
||||||
|
permission.content_types!.push(ContentType.ExtensionRepo);
|
||||||
|
await this.application!.changeItem(batchManager.uuid, (m) => {
|
||||||
|
const mutator = m as ComponentMutator;
|
||||||
|
mutator.permissions = permissions;
|
||||||
|
});
|
||||||
|
needsSync = true;
|
||||||
|
}
|
||||||
|
if (needsSync) {
|
||||||
|
this.application!.saveItem(batchManager.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
batchManagerTemplateContent() {
|
||||||
|
const url = this.batchMgrUrl;
|
||||||
|
if (!url) {
|
||||||
|
throw Error('window._batch_manager_location must be set.');
|
||||||
|
}
|
||||||
|
const packageInfo = {
|
||||||
|
name: 'Batch Manager',
|
||||||
|
identifier: this.batchManagerId
|
||||||
|
};
|
||||||
|
const allContentType = dictToArray(ContentType);
|
||||||
|
const content = FillItemContent({
|
||||||
|
name: packageInfo.name,
|
||||||
|
area: 'modal',
|
||||||
|
package_info: packageInfo,
|
||||||
|
permissions: [
|
||||||
|
{
|
||||||
|
name: ComponentAction.StreamItems,
|
||||||
|
content_types: allContentType
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
if (isDesktopApplication()) {
|
||||||
|
content.local_url = this.batchMgrUrl;
|
||||||
|
} else {
|
||||||
|
content.hosted_url = this.batchMgrUrl;
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,7 +54,7 @@ export class PreferencesManager extends ApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getValue(key: WebPrefKey, defaultValue: any) {
|
getValue(key: WebPrefKey, defaultValue?: any) {
|
||||||
if (!this.userPreferences) { return defaultValue; }
|
if (!this.userPreferences) { return defaultValue; }
|
||||||
const value = this.userPreferences.getPref(key);
|
const value = this.userPreferences.getPref(key);
|
||||||
return (value !== undefined && value !== null) ? value : defaultValue;
|
return (value !== undefined && value !== null) ? value : defaultValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user