refactor: component manager usecases (#2354)
This commit is contained in:
@@ -3,43 +3,39 @@ import {
|
||||
ComponentArea,
|
||||
ComponentFeatureDescription,
|
||||
EditorFeatureDescription,
|
||||
EditorIdentifier,
|
||||
IframeComponentFeatureDescription,
|
||||
ThemeFeatureDescription,
|
||||
} from '@standardnotes/features'
|
||||
import {
|
||||
ActionObserver,
|
||||
ComponentInterface,
|
||||
ComponentOrNativeFeature,
|
||||
PermissionDialog,
|
||||
SNNote,
|
||||
} from '@standardnotes/models'
|
||||
|
||||
import { ActionObserver, ComponentInterface, UIFeature, PermissionDialog, SNNote, SNTag } from '@standardnotes/models'
|
||||
import { DesktopManagerInterface } from '../Device/DesktopManagerInterface'
|
||||
import { ComponentViewerInterface } from './ComponentViewerInterface'
|
||||
|
||||
export interface ComponentManagerInterface {
|
||||
urlForComponent(uiFeature: ComponentOrNativeFeature<ComponentFeatureDescription>): string | undefined
|
||||
urlForFeature(uiFeature: UIFeature<ComponentFeatureDescription>): string | undefined
|
||||
setDesktopManager(desktopManager: DesktopManagerInterface): void
|
||||
thirdPartyComponentsForArea(area: ComponentArea): ComponentInterface[]
|
||||
editorForNote(note: SNNote): ComponentOrNativeFeature<EditorFeatureDescription | IframeComponentFeatureDescription>
|
||||
doesEditorChangeRequireAlert(
|
||||
from: ComponentOrNativeFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
to: ComponentOrNativeFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
from: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
to: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
|
||||
): boolean
|
||||
showEditorChangeAlert(): Promise<boolean>
|
||||
destroyComponentViewer(viewer: ComponentViewerInterface): void
|
||||
createComponentViewer(
|
||||
uiFeature: ComponentOrNativeFeature<IframeComponentFeatureDescription>,
|
||||
uiFeature: UIFeature<IframeComponentFeatureDescription>,
|
||||
item: ComponentViewerItem,
|
||||
actionObserver?: ActionObserver,
|
||||
urlOverride?: string,
|
||||
): ComponentViewerInterface
|
||||
presentPermissionsDialog(_dialog: PermissionDialog): void
|
||||
legacyGetDefaultEditor(): ComponentInterface | undefined
|
||||
|
||||
isThemeActive(theme: ComponentOrNativeFeature<ThemeFeatureDescription>): boolean
|
||||
toggleTheme(theme: ComponentOrNativeFeature<ThemeFeatureDescription>): Promise<void>
|
||||
getActiveThemes(): ComponentOrNativeFeature<ThemeFeatureDescription>[]
|
||||
setPermissionDialogUIHandler(handler: (dialog: PermissionDialog) => void): void
|
||||
|
||||
editorForNote(note: SNNote): UIFeature<EditorFeatureDescription | IframeComponentFeatureDescription>
|
||||
getDefaultEditorIdentifier(currentTag?: SNTag): EditorIdentifier
|
||||
|
||||
isThemeActive(theme: UIFeature<ThemeFeatureDescription>): boolean
|
||||
toggleTheme(theme: UIFeature<ThemeFeatureDescription>): Promise<void>
|
||||
getActiveThemes(): UIFeature<ThemeFeatureDescription>[]
|
||||
getActiveThemesIdentifiers(): string[]
|
||||
|
||||
isComponentActive(component: ComponentInterface): boolean
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ActionObserver,
|
||||
ComponentEventObserver,
|
||||
ComponentMessage,
|
||||
ComponentOrNativeFeature,
|
||||
} from '@standardnotes/models'
|
||||
import { ActionObserver, ComponentEventObserver, ComponentMessage, UIFeature } from '@standardnotes/models'
|
||||
import { FeatureStatus } from '../Feature/FeatureStatus'
|
||||
import { ComponentViewerError } from './ComponentViewerError'
|
||||
import { IframeComponentFeatureDescription } from '@standardnotes/features'
|
||||
@@ -16,7 +11,7 @@ export interface ComponentViewerInterface {
|
||||
get url(): string
|
||||
get componentUniqueIdentifier(): string
|
||||
|
||||
getComponentOrFeatureItem(): ComponentOrNativeFeature<IframeComponentFeatureDescription>
|
||||
getComponentOrFeatureItem(): UIFeature<IframeComponentFeatureDescription>
|
||||
|
||||
destroy(): void
|
||||
setReadonly(readonly: boolean): void
|
||||
|
||||
Reference in New Issue
Block a user