diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 941fa747..bff651ea 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -749,8 +749,8 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - [ ] `shortcut:` the « − » bubble for a mouse is 28 × 22 px, read off board 05 (R-9 gives only the touch size), `apps/app/src/editor/annotations/handleSize.ts`. Upgrade: the owner's value at the trial (U2 Task 5). - [ ] No `scroll-padding-top` under the sticky top bar (pre-existing, WCAG 2.4.11): a keyboard focus on the header's « Défaire », « Refaire » or « Enregistrer » while scrolled can stay hidden under it; axe target-size flags them once a list click scrolled the page (U2 Task 5 review M-3). - [x] At the page's end, a side panel that shortens (the issue list leaving it) clamps the scroll and moves the canvas by its height (11 px in `editor-geometry.spec.ts`, which starts from the top for that reason). Gone with Task 6: the column keeps the overview, the issue is in the strip and the dialog. `editor-geometry.spec.ts` now runs the accepted repair (the issue leaving) from the page's end under `expectNoShift`, buttons pressed in place, scroll position unchanged (U2 Task 5 fix round 1, closed by Task 6 fix round 1). - - [ ] `shortcut:` the creation panel still shows the general lines `editor.annotations.required.fields` / `.names`, which R-3 removes (`apps/app/src/components/editor/annotations/CreationPanel.tsx`, `formProblem` in `creation.ts`). Upgrade: Task 7's creation dialog uses `missingFields` and the `editor.annotations.missing.*` keys, then the two keys and `formProblem` go (U2 Task 6 review Minor 6). - - [ ] `shortcut:` the close of a zone tracing (« Fermer le tracé ») is checked out of `expectNoShift` in `editor-annotations.spec.ts` « the drawing never moves »: the creation panel still replaces the overview in the side column until Task 7. Upgrade: wrap it again once the creation is a dialog (U2 Task 6, `aside-content` exemption removed). + - [x] (U2 Task 7: `CreationPanel`, `formProblem` and the two keys removed; the creation dialog uses `missingFields`) `shortcut:` the creation panel still shows the general lines `editor.annotations.required.fields` / `.names`, which R-3 removes (`apps/app/src/components/editor/annotations/CreationPanel.tsx`, `formProblem` in `creation.ts`). Upgrade: Task 7's creation dialog uses `missingFields` and the `editor.annotations.missing.*` keys, then the two keys and `formProblem` go (U2 Task 6 review Minor 6). + - [x] (U2 Task 7: the close runs under `expectNoShift` again) `shortcut:` the close of a zone tracing (« Fermer le tracé ») is checked out of `expectNoShift` in `editor-annotations.spec.ts` « the drawing never moves »: the creation panel still replaces the overview in the side column until Task 7. Upgrade: wrap it again once the creation is a dialog (U2 Task 6, `aside-content` exemption removed). - [ ] Test anomaly A (owner 2026-11-09, separate from U1/U2): fictitious fingerprints `'a'.repeat(64)` from worker stand-ins (`packages/supabase/tests/sandbox/sheet-fixtures.ts:115` openRound, `sheets-concurrency.sandbox.ts:168`, `sheets-perf.sandbox.ts:169`); 7 published/deprecated sandbox versions fail `check_published`. Fix: real fingerprint through the core (as e2e `fingerprintOf`, `apps/app/e2e/support/catalogue.ts:88`); never weaken the publish gate or the reader check. Needs its own go. Census 2026-11-17 (R4 Task 3, read-only): 4 of 164 catalogue entries fail, the four current « Cheval sandbox » versions (2 at v1, 2 at v2), all `fingerprint_mismatch`; R4 cards show them with the integrity line. - [ ] Test anomaly B (owner 2026-11-09, separate from U1/U2): `packages/supabase/tests/sandbox/sheets-admin.sandbox.ts:181-195` creates the historical working copy and never archives it; slot taken → `admin.spec.ts:717` fails x4. Fix test independence and cleanup; the existing copy `8c315a12-20d4-4432-9db3-7cb88b27a5b4` stays untouched until the owner authorises. Linked: RR-13, the admin.spec confirmation line above. - [x] Test anomaly C (owner 2026-11-09, separate from U1/U2): CLOSED 2026-11-17 with R4's owner validation. Integrity failure invisible in catalogue cards; implemented as lot R4; failure shown, never hidden or bypassed. Built 2026-11-17 (R4 Task 1-3 and final fix wave, `V1-2-6_U1_CORRECTIONS.md` §5 row C: built by R4, closes on the owner's validation); checked off with R4's owner validation. diff --git a/apps/app/e2e/shell/editor-annotations.spec.ts b/apps/app/e2e/shell/editor-annotations.spec.ts index 3843cedd..3f6d6952 100644 --- a/apps/app/e2e/shell/editor-annotations.spec.ts +++ b/apps/app/e2e/shell/editor-annotations.spec.ts @@ -35,7 +35,10 @@ import { expectNoShift, keepNativeFrames } from '../support/layout' const dict = fr const isPhone = (info: TestInfo) => info.project.name === 'chromium-375' +/** The creation dialog's form (U2 Task 7). */ const creation = (page: Page) => page.getByTestId('annotation-creation') +const creationDialog = (page: Page, kind: string) => + page.getByRole('dialog', { name: dict[`editor.annotations.new.${kind}`] }) /** The selection's commands in the strip (U2 Task 6: the properties are a dialog). */ const properties = (page: Page) => page.locator('[data-testid="edit-strip"]:has([data-properties-button])') @@ -53,7 +56,7 @@ interface Names { en: string } -/** Fills the creation panel; the category keeps its first choice. */ +/** Fills the creation dialog; the category keeps its first choice (A4). */ async function fillCreation(page: Page, names: Names, opens?: string) { const panel = creation(page) await panel.getByLabel(dict['editor.annotations.name_fr']).fill(names.fr) @@ -71,6 +74,8 @@ async function createFromPanel(page: Page) { .getByRole('button', { name: dict['editor.annotations.create'] }) .click() await expect(creation(page)).toHaveCount(0) + // A7: back to « Sélectionner », the new element selected. + await expect(tool(page, 'select')).toHaveAttribute('aria-pressed', 'true') } async function openAnnotations(page: Page) { @@ -97,12 +102,34 @@ test.describe('editor annotations (A3)', () => { }) => { const { actor, seed } = await openAnnotations(page) requests.forbid(actor.account.email, actor.account.password) + const line = page.getByTestId('gesture-line') - // A point: the tool, a click in the drawing, the fields the core requires. + // An entry of the editor's own below this one, for the Back further down. + await selectTab(page, dict, 'general') + await selectTab(page, dict, 'annotations') + // A point: the tool, a click in the drawing, the dialog « Nouveau point » (A2). await tool(page, 'point').click() await clickDrawing(page, 300, 300) - await expect(creation(page)).toBeVisible() - await expectAccessible(page, 'the point creation panel') + await expect(creationDialog(page, 'point')).toBeVisible() + await expect(page.getByTestId('overlay-ghost')).toBeAttached() + await expect(page.getByTestId('annotation-canvas')).toHaveAttribute( + 'data-creating', + '', + ) + await expectAccessible(page, 'the point creation dialog') + // A Back while the dialog is open: refused (a modal, no history layer), the question + // inside the dialog (A12); the tab stays. + await page.goBack() + const ask = creationDialog(page, 'point').getByRole('group', { + name: dict['editor.annotations.guard.creation'], + }) + await expect(ask).toBeVisible() + await expect(page.locator('dialog[open]')).toHaveCount(1) + await ask + .getByRole('button', { name: dict['editor.annotations.guard.continue'] }) + .click() + await expect(ask).toHaveCount(0) + await expect(creationDialog(page, 'point')).toBeVisible() await fillCreation(page, { fr: 'Point un', en: 'Point one' }) await creation(page) .getByLabel(dict['editor.annotations.zone']) @@ -110,6 +137,9 @@ test.describe('editor annotations (A3)', () => { await createFromPanel(page) await expect(selectionTag(page)).toContainText('Point un') await expect(properties(page)).toBeVisible() + await expect(line).toContainText( + dict['editor.annotations.message.created.point'], + ) const placed = await shownNumber(page, 'cx') expect(Math.abs(placed - 300)).toBeLessThan(1) @@ -121,12 +151,18 @@ test.describe('editor annotations (A3)', () => { [700, 400], ]) await clickDrawing(page, x, y) + await expectAccessible(page, 'a zone tracing in progress') await page .getByRole('button', { name: dict['editor.annotations.trace_close'] }) .click() + await expect(creationDialog(page, 'zone')).toBeVisible() + await expectAccessible(page, 'the zone creation dialog') await fillCreation(page, { fr: 'Zone une', en: 'Zone one' }) await createFromPanel(page) await expect(selectionTag(page)).toContainText('Zone une') + await expect(line).toContainText( + dict['editor.annotations.message.created.zone'], + ) // A link to the detail view: the same tracing, the opened view chosen. await tool(page, 'link').click() @@ -144,6 +180,15 @@ test.describe('editor annotations (A3)', () => { await expect(selectionTag(page)).toContainText('Accès un') await expect(historyButton(page, dict, 'undo')).toBeEnabled() + // Each creation is one step: « Défaire » removes the link, « Refaire » brings it back. + const rows = list(page).getByRole('button') + await expect(rows.filter({ hasText: 'Accès un' })).toHaveCount(1) + await historyButton(page, dict, 'undo').click() + await expect(rows.filter({ hasText: 'Accès un' })).toHaveCount(0) + await expect(rows.filter({ hasText: 'Zone une' })).toHaveCount(1) + await historyButton(page, dict, 'redo').click() + await expect(rows.filter({ hasText: 'Accès un' })).toHaveCount(1) + // A keyboard edit on the point's handle (two steps of 5 units), then undo and redo. await tool(page, 'select').click() await pickAnnotation(page, dict, /Point un/) @@ -221,64 +266,63 @@ test.describe('editor annotations (A3)', () => { await expect(shownShape(page)).toHaveAttribute('cx', x0) }) - test('keyboard only: creation by the add buttons, numeric position, edit by the handle keys', async ({ + // UX_TESTS « Keyboard »: create a zone, add and remove a vertex, move the zone, validate. + test('keyboard only: a zone by « Ajouter une zone », a vertex added and removed, moved, validated', async ({ page, requests, }) => { const { actor, seed } = await openAnnotations(page) requests.forbid(actor.account.email, actor.account.password) - const add = page.getByRole('button', { - name: dict['editor.annotations.add.point'], - }) - await add.focus() - await page.keyboard.press('Enter') - await expect(creation(page)).toBeVisible() - await fillCreation(page, { fr: 'Clavier', en: 'Keyboard' }) - const cx = creation(page).getByLabel(dict['editor.annotations.geometry.cx']) - await cx.fill('250') - await cx.press('Enter') - await expect(cx).toHaveValue('250') - await creation(page) - .getByRole('button', { name: dict['editor.annotations.create'] }) - .focus() - await page.keyboard.press('Enter') - await expect(creation(page)).toHaveCount(0) - await expect(selectionTag(page)).toContainText('Clavier') - await expect(shownShape(page)).toHaveAttribute('cx', '250') - - // The handle keys (U2 Task 5): two steps of 5 units down, one commit on Enter. - const cy0 = await shownNumber(page, 'cy') - await page - .getByRole('button', { name: 'Point Clavier', exact: true }) - .focus() - await page.keyboard.press('ArrowDown') - await page.keyboard.press('ArrowDown') - await page.keyboard.press('Enter') - await expect(shownShape(page)).toHaveAttribute( - 'cy', - String(round2(round2(cy0 + 5) + 5)), - ) - - // A polygon edit: the zone added by keyboard, its first vertex moved by its keys. await page .getByRole('button', { name: dict['editor.annotations.add.zone'] }) .focus() await page.keyboard.press('Enter') + await expect(creationDialog(page, 'zone')).toBeVisible() await fillCreation(page, { fr: 'Zone clavier', en: 'Keyboard zone' }) await creation(page) .getByRole('button', { name: dict['editor.annotations.create'] }) .focus() await page.keyboard.press('Enter') + await expect(creation(page)).toHaveCount(0) await expect(selectionTag(page)).toContainText('Zone clavier') - const [[before]] = await shownPoints(page) - await page.getByRole('button', { name: 'Sommet 1', exact: true }).focus() - await page.keyboard.press('ArrowRight') - await page.keyboard.press('ArrowRight') + // Board 32: « Créer » réussi, the focus on the new row. + await expect( + list(page).getByRole('button', { name: /Zone clavier/ }), + ).toBeFocused() + const [first] = await shownPoints(page) + expect(await shownPoints(page)).toHaveLength(3) + + // « + » after vertex 1 by Enter: four vertices; Delete on the chosen one: three again. + await page + .getByRole('button', { name: 'Ajouter un sommet après le sommet 1' }) + .focus() + await page.keyboard.press('Enter') + await expect.poll(async () => (await shownPoints(page)).length).toBe(4) + await page.getByRole('button', { name: 'Sommet 2', exact: true }).focus() + await page.keyboard.press('Delete') + await expect.poll(async () => (await shownPoints(page)).length).toBe(3) + // Escape unchooses the vertex (board 32 row 5): the strip offers the zone's move. + await page.keyboard.press('Escape') + + // The move mode by its keys: two steps right, then « Valider la position ». + await page + .getByRole('button', { name: dict['editor.annotations.move.zone'] }) + .focus() + await page.keyboard.press('Enter') + const right = page.getByRole('button', { + name: dict['editor.annotations.move.right'], + }) + await right.focus() + await page.keyboard.press('Enter') + await page.keyboard.press('Enter') + await page + .getByRole('button', { name: dict['editor.annotations.move.confirm'] }) + .focus() await page.keyboard.press('Enter') await expect .poll(async () => (await shownPoints(page))[0][0]) - .toBe(round2(round2(before + 5) + 5)) + .toBe(round2(round2(first[0] + 5) + 5)) await saveDraft(page, dict, seed.revision + 1) }) @@ -394,11 +438,11 @@ test.describe('editor annotations (A3)', () => { button(page, 'editor.annotations.trace_pop').click(), ) await expectNoShift(page, () => clickDrawing(page, 700, 400)) - // shortcut: the creation panel still replaces the overview in the side column until - // Task 7 (the creation dialog), so the close is checked out of the no-shift probe. - // Upgrade path: wrap it in expectNoShift again once the creation is a dialog. - await button(page, 'editor.annotations.trace_close').click() - await expect(creation(page)).toBeVisible() + // The close opens « Nouvelle zone » over the column: nothing under it moves. + await expectNoShift(page, async () => { + await button(page, 'editor.annotations.trace_close').click() + await expect(creationDialog(page, 'zone')).toBeVisible() + }) }) } diff --git a/apps/app/e2e/shell/editor-deselect.spec.ts b/apps/app/e2e/shell/editor-deselect.spec.ts index de25b5bd..a07e7c9a 100644 --- a/apps/app/e2e/shell/editor-deselect.spec.ts +++ b/apps/app/e2e/shell/editor-deselect.spec.ts @@ -263,7 +263,8 @@ test.describe('deselect and D6b (editor, mouse and keyboard)', () => { await page.keyboard.press('Escape') await expectDeselected(page) - // A tracing: Escape cancels the tracing only. + // A tracing (a creation, U2 Task 7): Escape asks first (board 32 row 3, A12), then + // « Abandonner » cancels the tracing only. await select(page, POINT) await toolButton(page, dict, 'zone').click() await clickAt(page, { x: 300, y: 500 }) @@ -272,6 +273,12 @@ test.describe('deselect and D6b (editor, mouse and keyboard)', () => { await expect(bar).toBeVisible() await box(page).focus() await page.keyboard.press('Escape') + const guardQuestion = page.getByRole('dialog', { + name: dict['editor.annotations.guard.creation'], + }) + await guardQuestion + .getByRole('button', { name: dict['editor.annotations.guard.discard'] }) + .click() await expect(bar).toHaveCount(0) await expectKept(page, POINT) expect(saves).toEqual([]) diff --git a/apps/app/e2e/shell/editor-geometry.spec.ts b/apps/app/e2e/shell/editor-geometry.spec.ts index 581203f3..9003437f 100644 --- a/apps/app/e2e/shell/editor-geometry.spec.ts +++ b/apps/app/e2e/shell/editor-geometry.spec.ts @@ -48,12 +48,16 @@ const viewChip = (page: Page, name: string) => .getByRole('group', { name: dict['editor.annotations.views'] }) .getByRole('button', { name }) -/** The x and y a correction notice proposes, read from its sentence. */ +/** + * The x and y the correction proposes, read from the drawing (R-4: the notice in the + * creation dialog says it without numbers). + */ async function proposed(page: Page): Promise<{ x: string; y: string }> { - const text = (await notice(page).innerText()).replace(/\s+/g, ' ') - const found = /x = (-?\d+(?:\.\d+)?), y = (-?\d+(?:\.\d+)?)/.exec(text) - if (!found) throw new Error('no proposed position in the notice') - return { x: found[1], y: found[2] } + const circle = page.getByTestId('overlay-correction').locator('circle') + const x = await circle.getAttribute('cx') + const y = await circle.getAttribute('cy') + if (x === null || y === null) throw new Error('no proposed position drawn') + return { x, y } } /** A mouse drag on the drawing in the move mode, between two points in drawing units. */ @@ -109,6 +113,10 @@ test.describe('editor geometry (adversarial)', () => { .getByRole('button', { name: dict['editor.annotations.create'] }) .click() await expect(notice(page)).toBeVisible() + // R-4: the notice is in the creation dialog, its text without numbers. + await expect( + page.getByRole('dialog', { name: dict['editor.annotations.new.point'] }), + ).toContainText(dict['editor.annotations.correction']) await expect(page.getByTestId('overlay-click-cross')).toBeAttached() const shown = await proposed(page) await expect(selectionTag(page)).toHaveCount(0) // an insertion selects it diff --git a/apps/app/e2e/shell/editor-shell-crossing.spec.ts b/apps/app/e2e/shell/editor-shell-crossing.spec.ts index 0580db40..8e1d6622 100644 --- a/apps/app/e2e/shell/editor-shell-crossing.spec.ts +++ b/apps/app/e2e/shell/editor-shell-crossing.spec.ts @@ -252,7 +252,9 @@ test.describe('editor shell, width crossing (H)', () => { await expectNoDialog(page) }) - test('the annotation edit body keeps its tool and its pending creation', async ({ + // U2 Task 7 (R-14): the creation dialog is mounted outside the edit-only body. A + // crossing keeps it open, read-only, with its form; widening gives the form back. + test('the creation dialog stays across a crossing: its form kept, « Créer » off, then on', async ({ page, }) => { await open(page) @@ -266,15 +268,26 @@ test.describe('editor shell, width crossing (H)', () => { await page .getByRole('button', { name: dict['editor.annotations.add.point'] }) .click() - const name = page.getByLabel(dict['editor.annotations.name_fr']) + const dialog = page.getByRole('dialog', { + name: dict['editor.annotations.new.point'], + }) + const name = dialog.getByLabel(dict['editor.annotations.name_fr']) + const create = dialog.getByRole('button', { + name: dict['editor.annotations.create'], + }) await name.fill('Futur point') - await cross(page, NARROW) - await expect(name).toBeHidden() + await page.setViewportSize(NARROW) await expect(zone).toHaveCount(0) - await expect(active(page)).toHaveAttribute('id', 'editor-tab-annotations') - await cross(page, WIDE) + await expect(dialog).toBeVisible() await expect(name).toHaveValue('Futur point') - await expect(zone).toHaveAttribute('aria-pressed', 'true') + await expect(name).not.toBeEditable() + await expect(create).toBeDisabled() + await expect(page.getByTestId('overlay-ghost')).toBeAttached() + await page.setViewportSize(WIDE) + await expect(name).toHaveValue('Futur point') + await expect(name).toBeEditable() + await expect(create).toBeEnabled() + await expect(page.getByTestId('overlay-ghost')).toBeVisible() await expect(saveLine(page)).not.toHaveText(UNSAVED_LINE) }) diff --git a/apps/app/e2e/support/editor.ts b/apps/app/e2e/support/editor.ts index f00e993d..e7696cec 100644 --- a/apps/app/e2e/support/editor.ts +++ b/apps/app/e2e/support/editor.ts @@ -676,7 +676,7 @@ export async function clickDrawing(page: Page, x: number, y: number) { await page.mouse.click(at.x, at.y) } -/** The geometry fields of the open creation panel (until U2 Task 7) or repair dialog. */ +/** The geometry fields of the open repair dialog (D1: the only place they remain). */ export const geometryField = (page: Page, dict: Dict, key: string) => page.getByLabel(dict[`editor.annotations.geometry.${key}`], { exact: true }) @@ -738,6 +738,7 @@ export function shapeWith(...annotations: unknown[]) { } } +/** The creation dialog's form (U2 Task 7: the side panel became a dialog over the column). */ export const creationPanel = (page: Page) => page.getByTestId('annotation-creation') @@ -791,7 +792,7 @@ export const toolButton = (page: Page, dict: Dict, id: string) => exact: true, }) -/** Fills the creation panel; the category keeps its first choice. */ +/** Fills the creation dialog; the category keeps its first choice (A4). */ export async function fillCreation( page: Page, dict: Dict, diff --git a/apps/app/src/components/editor/HistoryButtons.tsx b/apps/app/src/components/editor/HistoryButtons.tsx index 2852eba9..8edb0d58 100644 --- a/apps/app/src/components/editor/HistoryButtons.tsx +++ b/apps/app/src/components/editor/HistoryButtons.tsx @@ -7,7 +7,10 @@ import { import { useEditorReadOnly } from '@/editor/editingContext' import { commitFocusedField } from '@/editor/focusRequest' import { canRedo, canUndo, useEditorStore } from '@/editor/state/editorStore' -import { cancelPending } from '@/editor/annotations/workStore' +import { + cancelPending, + useAnnotationWork, +} from '@/editor/annotations/workStore' import { useT } from '@/i18n/useT' import EditorGlyph from './EditorGlyph' @@ -67,6 +70,8 @@ function usePress( left.current = asField(event.relatedTarget) ?? left.current } const onClick = () => { + // A12: undo and redo are inactive during a creation (R-13). + if (useAnnotationWork.getState().creation) return const field = left.current forget() if (field?.isConnected && field.getAttribute('aria-invalid') === 'true') { @@ -101,6 +106,7 @@ function HistoryButton({ const t = useT() const readOnly = useEditorReadOnly() const steppable = useEditorStore(direction === 'undo' ? canUndo : canRedo) + const creating = useAnnotationWork((s) => s.creation !== null) const name = t(`editor.history.${direction}_title`) const press = usePress(direction, readOnly, left) return ( @@ -108,7 +114,7 @@ function HistoryButton({ type="button" aria-label={name} title={`${name} (${t(`editor.history.${direction}_shortcut`)})`} - aria-disabled={readOnly || !steppable} + aria-disabled={readOnly || !steppable || creating} aria-keyshortcuts={SHORTCUT[direction]} {...press} className={BUTTON} diff --git a/apps/app/src/components/editor/annotations/AnnotationCanvas.tsx b/apps/app/src/components/editor/annotations/AnnotationCanvas.tsx index de927be4..3f283145 100644 --- a/apps/app/src/components/editor/annotations/AnnotationCanvas.tsx +++ b/apps/app/src/components/editor/annotations/AnnotationCanvas.tsx @@ -1,4 +1,11 @@ -import { useEffect, useRef, type KeyboardEvent, type RefObject } from 'react' +import { + useEffect, + useRef, + useState, + type KeyboardEvent, + type PointerEvent, + type RefObject, +} from 'react' import type { Geometry } from '@faunosteo/core-wasm/types' import Button from '@/components/ui/Button' import Notice from '@/components/ui/Notice' @@ -6,6 +13,7 @@ import { coreFailureMessage } from '@/core/failure' import { useCoreStopped } from '@/core/runtime' import { transformOf } from '@/catalogue/framing' import type { XY } from '@/editor/annotations/frame' +import { clientToDrawing } from '@/editor/annotations/gesture' import { useCanvasBuild, type RootAttributes, @@ -23,7 +31,7 @@ import ToolColumn, { type ToolColumnProps } from './ToolColumn' type OverlayData = Omit< OverlayProps, - 'svgRef' | 'viewBox' | 'ratio' | 'dragged' + 'svgRef' | 'viewBox' | 'ratio' | 'dragged' | 'hover' > /** The handle layer's content: the handle and its keys (the layer measures itself). */ @@ -37,6 +45,10 @@ export interface AnnotationCanvasProps { viewName: string tool: ToolId selectedId: string | null + /** The point tool's next size (A5), shown under a mouse pointer; null: no preview. */ + previewRadius: number | null + /** A creation is in progress: the other markers are dimmed and unselectable (A12). */ + creating: boolean /** The selected annotation when it can be moved now. */ moveTarget: MoveTarget | null overlay: OverlayData @@ -71,6 +83,7 @@ export default function AnnotationCanvas(props: AnnotationCanvasProps) { overlay, viewport, }) + const preview = usePointPreview(props.previewRadius, overlay) useSelectionMark(build.host, props.selectedId, build.root) useReportRoot(build.root, props.onRoot) return ( @@ -85,13 +98,14 @@ export default function AnnotationCanvas(props: AnnotationCanvasProps) { {...props} build={build} viewport={viewport} - boxProps={gestures.boxProps} + boxProps={withPreview(gestures.boxProps, preview)} layer={{ transform: transformOf(gestures.framing.framing), overlay: { ...props.overlay, svgRef: overlay, dragged: gestures.drag, + hover: preview.hover, }, handles: { ...props.handles, @@ -105,11 +119,47 @@ export default function AnnotationCanvas(props: AnnotationCanvasProps) { } type Build = ReturnType +type BoxProps = ReturnType['boxProps'] +type Preview = ReturnType + +/** + * Board 02 A: with the point tool, the next point follows a mouse pointer over the drawing + * at the strip's size. Touch and pen have no hover: nothing is shown for them. + */ +function usePointPreview( + radius: number | null, + overlay: RefObject, +) { + const [at, setAt] = useState(null) + const onMove = (event: PointerEvent) => { + if (radius === null || event.pointerType !== 'mouse') { + if (at !== null) setAt(null) + return + } + const client = { x: event.clientX, y: event.clientY } + setAt(clientToDrawing(overlay.current, client)) + } + const hover = radius !== null && at ? { ...at, r: radius } : null + return { hover, onMove, onLeave: () => setAt(null) } +} + +/** The box's own pointer handlers, then the preview's. */ +function withPreview(box: BoxProps, preview: Preview) { + return { + ...box, + onPointerMove: (event: PointerEvent) => { + box.onPointerMove(event) + preview.onMove(event) + }, + onPointerLeave: preview.onLeave, + } +} function CanvasBox({ viewId, viewName, tool, + creating, build, viewport, boxProps, @@ -117,7 +167,7 @@ function CanvasBox({ }: AnnotationCanvasProps & { build: Build viewport: RefObject - boxProps: ReturnType['boxProps'] + boxProps: BoxProps layer: Omit }) { const root = build.root?.viewId === viewId ? build.root : null @@ -130,6 +180,7 @@ function CanvasBox({ role="group" aria-label={viewName} data-testid="annotation-canvas" + data-creating={creating ? '' : undefined} className={`svg-canvas aspect-[4/3] w-full select-none ${cursor} ${FOCUS_RING}`} {...boxProps} > diff --git a/apps/app/src/components/editor/annotations/AnnotationEditForm.tsx b/apps/app/src/components/editor/annotations/AnnotationEditForm.tsx index cc1748b4..3d07962c 100644 --- a/apps/app/src/components/editor/annotations/AnnotationEditForm.tsx +++ b/apps/app/src/components/editor/annotations/AnnotationEditForm.tsx @@ -18,29 +18,14 @@ import { useEditCommand } from '@/editor/useEditCommand' import type { Guards } from '@/editor/useEditorNavigation' import { useT } from '@/i18n/useT' import CreationFields from './CreationFields' +import MissingSummary, { focusFirstMissing } from './MissingSummary' /** What the form edits: the creation's fields plus « Couleur » (A9), as plain strings. */ type Draft = CreationForm & { color: string } -/** The edit form's ids: never the creation panel's, kept mounted in the hidden edit body. */ +/** The edit form's ids: never the creation dialog's (`creation-`). */ const ID_PREFIX = 'annotation-edit-' -const FIELD_ID: Record = { - name_fr: 'fr', - name_en: 'en', - category: 'category', - laterality: 'laterality', - opens: 'opens', -} - -const FIELD_LABEL: Record = { - name_fr: 'editor.annotations.name_fr', - name_en: 'editor.annotations.name_en', - category: 'editor.annotations.category', - laterality: 'editor.annotations.laterality', - opens: 'editor.annotations.opens', -} - function draftOf(annotation: Annotation): Draft { const link = annotation.kind === 'detail_trigger' return { @@ -158,7 +143,7 @@ function useSave(props: AnnotationEditFormProps, form: FormDraft) { const absent = missingFields(props.annotation.kind, form.draft) setMissing(absent) if (absent.length > 0) { - document.getElementById(`${ID_PREFIX}${FIELD_ID[absent[0]!]}`)?.focus() + focusFirstMissing(ID_PREFIX, absent) return } if (!form.dirty) return props.onDone(false) @@ -174,21 +159,6 @@ function useSave(props: AnnotationEditFormProps, form: FormDraft) { type FormDraft = ReturnType> -/** « À compléter : Latéralité. »: the missing fields by their labels, in form order. */ -function MissingSummary({ missing }: { missing: readonly MissingField[] }) { - const t = useT() - if (missing.length === 0) return null - const fields = missing.map((field) => t(FIELD_LABEL[field])).join(', ') - return ( -

- {t('editor.annotations.missing.summary').replace( - '{fields}', - () => fields, - )} -

- ) -} - /** * « Modifier » (board 31 C): the creation's fields with « Couleur » on a local draft, one * `update` on « Enregistrer » (none when unchanged), nothing on « Annuler » or a close. diff --git a/apps/app/src/components/editor/annotations/AnnotationOverlay.tsx b/apps/app/src/components/editor/annotations/AnnotationOverlay.tsx index 33184c5d..677d88fe 100644 --- a/apps/app/src/components/editor/annotations/AnnotationOverlay.tsx +++ b/apps/app/src/components/editor/annotations/AnnotationOverlay.tsx @@ -16,7 +16,11 @@ export interface OverlayProps { dragged: Geometry | null /** The place the core just refused (red dashes while its message shows). */ refused: Geometry | null + /** The new shape waiting for its properties (the ghost), in its category's colour (A4). */ pending: Geometry | null + pendingColour: string + /** The point tool's preview under a mouse pointer (none on touch). */ + hover: { x: number; y: number; r: number } | null tracing: Point[] | null correction: Correction | null /** A redraw runs: the stored outline stays as the old place until the close (06 C). */ @@ -94,6 +98,74 @@ function HollowCross({ ) } +/** The shape `geometry` with its own style: a ghost's fill and halo, the preview's dashes. */ +function Shape({ + geometry, + style, +}: { + geometry: Geometry + style: Record +}) { + if (geometry.type === 'circle') { + return ( + + ) + } + if (geometry.type === 'polygon') { + return + } + return null +} + +/** + * The new shape before « Créer »: its category's colour, a white halo, accent dashes over + * it (docs/ANNOTATION-RENDERING.md « Editor overlay »). + */ +function Ghost({ geometry, colour }: { geometry: Geometry; colour: string }) { + const line = { vectorEffect: 'non-scaling-stroke', fill: 'none' } + return ( + + + + + + ) +} + +/** Board 02 A: the next point's size, dashed, with a cross at the pointer. */ +function HoverPreview({ + hover, +}: { + hover: { x: number; y: number; r: number } +}) { + const { x, y, r } = hover + const arm = r / 4 + const style = { ...STROKE, stroke: 'var(--color-accent)', strokeWidth: 1.5 } + return ( + + + + + ) +} + function TracingPath({ points, size }: { points: Point[]; size: number }) { if (points.length === 0) return null const shape: Geometry = { type: 'polygon', points } @@ -163,24 +235,19 @@ export default function AnnotationOverlay(props: OverlayProps) { )} - {pending && ( - - )} + {pending && } {correction && ( - <> + - + )} {tracing && } + {props.hover && } ) } diff --git a/apps/app/src/components/editor/annotations/CorrectionNotice.tsx b/apps/app/src/components/editor/annotations/CorrectionNotice.tsx index 4bb52cac..67125ca4 100644 --- a/apps/app/src/components/editor/annotations/CorrectionNotice.tsx +++ b/apps/app/src/components/editor/annotations/CorrectionNotice.tsx @@ -1,26 +1,21 @@ import Button from '@/components/ui/Button' import Notice from '@/components/ui/Notice' -import type { Correction } from '@/editor/annotations/correction' import { useT } from '@/i18n/useT' /** - * The corrected position is never taken silently: the page says where the point would - * sit, the overlay shows it with the click marked apart, and only « Utiliser cette - * position » inserts it. + * The corrected position is never taken silently: the notice says a corrected position + * is proposed (no numbers, A8, R-4), the overlay shows it with the click marked apart, + * and only « Utiliser cette position » inserts it. */ export default function CorrectionNotice({ - correction, onConfirm, onCancel, }: { - correction: Correction onConfirm: () => void onCancel: () => void }) { const t = useT() const message = t('editor.annotations.correction') - .replace('{x}', String(correction.circle.cx)) - .replace('{y}', String(correction.circle.cy)) return (
diff --git a/apps/app/src/components/editor/annotations/CreationCommands.tsx b/apps/app/src/components/editor/annotations/CreationCommands.tsx new file mode 100644 index 00000000..4b003529 --- /dev/null +++ b/apps/app/src/components/editor/annotations/CreationCommands.tsx @@ -0,0 +1,65 @@ +import Button from '@/components/ui/Button' +import { askCreation } from '@/editor/annotations/creationAsk' +import { backToProperties, popVertex } from '@/editor/annotations/creationWork' +import type { Creation } from '@/editor/annotations/workStore' +import { useT } from '@/i18n/useT' +import EditorGlyph from '../EditorGlyph' + +const COMMAND = 'min-h-11 gap-1.5 xl:min-h-9' + +/** The vertices a resumed tracing holds now; null for a point. */ +const tracedCount = (work: Creation) => + !work.closed && work.pending.geometry.type === 'polygon' + ? work.pending.geometry.points.length + : null + +/** + * Board 04 C: the dialog hidden by « Replacer le point » or « Reprendre le tracé ». « Revenir + * aux propriétés » shows it again (a tracing closes first, three vertices at least); + * « Abandonner » asks first, the shape always exists (A12). + */ +export default function CreationCommands({ creation }: { creation: Creation }) { + const t = useT() + const count = tracedCount(creation) + return ( +
+ + {count !== null && ( + + )} + +
+ ) +} diff --git a/apps/app/src/components/editor/annotations/CreationDialog.tsx b/apps/app/src/components/editor/annotations/CreationDialog.tsx new file mode 100644 index 00000000..82cc8f91 --- /dev/null +++ b/apps/app/src/components/editor/annotations/CreationDialog.tsx @@ -0,0 +1,281 @@ +import { useRef, useState, type RefObject } from 'react' +import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types' +import DiscardConfirm from '@/components/editor/findings/DiscardConfirm' +import ReadOnlyNotice from '@/components/editor/findings/ReadOnlyNotice' +import Button from '@/components/ui/Button' +import Dialog from '@/components/ui/Dialog' +import { creationOpener } from '@/editor/annotations/creationAsk' +import { + confirmAttempt, + createAttempt, + type Attempt, +} from '@/editor/annotations/creationAttempt' +import { + dropCreation, + finishCreation, + patchForm, + replacePoint, + resumeTrace, + setCorrection, +} from '@/editor/annotations/creationWork' +import { answerDrawing, guardDrawing } from '@/editor/annotations/drawingGuard' +import type { MissingField } from '@/editor/annotations/missingFields' +import { + useAnnotationWork, + type Creation, +} from '@/editor/annotations/workStore' +import { visibleElement } from '@/editor/focusRequest' +import { CANVAS_BOX } from '@/editor/useEditorNavigation' +import { usePlaceVisible } from '@/lib/placeVisibility' +import { useT } from '@/i18n/useT' +import { useLocaleStore } from '@/state/localeStore' +import { pluralKey } from '@/editor/plural' +import EditorGlyph from '../EditorGlyph' +import CorrectionNotice from './CorrectionNotice' +import CreationFields from './CreationFields' +import MissingSummary, { focusFirstMissing } from './MissingSummary' + +const ID_PREFIX = 'creation-' + +export interface CreationDialogProps { + doc: AnatomicalSheetDocument + readOnly: boolean + /** The column the dialog sits over (A2); null: centred. */ + anchor: RefObject +} + +/** What « Créer » left on screen: the fields R-3 names, or the core's refusal. */ +interface Outcome { + missing: MissingField[] + messages: string[] +} +const NONE: Outcome = { missing: [], messages: [] } + +/** + * « Créer » and « Utiliser cette position »: one `insertAnnotation` under `accept` (one + * undo); a point lets the core's verdict offer C (C26); a success ends the creation. + */ +function useCreate(work: Creation, created: { current: boolean }) { + const t = useT() + const locale = useLocaleStore((s) => s.locale) + const [outcome, setOutcome] = useState(NONE) + const settle = (attempt: Attempt) => { + if (attempt.status === 'invalid') { + setOutcome({ missing: attempt.missing, messages: [] }) + return focusFirstMissing(ID_PREFIX, attempt.missing) + } + setOutcome({ + missing: [], + messages: attempt.status === 'refused' ? attempt.messages : [], + }) + if (attempt.status === 'correction') setCorrection(attempt.correction) + if (attempt.status !== 'created') return + created.current = true + if (attempt.id) finishCreation(attempt.id, work.pending.kind) + else dropCreation() + } + const input = { ...work, context: { t, locale } } + return { + outcome, + create: () => settle(createAttempt(input, work.form)), + confirm: () => { + const { correction } = work.pending + if (correction) settle(confirmAttempt(input, work.form, correction)) + }, + } +} + +/** « Point placé · Replacer le point », « Zone tracée, 5 sommets · Reprendre le tracé ». */ +function ShapeLine({ work, readOnly }: { work: Creation; readOnly: boolean }) { + const t = useT() + const locale = useLocaleStore((s) => s.locale) + const { kind, geometry } = work.pending + const count = geometry.type === 'polygon' ? geometry.points.length : 0 + const text = + kind === 'point' + ? t('editor.annotations.creation.placed') + : t( + pluralKey( + locale, + `editor.annotations.creation.traced.${kind}`, + count, + ), + ).replace('{count}', String(count)) + const point = kind === 'point' + return ( +
+ + {text} + +
+ ) +} + +/** Board 02: « Abandonner » asks first (A12), « Créer » inserts; the question in its place. */ +function CreationActions({ + readOnly, + onDiscard, +}: { + readOnly: boolean + onDiscard: () => void +}) { + const t = useT() + const asking = useAnnotationWork((s) => s.question?.work === 'creation') + if (asking) { + return ( + answerDrawing(false)} + onDiscard={() => answerDrawing(true)} + /> + ) + } + return ( +
+ + +
+ ) +} + +/** The guard is always armed (A12): ✕, Échap and « Abandonner » ask, even with nothing typed. */ +const askDiscard = () => guardDrawing(() => undefined) + +function CreationBody({ + work, + doc, + readOnly, + created, +}: { + work: Creation + doc: AnatomicalSheetDocument + readOnly: boolean + created: { current: boolean } +}) { + const creating = useCreate(work, created) + const { outcome } = creating + return ( +
{ + event.preventDefault() + if (!readOnly) creating.create() + }} + > + {readOnly && } + + + {work.pending.correction && ( + !readOnly && creating.confirm()} + onCancel={() => setCorrection(null)} + /> + )} + + {outcome.messages.length > 0 && ( +
+ {outcome.messages.map((text) => ( +

{text}

+ ))} +
+ )} + + + ) +} + +/** + * Where the focus goes once the dialog closes (board 32): nowhere after « Créer » (the new + * row takes it), the strip's « Revenir aux propriétés » while the shape is replaced or + * retraced, else what started the creation. + */ +function useCreationReturn(work: Creation | null) { + const last = useRef(null) + const created = useRef(false) + // A new creation starts with no « Créer » behind it. + if (work && last.current === null) created.current = false + last.current = work ?? last.current + const returnFocus = () => { + const ended = last.current + if (useAnnotationWork.getState().creation) { + return ( + visibleElement('[data-back-to-properties]') ?? + visibleElement(CANVAS_BOX) + ) + } + last.current = null + if (created.current || !ended) return null + return creationOpener(ended) + } + return { created, returnFocus } +} + +/** + * « Nouveau point », « Nouvelle zone », « Nouvel accès » (board 02, 04): a modal without a + * history layer over the right column, mounted outside the edit-only body so a read-only + * flip keeps it with its form and ghost, « Créer » disabled (R-14). The shape and the + * form are the work store's: they outlive « Replacer le point » and « Reprendre le tracé ». + */ +export default function CreationDialog(props: CreationDialogProps) { + const t = useT() + const visible = usePlaceVisible() + const work = useAnnotationWork((s) => s.creation) + const back = useCreationReturn(work) + const shown = visible && work !== null && work.dialog + const title = work ? t(`editor.annotations.new.${work.pending.kind}`) : '' + return ( + (askDiscard() ? undefined : 'kept')} + > + {work && ( + + )} + + ) +} diff --git a/apps/app/src/components/editor/annotations/CreationPanel.tsx b/apps/app/src/components/editor/annotations/CreationPanel.tsx deleted file mode 100644 index 79b961d5..00000000 --- a/apps/app/src/components/editor/annotations/CreationPanel.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import { useState, type Dispatch } from 'react' -import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types' -import Button from '@/components/ui/Button' -import type { CommitContext } from '@/editor/annotations/annotationCommit' -import { - emptyForm, - withGeometry, - type CreationForm, - type PendingElement, -} from '@/editor/annotations/creation' -import { - confirmAttempt, - createAttempt, - type Attempt, - type CreationInput, -} from '@/editor/annotations/creationAttempt' -import type { Frame } from '@/editor/annotations/frame' -import type { UiAction } from '@/editor/annotations/uiState' -import { useT } from '@/i18n/useT' -import CorrectionNotice from './CorrectionNotice' -import CreationFields from './CreationFields' -import GeometryGroup from './GeometryGroup' - -export interface CreationPanelProps { - pending: PendingElement - viewId: string - doc: AnatomicalSheetDocument - /** F of the current view; null while it is not measured. */ - frame: Frame | null - dispatch: Dispatch - context: CommitContext -} - -/** What an attempt leaves on screen: the core's words, or the form's own. */ -function messagesOf(attempt: Attempt, words: (problem: string) => string) { - if (attempt.status === 'refused') return attempt.messages - return attempt.status === 'invalid' ? [words(attempt.problem)] : [] -} - -/** - * The typed fields and the outcome of « Créer » / « Utiliser cette position ». The form - * survives a change of the pending geometry (a second click): the panel is not remounted. - */ -function useCreation(props: CreationPanelProps) { - const t = useT() - const [form, setForm] = useState(() => emptyForm(props.doc)) - const [messages, setMessages] = useState([]) - const settle = (attempt: Attempt) => { - const { dispatch, pending } = props - // shortcut: the general lines `editor.annotations.required.{fields,names}` (R-3 removes - // them) stay until Task 7. Upgrade: the creation dialog names each field through - // `missingFields` and the `editor.annotations.missing.*` keys, as the edit form does. - setMessages( - messagesOf(attempt, (p) => t(`editor.annotations.required.${p}`)), - ) - if (attempt.status === 'created') { - dispatch({ type: 'select', id: attempt.id ?? null }) - } - if (attempt.status === 'correction') { - const next = { ...pending, correction: attempt.correction } - dispatch({ type: 'pending_update', pending: next }) - } - } - const input: CreationInput = props - return { - form, - messages, - patch: (change: Partial) => setForm({ ...form, ...change }), - create: () => settle(createAttempt(input, form)), - confirm: () => { - const { correction } = props.pending - if (correction) settle(confirmAttempt(input, form, correction)) - }, - } -} - -/** - * « Nouveau point / Nouvelle zone / Nouvel accès »: the fields the core requires are - * collected first, then « Créer » inserts once through `accept` (no default labels). - * The geometry stays here, outside the document, until then. - */ -export default function CreationPanel(props: CreationPanelProps) { - const t = useT() - const creation = useCreation(props) - const { pending, dispatch } = props - const title = t(`editor.annotations.new.${pending.kind}`) - return ( -
-

- {title} -

- - { - const next = withGeometry(pending, geometry) - dispatch({ type: 'pending_update', pending: next }) - return { ok: true } - }} - /> - {pending.correction && ( - - dispatch({ - type: 'pending_update', - pending: { ...pending, correction: null }, - }) - } - /> - )} - - dispatch({ type: 'pending_drop' })} - /> -
- ) -} - -function CreationActions({ - onCreate, - onCancel, -}: { - onCreate: () => void - onCancel: () => void -}) { - const t = useT() - return ( -
- - -
- ) -} - -function Messages({ messages }: { messages: string[] }) { - if (messages.length === 0) return null - return ( -
- {messages.map((message) => ( -

{message}

- ))} -
- ) -} diff --git a/apps/app/src/components/editor/annotations/DrawingGuardDialog.tsx b/apps/app/src/components/editor/annotations/DrawingGuardDialog.tsx index e2799afc..ce093262 100644 --- a/apps/app/src/components/editor/annotations/DrawingGuardDialog.tsx +++ b/apps/app/src/components/editor/annotations/DrawingGuardDialog.tsx @@ -7,11 +7,14 @@ import ConfirmDialog from '../ConfirmDialog' /** * The drawing guard's question (R-12), mounted with the workspace so it shows whatever * tab is in view: « Continuer » keeps the work, « Abandonner » drops it and makes the move - * that was held. + * that was held. The creation dialog, when shown, asks it in its own footer instead. */ export default function DrawingGuardDialog() { const t = useT() - const question = useAnnotationWork((s) => s.question) + // Over a shown creation dialog the question is that dialog's own (R-12, board 31 D). + const question = useAnnotationWork((s) => + s.question?.work === 'creation' && s.creation?.dialog ? null : s.question, + ) // The title stays while the dialog closes. const title = useRef('') if (question) title.current = t(`editor.annotations.guard.${question.work}`) diff --git a/apps/app/src/components/editor/annotations/EditableAnnotations.tsx b/apps/app/src/components/editor/annotations/EditableAnnotations.tsx index a840519d..3533e6ce 100644 --- a/apps/app/src/components/editor/annotations/EditableAnnotations.tsx +++ b/apps/app/src/components/editor/annotations/EditableAnnotations.tsx @@ -7,6 +7,15 @@ import type { import type { CommitContext } from '@/editor/annotations/annotationCommit' import { useAnnotationRequest } from '@/editor/annotations/focusTarget' import { keyboardPending, type NewKind } from '@/editor/annotations/creation' +import { + creationTracing, + placePending, +} from '@/editor/annotations/creationWork' +import { useCreationFollow } from '@/editor/annotations/useCreationFollow' +import { + useAnnotationWork, + type Creation, +} from '@/editor/annotations/workStore' import { parseFrame, type Frame } from '@/editor/annotations/frame' import { newPointSize } from '@/editor/annotations/pointSize' import { guardDrawing } from '@/editor/annotations/drawingGuard' @@ -24,12 +33,13 @@ import { useLayerFollow, type OpenDialog, } from '@/editor/annotations/dialogOpening' -import { usePlacement } from '@/editor/annotations/usePlacement' +import { creationStart, usePlacement } from '@/editor/annotations/usePlacement' import { useGestureMessage } from '@/editor/annotations/useGestureMessage' import { initialUi, uiReducer, type ToolId, + type Tracing, type UiAction, type UiState, } from '@/editor/annotations/uiState' @@ -46,7 +56,6 @@ import { useT } from '@/i18n/useT' import { useLocaleStore } from '@/state/localeStore' import AnnotationCanvas from './AnnotationCanvas' import { annotationName } from './AnnotationList' -import CreationPanel from './CreationPanel' import GestureMessage from './GestureMessage' import KeyboardAdd from './KeyboardAdd' import OverviewPanel from './OverviewPanel' @@ -73,6 +82,10 @@ export interface Scene { /** F of the current view, only while the core measures it and the build is its own. */ frame: Frame | null selected: Annotation | undefined + /** The creation in progress on this view (A12), the work store's. */ + creation: Creation | null + /** The tracing shown: a redraw's, or the open tracing of a new zone or link. */ + tracing: Tracing | null setRoot: (root: RootAttributes | null) => void navigate: EditorPlaceProps['navigate'] onOpenSection: Props['onOpenSection'] @@ -81,9 +94,9 @@ export interface Scene { /** * The shown view no longer exists (an undo, a deletion in the views section): the full - * reset to the main view drops the pending creation, the tracing and the selection, so - * nothing pending is inserted on another view. It fires only for a view absent from the - * document, since `view` always returns a new state. + * reset to the main view drops the tracing and the selection (a creation on that view is + * dropped by `useCreationFollow`), so nothing pending is inserted on another view. It + * fires only for a view absent from the document, since `view` always returns a new state. */ function useViewFallback( doc: AnatomicalSheetDocument, @@ -100,11 +113,16 @@ function useViewFallback( } /** « Aller à » an annotation: the request, with what it needs of the drawing's state. */ +/** A fresh tracing reads as a tracing; a placed, closed or resumed shape as a creation. */ +function busyOf(creation: Creation | null, ui: UiState) { + if (creation) + return creation.closed || creation.resumed ? 'creation' : 'tracing' + return ui.tracing ? 'tracing' : null +} + function useSceneRequest( { doc, focus, layerId }: Props, - ui: UiState, - viewId: string, - dispatch: Dispatch, + { ui, viewId, dispatch, creation }: SceneCore, ) { useViewFallback(doc, ui.viewId, dispatch) const show = (view: string, id: string) => { @@ -114,7 +132,7 @@ function useSceneRequest( useAnnotationRequest(focus, doc, { viewId, selectedId: ui.selectedId, - busy: ui.pending ? 'creation' : ui.tracing ? 'tracing' : null, + busy: busyOf(creation, ui), show, }) useLayerFollow(layerId, doc, { @@ -125,6 +143,13 @@ function useSceneRequest( }) } +interface SceneCore { + ui: UiState + viewId: string + dispatch: Dispatch + creation: Creation | null +} + function useScene(props: Props): Scene { const { doc, navigate, onOpenSection, onOpen } = props const [ui, dispatch] = useReducer(uiReducer, initialUi) @@ -132,13 +157,17 @@ function useScene(props: Props): Scene { const viewId = ui.viewId ?? mainViewId(doc) const model = useViewModel(doc, viewId) const own = model.measured && root?.viewId === viewId - useSceneRequest(props, ui, viewId, dispatch) + const work = useAnnotationWork((s) => s.creation) + const creation = work?.viewId === viewId ? work : null + useSceneRequest(props, { ui, viewId, dispatch, creation }) return { doc, ui, dispatch, viewId, model, + creation, + tracing: ui.tracing ?? creationTracing(creation, viewId), frame: own ? parseFrame(root.viewBox) : null, selected: model.annotations.find((a) => a.id === ui.selectedId), setRoot, @@ -163,6 +192,7 @@ function useWork(scene: Scene) { const context = useCommitContext() const message = useGestureMessage() const placement = usePlacement({ ...scene, context, message }) + useCreationFollow({ ...scene, message, t: context.t }) const target = movableOf(scene.selected, scene.model, scene.ui.tool) const onDrop = placement.onDrop const edit = usePointEdit({ target, frame: scene.frame, onDrop }) @@ -198,11 +228,11 @@ export default function EditableAnnotations(props: Props) { const { asideRef, byDrawing } = useSelectionEscape( selected?.id ?? null, () => scene.dispatch({ type: 'select', id: null }), - // A redraw's Escape cancels it at once (R-12); a new tracing keeps its own keys. + // A redraw's Escape cancels it at once (R-12); a creation asks (board 32 row 3). visible && - selected !== undefined && + (selected !== undefined || scene.creation !== null) && (ui.tracing === null || ui.tracing.target === 'replace'), - { editable: true, creating: ui.pending !== null }, + { editable: true, creating: scene.creation !== null }, ) return (
@@ -210,7 +240,7 @@ export default function EditableAnnotations(props: Props) {
@@ -283,8 +313,10 @@ function CanvasStage({ const locale = useLocaleStore((s) => s.locale) // Hidden (the editor is read-only): no drag in flight survives, none is committed. const shown = usePlaceVisible() - const { doc, ui, dispatch, model, frame, selected } = scene + const { doc, ui, dispatch, model, selected, creation } = scene const handle = useHandle(shown ? work.target : null, doc) + // A12: during a creation nothing else is selected or opened from the drawing. + const free = creation === null const points = shown ? handledPoints(work.target?.geometry ?? null) : null const zone = points && { annotationId: work.target!.id, points } const view = doc.views.find((v) => v.id === scene.viewId) @@ -296,8 +328,10 @@ function CanvasStage({ viewName={view.name[locale]} tool={ui.tool} selectedId={ui.selectedId} + previewRadius={previewRadiusOf(scene)} + creating={!free} moveTarget={shown ? moveTargetOf(selected, model, ui.tool) : null} - overlay={overlayOf(ui, selected, frame, work.message.message?.place)} + overlay={overlayOf(scene, work.message.message?.place)} handles={{ handle, onKeyDown: work.edit.onHandleKey, @@ -313,48 +347,35 @@ function CanvasStage({ linkDisabled: model.children.length === 0, }} onRoot={scene.setRoot} - onSelect={(id) => dispatch({ type: 'select', id })} - onOpen={(id) => scene.onOpen(id, 'drawing')} + onSelect={(id) => free && dispatch({ type: 'select', id })} + onOpen={(id) => free && scene.onOpen(id, 'drawing')} onPlace={work.placement.onPlace} onDrop={work.placement.onDrop} onHandle={work.zone.onHandle} - onDeselect={onDeselect} + onDeselect={() => free && onDeselect()} onTraceKey={work.placement.onTraceKey} /> ) } -function addAtCentre( - kind: NewKind, - { frame, doc, viewId, ui, dispatch }: Scene, -) { +/** « Ajouter … » (keyboard): the shape at the centre at the A5 size, then its dialog. */ +function addAtCentre(kind: NewKind, scene: Scene) { + const { frame, doc, viewId, ui } = scene if (!frame) return const size = newPointSize(doc.annotations, viewId, frame, ui.size) - dispatch({ type: 'pending_new', pending: keyboardPending(kind, frame, size) }) + const start = creationStart(scene, 'keyboard') + placePending(start, keyboardPending(kind, frame, size)) } -/** The creation panel while an element is pending, else the overview (A3). */ -function SidePanel({ - scene, - context, -}: { - scene: Scene - context: CommitContext -}) { - const { doc, ui, dispatch, frame } = scene - if (ui.pending) { - return ( - - ) - } +/** Board 02 A: the next point's size under a mouse pointer, while the point tool places. */ +function previewRadiusOf({ ui, frame, doc, viewId, creation }: Scene) { + if (ui.tool !== 'point' || !frame || creation?.dialog) return null + return newPointSize(doc.annotations, viewId, frame, ui.size) +} + +/** The overview, during a selection (A3) and a creation alike: the right column never swaps. */ +function SidePanel({ scene }: { scene: Scene }) { + const { doc, ui, dispatch } = scene return ( c.id === id) + return category?.color ?? 'var(--color-accent)' +} + function overlayOf( - ui: UiState, - selected: Annotation | undefined, - frame: Frame | null, + { ui, selected, frame, creation, tracing, doc }: Scene, refused: Geometry | null | undefined, ) { + const placed = creation?.closed ? creation.pending : null return { frame, selectedId: selected?.id ?? null, refused: refused ?? null, selected: selected?.geometry ?? null, - pending: ui.pending?.geometry ?? null, - tracing: ui.tracing?.points ?? null, - correction: ui.pending?.correction ?? null, + pending: placed?.geometry ?? null, + pendingColour: ghostColour(doc, creation), + tracing: tracing?.points ?? null, + correction: placed?.correction ?? null, redrawing: ui.tracing?.target === 'replace', } } diff --git a/apps/app/src/components/editor/annotations/GestureMessage.tsx b/apps/app/src/components/editor/annotations/GestureMessage.tsx index 42427ecd..4706234a 100644 --- a/apps/app/src/components/editor/annotations/GestureMessage.tsx +++ b/apps/app/src/components/editor/annotations/GestureMessage.tsx @@ -2,7 +2,10 @@ import type { ReactNode } from 'react' import { useEditorReadOnly } from '@/editor/editingContext' import type { GestureMessages } from '@/editor/annotations/useGestureMessage' import { canUndo, useEditorStore } from '@/editor/state/editorStore' -import { cancelPending } from '@/editor/annotations/workStore' +import { + cancelPending, + useAnnotationWork, +} from '@/editor/annotations/workStore' import { useT } from '@/i18n/useT' const PILL = @@ -45,6 +48,8 @@ export default function GestureMessage({ function Message({ messages }: { messages: GestureMessages }) { const t = useT() const readOnly = useEditorReadOnly() + // A12: « Défaire » is hidden during a creation; the message itself stays. + const creating = useAnnotationWork((s) => s.creation !== null) const { message, hold } = messages if (!message) return null const error = message.tone === 'error' @@ -65,7 +70,7 @@ function Message({ messages }: { messages: GestureMessages }) { {message.text} - {message.undo && !error && ( + {message.undo && !error && !creating && ( <>
diff --git a/apps/app/src/components/editor/tabs/AnnotationsTab.tsx b/apps/app/src/components/editor/tabs/AnnotationsTab.tsx index 0970b33f..8db80eda 100644 --- a/apps/app/src/components/editor/tabs/AnnotationsTab.tsx +++ b/apps/app/src/components/editor/tabs/AnnotationsTab.tsx @@ -7,6 +7,7 @@ import CatalogueCanvas from '@/components/catalogue/CatalogueCanvas' import AnnotationDialog from '@/components/editor/annotations/AnnotationDialog' import { annotationName } from '@/components/editor/annotations/AnnotationList' import AnnotationReadBody from '@/components/editor/annotations/AnnotationReadBody' +import CreationDialog from '@/components/editor/annotations/CreationDialog' import EditableAnnotations from '@/components/editor/annotations/EditableAnnotations' import EditStrip from '@/components/editor/annotations/EditStrip' import OverviewPanel from '@/components/editor/annotations/OverviewPanel' @@ -68,8 +69,9 @@ function SectionPlace({ } /** - * The drawing workspace: edit or read-only body of the same view, and the properties - * dialog over both, outside the edit-only part so a read-only flip keeps it (R-14). + * The drawing workspace: edit or read-only body of the same view, and the properties and + * creation dialogs over both, outside the edit-only part so a read-only flip keeps them + * (R-14). */ function DrawingPlace(props: AnnotationsTabProps) { const t = useT() @@ -107,6 +109,9 @@ function DrawingPlace(props: AnnotationsTabProps) { returnFocus={dialog.returnFocus} /> )} + {doc && ( + + )} ) } @@ -120,8 +125,8 @@ function SectionBody(props: AnnotationsTabProps & { id: SectionId }) { } /** - * Annotations: the drawing workspace (canvas with its tools, the overview or the creation - * panel, the properties dialog), or one of its full-width sections. Read-only, the same + * Annotations: the drawing workspace (canvas with its tools, the overview, the properties + * and creation dialogs), or one of its full-width sections. Read-only, the same * view is browsable (canvas, list, properties as text) with no tool and no action. * Each section shown so far stays mounted, hidden while another is shown. */ diff --git a/apps/app/src/editor/annotations/creation.ts b/apps/app/src/editor/annotations/creation.ts index 7aeb040b..90e52bde 100644 --- a/apps/app/src/editor/annotations/creation.ts +++ b/apps/app/src/editor/annotations/creation.ts @@ -31,22 +31,7 @@ export interface PendingElement { wantedRadius?: number } -/** The pending element with a geometry the user typed: C and the proposal lapse with it. */ -export function withGeometry( - pending: PendingElement, - geometry: EditableGeometry, -): PendingElement { - const kept = - geometry.type === 'circle' && geometry.r === pending.proposedRadius - return { - ...pending, - geometry, - correction: null, - proposedRadius: kept ? pending.proposedRadius : undefined, - } -} - -/** What the creation panel collects (no default labels: names and laterality are typed). */ +/** What the creation dialog collects (no default labels: names and laterality are typed). */ export interface CreationForm { fr: string en: string @@ -107,23 +92,8 @@ export function keyboardPending( return { kind, geometry: { type: 'polygon', points: centreTriangle(frame) } } } -export type FormProblem = 'names' | 'fields' - const blank = (value: string) => value.trim() === '' -/** Input shape only: what the core requires to exist, collected before the insert. */ -export function formProblem( - kind: NewKind, - form: CreationForm, -): FormProblem | null { - if (form.categoryId === '' || form.laterality === '') return 'fields' - if (kind === 'detail_trigger') { - if (form.opensViewId === '') return 'fields' - return blank(form.fr) !== blank(form.en) ? 'names' : null - } - return blank(form.fr) || blank(form.en) ? 'names' : null -} - const orNull = (value: string): string | null => (blank(value) ? null : value) /** The annotation the form and the pending geometry describe, under a given id. */ diff --git a/apps/app/src/editor/annotations/creationAsk.ts b/apps/app/src/editor/annotations/creationAsk.ts new file mode 100644 index 00000000..77ab0ced --- /dev/null +++ b/apps/app/src/editor/annotations/creationAsk.ts @@ -0,0 +1,34 @@ +import { landAfterModalsClosed } from '@/components/ui/afterModalsClosed' +import { visibleElement } from '../focusRequest' +import { guardDrawing } from './drawingGuard' +import type { NewKind } from './creation' +import { useAnnotationWork, type Creation } from './workStore' + +const TOOL_OF: Record = { + point: 'point', + zone: 'zone', + detail_trigger: 'link', +} + +/** + * Where the focus goes once a creation is abandoned (board 32): the tool's button, or the + * keyboard « Ajouter … » button that started it. + */ +export function creationOpener(work: Creation): HTMLElement | null { + const { kind } = work.pending + if (work.origin === 'keyboard') { + return visibleElement(`[data-add-kind="${kind}"]`) + } + return visibleElement(`[data-tool="${TOOL_OF[kind]}"]`) +} + +/** + * Escape or « Abandonner » outside the dialog (a tracing, a point being replaced): the + * guard is always armed (A12), « Abandonner la création ? » asks; its « Abandonner » + * drops the creation and the focus goes back to what started it. + */ +export function askCreation(): void { + const work = useAnnotationWork.getState().creation + if (!work) return + guardDrawing(() => landAfterModalsClosed(() => creationOpener(work)?.focus())) +} diff --git a/apps/app/src/editor/annotations/creationAttempt.ts b/apps/app/src/editor/annotations/creationAttempt.ts index 95b9e595..22594b0d 100644 --- a/apps/app/src/editor/annotations/creationAttempt.ts +++ b/apps/app/src/editor/annotations/creationAttempt.ts @@ -12,12 +12,12 @@ import { } from './correction' import { annotationOf, - formProblem, type CreationForm, type PendingElement, } from './creation' import { defaultRadius, type Frame } from './frame' import type { EditableGeometry } from './geometryEdit' +import { missingFields, type MissingField } from './missingFields' /** What « Créer » or the confirmation of C works from. */ export interface CreationInput { @@ -28,7 +28,10 @@ export interface CreationInput { context: CommitContext } -export type Attempt = PointAttempt | { status: 'invalid'; problem: string } +/** `invalid`: the fields R-3 names as missing, nothing tried. */ +export type Attempt = + | PointAttempt + | { status: 'invalid'; missing: MissingField[] } /** The insert of the pending element under a given geometry, through `accept`. */ function inserterOf(input: CreationInput, form: CreationForm) { @@ -46,8 +49,8 @@ export function createAttempt( form: CreationForm, ): Attempt { const { pending, frame } = input - const problem = formProblem(pending.kind, form) - if (problem) return { status: 'invalid', problem } + const missing = missingFields(pending.kind, form) + if (missing.length > 0) return { status: 'invalid', missing } const insert = inserterOf(input, form) const { geometry } = pending if (pending.kind === 'point' && geometry.type === 'circle' && frame) { diff --git a/apps/app/src/editor/annotations/creationWork.ts b/apps/app/src/editor/annotations/creationWork.ts new file mode 100644 index 00000000..2efa1e1a --- /dev/null +++ b/apps/app/src/editor/annotations/creationWork.ts @@ -0,0 +1,149 @@ +import type { Point } from '@faunosteo/core-wasm/types' +import type { CreationForm, NewKind, PendingElement } from './creation' +import type { Correction } from './correction' +import type { Frame } from './frame' +import type { Tracing } from './uiState' +import { useAnnotationWork, type Creation } from './workStore' + +/** Where a creation starts: its view, F, how it began, and the form it starts with. */ +export interface CreationStart { + viewId: string + frame: Frame | null + origin: Creation['origin'] + form: CreationForm +} + +const creation = () => useAnnotationWork.getState().creation + +function patch(change: Partial): void { + const current = creation() + if (current) + useAnnotationWork.setState({ creation: { ...current, ...change } }) +} + +/** + * A placed point or a keyboard shape: the dialog opens (A2). A creation of the same kind + * keeps its form (« Replacer le point »: the next click moves the ghost). + */ +export function placePending( + start: CreationStart, + pending: PendingElement, +): void { + const kept = creation() + const same = kept !== null && kept.pending.kind === pending.kind + useAnnotationWork.setState({ + creation: { + ...start, + form: same ? kept.form : start.form, + resumed: same ? kept.resumed : false, + pending, + closed: true, + dialog: true, + }, + }) +} + +const polygonOf = (kind: NewKind, points: Point[]): PendingElement => ({ + kind, + geometry: { type: 'polygon', points }, +}) + +/** The open tracing's vertices; none when no tracing of a new shape is open. */ +const tracedPoints = (work: Creation | null): Point[] | null => + work && !work.closed && work.pending.geometry.type === 'polygon' + ? work.pending.geometry.points + : null + +/** A vertex of a new zone or link: the first one starts the creation (A12). */ +export function traceVertex( + start: CreationStart, + kind: NewKind, + point: Point, +): void { + const points = tracedPoints(creation()) + if (points) return patch({ pending: polygonOf(kind, [...points, point]) }) + useAnnotationWork.setState({ + creation: { + ...start, + pending: polygonOf(kind, [point]), + closed: false, + dialog: false, + resumed: false, + }, + }) +} + +/** Backspace or « Retirer le dernier sommet »; a fresh tracing left empty is no creation. */ +export function popVertex(): void { + const work = creation() + const points = tracedPoints(work) + if (!work || !points) return + const left = points.slice(0, -1) + if (left.length === 0 && !work.resumed) return dropCreation() + patch({ pending: polygonOf(work.pending.kind, left) }) +} + +/** The tracing closes (three vertices at least): « Nouvelle zone » opens. */ +export function closeTrace(): boolean { + const points = tracedPoints(creation()) + if (!points || points.length < 3) return false + patch({ closed: true, dialog: true }) + return true +} + +/** « Reprendre le tracé »: the dialog hides, the vertices and the form are kept. */ +export function resumeTrace(): void { + patch({ closed: false, dialog: false, resumed: true }) +} + +/** « Replacer le point »: the dialog hides; the next click moves the ghost. */ +export function replacePoint(): void { + patch({ dialog: false, resumed: true }) +} + +/** « Revenir aux propriétés »: a resumed tracing closes again, a point shows its dialog. */ +export function backToProperties(): boolean { + const work = creation() + if (!work) return false + if (work.closed) { + patch({ dialog: true }) + return true + } + return closeTrace() +} + +export function patchForm(change: Partial): void { + const work = creation() + if (work) patch({ form: { ...work.form, ...change } }) +} + +/** Candidate C offered by the core's verdict (C26), or withdrawn. */ +export function setCorrection(correction: Correction | null): void { + const work = creation() + if (work) patch({ pending: { ...work.pending, correction } }) +} + +/** « Abandonner », or a guard's « Abandonner »: nothing of the creation is left. */ +export function dropCreation(): void { + useAnnotationWork.setState({ creation: null }) +} + +/** « Créer » succeeded: the creation ends, the drawing selects `id` (A7). */ +export function finishCreation(id: string, kind: NewKind): void { + useAnnotationWork.setState({ creation: null, created: { id, kind } }) +} + +/** The open tracing of a new shape on `viewId`, as the drawing reads a tracing. */ +export function creationTracing( + work: Creation | null, + viewId: string, +): Tracing | null { + const points = tracedPoints(work) + if (!work || !points || work.viewId !== viewId) return null + return { + target: work.pending.kind, + annotationId: null, + points, + refused: false, + } +} diff --git a/apps/app/src/editor/annotations/deselect.ts b/apps/app/src/editor/annotations/deselect.ts index 99de25c6..5bf92224 100644 --- a/apps/app/src/editor/annotations/deselect.ts +++ b/apps/app/src/editor/annotations/deselect.ts @@ -9,6 +9,7 @@ import { } from '@/editor/focusRequest' import { CANVAS_BOX } from '@/editor/useEditorNavigation' import { useT } from '@/i18n/useT' +import { askCreation } from './creationAsk' import { commitFocusedSeries } from './drawingGuard' import { escapeAction, type EscapeAction } from './escape' import { endMode, useAnnotationWork } from './workStore' @@ -121,8 +122,9 @@ function runEscape(action: EscapeAction, deselect: () => boolean): boolean { else if (action === 'drop_mode') endMode() else if (action === 'unchoose') useAnnotationWork.setState({ chosen: null }) else if (action === 'deselect') return deselect() - // `ask_creation`: the creation dialog asks (U2 Task 7); nothing here yet. - return action !== null && action !== 'ask_creation' + // The dialog hidden (a tracing, a point being replaced): « Abandonner la création ? ». + else if (action === 'ask_creation') askCreation() + return action !== null } /** Where Escape applies: the editable body runs the work order; the read-only twin deselects. */ diff --git a/apps/app/src/editor/annotations/drawingGuard.ts b/apps/app/src/editor/annotations/drawingGuard.ts index a56d9e04..3123df38 100644 --- a/apps/app/src/editor/annotations/drawingGuard.ts +++ b/apps/app/src/editor/annotations/drawingGuard.ts @@ -28,21 +28,30 @@ function endModeOnly(): void { * (false). */ export function guardDrawing(proceed: () => void): boolean { - const work = guardWork(useAnnotationWork.getState()) + const state = useAnnotationWork.getState() + const work = guardWork(state) if (work === null) { commitFocusedSeries() endModeOnly() return true } - useAnnotationWork.setState({ question: { work, proceed } }) + // A question already open keeps its own move (a Back over it is not replayed). + if (state.question === null) { + useAnnotationWork.setState({ question: { work, proceed } }) + } return false } -/** « Continuer » keeps the work as it is; « Abandonner » drops it and makes the move. */ +/** + * « Continuer » keeps the work as it is; « Abandonner » drops the work the question + * named (the mode, or the whole creation) and makes the move. + */ export function answerDrawing(discard: boolean): void { const { question } = useAnnotationWork.getState() useAnnotationWork.setState({ question: null }) if (!discard || !question) return - endMode() + if (question.work === 'creation') + useAnnotationWork.setState({ creation: null }) + else endMode() question.proceed() } diff --git a/apps/app/src/editor/annotations/focusTarget.ts b/apps/app/src/editor/annotations/focusTarget.ts index 4a9356c2..a0ee6a25 100644 --- a/apps/app/src/editor/annotations/focusTarget.ts +++ b/apps/app/src/editor/annotations/focusTarget.ts @@ -35,13 +35,13 @@ export interface DrawingState { } const BUSY_TARGET = { - creation: '[data-creation-heading]', + creation: '[data-creation-focus]', tracing: '[data-testid="tracing-commands"]', } as const const focusFirst = (selector: string) => visibleElement(selector)?.focus() -/** A creation or tracing in progress keeps the request: focus its panel, say why. */ +/** A creation or tracing in progress keeps the request: focus its dialog or the strip, say why. */ function keepBusy( busy: NonNullable, announce: (text: string) => void, diff --git a/apps/app/src/editor/annotations/stripLead.ts b/apps/app/src/editor/annotations/stripLead.ts index 7eef09cb..54561926 100644 --- a/apps/app/src/editor/annotations/stripLead.ts +++ b/apps/app/src/editor/annotations/stripLead.ts @@ -10,7 +10,8 @@ import type { Locale } from '@/i18n/types' import { pluralKey } from '../plural' import type { PendingElement } from './creation' import { HANDLE_CAP } from './polygonEdit' -import type { ToolId, Tracing, UiState } from './uiState' +import type { ToolId, Tracing } from './uiState' +import type { Creation } from './workStore' /** The strip's left part: what is selected or in progress, then its type and detail. */ export interface StripLead { @@ -130,6 +131,27 @@ function pendingLead(pending: PendingElement, ctx: LeadContext): StripLead { } } +/** + * A creation whose dialog is shown or was (board 04 C): placed or closed, waiting for its + * properties; a point being replaced says where to click; a resumed tracing says the + * input is kept. A fresh tracing reads as a tracing. + */ +function creationLead(work: Creation, ctx: LeadContext): StripLead | null { + const { pending } = work + const title = ctx.t(`editor.annotations.new.${pending.kind}`) + const icon = ICON[pending.kind] + if (work.closed && !work.dialog && pending.geometry.type === 'circle') { + return { + title, + detail: ctx.t('editor.annotations.strip.place_point'), + icon, + } + } + if (work.closed) return pendingLead(pending, ctx) + if (!work.resumed) return null + return { title, detail: ctx.t('editor.annotations.strip.resumed'), icon } +} + const TOOL_LEAD: Record< ToolId, { title: string; detail: string; icon: GlyphName } @@ -156,14 +178,22 @@ const TOOL_LEAD: Record< }, } +/** What the strip reads of the drawing: the tool, the tracing shown, the creation. */ +export interface LeadState { + tool: ToolId + tracing: Tracing | null + creation?: Creation | null +} + /** What the strip leads with: a creation, then a tracing, then the selection, then the tool. */ export function stripLeadOf( - ui: UiState, + ui: LeadState, selected: Annotation | undefined, doc: AnatomicalSheetDocument, ctx: LeadContext, ): StripLead { - if (ui.pending) return pendingLead(ui.pending, ctx) + const creation = ui.creation ? creationLead(ui.creation, ctx) : null + if (creation) return creation if (ui.tracing) { const replaced = doc.annotations.find( (a) => a.id === ui.tracing?.annotationId, diff --git a/apps/app/src/editor/annotations/uiState.ts b/apps/app/src/editor/annotations/uiState.ts index baf713c4..cbaf4251 100644 --- a/apps/app/src/editor/annotations/uiState.ts +++ b/apps/app/src/editor/annotations/uiState.ts @@ -1,9 +1,12 @@ import type { Point } from '@faunosteo/core-wasm/types' -import type { NewKind, PendingElement } from './creation' +import type { NewKind } from './creation' export type ToolId = 'select' | 'point' | 'zone' | 'link' -/** A tracing in progress: a new zone or link, or a polygon replacing a geometry. */ +/** + * A tracing in progress: a new zone or link, or a polygon replacing a geometry. Only a + * redraw's tracing is the reducer's; a new shape's lives in the creation (work store). + */ export interface Tracing { target: NewKind | 'replace' /** The annotation whose geometry the tracing replaces (target `replace`). */ @@ -17,9 +20,6 @@ export interface UiState { viewId: string | null tool: ToolId selectedId: string | null - pending: PendingElement | null - /** Bumped by every new pending element: keys the creation form's own state. */ - serial: number tracing: Tracing | null hint: string | null /** The overview's « Filtrer par nom » term: it outlives a selection, not a view. */ @@ -32,9 +32,6 @@ export type UiAction = | { type: 'view'; viewId: string } | { type: 'tool'; tool: ToolId } | { type: 'select'; id: string | null } - | { type: 'pending_new'; pending: PendingElement } - | { type: 'pending_update'; pending: PendingElement } - | { type: 'pending_drop' } | { type: 'trace_start'; target: Tracing['target']; annotationId?: string } | { type: 'trace_add'; point: Point } | { type: 'trace_pop' } @@ -48,8 +45,6 @@ export const initialUi: UiState = { viewId: null, tool: 'select', selectedId: null, - pending: null, - serial: 0, tracing: null, hint: null, filter: '', @@ -88,32 +83,13 @@ export function uiReducer(state: UiState, action: UiAction): UiState { ...state, tool: toolAfterTracing(state), selectedId: action.id, - pending: null, tracing: null, hint: null, } - case 'pending_new': - return { - ...state, - pending: action.pending, - // A second click with the same kind keeps the typed fields (same panel). - serial: - state.pending?.kind === action.pending.kind - ? state.serial - : state.serial + 1, - selectedId: null, - tracing: null, - hint: null, - } - case 'pending_update': - return state.pending ? { ...state, pending: action.pending } : state - case 'pending_drop': - return { ...state, pending: null, hint: null } case 'trace_start': return { ...state, tool: TOOL_OF[action.target], - pending: null, hint: null, tracing: { target: action.target, diff --git a/apps/app/src/editor/annotations/useCreationFollow.ts b/apps/app/src/editor/annotations/useCreationFollow.ts new file mode 100644 index 00000000..90dfeaf6 --- /dev/null +++ b/apps/app/src/editor/annotations/useCreationFollow.ts @@ -0,0 +1,75 @@ +import { useEffect, useRef, type Dispatch } from 'react' +import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types' +import { landAfterModalsClosed } from '@/components/ui/afterModalsClosed' +import type { NewKind } from './creation' +import { dropCreation } from './creationWork' +import { focusRowOrDrawing } from './deselect' +import type { ToolId, UiAction, UiState } from './uiState' +import type { GestureMessages } from './useGestureMessage' +import { useAnnotationWork, type Creation } from './workStore' + +const TOOL_OF: Record = { + point: 'point', + zone: 'zone', + detail_trigger: 'link', +} + +export interface CreationFollow { + doc: AnatomicalSheetDocument + ui: UiState + dispatch: Dispatch + creation: Creation | null + message: Pick + t: (key: string) => string +} + +/** + * The drawing kept in step with the creation: nothing selected once its shape is placed, its tool + * on while the dialog is hidden (« Replacer le point » places with the point tool, a + * resumed tracing traces), and dropped when its view no longer exists. + */ +function useDrawingFollows({ doc, ui, dispatch, creation }: CreationFollow) { + const wanted = + creation && !creation.dialog ? TOOL_OF[creation.pending.kind] : null + // A placed or closed shape takes the stage; a fresh tracing keeps the selection under + // it, as before, so abandoning it gives the selection back. + const selected = creation?.closed === true && ui.selectedId !== null + const gone = + creation !== null && !doc.views.some((v) => v.id === creation.viewId) + useEffect(() => { + if (wanted && wanted !== ui.tool) dispatch({ type: 'tool', tool: wanted }) + }, [wanted, ui.tool, dispatch]) + useEffect(() => { + if (selected) dispatch({ type: 'select', id: null }) + }, [selected, dispatch]) + useEffect(() => { + if (gone) dropCreation() + }, [gone]) +} + +/** + * « Créer » succeeded (A7): the tool goes back to « Sélectionner », the new annotation is + * selected, the line under the drawing says « Point créé · Défaire » and the focus goes to + * its row once the dialog has closed (board 32). + */ +function useCreatedFollows({ dispatch, message, t }: CreationFollow) { + const created = useAnnotationWork((s) => s.created) + const latest = useRef({ message, t }) + latest.current = { message, t } + useEffect(() => { + if (!created) return + useAnnotationWork.setState({ created: null }) + dispatch({ type: 'tool', tool: 'select' }) + dispatch({ type: 'select', id: created.id }) + const text = latest.current.t( + `editor.annotations.message.created.${created.kind}`, + ) + latest.current.message.show(text, { undo: true, tone: 'info' }) + landAfterModalsClosed(() => void focusRowOrDrawing(created.id)) + }, [created, dispatch]) +} + +export function useCreationFollow(input: CreationFollow): void { + useDrawingFollows(input) + useCreatedFollows(input) +} diff --git a/apps/app/src/editor/annotations/usePlacement.ts b/apps/app/src/editor/annotations/usePlacement.ts index 6bbf1eb2..71586bc0 100644 --- a/apps/app/src/editor/annotations/usePlacement.ts +++ b/apps/app/src/editor/annotations/usePlacement.ts @@ -7,7 +7,15 @@ import type { } from '@faunosteo/core-wasm/types' import { useT } from '@/i18n/useT' import { updateGeometry, type CommitContext } from './annotationCommit' -import { pendingForClick, type NewKind } from './creation' +import { emptyForm, pendingForClick, type NewKind } from './creation' +import { + closeTrace, + placePending, + popVertex, + traceVertex, + type CreationStart, +} from './creationWork' +import { askCreation } from './creationAsk' import { round2, type Frame, type XY } from './frame' import { newPointSize } from './pointSize' import { endMode, useAnnotationWork } from './workStore' @@ -22,6 +30,8 @@ const TOOL_TARGET: Record, NewKind> = { export interface PlacementInput { ui: UiState + /** The tracing shown: a redraw's (the reducer's) or a new shape's (the creation's). */ + tracing: Tracing | null dispatch: Dispatch frame: Frame | null doc: AnatomicalSheetDocument @@ -64,44 +74,52 @@ function closeRedraw(input: PlacementInput, tracing: Tracing): void { input.message.show(text, { undo: true, tone: 'info' }) } -/** Tracing with the zone and link tools: vertices, closing, Enter, Backspace and Escape. */ +/** Where a creation on this view starts: F, the origin, a fresh form (A4). */ +export const creationStart = ( + { viewId, frame, doc }: Pick, + origin: CreationStart['origin'], +): CreationStart => ({ viewId, frame, origin, form: emptyForm(doc) }) + +const isRedraw = (tracing: Tracing | null) => tracing?.target === 'replace' + +/** + * Tracing with the zone and link tools: vertices, closing, Enter, Backspace and Escape. A + * redraw's tracing is the reducer's; a new shape's is the creation's (A12): its Escape + * asks « Abandonner la création ? » (board 32 row 3). + */ function tracingActions(input: PlacementInput) { - const { ui, dispatch } = input + const { tracing, dispatch } = input const closeTracing = () => { - const tracing = ui.tracing if (!tracing || tracing.points.length < 3) return - if (tracing.target === 'replace') return closeRedraw(input, tracing) - const pending = { - kind: tracing.target, - geometry: { type: 'polygon' as const, points: tracing.points }, - } - dispatch({ type: 'pending_new', pending }) + if (isRedraw(tracing)) return closeRedraw(input, tracing) + closeTrace() } const trace = ( tool: Exclude, at: XY, reach: number, ) => { - if (ui.tracing && nearFirstVertex(ui.tracing, at, reach)) { - return closeTracing() - } - if (!ui.tracing) - dispatch({ type: 'trace_start', target: TOOL_TARGET[tool] }) - dispatch({ type: 'trace_add', point: asPoint(at) }) + if (tracing && nearFirstVertex(tracing, at, reach)) return closeTracing() + if (isRedraw(tracing)) + return dispatch({ type: 'trace_add', point: asPoint(at) }) + traceVertex(creationStart(input, 'tool'), TOOL_TARGET[tool], asPoint(at)) } + const pop = () => + isRedraw(tracing) ? dispatch({ type: 'trace_pop' }) : popVertex() const onTraceKey = (event: KeyboardEvent) => { - if (!ui.tracing) return + if (!tracing) return if (event.key === 'Enter') closeTracing() if (event.key === 'Backspace') { event.preventDefault() - dispatch({ type: 'trace_pop' }) + pop() } if (event.key === 'Escape') { event.preventDefault() - dispatch({ type: 'trace_cancel' }) + if (isRedraw(tracing)) dispatch({ type: 'trace_cancel' }) + else askCreation() } } - return { closeTracing, trace, onTraceKey } + return { closeTracing, trace, onTraceKey, pop } } /** @@ -174,7 +192,8 @@ export function usePlacement(input: PlacementInput) { const size = newPointSize(doc.annotations, viewId, frame, ui.size) const outcome = pendingForClick(frame, at, size) if (outcome.kind === 'pending') { - return dispatch({ type: 'pending_new', pending: outcome.pending }) + dispatch({ type: 'hint', hint: null }) + return placePending(creationStart(input, 'tool'), outcome.pending) } dispatch({ type: 'hint', hint: t('editor.annotations.outside') }) } @@ -183,6 +202,6 @@ export function usePlacement(input: PlacementInput) { onDrop: dropAction(input), onTraceKey: tracing.onTraceKey, closeTracing: tracing.closeTracing, - popVertex: () => dispatch({ type: 'trace_pop' }), + popVertex: tracing.pop, } } diff --git a/apps/app/src/editor/annotations/workStore.ts b/apps/app/src/editor/annotations/workStore.ts index 9da66847..b17d3bd4 100644 --- a/apps/app/src/editor/annotations/workStore.ts +++ b/apps/app/src/editor/annotations/workStore.ts @@ -1,6 +1,7 @@ import { create } from 'zustand' import type { Geometry } from '@faunosteo/core-wasm/types' -import type { CreationForm, PendingElement } from './creation' +import type { CreationForm, NewKind, PendingElement } from './creation' +import type { Frame } from './frame' /** A geometry shown but not committed, stamped with the document text it was computed on. */ export interface Preview { @@ -14,13 +15,29 @@ export interface Chosen { vertex: number base: string } +/** + * A creation in progress (A12): the only owner of the new shape and of its form, read by + * the drawing and by the creation dialog, which lives outside the edit-only body (R-14). + */ export interface Creation { + viewId: string + /** F of the view when the shape was placed: the point's verdict works from it. */ + frame: Frame | null + /** A tool on the drawing, or a keyboard « Ajouter … » (where the focus goes back). */ + origin: 'tool' | 'keyboard' /** A new zone or link being traced lives here from its first vertex (`closed` false). */ pending: PendingElement closed: boolean form: CreationForm /** The dialog is shown; false while the shape is replaced or the trace resumed. */ dialog: boolean + /** The dialog was shown once: « Replacer le point » or « Reprendre le tracé » ran. */ + resumed: boolean +} +/** The annotation « Créer » just inserted: the drawing selects it and says so (A7). */ +export interface Created { + id: string + kind: NewKind } /** * A move mode or a redraw, stamped with the document text it started on; `started` once @@ -42,6 +59,7 @@ export interface DrawingQuestion { } interface Work { creation: Creation | null + created: Created | null mode: ModeWork | null preview: Preview | null chosen: Chosen | null @@ -51,6 +69,7 @@ interface Work { } const NO_WORK: Work = { creation: null, + created: null, mode: null, preview: null, chosen: null, diff --git a/apps/app/src/editor/history/useEditorHistory.ts b/apps/app/src/editor/history/useEditorHistory.ts index bd9d9448..ae6421c0 100644 --- a/apps/app/src/editor/history/useEditorHistory.ts +++ b/apps/app/src/editor/history/useEditorHistory.ts @@ -10,6 +10,7 @@ import { landAfterModalsClosed, } from '@/components/ui/afterModalsClosed' import { guardDrawing } from '../annotations/drawingGuard' +import { useAnnotationWork } from '../annotations/workStore' import { focusActiveTab } from '../focusRequest' import { LAYERS_TOP_DOWN } from '../leftDraft' import { citationsOfView, sameView, type EditorView } from '../navigation' @@ -251,6 +252,9 @@ function refusal( const { nav, view } = ctx if (document.querySelector('dialog[open]:not([data-layer])')) { nav.guards.askAll(false) + // The creation dialog is such a modal: its « Abandonner la création ? » shows inside. + if (useAnnotationWork.getState().creation?.dialog) + guardDrawing(() => undefined) return 'modal' } const leaving = leavingLayers(view, entry?.view ?? ctx.defaultView) diff --git a/apps/app/src/editor/useUndoShortcuts.ts b/apps/app/src/editor/useUndoShortcuts.ts index ddc60710..cb489024 100644 --- a/apps/app/src/editor/useUndoShortcuts.ts +++ b/apps/app/src/editor/useUndoShortcuts.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { cancelPending } from './annotations/workStore' +import { cancelPending, useAnnotationWork } from './annotations/workStore' import { isTextField } from './focusRequest' import { useEditorStore } from './state/editorStore' @@ -17,6 +17,8 @@ export function useUndoShortcuts(writable: boolean): void { // A text field keeps its own undo; a slider or a checkbox does not (R-13). if (isTextField(event.target)) return if (document.querySelector(MODAL_OPEN)) return + // A12: undo is inactive during a creation, its dialog shown or not (R-13). + if (useAnnotationWork.getState().creation) return if (!(event.ctrlKey || event.metaKey) || event.key.toLowerCase() !== 'z') return event.preventDefault() diff --git a/apps/app/src/i18n/en.ts b/apps/app/src/i18n/en.ts index 49e8ee45..38c21ecf 100644 --- a/apps/app/src/i18n/en.ts +++ b/apps/app/src/i18n/en.ts @@ -35,8 +35,7 @@ export const en: Dict = { 'home.import.error_incompatible_version': 'This PDF uses format v{version}, which this version of the application cannot read (accepted formats: v2 and v3).', 'home.import.complete': 'Full restoration.', - 'home.import.degraded': - 'Partial recovery: check the items flagged below.', + 'home.import.degraded': 'Partial recovery: check the items flagged below.', 'home.import.migrated': 'Report imported from an older format. Findings not found in the current sheet: {count} (kept with their labels).', 'home.import.archive_ok': @@ -88,55 +87,42 @@ export const en: Dict = { "This tab's storage is full: your latest changes are no longer saved in the tab. Export the PDF to keep them.", 'session.held.notice': "Some data in this tab could not be set aside in the browser's storage (not enough space, or the slot is taken). It is kept as it is; nothing was deleted. Until it is resolved, no report can be created or imported in this tab.", - 'session.held.draft_unreadable': - "Draft this version cannot read ({size})", + 'session.held.draft_unreadable': 'Draft this version cannot read ({size})', 'session.held.draft_pre_rebase': - "Draft to adapt to the current anatomical sheet; its original could not be set aside ({size})", + 'Draft to adapt to the current anatomical sheet; its original could not be set aside ({size})', 'session.held.archive_unreadable': - "Archive of the imported report, unreadable ({size})", + 'Archive of the imported report, unreadable ({size})', 'session.held.archive_companion': - "Archive of the imported report that goes with this draft ({size})", - 'session.held.size_kb': - "{n} KB", - 'session.held.download': - "Download a copy", - 'session.held.download_original': - "Download the original", - 'session.held.discard': - "Delete permanently…", - 'session.held.open_adapted': - "Open the adapted version…", - 'session.held.retry': - "Retry", - 'session.held.discard_title_draft': - "Delete this draft permanently?", - 'session.held.discard_title_archive': - "Delete this archive permanently?", + 'Archive of the imported report that goes with this draft ({size})', + 'session.held.size_kb': '{n} KB', + 'session.held.download': 'Download a copy', + 'session.held.download_original': 'Download the original', + 'session.held.discard': 'Delete permanently…', + 'session.held.open_adapted': 'Open the adapted version…', + 'session.held.retry': 'Retry', + 'session.held.discard_title_draft': 'Delete this draft permanently?', + 'session.held.discard_title_archive': 'Delete this archive permanently?', 'session.held.discard_body': - "This text will be erased from this tab and cannot be recovered. Download a copy first to keep it.", - 'session.held.discard_confirm': - "Delete", - 'session.held.open_title': - "Open the adapted version?", + 'This text will be erased from this tab and cannot be recovered. Download a copy first to keep it.', + 'session.held.discard_confirm': 'Delete', + 'session.held.open_title': 'Open the adapted version?', 'session.held.open_body': - "The original will be replaced in this tab by the version adapted to the current anatomical sheet (items not found are kept with their labels). Download the original first to keep it.", - 'session.held.open_confirm': - "Open", + 'The original will be replaced in this tab by the version adapted to the current anatomical sheet (items not found are kept with their labels). Download the original first to keep it.', + 'session.held.open_confirm': 'Open', 'session.held_blocked': - "A draft in this tab must be recovered or deleted first: it could not be set aside and would be overwritten. The editor will open to resolve it.", + 'A draft in this tab must be recovered or deleted first: it could not be set aside and would be overwritten. The editor will open to resolve it.', 'session.held.notice_engine': "Faunosteo's computation engine cannot open a draft of this tab. It is kept as is; nothing was deleted. Download a copy, try again, or delete it to start a new report.", 'session.held.draft_engine_failure': - "Draft the computation engine cannot open ({size})", + 'Draft the computation engine cannot open ({size})', 'session.held_blocked_engine': - "A draft of this tab makes the computation engine fail: recover or delete it first. The editor will open to resolve it.", + 'A draft of this tab makes the computation engine fail: recover or delete it first. The editor will open to resolve it.', 'session.replace.title': 'Replace the report in progress?', 'session.replace.body': - "The report of {animal} will be replaced in this tab. Export it as a PDF to keep it.", + 'The report of {animal} will be replaced in this tab. Export it as a PDF to keep it.', 'session.replace.body_unloaded': - "The report in progress in this tab will be replaced. Open it and export it as a PDF to keep it.", - 'session.replace.unsaved': - "Its latest changes are not saved in this tab.", + 'The report in progress in this tab will be replaced. Open it and export it as a PDF to keep it.', + 'session.replace.unsaved': 'Its latest changes are not saved in this tab.', 'session.replace.open': 'Open the report in progress', 'session.replace.confirm': 'Replace', 'editor.edit_infos': 'Edit info', @@ -224,7 +210,7 @@ export const en: Dict = { "Faunosteo's computation engine stopped after several errors, and this tab's storage is full: your latest changes are not saved and would be lost if you reload the page. Download a copy before reloading.", 'core.reload': 'Reload the page', 'canvas.view_unavailable': - "This anatomical view cannot be displayed: its drawing was refused by the safety checks or could not be composed. Your report is not changed.", + 'This anatomical view cannot be displayed: its drawing was refused by the safety checks or could not be composed. Your report is not changed.', 'core.action_failed': 'This action could not be applied. Try again; your report was not changed.', @@ -341,10 +327,12 @@ export const en: Dict = { 'auth.failure.invalid_credentials': 'Incorrect email or password.', 'auth.failure.email_not_confirmed': 'Your email address is not confirmed yet. Open the link you received by email.', - 'auth.failure.user_exists': 'An account already exists with this email address.', + 'auth.failure.user_exists': + 'An account already exists with this email address.', 'auth.failure.weak_password': 'Password too weak: at least 12 characters, with a lowercase letter, an uppercase letter and a digit.', - 'auth.failure.same_password': 'The new password must differ from the old one.', + 'auth.failure.same_password': + 'The new password must differ from the old one.', 'auth.failure.invalid_email': 'This email address is not accepted.', 'auth.failure.rate_limited': 'Too many attempts. Wait a few minutes before trying again.', @@ -440,7 +428,8 @@ export const en: Dict = { 'The language is saved on your account and applies on every device.', 'account.preferences.language': 'Language', 'account.preferences.timezone': 'Time zone', - 'account.preferences.timezone_hint': 'Used for dates and future appointments.', + 'account.preferences.timezone_hint': + 'Used for dates and future appointments.', 'account.security.title': 'Security', 'account.security.description': 'Password and sessions.', 'account.security.email_label': 'Sign-in address', @@ -475,8 +464,7 @@ export const en: Dict = { 'Unsupported format: choose a JPEG, PNG or WebP image.', 'account.avatar.error.rate_limited': 'Too many attempts. Try again in an hour.', - 'account.avatar.error.storage_full': - 'Storage is full. Try again later.', + 'account.avatar.error.storage_full': 'Storage is full. Try again later.', 'account.avatar.error.upload_missing': 'The upload did not complete. Try again.', 'account.avatar.error.invalid_state': @@ -801,8 +789,7 @@ export const en: Dict = { 'relations.failure.already_ended': 'This relation has already ended.', 'relations.failure.session_expired': 'Your session has expired. Sign in again.', - 'relations.failure.network': - 'No connection. Check your network, then retry.', + 'relations.failure.network': 'No connection. Check your network, then retry.', 'relations.failure.unavailable': 'The service is not answering right now. Retry.', 'relations.title': 'Linked clients', @@ -829,12 +816,12 @@ export const en: Dict = { 'relations.panel.save_animal': 'Link this animal', 'relations.panel.saving': 'Saving…', 'relations.picker.client_label': 'Search a client', - 'relations.picker.client_hint': - 'Active clients: name, city, email or phone', + 'relations.picker.client_hint': 'Active clients: name, city, email or phone', 'relations.picker.client_results': 'Suggested clients', 'relations.picker.client_none': 'No active client matches.', 'relations.picker.animal_label': 'Search an animal', - 'relations.picker.animal_hint': 'Active animals: name, breed or species detail', + 'relations.picker.animal_hint': + 'Active animals: name, breed or species detail', 'relations.picker.animal_results': 'Suggested animals', 'relations.picker.animal_none': 'No active animal matches.', 'relations.picker.loading': 'Searching…', @@ -862,23 +849,28 @@ export const en: Dict = { 'relations.error.end_before_start': 'The end cannot come before the start.', // V1-2.5: catalogue and administration entries, access denied, MFA - 'auth.failure.aal2_required': 'Your account is protected by two-factor authentication: enter a code from your authenticator app first.', + 'auth.failure.aal2_required': + 'Your account is protected by two-factor authentication: enter a code from your authenticator app first.', 'shell.nav.anatomy': 'Anatomical sheets', 'shell.nav.admin': 'Administration', 'access_denied.title': 'Access denied', 'access_denied.body': "You don't have permission to access this page.", 'access_denied.back': 'Back to dashboard', 'permissions_unavailable.title': 'Unable to verify your permissions', - 'permissions_unavailable.body': 'The check did not complete, probably because of a connection problem. This error does not change your permissions.', + 'permissions_unavailable.body': + 'The check did not complete, probably because of a connection problem. This error does not change your permissions.', 'admin.sheets.title': 'Official sheets', 'admin.sheets.new': 'New sheet', 'admin.species.title': 'Species', 'admin.access.title': 'Access and permissions', 'admin.step_up.title': 'Two-factor authentication required', - 'admin.step_up.body': 'Administration needs a strengthened session: enter the 6-digit code from your authenticator app.', - 'admin.step_up.no_factor': 'Administration requires two-factor authentication. First add a factor in My account, Security.', + 'admin.step_up.body': + 'Administration needs a strengthened session: enter the 6-digit code from your authenticator app.', + 'admin.step_up.no_factor': + 'Administration requires two-factor authentication. First add a factor in My account, Security.', 'admin.step_up.to_security': 'Open My account, Security', - 'mfa.description': 'A 6-digit code from an authenticator app, on top of your password. Required for administration.', + 'mfa.description': + 'A 6-digit code from an authenticator app, on top of your password. Required for administration.', 'mfa.factor.loading': 'Loading factors…', 'mfa.factor.none': 'No factor yet.', 'mfa.factor.list_label': 'Authentication factors', @@ -889,37 +881,50 @@ export const en: Dict = { 'mfa.factor.remove': 'Remove', 'mfa.factor.removed': 'Factor removed.', 'mfa.remove.title': 'Remove this factor?', - 'mfa.remove.body': '“{name}” will no longer strengthen your session. Removing a verified factor needs a strengthened session.', + 'mfa.remove.body': + '“{name}” will no longer strengthen your session. Removing a verified factor needs a strengthened session.', 'mfa.remove.confirm': 'Remove', 'mfa.enrol.start': 'Add a factor', 'mfa.enrol.name': 'Factor name', - 'mfa.enrol.name_hint': 'To recognise it in the list, for example “Personal phone”.', + 'mfa.enrol.name_hint': + 'To recognise it in the list, for example “Personal phone”.', 'mfa.enrol.continue': 'Continue', 'mfa.enrol.creating': 'Creating…', - 'mfa.enrol.scan': 'Scan this QR code with your authenticator app, then enter the code it shows.', + 'mfa.enrol.scan': + 'Scan this QR code with your authenticator app, then enter the code it shows.', 'mfa.enrol.qr_alt': 'QR code to scan with your authenticator app', 'mfa.enrol.secret_label': 'Setup key for manual entry', - 'mfa.enrol.secret_hint': 'If you cannot scan the QR code. It is shown only once: do not keep it anywhere else.', + 'mfa.enrol.secret_hint': + 'If you cannot scan the QR code. It is shown only once: do not keep it anywhere else.', 'mfa.enrol.done': 'Factor added and verified.', 'mfa.code.label': 'Verification code', 'mfa.code.hint': 'The 6 digits shown by your authenticator app.', 'mfa.code.verify': 'Verify', 'mfa.code.verifying': 'Verifying…', 'mfa.step_up.factor': 'Factor', - 'mfa.step_up.required': 'This action needs a strengthened session: enter a code from your authenticator app.', + 'mfa.step_up.required': + 'This action needs a strengthened session: enter a code from your authenticator app.', 'mfa.error.code_format': 'The code has 6 digits.', 'mfa.error.name_required': 'Give the factor a name.', 'mfa.error.name_too_long': 'Name too long ({max} characters maximum).', - 'mfa.failure.aal2_required': 'This action needs a session strengthened by two-factor authentication.', - 'mfa.failure.invalid_code': 'Incorrect or expired code. Enter the code shown now.', - 'mfa.failure.factor_not_found': 'This factor no longer exists. Reload the page.', - 'mfa.failure.challenge_expired': 'The verification expired. Enter a new code.', - 'mfa.failure.too_many_factors': 'Maximum number of factors reached. Remove one before adding another.', - 'mfa.failure.name_taken': 'A factor already has this name. Choose another one.', - 'mfa.failure.rate_limited': 'Too many attempts. Wait a few minutes before trying again.', + 'mfa.failure.aal2_required': + 'This action needs a session strengthened by two-factor authentication.', + 'mfa.failure.invalid_code': + 'Incorrect or expired code. Enter the code shown now.', + 'mfa.failure.factor_not_found': + 'This factor no longer exists. Reload the page.', + 'mfa.failure.challenge_expired': + 'The verification expired. Enter a new code.', + 'mfa.failure.too_many_factors': + 'Maximum number of factors reached. Remove one before adding another.', + 'mfa.failure.name_taken': + 'A factor already has this name. Choose another one.', + 'mfa.failure.rate_limited': + 'Too many attempts. Wait a few minutes before trying again.', 'mfa.failure.session_expired': 'Your session has expired. Sign in again.', 'mfa.failure.network': 'Cannot reach the server. Check your network.', - 'mfa.failure.unavailable': 'Two-factor authentication is temporarily unavailable. Try again later.', + 'mfa.failure.unavailable': + 'Two-factor authentication is temporarily unavailable. Try again later.', // V1-2.5 G, H: administration page, species, rights, official sheets 'admin.home.permissions': 'Your permissions: {list}', @@ -928,10 +933,12 @@ export const en: Dict = { 'admin.home.capability.sheet_reviewer': 'reviewer', 'admin.home.capability.sheet_publisher': 'publisher', 'admin.home.owner_role': 'owner role', - 'admin.home.session': 'strengthened session (two-factor authentication) active', + 'admin.home.session': + 'strengthened session (two-factor authentication) active', 'admin.home.sheets_body': 'Drafts, reviews, versions.', 'admin.home.species_body': 'Catalogue species, active or not.', - 'admin.home.access_body': 'Catalogue access and permissions: grant, expiry, revocation.', + 'admin.home.access_body': + 'Catalogue access and permissions: grant, expiry, revocation.', 'admin.home.open': 'Open', 'admin.home.all_sheets': 'All official sheets', 'admin.home.latest': 'Latest changes', @@ -940,8 +947,10 @@ export const en: Dict = { 'admin.badge.working_copy': 'Working copy', 'admin.badge.to_review': '{count} awaiting review', 'admin.working_copy.create': 'Create a working copy', - 'admin.working_copy.active': 'An active working copy already exists (one at a time).', - 'admin.working_copy.body': "A new draft takes the historical sheet's content and drawings, without changing it. Choose the copy's identifier.", + 'admin.working_copy.active': + 'An active working copy already exists (one at a time).', + 'admin.working_copy.body': + "A new draft takes the historical sheet's content and drawings, without changing it. Choose the copy's identifier.", 'admin.working_copy.confirm': 'Create the copy', 'admin.working_copy.pending': 'Creating…', 'admin.sheet_status.active': 'Active', @@ -969,7 +978,8 @@ export const en: Dict = { 'admin.grant_state.expiring': 'Expires within 30 days', 'admin.grant_state.expired': 'Expired', 'admin.grant_state.revoked': 'Revoked', - 'admin.access.lede': 'Grant and revoke catalogue access and permissions. Every right carries a reason and stays on record.', + 'admin.access.lede': + 'Grant and revoke catalogue access and permissions. Every right carries a reason and stays on record.', 'admin.access.loading': 'Loading rights…', 'admin.access.grant_title': 'Grant a right', 'admin.access.lookup.email': 'Account e-mail address', @@ -986,18 +996,22 @@ export const en: Dict = { 'admin.access.account.no_role': 'No platform role', 'admin.access.form.kind': 'Right', 'admin.access.form.reason': 'Reason', - 'admin.access.form.reason_hint': 'Why this right is granted, 1,000 characters at most.', + 'admin.access.form.reason_hint': + 'Why this right is granted, 1,000 characters at most.', 'admin.access.form.note': 'Verification note', - 'admin.access.form.note_hint': 'Required for a permission: the qualification declared and what you checked, never a certification.', + 'admin.access.form.note_hint': + 'Required for a permission: the qualification declared and what you checked, never a certification.', 'admin.access.form.note_hint_reader': 'Optional for catalogue access.', 'admin.access.form.expiry': 'Expiry', - 'admin.access.form.expiry_hint': 'The right ends at the end of this day. Without a date, it lasts until revoked.', + 'admin.access.form.expiry_hint': + 'The right ends at the end of this day. Without a date, it lasts until revoked.', 'admin.access.form.submit': 'Grant', 'admin.access.form.pending': 'Granting…', 'admin.access.error.kind': 'Choose a right.', 'admin.access.error.expiry': 'Choose a date after today.', 'admin.access.granted': 'Right granted.', - 'admin.access.ineligible_detail': 'Conditions: an active account with a confirmed e-mail for every right; a verified authentication factor for a permission; the owner or admin platform role for Sheet editor and Publisher.', + 'admin.access.ineligible_detail': + 'Conditions: an active account with a confirmed e-mail for every right; a verified authentication factor for a permission; the owner or admin platform role for Sheet editor and Publisher.', 'admin.access.list.title': 'Granted rights', 'admin.access.list.filter': 'State', 'admin.access.list.all': 'All', @@ -1010,7 +1024,8 @@ export const en: Dict = { 'admin.access.list.suspended': 'Suspended: conditions not met', 'admin.access.revoke.action': 'Revoke', 'admin.access.revoke.title': 'Revoke this right?', - 'admin.access.revoke.body': "{subject}. Revocation takes effect at the account's next request and cannot be undone; a new right can be granted later.", + 'admin.access.revoke.body': + "{subject}. Revocation takes effect at the account's next request and cannot be undone; a new right can be granted later.", 'admin.access.revoke.reason': 'Reason for revocation', 'admin.access.revoke.confirm': 'Revoke', 'admin.access.revoke.pending': 'Revoking…', @@ -1042,22 +1057,27 @@ export const en: Dict = { 'admin.sheets.filters_active': 'Filters ({count})', 'admin.sheets.filters_reset': 'Reset filters', 'admin.sheets.no_result': 'No sheet name contains “{q}”.', - 'admin.sheet_form.lede': 'The sheet starts empty: views, annotations and findings are entered later in the editor.', + 'admin.sheet_form.lede': + 'The sheet starts empty: views, annotations and findings are entered later in the editor.', 'admin.sheet_form.species': 'Species', - 'admin.sheet_form.species_hint': 'Active or not. Creating a sheet does not activate the species.', + 'admin.sheet_form.species_hint': + 'Active or not. Creating a sheet does not activate the species.', 'admin.sheet_form.species_choose': 'Choose a species', 'admin.sheet_form.species_inactive': '{name} (inactive)', 'admin.sheet_form.name_fr': 'Name (French)', 'admin.sheet_form.name_en': 'Name (English)', 'admin.sheet_form.slug': 'Identifier (slug)', - 'admin.sheet_form.slug_hint': 'Lower-case letters without accents, digits and hyphens, 2 to 80 characters; unique among official sheets.', + 'admin.sheet_form.slug_hint': + 'Lower-case letters without accents, digits and hyphens, 2 to 80 characters; unique among official sheets.', 'admin.sheet_form.submit': 'Create the sheet', 'admin.sheet_form.creating': 'Creating…', 'admin.sheet_form.error.species': 'Choose a species.', - 'admin.sheet_form.error.slug': 'Lower-case letters without accents, digits and hyphens, 2 to 80 characters, not starting with a hyphen.', + 'admin.sheet_form.error.slug': + 'Lower-case letters without accents, digits and hyphens, 2 to 80 characters, not starting with a hyphen.', 'admin.overview.loading': 'Loading the sheet…', 'admin.overview.not_found_title': 'Sheet not found', - 'admin.overview.not_found_body': 'This sheet does not exist or is not available with your permissions.', + 'admin.overview.not_found_body': + 'This sheet does not exist or is not available with your permissions.', 'admin.overview.back': 'Back to official sheets', 'admin.overview.copy_of': 'copy of version {number} of the historical sheet', 'admin.overview.to_catalogue': 'View in the catalogue', @@ -1078,7 +1098,8 @@ export const en: Dict = { 'admin.overview.decided_on': 'decided on {date}', 'admin.overview.decided_on_by': 'decided on {date} by {name}', 'admin.overview.withdrawn_on': 'withdrawn on {date}', - 'admin.species.lede': 'The species of the sheet catalogue. An inactive species does not appear in the animal forms.', + 'admin.species.lede': + 'The species of the sheet catalogue. An inactive species does not appear in the animal forms.', 'admin.species.loading': 'Loading species…', 'admin.species.empty': 'No species.', 'admin.species.new': 'New species', @@ -1092,7 +1113,8 @@ export const en: Dict = { 'admin.species.activate.action': 'Activate', 'admin.species.activate.action_named': 'Activate {name}', 'admin.species.activate.title': 'Activate “{name}”?', - 'admin.species.activate.body': 'The animal forms will then offer this species to every account. An activated species cannot be deactivated.', + 'admin.species.activate.body': + 'The animal forms will then offer this species to every account. An activated species cannot be deactivated.', 'admin.species.activate.confirm': 'Activate', 'admin.species.activate.pending': 'Activating…', 'admin.species.activate.done': 'Species activated.', @@ -1101,56 +1123,80 @@ export const en: Dict = { 'admin.species.dialog.create_title': 'New species', 'admin.species.dialog.edit_title': 'Edit the species', 'admin.species.dialog.rename_title': 'Rename the species', - 'admin.species.dialog.create_body': 'Created inactive: the animal forms offer it only once the owner activates it. Its identifier never changes afterwards.', + 'admin.species.dialog.create_body': + 'Created inactive: the animal forms offer it only once the owner activates it. Its identifier never changes afterwards.', 'admin.species.field.id': 'Identifier', - 'admin.species.field.id_hint': 'Lower-case letters without accents, digits, hyphens and underscores, 64 characters at most; “other” is reserved.', + 'admin.species.field.id_hint': + 'Lower-case letters without accents, digits, hyphens and underscores, 64 characters at most; “other” is reserved.', 'admin.species.field.id_value': 'Identifier: {id}', 'admin.species.field.name_fr': 'Name (French)', 'admin.species.field.name_en': 'Name (English)', 'admin.species.field.order': 'Display order', 'admin.species.field.order_hint': 'A number from 0 to 9999, smaller first.', - 'admin.species.error.id': 'Invalid identifier: lower-case letters without accents, digits, hyphens and underscores; “other” is reserved.', + 'admin.species.error.id': + 'Invalid identifier: lower-case letters without accents, digits, hyphens and underscores; “other” is reserved.', 'admin.species.error.order': 'A whole number from 0 to 9999.', 'admin.failure.authentication_required': 'Sign in to continue.', - 'admin.failure.mfa_required': 'This action needs a session strengthened by two-factor authentication.', + 'admin.failure.mfa_required': + 'This action needs a session strengthened by two-factor authentication.', 'admin.failure.forbidden': 'Action not allowed.', - 'admin.failure.rights.account': 'Your account must be active, with a confirmed e-mail, for this action.', - 'admin.failure.rights.capability': 'Your permissions do not allow this action.', - 'admin.failure.rights.mfa': 'This action needs a session strengthened by two-factor authentication.', + 'admin.failure.rights.account': + 'Your account must be active, with a confirmed e-mail, for this action.', + 'admin.failure.rights.capability': + 'Your permissions do not allow this action.', + 'admin.failure.rights.mfa': + 'This action needs a session strengthened by two-factor authentication.', 'admin.failure.rights.owner': 'Only the platform owner can do this.', - 'admin.failure.not_found': 'Item not found or not available. Reload the page.', + 'admin.failure.not_found': + 'Item not found or not available. Reload the page.', 'admin.failure.grant.active': 'This account already holds this right.', - 'admin.failure.grant.ineligible': 'This account does not meet the conditions of this right.', + 'admin.failure.grant.ineligible': + 'This account does not meet the conditions of this right.', 'admin.failure.grant.revoked': 'This right is already revoked.', 'admin.failure.grant.target_invalid': 'This account no longer exists.', - 'admin.failure.document.shape': 'The server did not accept the sheet document.', - 'admin.failure.document.schema_version': 'The server does not accept this sheet format version.', - 'admin.failure.document.species': "The document's species does not match the sheet's.", - 'admin.failure.document.too_large': 'The sheet document exceeds the allowed size.', - 'admin.failure.sheet.species_invalid': 'This species cannot have an official sheet.', - 'admin.failure.sheet.slug_taken': 'Another official sheet already uses this identifier.', + 'admin.failure.document.shape': + 'The server did not accept the sheet document.', + 'admin.failure.document.schema_version': + 'The server does not accept this sheet format version.', + 'admin.failure.document.species': + "The document's species does not match the sheet's.", + 'admin.failure.document.too_large': + 'The sheet document exceeds the allowed size.', + 'admin.failure.sheet.species_invalid': + 'This species cannot have an official sheet.', + 'admin.failure.sheet.slug_taken': + 'Another official sheet already uses this identifier.', 'admin.failure.species.exists': 'A species already has this identifier.', - 'admin.failure.species.not_active': 'This species is not active: edit it instead of renaming it.', - 'admin.failure.species.not_inactive': 'This species is already active: only the owner can rename it.', - 'admin.failure.working_copy.source_invalid': 'Only a version of the historical sheet can be copied.', - 'admin.failure.working_copy.exists': 'An active working copy already exists (one at a time).', - 'admin.failure.working_copy.assets_missing': 'Some drawings of the historical sheet are missing from storage: no copy was created. They must be uploaded first.', + 'admin.failure.species.not_active': + 'This species is not active: edit it instead of renaming it.', + 'admin.failure.species.not_inactive': + 'This species is already active: only the owner can rename it.', + 'admin.failure.working_copy.source_invalid': + 'Only a version of the historical sheet can be copied.', + 'admin.failure.working_copy.exists': + 'An active working copy already exists (one at a time).', + 'admin.failure.working_copy.assets_missing': + 'Some drawings of the historical sheet are missing from storage: no copy was created. They must be uploaded first.', 'admin.failure.invalid_input': 'A value was not accepted. Check the fields.', - 'admin.failure.rate_limited': 'Too many actions in a short time. Try again in a few minutes.', + 'admin.failure.rate_limited': + 'Too many actions in a short time. Try again in a few minutes.', 'admin.failure.conflict_retry': 'Another action was in progress. Retry.', 'admin.failure.session_expired': 'Your session has expired. Sign in again.', 'admin.failure.network': 'No connection. Check your network, then retry.', 'admin.failure.unavailable': 'The service is not answering right now. Retry.', // V1-2.5: anatomical catalogue (slice I) - 'catalogue.lede': 'Published official sheets, by species. Read-only: nothing is changed here.', + 'catalogue.lede': + 'Published official sheets, by species. Read-only: nothing is changed here.', 'catalogue.search': 'Search for a sheet', 'catalogue.species_filter': 'Filter by species', 'catalogue.all_species': 'All species', 'catalogue.loading': 'Loading the catalogue…', 'catalogue.results': 'Published sheets', - 'catalogue.empty': 'A species appears here as soon as an official sheet is published for it.', - 'catalogue.empty_hint': 'Drafts and reviews are never listed in the catalogue.', + 'catalogue.empty': + 'A species appears here as soon as an official sheet is published for it.', + 'catalogue.empty_hint': + 'Drafts and reviews are never listed in the catalogue.', 'catalogue.no_results': 'No sheet matches this search.', 'catalogue.status.published': 'Published', 'catalogue.status.deprecated': 'Withdrawn', @@ -1160,7 +1206,8 @@ export const en: Dict = { 'catalogue.card.views_other': '{count} views', 'catalogue.card.zones_one': '1 finding zone', 'catalogue.card.zones_other': '{count} finding zones', - 'catalogue.card.integrity_failed': 'Integrity check failed: this version cannot be displayed.', + 'catalogue.card.integrity_failed': + 'Integrity check failed: this version cannot be displayed.', 'catalogue.view': 'View', 'catalogue.view_sheet': 'View {name}', 'catalogue.loading_sheet': 'Loading the sheet…', @@ -1172,14 +1219,17 @@ export const en: Dict = { 'catalogue.versions.title': 'Sheet versions', 'catalogue.views': 'Sheet views', 'catalogue.canvas.label': 'Drawing: {view}', - 'catalogue.canvas.help': 'Pinch to zoom, drag to move. Tap a zone to see its findings.', - 'catalogue.canvas.keys': 'With the keyboard: arrows to move, + and − to zoom, 0 to show the whole drawing.', + 'catalogue.canvas.help': + 'Pinch to zoom, drag to move. Tap a zone to see its findings.', + 'catalogue.canvas.keys': + 'With the keyboard: arrows to move, + and − to zoom, 0 to show the whole drawing.', 'catalogue.zoom.out': 'Zoom out', 'catalogue.zoom.in': 'Zoom in', 'catalogue.zoom.fit': 'Fit', 'catalogue.zone.choose': 'Zone', 'catalogue.zone.none': 'Choose a zone', - 'catalogue.zone.prompt': 'Tap a zone on the drawing, or choose it in the list, to see its findings.', + 'catalogue.zone.prompt': + 'Tap a zone on the drawing, or choose it in the list, to see its findings.', 'catalogue.zone.title': 'Zone: {name}', 'catalogue.zone.category': 'Category: {name}', 'catalogue.zone.vertebrae': 'vertebrae {first} to {last}', @@ -1187,26 +1237,40 @@ export const en: Dict = { 'catalogue.references.title': 'References', 'catalogue.references.none': 'This sheet cites no reference.', 'catalogue.references.link': 'Link', - 'catalogue.failure.view': 'This view cannot be shown: its drawing was refused by the security checks or could not be composed.', + 'catalogue.failure.view': + 'This view cannot be shown: its drawing was refused by the security checks or could not be composed.', 'catalogue.failure.network': 'Cannot reach the server. Check your network.', - 'catalogue.failure.session_expired': 'Your session has expired. Sign in again.', - 'catalogue.failure.rate_limited': 'Too many requests. Wait a few minutes before trying again.', - 'catalogue.failure.unavailable': 'The catalogue is temporarily unavailable. Try again later.', - 'catalogue.failure.drawing_missing': 'A drawing of this version cannot be found.', - 'catalogue.failure.drawing_hash_mismatch': "The illustration file's contents do not match its recorded SHA-256 hash.", - 'catalogue.failure.fingerprint_mismatch': "This version's fingerprint does not match the one recorded at its publication.", - 'catalogue.failure.invalid_document': "This version's content cannot be read.", + 'catalogue.failure.session_expired': + 'Your session has expired. Sign in again.', + 'catalogue.failure.rate_limited': + 'Too many requests. Wait a few minutes before trying again.', + 'catalogue.failure.unavailable': + 'The catalogue is temporarily unavailable. Try again later.', + 'catalogue.failure.drawing_missing': + 'A drawing of this version cannot be found.', + 'catalogue.failure.drawing_hash_mismatch': + "The illustration file's contents do not match its recorded SHA-256 hash.", + 'catalogue.failure.fingerprint_mismatch': + "This version's fingerprint does not match the one recorded at its publication.", + 'catalogue.failure.invalid_document': + "This version's content cannot be read.", 'catalogue.failure.caps': 'This version exceeds the size limits of a sheet.', // V1-2.6 E: draft editor route, header, tabs, recovery, conflict 'admin.overview.open_draft': 'Open the draft', 'admin.overview.view_draft': 'View the draft', - 'admin.failure.round.open': 'A review is already under way on this draft: it cannot be submitted again.', - 'admin.failure.view.asset.unknown': "A drawing of the draft is not registered for this sheet: choose it again in Annotations, Views section.", - 'admin.failure.draft.frozen': 'A review is under way on this draft: it can no longer be edited.', + 'admin.failure.round.open': + 'A review is already under way on this draft: it cannot be submitted again.', + 'admin.failure.view.asset.unknown': + 'A drawing of the draft is not registered for this sheet: choose it again in Annotations, Views section.', + 'admin.failure.draft.frozen': + 'A review is under way on this draft: it can no longer be edited.', 'admin.failure.draft.not_a_draft': 'This version is no longer a draft.', - 'admin.failure.sheet.inactive': 'This sheet is archived: its draft can no longer be edited.', - 'admin.failure.sheet.state': "The sheet's state does not allow this action. Reload the page.", - 'admin.failure.sheet.historical_read_only': 'The historical sheet cannot be edited: create a working copy.', + 'admin.failure.sheet.inactive': + 'This sheet is archived: its draft can no longer be edited.', + 'admin.failure.sheet.state': + "The sheet's state does not allow this action. Reload the page.", + 'admin.failure.sheet.historical_read_only': + 'The historical sheet cannot be edited: create a working copy.', 'editor.tab.list': 'Draft sections', 'editor.tab.general': 'General', 'editor.tab.annotations': 'Annotations', @@ -1222,8 +1286,10 @@ export const en: Dict = { 'editor.place.regions': 'Vertebral regions', 'editor.place.references': 'References', 'editor.section.back': 'Back to the drawing', - 'editor.live.creation_kept': "A creation is in progress: finish or abandon it to reach this annotation.", - 'editor.live.tracing_kept': "A tracing is in progress: finish or cancel it to reach this annotation.", + 'editor.live.creation_kept': + 'A creation is in progress: finish or abandon it to reach this annotation.', + 'editor.live.tracing_kept': + 'A tracing is in progress: finish or cancel it to reach this annotation.', 'editor.overview.label': 'Sheet overview', 'editor.overview.views': 'Views', 'editor.overview.view_main': 'Main view', @@ -1252,16 +1318,23 @@ export const en: Dict = { 'editor.citations.edit_reference': 'Edit the reference', 'editor.citations.new_reference': 'New reference', 'editor.citations.cite': 'Cite', - 'editor.citations.pending_choice': 'Reference chosen but not cited yet: choose « Cite » or go back to the empty choice.', - 'editor.citations.created_draft': 'New reference cited in the draft: {citation}. It will be saved with the citations.', + 'editor.citations.pending_choice': + 'Reference chosen but not cited yet: choose « Cite » or go back to the empty choice.', + 'editor.citations.created_draft': + 'New reference cited in the draft: {citation}. It will be saved with the citations.', 'editor.citations.pending_removed': 'New reference removed: {citation}', 'editor.citations.pending_updated': 'New reference edited: {citation}', 'editor.citations.pending': 'New', - 'editor.citations.pending_kept': 'New reference not saved, still in the draft: {citation}', - 'editor.references.panel_count_one': '{count} reference cited by this finding', - 'editor.references.panel_count_other': '{count} references cited by this finding', - 'editor.references.panel_count_family_one': '{count} reference cited by this family', - 'editor.references.panel_count_family_other': '{count} references cited by this family', + 'editor.citations.pending_kept': + 'New reference not saved, still in the draft: {citation}', + 'editor.references.panel_count_one': + '{count} reference cited by this finding', + 'editor.references.panel_count_other': + '{count} references cited by this finding', + 'editor.references.panel_count_family_one': + '{count} reference cited by this family', + 'editor.references.panel_count_family_other': + '{count} references cited by this family', 'editor.references.panel_show_all': 'Show all in the References tab', 'editor.references.panel_empty': 'This finding cites no reference.', 'editor.references.panel_empty_family': 'This family cites no reference.', @@ -1282,7 +1355,8 @@ export const en: Dict = { 'editor.references.none_doi': 'None', 'editor.references.none_url': 'None', 'editor.references.new_tab': '(new tab)', - 'editor.references.delete_hint': 'To delete this reference, first remove each of its citations: “Go to”, then “X references”, “Edit” and “Remove” in the references of the finding or the family.', + 'editor.references.delete_hint': + 'To delete this reference, first remove each of its citations: “Go to”, then “X references”, “Edit” and “Remove” in the references of the finding or the family.', 'editor.references.add': 'Add a reference', 'editor.references.added': 'Reference added: {citation}', 'editor.references.added_show': 'Show', @@ -1290,11 +1364,14 @@ export const en: Dict = { 'editor.references.filter_chip': 'References of the finding: {name}', 'editor.references.filter_chip_family': 'References of the family: {name}', 'editor.references.filter_remove': 'Remove the filter of the finding {name}', - 'editor.references.filter_remove_family': 'Remove the filter of the family {name}', + 'editor.references.filter_remove_family': + 'Remove the filter of the family {name}', 'editor.references.filter_back': 'Back to the finding', 'editor.references.filter_back_family': 'Back to the family', - 'editor.references.filter_gone': 'The finding no longer exists: the filter is removed', - 'editor.references.filter_gone_family': 'The family no longer exists: the filter is removed', + 'editor.references.filter_gone': + 'The finding no longer exists: the filter is removed', + 'editor.references.filter_gone_family': + 'The family no longer exists: the filter is removed', 'editor.references.clear_search': 'Clear the search', 'editor.references.sort_by': 'Sort by', 'editor.references.sort.sheet': 'Sheet order', @@ -1305,9 +1382,11 @@ export const en: Dict = { 'editor.references.count_other': '{count} references', 'editor.references.count_of_one': '{count} reference of {total}', 'editor.references.count_of_other': '{count} references of {total}', - 'editor.references.reorder_hint': 'To reorder, show the sheet order without a search.', + 'editor.references.reorder_hint': + 'To reorder, show the sheet order without a search.', 'editor.references.no_result': 'No reference contains “{q}”.', - 'editor.references.no_result_scope': 'The search covers the citation, the DOI and the URL.', + 'editor.references.no_result_scope': + 'The search covers the citation, the DOI and the URL.', 'editor.references.outside_search': 'Does not match the search', 'editor.findings.references_open_one': '{count} reference', 'editor.findings.references_open_other': '{count} references', @@ -1317,8 +1396,10 @@ export const en: Dict = { 'editor.draft.title': 'Draft, version {number}', 'editor.draft.read_only': 'Read-only', 'editor.draft.discard': 'Discard changes', - 'editor.draft.discard_copy': 'The temporary local copy of these changes will be deleted too.', - 'editor.draft.discard_ask': 'Discard the unsaved changes? The draft will return to the last revision saved on the server.', + 'editor.draft.discard_copy': + 'The temporary local copy of these changes will be deleted too.', + 'editor.draft.discard_ask': + 'Discard the unsaved changes? The draft will return to the last revision saved on the server.', 'editor.draft.discard_confirm': 'Discard changes', 'editor.draft.status.revision': 'Revision {revision}', 'editor.draft.status.unsaved': 'Unsaved changes', @@ -1333,32 +1414,52 @@ export const en: Dict = { 'editor.history.redo_title': 'Redo the last undone change', 'editor.history.redo_shortcut': 'Ctrl+Shift+Z or ⇧⌘Z', 'editor.draft.status.saving': 'Saving…', - 'editor.draft.status.copy_quota': "Temporary local copy impossible (tab full): not saved on the server", - 'editor.draft.status.copy_cap': "Temporary local copy impossible (two other copies in this tab): not saved on the server", - 'editor.draft.copy_kept': "A temporary local copy, limited to this tab, is kept; it is not saved on the server.", - 'editor.draft.copy_not_kept': "No temporary local copy could be written in this tab: these changes are saved nowhere, neither in the tab nor on the server.", - 'editor.draft.mode.narrow': 'Editing requires a screen at least 1,024 px wide.', - 'editor.draft.mode.rights': 'Your permissions do not allow editing this draft. It remains readable.', + 'editor.draft.status.copy_quota': + 'Temporary local copy impossible (tab full): not saved on the server', + 'editor.draft.status.copy_cap': + 'Temporary local copy impossible (two other copies in this tab): not saved on the server', + 'editor.draft.copy_kept': + 'A temporary local copy, limited to this tab, is kept; it is not saved on the server.', + 'editor.draft.copy_not_kept': + 'No temporary local copy could be written in this tab: these changes are saved nowhere, neither in the tab nor on the server.', + 'editor.draft.mode.narrow': + 'Editing requires a screen at least 1,024 px wide.', + 'editor.draft.mode.rights': + 'Your permissions do not allow editing this draft. It remains readable.', 'editor.draft.mode.frozen_verifying': '{round} · verification in progress', - 'editor.draft.mode.frozen_generic': 'A review is under way: the draft can no longer be edited.', - 'editor.draft.mode.historical': 'The historical sheet cannot be edited: create a working copy to edit it.', - 'editor.draft.mode.inactive': 'This sheet is archived: its draft can no longer be edited.', - 'editor.draft.mode.unusable_copy': "A temporary local copy of this draft exists in this tab; it is not saved on the server and cannot be used in this state.", - 'editor.draft.recovery.offer': 'A temporary local copy of this draft exists in this tab (revision {revision}, {time}). It is not saved on the server. Choose before editing the draft.', - 'editor.draft.recovery.older': 'It is based on revision {revision}; the server is at revision {server}.', - 'editor.draft.recovery.unreadable': "A temporary local copy of this draft exists in this tab but cannot be read. It is not saved on the server. Ignoring it deletes it from this tab: its content will be lost.", - 'editor.draft.recovery.refused': "The document check refuses this copy: {kind}. It stays in this tab.", - 'editor.draft.recovery.refused_kind.invalid_shape': "the document does not follow the sheet format", - 'editor.draft.recovery.refused_kind.core_unavailable': "the calculation engine is not available", - 'editor.draft.recovery.refused_kind.unknown': "reason not recognised", - 'editor.draft.recovery.refused_kind.other': "reason not recognised", + 'editor.draft.mode.frozen_generic': + 'A review is under way: the draft can no longer be edited.', + 'editor.draft.mode.historical': + 'The historical sheet cannot be edited: create a working copy to edit it.', + 'editor.draft.mode.inactive': + 'This sheet is archived: its draft can no longer be edited.', + 'editor.draft.mode.unusable_copy': + 'A temporary local copy of this draft exists in this tab; it is not saved on the server and cannot be used in this state.', + 'editor.draft.recovery.offer': + 'A temporary local copy of this draft exists in this tab (revision {revision}, {time}). It is not saved on the server. Choose before editing the draft.', + 'editor.draft.recovery.older': + 'It is based on revision {revision}; the server is at revision {server}.', + 'editor.draft.recovery.unreadable': + 'A temporary local copy of this draft exists in this tab but cannot be read. It is not saved on the server. Ignoring it deletes it from this tab: its content will be lost.', + 'editor.draft.recovery.refused': + 'The document check refuses this copy: {kind}. It stays in this tab.', + 'editor.draft.recovery.refused_kind.invalid_shape': + 'the document does not follow the sheet format', + 'editor.draft.recovery.refused_kind.core_unavailable': + 'the calculation engine is not available', + 'editor.draft.recovery.refused_kind.unknown': 'reason not recognised', + 'editor.draft.recovery.refused_kind.other': 'reason not recognised', 'editor.draft.recovery.restore': 'Restore the copy', 'editor.draft.recovery.ignore': 'Ignore the copy', - 'editor.draft.recovery.ignore_body': "Abandon this tab's temporary local copy, not saved on the server (revision {revision}, {time})? It will be deleted from this tab.", - 'editor.draft.recovery.ignore_unreadable_body': "Abandon this tab's unreadable temporary local copy, not saved on the server? It will be deleted from this tab and its content will be lost.", + 'editor.draft.recovery.ignore_body': + "Abandon this tab's temporary local copy, not saved on the server (revision {revision}, {time})? It will be deleted from this tab.", + 'editor.draft.recovery.ignore_unreadable_body': + "Abandon this tab's unreadable temporary local copy, not saved on the server? It will be deleted from this tab and its content will be lost.", 'editor.draft.recovery.ignore_confirm': 'Abandon the copy', - 'editor.draft.copy_issue.cap': "Two other drafts already have a temporary local copy in this tab. The changes to this one are kept nowhere (nothing is saved on the server) until you abandon one.", - 'editor.draft.copy_issue.quota': "This tab's storage is full: the temporary local copy of this draft cannot be written, and its changes not saved on the server are not kept. Save the draft or abandon a copy below.", + 'editor.draft.copy_issue.cap': + 'Two other drafts already have a temporary local copy in this tab. The changes to this one are kept nowhere (nothing is saved on the server) until you abandon one.', + 'editor.draft.copy_issue.quota': + "This tab's storage is full: the temporary local copy of this draft cannot be written, and its changes not saved on the server are not kept. Save the draft or abandon a copy below.", 'editor.draft.copy.open': 'Open this draft', 'editor.draft.copy.abandon': 'Abandon this copy', 'editor.draft.copy.revision': 'revision {revision}', @@ -1366,18 +1467,25 @@ export const en: Dict = { 'editor.draft.conflict.reading_title': 'Save conflict', 'editor.draft.conflict.reading': 'Reading the server revision…', 'editor.draft.conflict.known': 'Another session saved revision {revision}', - 'editor.draft.conflict.unknown': 'Another session saved a newer version of this draft.', + 'editor.draft.conflict.unknown': + 'Another session saved a newer version of this draft.', 'editor.draft.conflict.by_other': 'by {name}, on {date}', - 'editor.draft.conflict.by_you': 'from another session of your account, on {date}', + 'editor.draft.conflict.by_you': + 'from another session of your account, on {date}', 'editor.draft.conflict.by_you_short': 'another session of your account', 'editor.draft.conflict.reload': 'Reload', 'editor.draft.conflict.retry': 'Retry', 'editor.draft.conflict.keep': 'Keep my version', - 'editor.draft.conflict.keep_hint': 'Server revision unknown: reload or retry.', - 'editor.draft.conflict.reload_ask': 'Abandon your changes and reload revision {revision}?', - 'editor.draft.conflict.reload_unknown_ask': 'Abandon your changes and reload the server version?', - 'editor.draft.conflict.keep_ask': 'Replace revision {revision} with your version?', - 'editor.draft.conflict.keep_ask_by': 'Replace revision {revision} ({who}, {date}) with your version?', + 'editor.draft.conflict.keep_hint': + 'Server revision unknown: reload or retry.', + 'editor.draft.conflict.reload_ask': + 'Abandon your changes and reload revision {revision}?', + 'editor.draft.conflict.reload_unknown_ask': + 'Abandon your changes and reload the server version?', + 'editor.draft.conflict.keep_ask': + 'Replace revision {revision} with your version?', + 'editor.draft.conflict.keep_ask_by': + 'Replace revision {revision} ({who}, {date}) with your version?', 'editor.action.delete': 'Delete', 'editor.action.remove': 'Remove', 'editor.action.move_up': 'Move up', @@ -1387,15 +1495,22 @@ export const en: Dict = { 'editor.field.integer': 'Enter a whole number.', 'editor.field.choose': 'Choose…', 'editor.refusal.blocked': 'The change was not applied.', - 'editor.refusal.recovery': "First answer this tab's temporary local copy offered at the top of the page: it is not saved on the server.", - 'editor.refusal.core.unknown_key': 'This element no longer exists in the draft.', - 'editor.refusal.core.duplicate_key': 'An element already has this identifier.', - 'editor.refusal.core.invalid_target': 'This change does not apply to this element.', - 'editor.refusal.core.id_changed': 'An element\'s identifier or code cannot be changed.', - 'editor.refusal.core.invalid_position': 'This position does not exist in the list.', + 'editor.refusal.recovery': + "First answer this tab's temporary local copy offered at the top of the page: it is not saved on the server.", + 'editor.refusal.core.unknown_key': + 'This element no longer exists in the draft.', + 'editor.refusal.core.duplicate_key': + 'An element already has this identifier.', + 'editor.refusal.core.invalid_target': + 'This change does not apply to this element.', + 'editor.refusal.core.id_changed': + "An element's identifier or code cannot be changed.", + 'editor.refusal.core.invalid_position': + 'This position does not exist in the list.', 'editor.refusal.core.too_deep': 'The tree is too deep (8 levels at most).', 'editor.refusal.core.has_dependents': 'Other elements still use this one.', - 'editor.refusal.core.other': 'The document check refuses this value ({kind}).', + 'editor.refusal.core.other': + 'The document check refuses this value ({kind}).', 'editor.element.sheet': 'Sheet', 'editor.element.reference': 'Reference', 'editor.element.region': 'Vertebral region', @@ -1415,8 +1530,10 @@ export const en: Dict = { 'editor.delete.title': 'Delete "{name}"?', 'editor.delete.ask': 'Delete "{name}" from the draft?', 'editor.delete.descendants': 'These elements will be deleted too:', - 'editor.delete.blocked': '"{name}" cannot be deleted: the following elements still use it.', - 'editor.delete.lookup_failed': 'Could not check what uses this element. Try again.', + 'editor.delete.blocked': + '"{name}" cannot be deleted: the following elements still use it.', + 'editor.delete.lookup_failed': + 'Could not check what uses this element. Try again.', 'editor.delete.confirm': 'Delete', 'editor.delete.cancel': 'Cancel', 'editor.delete.close': 'Close', @@ -1446,7 +1563,8 @@ export const en: Dict = { 'editor.reference.url': 'Web address (URL)', 'editor.reference.doi': 'DOI', 'editor.reference.new': 'New reference', - 'editor.reference.url_invalid': 'Enter an address starting with http:// or https://.', + 'editor.reference.url_invalid': + 'Enter an address starting with http:// or https://.', 'editor.reference.add': 'Add the reference', 'editor.reference.type.book': 'Book', 'editor.reference.type.journal': 'Journal article', @@ -1467,7 +1585,8 @@ export const en: Dict = { 'editor.vertebra.range_number': 'The range bounds are whole numbers.', 'editor.vertebra.new': 'New vertebral region', 'editor.vertebra.add': 'Add the region', - 'editor.vertebra.required': 'Fill in the code and the French and English names.', + 'editor.vertebra.required': + 'Fill in the code and the French and English names.', 'editor.views.main_title': 'Main view', 'editor.views.details_title': 'Detail views', 'editor.views.empty': 'No detail view yet.', @@ -1479,21 +1598,28 @@ export const en: Dict = { 'editor.views.drawing.ok': 'Drawing valid', 'editor.views.drawing.missing': 'Drawing not found', 'editor.views.drawing.rejected': 'Drawing rejected', - 'editor.views.drawing.not_canonical': "Drawing refused: it is not in the stored form. Choose the original file again to replace it.", - 'editor.views.drawing.rejected_reason': "Drawing refused ({reason}).", + 'editor.views.drawing.not_canonical': + 'Drawing refused: it is not in the stored form. Choose the original file again to replace it.', + 'editor.views.drawing.rejected_reason': 'Drawing refused ({reason}).', 'editor.views.drawing.inherited': "Uses the parent view's drawing.", - 'editor.views.drawing.hint': "Use « Choose a drawing » to add or replace this view's drawing.", - 'editor.views.drawing.unmeasured': 'This view cannot be measured: add or fix its drawing before placing or moving elements.', + 'editor.views.drawing.hint': + "Use « Choose a drawing » to add or replace this view's drawing.", + 'editor.views.drawing.unmeasured': + 'This view cannot be measured: add or fix its drawing before placing or moving elements.', 'editor.views.drawing.choose': 'Choose a drawing', 'editor.views.drawing.file': 'Drawing file (SVG)', 'editor.views.drawing.use_parent': "Use the parent view's drawing", 'editor.views.drawing.use_parent_title': "Use the parent view's drawing?", - 'editor.views.drawing.use_parent_body': "The view will show the parent view's drawing through its crop. Its own drawing file stays stored, and you can undo this change (Undo). The view's annotations go back to \"to confirm\".", - 'editor.views.drawing.use_parent_confirm': "Use the parent drawing", + 'editor.views.drawing.use_parent_body': + 'The view will show the parent view\'s drawing through its crop. Its own drawing file stays stored, and you can undo this change (Undo). The view\'s annotations go back to "to confirm".', + 'editor.views.drawing.use_parent_confirm': 'Use the parent drawing', 'editor.views.drawing.use_parent_cancel': 'Cancel', - 'editor.views.pending.cleaning': 'A drawing cleaning is waiting for your decision.', - 'editor.views.pending.repair': 'An annotation repair is waiting for your decision.', - 'editor.views.pending.parent': "Going back to the parent view's drawing is waiting for your confirmation.", + 'editor.views.pending.cleaning': + 'A drawing cleaning is waiting for your decision.', + 'editor.views.pending.repair': + 'An annotation repair is waiting for your decision.', + 'editor.views.pending.parent': + "Going back to the parent view's drawing is waiting for your confirmation.", 'editor.views.pending.resume': 'Resume', 'editor.views.crop.title': 'Crop', 'editor.views.crop.toggle': 'Edit the crop', @@ -1501,7 +1627,8 @@ export const en: Dict = { 'editor.views.crop.min_y': 'Crop: minimum y', 'editor.views.crop.width': 'Crop: width', 'editor.views.crop.height': 'Crop: height', - 'editor.views.crop.hint': "Rectangle in the parent drawing's units. Four values, or none for no crop. They apply together.", + 'editor.views.crop.hint': + "Rectangle in the parent drawing's units. Four values, or none for no crop. They apply together.", 'editor.views.crop.incomplete': 'Fill in all four crop values, or none.', 'editor.views.crop.number': 'The crop values are numbers.', 'editor.views.crop.not_applied': 'Not applied', @@ -1509,35 +1636,53 @@ export const en: Dict = { 'editor.views.crop.canvas': 'Parent view with the crop rectangle', 'editor.views.crop.canvas_failed': 'The parent view cannot be displayed.', 'editor.views.new': 'New detail view', - 'editor.views.new_hint': 'Fill in the crop for a cropped view; leave it empty for a view that will have its own drawing (chosen once the view is added).', + 'editor.views.new_hint': + 'Fill in the crop for a cropped view; leave it empty for a view that will have its own drawing (chosen once the view is added).', 'editor.views.add': 'Add the view', 'editor.views.required': 'Fill in the French and English names of the view.', - 'editor.views.frame.newly_invalid': 'This frame change would put the geometry of these elements in error: {names}. Move them first (Annotations, drawing).', - 'editor.views.frame.view_unmeasured': 'This change would make a view that holds annotations unmeasurable: {names}.', - 'editor.views.frame.kept': 'The drawing stays uploaded; the view keeps its previous drawing.', - 'editor.views.frame.newly_invalid_repairable': 'These elements fall outside the new frame: {names}. Choose the drawing again to repair them as you attach it.', + 'editor.views.frame.newly_invalid': + 'This frame change would put the geometry of these elements in error: {names}. Move them first (Annotations, drawing).', + 'editor.views.frame.view_unmeasured': + 'This change would make a view that holds annotations unmeasurable: {names}.', + 'editor.views.frame.kept': + 'The drawing stays uploaded; the view keeps its previous drawing.', + 'editor.views.frame.newly_invalid_repairable': + 'These elements fall outside the new frame: {names}. Choose the drawing again to repair them as you attach it.', 'editor.views.repair.title': 'Repair the annotations outside the new frame', - 'editor.views.repair.body_one': '{count} annotation falls outside the new frame of this drawing. The proposed values are computed in that frame. Nothing is applied before "Attach and apply": the drawing and the new values are then applied together, and a single Undo restores them together.', - 'editor.views.repair.body_other': '{count} annotations fall outside the new frame of this drawing. The proposed values are computed in that frame. Nothing is applied before "Attach and apply": the drawing and the new values are then applied together, and a single Undo restores them together.', + 'editor.views.repair.body_one': + '{count} annotation falls outside the new frame of this drawing. The proposed values are computed in that frame. Nothing is applied before "Attach and apply": the drawing and the new values are then applied together, and a single Undo restores them together.', + 'editor.views.repair.body_other': + '{count} annotations fall outside the new frame of this drawing. The proposed values are computed in that frame. Nothing is applied before "Attach and apply": the drawing and the new values are then applied together, and a single Undo restores them together.', 'editor.views.repair.row': '{kind} "{name}"', 'editor.views.repair.path_blocked': - "This free path is kept as it is. The drawing cannot be attached while it falls outside the new frame: the editor cannot yet correct the points of a free path.", - 'editor.views.repair.refused': 'Nothing was applied: the document check refuses these values.', - 'editor.views.repair.more_outside': 'Other elements would also fall outside the new frame: {names}. Nothing was applied. Cancel, fix them, then choose the drawing again.', - 'editor.views.repair.not_measurable': 'With this drawing, a view holding annotations would not be measurable. Nothing was applied.', + 'This free path is kept as it is. The drawing cannot be attached while it falls outside the new frame: the editor cannot yet correct the points of a free path.', + 'editor.views.repair.refused': + 'Nothing was applied: the document check refuses these values.', + 'editor.views.repair.more_outside': + 'Other elements would also fall outside the new frame: {names}. Nothing was applied. Cancel, fix them, then choose the drawing again.', + 'editor.views.repair.not_measurable': + 'With this drawing, a view holding annotations would not be measurable. Nothing was applied.', 'editor.views.repair.apply': 'Attach and apply', 'editor.views.repair.cancel': 'Cancel', 'editor.upload.working': 'Checking and sending the drawing…', 'editor.upload.done': 'The drawing is added to the view.', 'editor.upload.err.too_large': 'This file is larger than 2 MiB.', - 'editor.upload.err.svg_active_content': 'This file contains active or external content (script, link, remote image): it is refused.', - 'editor.upload.err.svg_rejected': 'This file is not a usable SVG drawing ({reason}).', - 'editor.upload.err.svg_not_canonical': "This drawing is not in the stored form: it is refused. Choose the original file again.", - 'editor.upload.err.size_mismatch': "A drawing's file size differs from the recorded size.", - 'editor.upload.err.upload_missing': 'The file did not reach the server. Try again.', - 'editor.upload.err.upload.pending_other': 'Another account is sending this drawing. Try again in a moment.', - 'editor.upload.err.object_conflict': "The illustration file's contents do not match its recorded SHA-256 hash.", - 'editor.upload.err.caps': 'Too many drawings in this editing session (16 at most). Save, then reload the draft.', + 'editor.upload.err.svg_active_content': + 'This file contains active or external content (script, link, remote image): it is refused.', + 'editor.upload.err.svg_rejected': + 'This file is not a usable SVG drawing ({reason}).', + 'editor.upload.err.svg_not_canonical': + 'This drawing is not in the stored form: it is refused. Choose the original file again.', + 'editor.upload.err.size_mismatch': + "A drawing's file size differs from the recorded size.", + 'editor.upload.err.upload_missing': + 'The file did not reach the server. Try again.', + 'editor.upload.err.upload.pending_other': + 'Another account is sending this drawing. Try again in a moment.', + 'editor.upload.err.object_conflict': + "The illustration file's contents do not match its recorded SHA-256 hash.", + 'editor.upload.err.caps': + 'Too many drawings in this editing session (16 at most). Save, then reload the draft.', 'editor.upload.err.core': 'The document check refused this drawing.', 'editor.upload.reason.malformed': 'malformed file', 'editor.upload.reason.doctype': 'DOCTYPE declaration not allowed', @@ -1550,16 +1695,20 @@ export const en: Dict = { 'editor.upload.reason.dangling_reference': 'reference to a missing element', 'editor.upload.reason.reserved_id': 'reserved identifier', 'editor.upload.reason.root_visibility': 'hidden root element', - 'editor.upload.reason.processing_instruction': "processing instruction not allowed", - 'editor.upload.reason.removal': "the file contains elements to remove", + 'editor.upload.reason.processing_instruction': + 'processing instruction not allowed', + 'editor.upload.reason.removal': 'the file contains elements to remove', 'editor.upload.reason.other': 'unrecognised reason', 'editor.cleaning.title': 'Clean this drawing?', - 'editor.cleaning.body': 'This file contains elements that are not kept. The preview shows the drawing as it will be saved.', + 'editor.cleaning.body': + 'This file contains elements that are not kept. The preview shows the drawing as it will be saved.', 'editor.cleaning.preview': 'Preview of the cleaned drawing', - 'editor.cleaning.preview_failed': 'The preview of the cleaned drawing cannot be composed.', + 'editor.cleaning.preview_failed': + 'The preview of the cleaned drawing cannot be composed.', 'editor.cleaning.removed': 'Removed elements:', 'editor.cleaning.active': 'Active or external content removed:', - 'editor.cleaning.style': 'The