feat(web): extract ui-services package
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ComponentArea } from '@standardnotes/features'
|
||||
import { ActionObserver, PermissionDialog, SNComponent, SNNote } from '@standardnotes/models'
|
||||
|
||||
import { DesktopManagerInterface } from '../Device/DesktopManagerInterface'
|
||||
import { ComponentViewerInterface } from './ComponentViewerInterface'
|
||||
|
||||
export interface ComponentManagerInterface {
|
||||
urlForComponent(component: SNComponent): string | undefined
|
||||
setDesktopManager(desktopManager: DesktopManagerInterface): void
|
||||
componentsForArea(area: ComponentArea): SNComponent[]
|
||||
editorForNote(note: SNNote): SNComponent | undefined
|
||||
doesEditorChangeRequireAlert(from: SNComponent | undefined, to: SNComponent | undefined): boolean
|
||||
showEditorChangeAlert(): Promise<boolean>
|
||||
destroyComponentViewer(viewer: ComponentViewerInterface): void
|
||||
createComponentViewer(
|
||||
component: SNComponent,
|
||||
contextItem?: Uuid,
|
||||
actionObserver?: ActionObserver,
|
||||
urlOverride?: string,
|
||||
): ComponentViewerInterface
|
||||
presentPermissionsDialog(_dialog: PermissionDialog): void
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum ComponentViewerError {
|
||||
OfflineRestricted = 'OfflineRestricted',
|
||||
MissingUrl = 'MissingUrl',
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
ActionObserver,
|
||||
ComponentEventObserver,
|
||||
ComponentMessage,
|
||||
DecryptedItemInterface,
|
||||
SNComponent,
|
||||
} from '@standardnotes/models'
|
||||
import { FeatureStatus } from '../Feature/FeatureStatus'
|
||||
import { ComponentViewerError } from './ComponentViewerError'
|
||||
|
||||
export interface ComponentViewerInterface {
|
||||
readonly component: SNComponent
|
||||
readonly url?: string
|
||||
identifier: string
|
||||
lockReadonly: boolean
|
||||
sessionKey?: string
|
||||
overrideContextItem?: DecryptedItemInterface
|
||||
get componentUuid(): string
|
||||
destroy(): void
|
||||
setReadonly(readonly: boolean): void
|
||||
getFeatureStatus(): FeatureStatus
|
||||
shouldRender(): boolean
|
||||
getError(): ComponentViewerError | undefined
|
||||
setWindow(window: Window): void
|
||||
addEventObserver(observer: ComponentEventObserver): () => void
|
||||
addActionObserver(observer: ActionObserver): () => void
|
||||
postActiveThemes(): void
|
||||
handleMessage(message: ComponentMessage): void
|
||||
}
|
||||
Reference in New Issue
Block a user