feat(web): extract ui-services package
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
import { ComponentAction } from '@standardnotes/features'
|
||||
import { MessageData } from './MessageData'
|
||||
|
||||
export type ActionObserver = (action: ComponentAction, messageData: MessageData) => void
|
||||
@@ -0,0 +1,3 @@
|
||||
import { ComponentViewerEvent } from './ComponentViewerEvent'
|
||||
|
||||
export type ComponentEventObserver = (event: ComponentViewerEvent) => void
|
||||
@@ -0,0 +1,9 @@
|
||||
import { ComponentAction } from '@standardnotes/features'
|
||||
import { MessageData } from './MessageData'
|
||||
|
||||
export type ComponentMessage = {
|
||||
action: ComponentAction
|
||||
sessionKey?: string
|
||||
componentData?: Record<string, unknown>
|
||||
data: MessageData
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export enum ComponentViewerEvent {
|
||||
FeatureStatusUpdated = 'FeatureStatusUpdated',
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { DecryptedTransferPayload } from '../TransferPayload/Interfaces/DecryptedTransferPayload'
|
||||
|
||||
export type IncomingComponentItemPayload = DecryptedTransferPayload & {
|
||||
clientData: Record<string, unknown>
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export enum KeyboardModifier {
|
||||
Shift = 'Shift',
|
||||
Ctrl = 'Control',
|
||||
Meta = 'Meta',
|
||||
}
|
||||
31
packages/models/src/Domain/Abstract/Component/MessageData.ts
Normal file
31
packages/models/src/Domain/Abstract/Component/MessageData.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ComponentPermission } from '@standardnotes/features'
|
||||
|
||||
import { IncomingComponentItemPayload } from './IncomingComponentItemPayload'
|
||||
import { KeyboardModifier } from './KeyboardModifier'
|
||||
|
||||
export type MessageData = Partial<{
|
||||
/** Related to the stream-item-context action */
|
||||
item?: IncomingComponentItemPayload
|
||||
/** Related to the stream-items action */
|
||||
content_types?: ContentType[]
|
||||
items?: IncomingComponentItemPayload[]
|
||||
/** Related to the request-permission action */
|
||||
permissions?: ComponentPermission[]
|
||||
/** Related to the component-registered action */
|
||||
componentData?: Record<string, unknown>
|
||||
uuid?: Uuid
|
||||
environment?: string
|
||||
platform?: string
|
||||
activeThemeUrls?: string[]
|
||||
/** Related to set-size action */
|
||||
width?: string | number
|
||||
height?: string | number
|
||||
type?: string
|
||||
/** Related to themes action */
|
||||
themes?: string[]
|
||||
/** Related to clear-selection action */
|
||||
content_type?: ContentType
|
||||
/** Related to key-pressed action */
|
||||
keyboardModifier?: KeyboardModifier
|
||||
}>
|
||||
@@ -0,0 +1,10 @@
|
||||
import { ComponentPermission } from '@standardnotes/features'
|
||||
import { SNComponent } from '../../Syncable/Component'
|
||||
|
||||
export type PermissionDialog = {
|
||||
component: SNComponent
|
||||
permissions: ComponentPermission[]
|
||||
permissionsString: string
|
||||
actionBlock: (approved: boolean) => void
|
||||
callback: (approved: boolean) => void
|
||||
}
|
||||
Reference in New Issue
Block a user