-
Notifications
You must be signed in to change notification settings - Fork 392
/
DocumentPaneContext.ts
55 lines (52 loc) · 1.96 KB
/
DocumentPaneContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import {DocumentActionDescription, DocumentBadgeDescription} from '@sanity/base'
import {Marker, Path, SanityDocument} from '@sanity/types'
import {EditStateFor} from '@sanity/base/_internal'
import {createContext} from 'react'
import {PaneView, PaneMenuItem, PaneMenuItemGroup} from '../../types'
import {Controller as HistoryController} from './documentHistory/history/Controller'
import {Timeline} from './documentHistory/history/Timeline'
import {TimelineMode} from './types'
// @todo: provide a TS type for this
type DocumentSchema = any
export interface DocumentPaneContextValue {
activeViewId: string | null
actions: DocumentActionDescription[] | null
badges: DocumentBadgeDescription[] | null
changesOpen: boolean
compareValue: Partial<SanityDocument> | null
connectionState: 'connecting' | 'reconnecting' | 'connected'
displayed: Partial<SanityDocument> | null
editState: EditStateFor | null
documentId: string
documentIdRaw: string
documentSchema: DocumentSchema | null
documentType: string
focusPath: Path
handleChange: (patches: any[]) => void
handleFocus: (nextPath: Path) => void
handleHistoryClose: () => void
handleHistoryOpen: () => void
handleInspectClose: () => void
handleKeyUp: (event: React.KeyboardEvent<HTMLDivElement>) => void
handleMenuAction: (item: PaneMenuItem) => void
handlePaneClose: () => void
handlePaneSplit?: () => void
historyController: HistoryController
index: number
inspectOpen: boolean
markers: Marker[]
menuItems: PaneMenuItem[]
menuItemGroups: PaneMenuItemGroup[]
paneKey: string
previewUrl: string | null
ready: boolean
setTimelineMode: (mode: TimelineMode) => void
setTimelineRange(since: string | null, rev: string | null): void
timeline: Timeline
timelineMode: TimelineMode
title: string | null
totalReferenceCount: number | undefined
value: Partial<SanityDocument>
views: PaneView[]
}
export const DocumentPaneContext = createContext<DocumentPaneContextValue | null>(null)