Remove dummy concept in favor of editor group and editors

This commit is contained in:
Mo Bitar
2020-04-14 15:01:32 -05:00
parent ef66170ba4
commit 9cf99896a5
81 changed files with 8136 additions and 7179 deletions

View File

@@ -1,5 +1,5 @@
/// <reference types="angular" />
import { WebApplication } from './../../application';
import { WebApplication } from '@/ui_models/application';
import { SNComponent } from 'snjs';
import { WebDirective } from './../../types';
declare type ComponentModalScope = {

View File

@@ -1,5 +1,5 @@
import { SNAlertService } from 'snjs';
export declare class AlertService extends SNAlertService {
alert(title: string, text: string, closeButtonText: string | undefined, onClose: () => void): Promise<unknown>;
confirm(title: string, text: string, confirmButtonText: string | undefined, cancelButtonText: string | undefined, onConfirm: () => void, onCancel: () => void, destructive?: boolean): Promise<unknown>;
alert(text: string, title: string, closeButtonText: string | undefined, onClose: () => void): Promise<unknown>;
confirm(text: string, title: string, confirmButtonText: string | undefined, cancelButtonText: string | undefined, onConfirm: () => void, onCancel: () => void, destructive?: boolean): Promise<unknown>;
}

View File

@@ -1,4 +1,4 @@
import { WebApplication } from '@/application';
import { WebApplication } from '@/ui_models/application';
import { SNItem } from 'snjs';
export declare class ArchiveManager {
private readonly application;

View File

@@ -1,6 +1,6 @@
/// <reference types="angular" />
import { SNComponent, PurePayload } from 'snjs';
import { WebApplication } from '@/application';
import { WebApplication } from '@/ui_models/application';
import { ApplicationService, ApplicationEvent } from 'snjs';
declare type UpdateObserverCallback = (component: SNComponent) => void;
declare type ComponentActivationCallback = (payload: PurePayload) => void;

View File

@@ -1,4 +1,4 @@
import { WebApplication } from './../application';
import { WebApplication } from '@/ui_models/application';
export declare class LockManager {
private application;
private unsubState;

View File

@@ -1,4 +1,4 @@
import { WebApplication } from '@/application';
import { WebApplication } from '@/ui_models/application';
import { ApplicationService, WebPrefKey } from 'snjs';
export declare class PreferencesManager extends ApplicationService {
private userPreferences;

View File

@@ -1,9 +1,10 @@
/// <reference types="angular" />
import { WebApplication } from './../application';
import { SNTag, SNNote, SNUserPrefs } from 'snjs';
import { WebApplication } from '@/ui_models/application';
import { Editor } from '@/ui_models/editor';
export declare enum AppStateEvent {
TagChanged = 1,
NoteChanged = 2,
ActiveEditorChanged = 2,
PreferencesChanged = 3,
PanelResized = 4,
EditorFocused = 5,
@@ -29,10 +30,22 @@ export declare class AppState {
rootScopeCleanup2: any;
onVisibilityChange: any;
selectedTag?: SNTag;
selectedNote?: SNNote;
userPreferences?: SNUserPrefs;
multiEditorEnabled: boolean;
constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication);
deinit(): void;
/**
* Creates a new editor if one doesn't exist. If one does, we'll replace the
* editor's note with an empty one.
*/
createEditor(title?: string): void;
openEditor(noteUuid: string): Promise<unknown>;
getActiveEditor(): Editor;
getEditors(): Editor[];
closeEditor(editor: Editor): void;
closeActiveEditor(): void;
closeAllEditors(): void;
editorForNote(note: SNNote): Editor | undefined;
streamNotesAndTags(): void;
addAppEventObserver(): void;
isLocked(): boolean;
@@ -41,13 +54,11 @@ export declare class AppState {
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;

View File

@@ -1,4 +1,4 @@
import { FooterStatus } from './../types';
import { FooterStatus } from '@/types';
declare type StatusCallback = (string: string) => void;
export declare class StatusManager {
private statuses;

View File

@@ -1,4 +1,4 @@
import { WebApplication } from '@/application';
import { WebApplication } from '@/ui_models/application';
import { ApplicationService } from 'snjs';
export declare class ThemeManager extends ApplicationService {
private activeThemes;

View File

@@ -0,0 +1,56 @@
/// <reference types="angular" />
import { EditorGroup } from '@/ui_models/editor_group';
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?;
editorGroup: EditorGroup;
constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: (app: WebApplication) => void);
/** @override */
deinit(): void;
setWebServices(services: WebServices): void;
/** @access public */
getAppState(): AppState;
/** @access public */
getDesktopService(): DesktopManager;
/** @access public */
getLockService(): LockManager;
/** @access public */
getArchiveService(): ArchiveManager;
/** @access public */
getNativeExtService(): NativeExtManager;
/** @access public */
getStatusService(): StatusManager;
/** @access public */
getThemeService(): ThemeManager;
/** @access public */
getPrefsService(): PreferencesManager;
/** @access public */
getKeyboardService(): KeyboardManager;
checkForSecurityUpdate(): Promise<boolean>;
presentPasswordWizard(type: PasswordWizardType): void;
promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator): void;
performProtocolUpgrade(): Promise<void>;
presentPrivilegesModal(action: ProtectedAction, onSuccess?: any, onCancel?: any): Promise<void>;
presentPrivilegesManagementModal(): void;
authenticationInProgress(): boolean;
presentPasswordModal(callback: () => void): void;
presentRevisionPreviewModal(uuid: string, content: any): void;
}
export {};

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
/// <reference types="angular" />
import { ApplicationEvent } from 'snjs';
import { WebApplication } from '@/ui_models/application';
export declare type CtrlState = Partial<Record<string, any>>;
export declare type CtrlProps = Partial<Record<string, any>>;
export declare class PureViewCtrl {
$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").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,4 @@
import { WebDirective } from '@/types';
export declare class ApplicationGroupView extends WebDirective {
constructor();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 NotesView extends WebDirective {
constructor();
}

View File

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

13795
dist/javascripts/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long