feat(editor): finding dialog and citations side sheet in the history

Constats opens each element in one modal dialog (view, edit with a
local draft, creation) driven by the editor view layer of the browser
history. The citations panel becomes a modal side sheet stacked over
it; its geometry, exit machinery and page inertness are removed.
Back and Forward restore the layers, a dirty form asks first.
This commit is contained in:
bchanot committed 2026-11-13 18:51:35 +01:00
1 parent 8e4f02620a
commit 18085cecf8
50 files changed
+2642 -1504

No files matched your search

+19 -3
View File
@@ -1,7 +1,8 @@
import type { ElementKey, PreviewState } from '@faunosteo/core-wasm/types'
import type { EditorTarget, FocusRequest } from './navigation'
import type { EditorTarget, EditorView, FocusRequest } from './navigation'
import { unmeasuredViews } from './issues'
import type { TabTier } from './useViewport'
import type { Guards } from './useEditorNavigation'
export const EDITOR_TABS = [
'general',
@@ -38,6 +39,21 @@ export function initialTab(state: PreviewState, tier: TabTier): EditorTabId {
return SHOWN[tier].includes(wanted) ? wanted : 'annotations'
}
/**
* What Constats needs of the navigation for its dialog (R2F-3): the layer the view
* holds and the moves on it. A user close answers false when a form refused it.
*/
export interface FindingLayer {
view: EditorView['finding']
guards: Guards
open: (key: ElementKey) => void
start: (kind: string, parent: ElementKey | null) => void
close: (forced?: boolean) => boolean
replace: (key: ElementKey | null, text?: string) => void
openCitations: (citedBy: ElementKey, opener?: HTMLElement | null) => void
announce: (text: string) => void
}
/** Props of every place (tab body, Annotations section). */
export interface EditorPlaceProps {
/** Not editable now: a mode that cannot save, or a recovery offer not answered yet. */
@@ -46,8 +62,8 @@ export interface EditorPlaceProps {
navigate: (target: EditorTarget) => void
/** « Aller à … » with an element: the place seeds its own selection from it once. */
focus?: FocusRequest
/** Opens the citations panel of one finding (only Constats offers it). */
openCitations?: (citedBy: ElementKey, opener?: HTMLElement | null) => void
/** The finding dialog and the citations sheet over it (only Constats has them). */
layer?: FindingLayer
/** Bumped by « Tout afficher »: the references library resets its search once per bump. */
libraryReset?: number
/** Reads the sheet's overview again (after a submission: the round freezes the draft). */