Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
feat(ok): make destructive confirmations undismissable (PRD-7907) (#3389)
Andrew Mikofalvya7568eab1f05
diff --git a/knip.config.ts b/knip.config.tsindex f9179f2d4..78162ec09 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -123,9 +123,7 @@ export default {'packages/server': {entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],project: 'src/**',- ignoreDependencies: [- '@types/shell-quote',- ],+ ignoreDependencies: ['@types/shell-quote'],},'packages/cli': {entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],diff --git a/packages/app/src/components/DeleteConfirmationDialog.tsx b/packages/app/src/components/DeleteConfirmationDialog.tsxindex 2e793a12f..648b28533 100644--- a/packages/app/src/components/DeleteConfirmationDialog.tsx+++ b/packages/app/src/components/DeleteConfirmationDialog.tsx@@ -1,15 +1,15 @@import { Trans, useLingui } from '@lingui/react/macro';import type { ReactNode } from 'react';-import { Button } from '@/components/ui/button';import {- DialogBody,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from '@/components/ui/dialog';+ AlertDialogBody,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from '@/components/ui/alert-dialog';+import { Button } from '@/components/ui/button';import { Spinner } from '@/components/ui/spinner';interface DeleteConfirmationProps {@@ -62,29 +62,31 @@ export function DeleteConfirmationDialog({const confirmLabel = customConfirmLabel ?? t`Delete`;const confirmLabelBusy = customConfirmLabelBusy ?? customConfirmLabel ?? t`Deleting`;return (- <DialogContent>- <DialogHeader>- <DialogTitle>{customTitle ?? t`Delete ${itemName}`}</DialogTitle>- <DialogDescription+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>{customTitle ?? t`Delete ${itemName}`}</AlertDialogTitle>+ <AlertDialogDescription// respect \n in messageclassName="whitespace-pre-wrap">{customDescription ??t`Are you sure you want to delete ${itemName}? This action cannot be undone.`}- </DialogDescription>+ </AlertDialogDescription>{customDetail ? (<p className="text-muted-foreground text-sm" data-testid="delete-confirmation-detail">{customDetail}</p>) : null}- </DialogHeader>- {children ? <DialogBody>{children}</DialogBody> : null}- <DialogFooter>- <DialogClose asChild>- <Button variant="outline" disabled={isSubmitting}>- <Trans>Cancel</Trans>- </Button>- </DialogClose>+ </AlertDialogHeader>+ {children ? <AlertDialogBody>{children}</AlertDialogBody> : null}+ <AlertDialogFooter>+ <AlertDialogCancel disabled={isSubmitting}>+ <Trans>Cancel</Trans>+ </AlertDialogCancel>+ {/* Deliberately a plain Button rather than AlertDialogAction: the action+ is awaited and reports its in-flight state in this button's own+ label, and AlertDialogAction closes the dialog the moment it is+ activated. The owner closes the dialog once the work settles. */}<Button variant="destructive" onClick={onDelete} disabled={isSubmitting}>{isSubmitting ? (<>@@ -94,7 +96,7 @@ export function DeleteConfirmationDialog({confirmLabel)}</Button>- </DialogFooter>- </DialogContent>+ </AlertDialogFooter>+ </AlertDialogContent>);}diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsxindex 27c61e558..8eaf8fcef 100644--- a/packages/app/src/components/FileTree.tsx+++ b/packages/app/src/components/FileTree.tsx@@ -169,8 +169,8 @@ import {TrashFailureModal,} from '@/components/TrashFailureModal';import { TemplateMenuRows } from '@/components/template-menu-rows';+import { AlertDialog } from '@/components/ui/alert-dialog';import { Button } from '@/components/ui/button';-import { Dialog } from '@/components/ui/dialog';import {DropdownMenu,DropdownMenuContent,@@ -3601,7 +3601,7 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {)}/></div>- <Dialog+ <AlertDialogopen={!!deleteRequest}onOpenChange={(open) => {if (!open && !busyPath) setDeleteRequest(null);@@ -3662,8 +3662,8 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {onDelete={() => handleDeleteTargets(deleteRequest.targets)}/>)}- </Dialog>- <Dialog+ </AlertDialog>+ <AlertDialogopen={!!templateConvertRequest}onOpenChange={(open) => {if (!open && !busyPath) setTemplateConvertRequest(null);@@ -3685,8 +3685,8 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {onDelete={() => executeImportTemplate(templateConvertRequest, true)}/>)}- </Dialog>- <Dialog+ </AlertDialog>+ <AlertDialogopen={!!trashFailure}onOpenChange={(open) => {if (!open && !busyPath) setTrashFailure(null);@@ -3701,7 +3701,7 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {onCancel={() => setTrashFailure(null)}/>)}- </Dialog>+ </AlertDialog><NewItemDialogopen={newItemRequest !== null}onOpenChange={(open) => {diff --git a/packages/app/src/components/SkillDeleteDialog.tsx b/packages/app/src/components/SkillDeleteDialog.tsxindex 7181ec730..ac4e1be1e 100644--- a/packages/app/src/components/SkillDeleteDialog.tsx+++ b/packages/app/src/components/SkillDeleteDialog.tsx@@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { toast } from 'sonner';import { DeleteConfirmationDialog } from '@/components/DeleteConfirmationDialog';-import { Dialog } from '@/components/ui/dialog';+import { AlertDialog } from '@/components/ui/alert-dialog';import { useDocumentContext } from '@/editor/DocumentContext';import { tabIdsForSkill } from '@/hooks/use-reconcile-skill-tabs';import { deleteSkill } from '@/lib/skills-api';@@ -52,7 +52,7 @@ export function SkillDeleteDialog({ skill, onOpenChange, onDeleted }: Props) {}return (- <Dialog+ <AlertDialogopen={skill !== null}onOpenChange={(open) => {if (!open && !deleting) onOpenChange(false);@@ -73,6 +73,6 @@ export function SkillDeleteDialog({ skill, onOpenChange, onDeleted }: Props) {}/>) : null}- </Dialog>+ </AlertDialog>);}diff --git a/packages/app/src/components/SkillFileDeleteDialog.tsx b/packages/app/src/components/SkillFileDeleteDialog.tsxindex 1776836b3..7601774f1 100644--- a/packages/app/src/components/SkillFileDeleteDialog.tsx+++ b/packages/app/src/components/SkillFileDeleteDialog.tsx@@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { toast } from 'sonner';import { DeleteConfirmationDialog } from '@/components/DeleteConfirmationDialog';-import { Dialog } from '@/components/ui/dialog';+import { AlertDialog } from '@/components/ui/alert-dialog';import { useDocumentContext } from '@/editor/DocumentContext';import { tabIdsForSkillFile } from '@/hooks/use-reconcile-skill-tabs';import { skillDir } from '@/lib/skill-scope';@@ -62,7 +62,7 @@ export function SkillFileDeleteDialog({}return (- <Dialog+ <AlertDialogopen={target !== null}onOpenChange={(open) => {if (!open && !deleting) onOpenChange(false);@@ -76,6 +76,6 @@ export function SkillFileDeleteDialog({customDescription={t`This permanently removes ${skillDir(target.skill.path)}/${target.filePath} from the "${target.skill.name}" skill. Anything in SKILL.md that points at it will break until it's recreated.`}/>) : null}- </Dialog>+ </AlertDialog>);}diff --git a/packages/app/src/components/TemplateDeleteDialog.tsx b/packages/app/src/components/TemplateDeleteDialog.tsxindex 47e640b38..3d40e8343 100644--- a/packages/app/src/components/TemplateDeleteDialog.tsx+++ b/packages/app/src/components/TemplateDeleteDialog.tsx@@ -2,7 +2,7 @@ import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { toast } from 'sonner';import { DeleteConfirmationDialog } from '@/components/DeleteConfirmationDialog';-import { Dialog } from '@/components/ui/dialog';+import { AlertDialog } from '@/components/ui/alert-dialog';import type { TemplateMenuEntry } from '@/hooks/use-folder-config';import { deleteTemplate } from '@/lib/folder-config-api';@@ -40,7 +40,7 @@ export function TemplateDeleteDialog({ template, onOpenChange, onDeleted }: Prop}return (- <Dialog+ <AlertDialogopen={template !== null}onOpenChange={(open) => {if (!open && !deleting) onOpenChange(false);@@ -63,6 +63,6 @@ export function TemplateDeleteDialog({ template, onOpenChange, onDeleted }: Prop);})(): null}- </Dialog>+ </AlertDialog>);}diff --git a/packages/app/src/components/TrashFailureModal.dom.test.tsx b/packages/app/src/components/TrashFailureModal.dom.test.tsxindex 326c976ff..6e3643fc8 100644--- a/packages/app/src/components/TrashFailureModal.dom.test.tsx+++ b/packages/app/src/components/TrashFailureModal.dom.test.tsx@@ -47,8 +47,8 @@ async function renderTrashFailureModal({failedTargets?: ReadonlyArray<TrashFailedTarget>;isSubmitting?: boolean;} = {}) {- const [{ Dialog }, { TrashFailureModal }] = await Promise.all([- import('@/components/ui/dialog'),+ const [{ AlertDialog }, { TrashFailureModal }] = await Promise.all([+ import('@/components/ui/alert-dialog'),import('./TrashFailureModal'),]);const onCancel = vi.fn(() => {});@@ -56,7 +56,7 @@ async function renderTrashFailureModal({const onDeletePermanently = vi.fn(() => {});render(- <Dialog open={true}>+ <AlertDialog open={true}><TrashFailureModalfailedTargets={failedTargets}isSubmitting={isSubmitting}@@ -64,7 +64,7 @@ async function renderTrashFailureModal({onDeletePermanently={onDeletePermanently}onRetry={onRetry}/>- </Dialog>,+ </AlertDialog>,);return { onCancel, onDeletePermanently, onRetry };@@ -83,7 +83,7 @@ describe('TrashFailureModal runtime behavior', () => {test('renders the single-target VSCode-parity copy and routes each action', async () => {const { onCancel, onDeletePermanently, onRetry } = await renderTrashFailureModal();- const dialog = screen.getByRole('dialog', { name: "Couldn't move to Trash" });+ const dialog = screen.getByRole('alertdialog', { name: "Couldn't move to Trash" });expect(dialog.textContent).toContain('Could not move "foo.md" to the Trash.');expect(dialog.textContent).toContain('Do you want to permanently delete instead?');expect(dialog.textContent).toContain('Reason: Permission denied (Operation not permitted)');@@ -147,7 +147,7 @@ describe('TrashFailureModal runtime behavior', () => {failedTargets: [fileTarget, folderTarget],});- const dialog = screen.getByRole('dialog', { name: "Couldn't move to Trash" });+ const dialog = screen.getByRole('alertdialog', { name: "Couldn't move to Trash" });expect(dialog.textContent).toContain('2 items could not be moved to the Trash. Do you want to permanently delete instead?',);diff --git a/packages/app/src/components/TrashFailureModal.tsx b/packages/app/src/components/TrashFailureModal.tsxindex 791c6a4f2..026cf740b 100644--- a/packages/app/src/components/TrashFailureModal.tsx+++ b/packages/app/src/components/TrashFailureModal.tsx@@ -1,14 +1,15 @@import { plural, t } from '@lingui/core/macro';import { Trans } from '@lingui/react/macro';-import { Button } from '@/components/ui/button';import {- DialogBody,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from '@/components/ui/dialog';+ AlertDialogBody,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from '@/components/ui/alert-dialog';+import { Button } from '@/components/ui/button';import { Spinner } from '@/components/ui/spinner';import { trashNounLabel } from '@/lib/platform-labels';@@ -18,9 +19,9 @@ import { trashNounLabel } from '@/lib/platform-labels';* a hard delete via `POST /api/delete-path` (which bypasses the OS Trash and* uses `unlinkSync`/`rmSync`), to retry the IPC call, or to cancel.*- * Copy is VSCode-parity (split into DialogTitle + DialogDescription so the- * `text-base leading-none` title primitive doesn't wrap a 2-sentence string- * to 3 lines with zero leading; semantics preserved):+ * Copy is VSCode-parity (split into AlertDialogTitle + AlertDialogDescription+ * so the `text-base leading-none` title primitive doesn't wrap a 2-sentence+ * string to 3 lines with zero leading; semantics preserved):* Title: "Couldn't move to Trash"* Description: "<target context> Do you want to permanently delete instead?"* (per-target detail appended for single-target failures)@@ -141,13 +142,15 @@ export function TrashFailureModal({? `${t`Could not move "${targetName}" to the ${trashNoun}. Do you want to permanently delete instead?`}\n${formatTrashFailureDetail(only)}`: t`Do you want to permanently delete instead?`;return (- <DialogContent className="sm:max-w-md">- <DialogHeader>- <DialogTitle>{t`Couldn't move to ${trashNoun}`}</DialogTitle>- <DialogDescription className="whitespace-pre-wrap">{headerDescription}</DialogDescription>- </DialogHeader>+ <AlertDialogContent className="sm:max-w-md">+ <AlertDialogHeader>+ <AlertDialogTitle>{t`Couldn't move to ${trashNoun}`}</AlertDialogTitle>+ <AlertDialogDescription className="whitespace-pre-wrap">+ {headerDescription}+ </AlertDialogDescription>+ </AlertDialogHeader>{isMulti ? (- <DialogBody>+ <AlertDialogBody><ul className="flex flex-col gap-2 text-xs">{failedTargets.map((target) => (<li key={target.path} data-testid="trash-failure-modal-target">@@ -156,18 +159,20 @@ export function TrashFailureModal({</li>))}</ul>- </DialogBody>+ </AlertDialogBody>) : null}- <DialogFooter>- <Button- variant="outline"- className="font-mono uppercase"+ <AlertDialogFooter>+ <AlertDialogCancelonClick={onCancel}disabled={isSubmitting}data-testid="trash-failure-modal-cancel"><Trans>Cancel</Trans>- </Button>+ </AlertDialogCancel>+ {/* Retry and Delete Permanently stay plain Buttons: both await IPC and+ report progress in their own labels, and an AlertDialogAction would+ close the dialog on activation. Retry in particular must keep the+ dialog mounted so a second failure can repopulate the same list. */}<Buttonvariant="outline"className="font-mono uppercase"@@ -197,7 +202,7 @@ export function TrashFailureModal({<Trans>Delete Permanently</Trans>)}</Button>- </DialogFooter>- </DialogContent>+ </AlertDialogFooter>+ </AlertDialogContent>);}diff --git a/packages/app/src/components/settings/LintingSection.tsx b/packages/app/src/components/settings/LintingSection.tsxindex c1a2f57b4..c69141d91 100644--- a/packages/app/src/components/settings/LintingSection.tsx+++ b/packages/app/src/components/settings/LintingSection.tsx@@ -25,8 +25,8 @@ import { ArrowUpRight, Plus, SquarePen, Trash2 } from 'lucide-react';import { useState } from 'react';import { toast } from 'sonner';import { DeleteConfirmationDialog } from '@/components/DeleteConfirmationDialog';+import { AlertDialog } from '@/components/ui/alert-dialog';import { Button } from '@/components/ui/button';-import { Dialog } from '@/components/ui/dialog';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';@@ -758,7 +758,7 @@ export function FrontmatterPluginSection() {))}</div>)}- <Dialog+ <AlertDialogopen={deleteTarget !== null}onOpenChange={(open) => {if (!open && !deleting) setDeleteTarget(null);@@ -772,7 +772,7 @@ export function FrontmatterPluginSection() {customDescription={t`This permanently deletes ${deleteTarget} from the project and removes its mapping from config.yml.`}/>) : null}- </Dialog>+ </AlertDialog></section>);}diff --git a/packages/app/src/components/ui/alert-dialog.dom.test.tsx b/packages/app/src/components/ui/alert-dialog.dom.test.tsxnew file mode 100644index 000000000..4be3df440--- /dev/null+++ b/packages/app/src/components/ui/alert-dialog.dom.test.tsx@@ -0,0 +1,310 @@+/**+ * DOM-substrate tests for AlertDialog.+ *+ * This primitive exists for one reason: a destructive confirmation must not be+ * dismissible by an accidental pointer gesture. Every assertion below is either+ * that property, or one of the properties the confirmation dialogs built on top+ * of it depend on.+ *+ * Several tests render a plain `Dialog` alongside as a control. Without one, a+ * "did not dismiss" assertion passes just as happily when the synthetic gesture+ * never reached Radix at all, which is the failure mode that makes this whole+ * file worthless.+ */++import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';+import { afterEach, describe, expect, test, vi } from 'vitest';+import { expectVisualClassTokens } from '@/test-utils/visual-contract';+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogBody,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from './alert-dialog';+import { Button } from './button';+import { Dialog, DialogContent, DialogDescription, DialogTitle } from './dialog';++afterEach(cleanup);++const A11Y_OPT_IN = [+ 'motion-reduce:data-open:animate-none',+ 'motion-reduce:data-closed:animate-none',+ 'motion-reduce:duration-0',+] as const;++function renderAlert({+ onOpenChange = () => {},+ footer,+}: {+ onOpenChange?: (open: boolean) => void;+ footer?: React.ReactNode;+} = {}) {+ render(+ <AlertDialog open onOpenChange={onOpenChange}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete the thing</AlertDialogTitle>+ <AlertDialogDescription>This cannot be undone.</AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogBody>+ <p>a body slot</p>+ </AlertDialogBody>+ <AlertDialogFooter>+ {footer ?? <AlertDialogCancel>Cancel</AlertDialogCancel>}+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>,+ );+}++/**+ * Radix registers its outside-pointerdown listener inside a zero-delay timeout,+ * so the gesture that opened a layer cannot immediately close it again. A test+ * that dispatches an outside gesture before that tick elapses reaches no+ * listener at all, and every "did not dismiss" assertion downstream of it+ * passes for the wrong reason.+ */+async function armOutsideDismissal() {+ await act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 0));+ });+}++function renderPlainDialog(onOpenChange: (open: boolean) => void) {+ render(+ <Dialog open onOpenChange={onOpenChange}>+ <DialogContent>+ <DialogTitle>Delete the thing</DialogTitle>+ <DialogDescription>This cannot be undone.</DialogDescription>+ </DialogContent>+ </Dialog>,+ );+}++describe('AlertDialog module surface', () => {+ test('exports the full API surface', async () => {+ const mod = await import('./alert-dialog');+ for (const name of [+ 'AlertDialog',+ 'AlertDialogAction',+ 'AlertDialogBody',+ 'AlertDialogCancel',+ 'AlertDialogContent',+ 'AlertDialogDescription',+ 'AlertDialogFooter',+ 'AlertDialogHeader',+ 'AlertDialogOverlay',+ 'AlertDialogPortal',+ 'AlertDialogTitle',+ 'AlertDialogTrigger',+ ]) {+ expect(typeof (mod as Record<string, unknown>)[name]).toBe('function');+ }+ });+});++describe('AlertDialog semantics', () => {+ test('announces as an alertdialog rather than a plain dialog', () => {+ renderAlert();++ expect(screen.getByRole('alertdialog')).toBeTruthy();+ });++ test('carries an accessible name and description from its title and description slots', () => {+ renderAlert();++ const content = screen.getByRole('alertdialog');+ const labelledBy = content.getAttribute('aria-labelledby');+ const describedBy = content.getAttribute('aria-describedby');++ expect(labelledBy && document.getElementById(labelledBy)?.textContent).toBe('Delete the thing');+ expect(describedBy && document.getElementById(describedBy)?.textContent).toBe(+ 'This cannot be undone.',+ );+ });++ test('renders no corner close affordance, unlike the Dialog it replaces', () => {+ renderAlert();++ expect(screen.queryByRole('button', { name: 'Close' })).toBeNull();++ // Control: the same query finds Dialog's close-X, so the assertion above is+ // about AlertDialog and not about a query that never matches anything.+ cleanup();+ renderPlainDialog(() => {});++ expect(screen.getByRole('button', { name: 'Close' })).toBeTruthy();+ });++ test('renders body-slot children inside the scrollable region', () => {+ renderAlert();++ const body = document.querySelector('[data-slot="alert-dialog-body"]');++ expect(body?.textContent).toBe('a body slot');+ });+});++describe('AlertDialog dismissal', () => {+ test('an outside pointer gesture does not dismiss it', async () => {+ const onOpenChange = vi.fn();+ renderAlert({ onOpenChange });+ await armOutsideDismissal();++ fireEvent.pointerDown(document.body);+ fireEvent.click(document.body);++ expect(onOpenChange).not.toHaveBeenCalled();+ });++ test('the same outside gesture does dismiss a plain Dialog', async () => {+ // The control for the test above. If this ever stops dismissing, the+ // synthetic gesture has stopped reaching Radix and the "does not dismiss"+ // assertion has quietly become vacuous.+ const onOpenChange = vi.fn();+ renderPlainDialog(onOpenChange);+ await armOutsideDismissal();++ fireEvent.pointerDown(document.body);+ fireEvent.click(document.body);++ expect(onOpenChange).toHaveBeenCalledWith(false);+ });++ test('Escape still dismisses, because it reads as Cancel', () => {+ const onOpenChange = vi.fn();+ renderAlert({ onOpenChange });++ fireEvent.keyDown(document, { key: 'Escape' });++ expect(onOpenChange).toHaveBeenCalledWith(false);+ });+});++describe('AlertDialog focus', () => {+ test('opening moves focus to the cancel choice, not the confirming one', async () => {+ renderAlert({+ footer: (+ <>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction>Delete</AlertDialogAction>+ </>+ ),+ });++ await waitFor(() => {+ expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Cancel' }));+ });+ });+});++describe('AlertDialog footer choices', () => {+ test('activating the cancel choice closes the dialog', () => {+ const onOpenChange = vi.fn();+ renderAlert({ onOpenChange });++ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));++ expect(onOpenChange).toHaveBeenCalledWith(false);+ });++ test('activating the action choice closes the dialog immediately', () => {+ // The reason both confirmation dialogs keep a plain Button for their+ // destructive action: they await a request and report progress in the+ // button's own label, which an immediate close would tear down.+ const onOpenChange = vi.fn();+ renderAlert({+ onOpenChange,+ footer: (+ <>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction>Delete</AlertDialogAction>+ </>+ ),+ });++ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));++ expect(onOpenChange).toHaveBeenCalledWith(false);+ });++ test('a plain Button in the footer leaves the dialog open', () => {+ const onOpenChange = vi.fn();+ const onDelete = vi.fn();+ renderAlert({+ onOpenChange,+ footer: (+ <>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <Button variant="destructive" onClick={onDelete}>+ Delete+ </Button>+ </>+ ),+ });++ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));++ expect(onDelete).toHaveBeenCalledTimes(1);+ expect(onOpenChange).not.toHaveBeenCalled();+ expect(screen.getByRole('alertdialog')).toBeTruthy();+ });++ test('a disabled cancel choice does not close the dialog', () => {+ // Both consumers disable Cancel while their action is in flight.+ const onOpenChange = vi.fn();+ renderAlert({+ onOpenChange,+ footer: <AlertDialogCancel disabled>Cancel</AlertDialogCancel>,+ });++ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));++ expect(onOpenChange).not.toHaveBeenCalled();+ });+});++describe('AlertDialog surface classes', () => {+ test('overlay opts out of the OS drag region and of animation under reduced motion', () => {+ renderAlert();++ const overlay = document.querySelector('[data-slot="alert-dialog-overlay"]');++ expectVisualClassTokens(overlay?.getAttribute('class'), [+ '[-webkit-app-region:no-drag]',+ ...A11Y_OPT_IN,+ ]);+ });++ test('content opts out of the OS drag region and of animation under reduced motion', () => {+ renderAlert();++ expectVisualClassTokens(screen.getByRole('alertdialog').getAttribute('class'), [+ '[-webkit-app-region:no-drag]',+ 'max-h-[calc(100dvh-2rem)]',+ ...A11Y_OPT_IN,+ ]);+ });++ test('caller className composes with the base classes rather than replacing them', () => {+ render(+ <AlertDialog open>+ <AlertDialogContent className="sm:max-w-md">+ <AlertDialogTitle>Title</AlertDialogTitle>+ <AlertDialogDescription>Description</AlertDialogDescription>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ </AlertDialogContent>+ </AlertDialog>,+ );++ expectVisualClassTokens(screen.getByRole('alertdialog').getAttribute('class'), [+ 'sm:max-w-md',+ '[-webkit-app-region:no-drag]',+ ]);+ });+});diff --git a/packages/app/src/components/ui/alert-dialog.tsx b/packages/app/src/components/ui/alert-dialog.tsxnew file mode 100644index 000000000..e86fb909a--- /dev/null+++ b/packages/app/src/components/ui/alert-dialog.tsx@@ -0,0 +1,225 @@+import { AlertDialog as AlertDialogPrimitive } from 'radix-ui';+import type * as React from 'react';+import { Button } from '@/components/ui/button';+import { cn } from '@/lib/utils';++/**+ * Confirmation dialog for decisions that must not be dismissed by accident.+ *+ * Radix's `AlertDialog` differs from `Dialog` in three ways that matter here:+ * it renders `role="alertdialog"`, it preventDefaults outside pointer/interact+ * events so a stray click on the overlay cannot dismiss the decision, and it+ * moves initial focus onto `AlertDialogCancel` rather than the first focusable+ * child. Escape still closes, which is the documented alertdialog keyboard+ * contract and reads as Cancel — the accidental-dismissal risk is the pointer,+ * not a deliberate keystroke.+ *+ * Because focus-on-open targets the cancel element, **every `AlertDialogContent`+ * must render an `AlertDialogCancel`.** Without one, Radix suppresses its default+ * auto-focus and focuses nothing, leaving focus stranded on `<body>` — strictly+ * worse than the plain Dialog it replaces.+ *+ * Hand-authored rather than installed via `shadcn add`, and the class strings+ * mirror `dialog.tsx` rather than the registry's:+ * - The registry component omits `[-webkit-app-region:no-drag]`. Without it,+ * pointer events over the OS titlebar drag region are swallowed by the+ * window-drag handler, so a dialog anchored near the top of the Electron+ * window becomes unclickable. Same reasoning as `dialog.tsx`.+ * - The registry component omits the `motion-reduce:*` opt-outs, so it+ * animates through `prefers-reduced-motion`.+ * - The registry title uses a `cn-font-heading` token that does not exist in+ * this project's theme, so it would silently fall back to the body font+ * while every sibling dialog uses `font-heading`.+ * - The registry has no body slot, and both consumers render a scrollable+ * list between the header and the footer.+ * Sharing one class string across `dialog.tsx` and this file was considered and+ * rejected: shadcn primitives are vendored copies meant to be edited+ * independently, and `sheet.tsx` already carries its own near-identical copy.+ *+ * `dialog.tsx`'s `ignoreToastInteractOutside` guard has no analogue here on+ * purpose — no outside interaction dismisses an alert dialog, so a toast+ * dismissal above it is already inert.+ */+function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;+}++function AlertDialogTrigger({+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;+}++function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {+ return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;+}++function AlertDialogOverlay({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {+ return (+ <AlertDialogPrimitive.Overlay+ data-slot="alert-dialog-overlay"+ className={cn(+ 'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs [-webkit-app-region:no-drag] data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0',+ className,+ )}+ {...props}+ />+ );+}++function AlertDialogContent({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {+ return (+ <AlertDialogPortal>+ <AlertDialogOverlay />+ <AlertDialogPrimitive.Content+ data-slot="alert-dialog-content"+ // No close affordance in the corner, by design: an alert dialog offers+ // exactly the choices in its footer. Layout otherwise matches+ // DialogContent so a migrated dialog keeps its current proportions —+ // scrolling lives in AlertDialogBody, the footer stays pinned.+ className={cn(+ 'fixed top-1/2 left-1/2 z-50 flex w-full max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-6 overflow-hidden rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm [-webkit-app-region:no-drag] data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0',+ className,+ )}+ {...props}+ />+ </AlertDialogPortal>+ );+}++function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {+ return (+ <div+ data-slot="alert-dialog-header"+ className={cn('flex shrink-0 flex-col gap-4', className)}+ {...props}+ />+ );+}++function AlertDialogBody({ className, ...props }: React.ComponentProps<'div'>) {+ return (+ <div+ data-slot="alert-dialog-body"+ className={cn(+ '-mx-6 min-h-0 flex-1 overflow-y-auto px-6 subtle-scrollbar scroll-fade-mask',+ className,+ )}+ {...props}+ />+ );+}++function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {+ return (+ <div+ data-slot="alert-dialog-footer"+ className={cn(+ '-mx-6 -mb-6 flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-6 py-4 sm:flex-row sm:justify-end',+ className,+ )}+ {...props}+ />+ );+}++function AlertDialogTitle({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {+ return (+ <AlertDialogPrimitive.Title+ data-slot="alert-dialog-title"+ className={cn('font-heading text-base leading-none font-medium', className)}+ {...props}+ />+ );+}++function AlertDialogDescription({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {+ return (+ <AlertDialogPrimitive.Description+ data-slot="alert-dialog-description"+ className={cn(+ 'text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',+ className,+ )}+ {...props}+ />+ );+}++/**+ * The dismissing choice, and the element Radix focuses when the dialog opens.+ * `font-mono uppercase` matches the treatment `DialogClose` bakes in, so a+ * migrated cancel button keeps its current appearance.+ */+function AlertDialogCancel({+ className,+ variant = 'outline',+ size = 'default',+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {+ return (+ <Button variant={variant} size={size} asChild>+ <AlertDialogPrimitive.Cancel+ data-slot="alert-dialog-cancel"+ className={cn('font-mono uppercase', className)}+ {...props}+ />+ </Button>+ );+}++/**+ * The confirming choice, for actions that resolve synchronously.+ *+ * Radix builds both Action and Cancel on `Dialog.Close`, so activating either+ * one closes the dialog immediately. An action that awaits a request and shows+ * an in-flight state in its own label therefore cannot use this — the dialog+ * would unmount out from under the pending work. Those call sites keep a plain+ * `Button` with an `onClick` and let the owner close the dialog once the work+ * settles.+ */+function AlertDialogAction({+ className,+ variant = 'default',+ size = 'default',+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {+ return (+ <Button variant={variant} size={size} asChild>+ <AlertDialogPrimitive.Action+ data-slot="alert-dialog-action"+ className={cn(className)}+ {...props}+ />+ </Button>+ );+}++export {+ AlertDialog,+ AlertDialogAction,+ AlertDialogBody,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogOverlay,+ AlertDialogPortal,+ AlertDialogTitle,+ AlertDialogTrigger,+};diff --git a/packages/app/src/globals.css b/packages/app/src/globals.cssindex 86c3fcb47..89848b9a0 100644--- a/packages/app/src/globals.css+++ b/packages/app/src/globals.css@@ -374,7 +374,8 @@`!important` (same cascade discipline as the reduced-motion block above). */@media (prefers-reduced-transparency: reduce) {[data-slot="dialog-overlay"],- [data-slot="sheet-overlay"] {+ [data-slot="sheet-overlay"],+ [data-slot="alert-dialog-overlay"] {-webkit-backdrop-filter: none;backdrop-filter: none;}diff --git a/packages/app/src/globals.reduced-transparency.test.ts b/packages/app/src/globals.reduced-transparency.test.tsindex 28fb632bc..215879c34 100644--- a/packages/app/src/globals.reduced-transparency.test.ts+++ b/packages/app/src/globals.reduced-transparency.test.ts@@ -54,7 +54,11 @@ describe('globals.css — prefers-reduced-transparency revert', () => {);});- test('strips backdrop-filter from dialog and sheet overlays', () => {+ // Every overlay slot that opts into a backdrop blur has to be listed here by+ // its exact selector. A new overlay primitive inherits the blur but not the+ // suppression, and the omission is invisible: the blur is `backdrop-blur-xs`,+ // subtle enough to pass a sighted spot-check by someone who has the setting on.+ test('strips backdrop-filter from dialog, sheet, and alert-dialog overlays', () => {const block = CSS.match(/@media \(prefers-reduced-transparency: reduce\) \{[^}]*\[data-slot="dialog-overlay"\][\s\S]*?\}\s*\}/,);@@ -62,6 +66,7 @@ describe('globals.css — prefers-reduced-transparency revert', () => {const blockText = block?.[0] ?? '';expect(blockText).toContain('[data-slot="dialog-overlay"]');expect(blockText).toContain('[data-slot="sheet-overlay"]');+ expect(blockText).toContain('[data-slot="alert-dialog-overlay"]');expect(blockText).toContain('backdrop-filter: none');expect(blockText).toContain('-webkit-backdrop-filter: none');});diff --git a/packages/app/tests/integration/fullscreen-overlay-safe-area-coverage.test.ts b/packages/app/tests/integration/fullscreen-overlay-safe-area-coverage.test.tsindex 77c594dfa..0790859f7 100644--- a/packages/app/tests/integration/fullscreen-overlay-safe-area-coverage.test.ts+++ b/packages/app/tests/integration/fullscreen-overlay-safe-area-coverage.test.ts@@ -141,6 +141,13 @@ interface AllowlistEntry {* — prefer migration to the safe-area-aware wrapper when feasible.*/const ALLOWLIST: readonly AllowlistEntry[] = [+ {+ file: 'components/ui/alert-dialog.tsx',+ pattern: 'P1-fixed-inset-0',+ // Stronger than the sibling Dialog/Sheet case: an alert dialog is+ // undismissable, so the backdrop carries no click behavior either.+ rationale: 'Radix AlertDialog.Overlay backdrop — no interactive content',+ },{file: 'components/ui/dialog.tsx',pattern: 'P1-fixed-inset-0',diff --git a/packages/app/tests/stress/file-tree-create.e2e.ts b/packages/app/tests/stress/file-tree-create.e2e.tsindex 5ced25145..dbb678189 100644--- a/packages/app/tests/stress/file-tree-create.e2e.ts+++ b/packages/app/tests/stress/file-tree-create.e2e.ts@@ -447,7 +447,7 @@ test.describe('FileTree sidebar create', () => {await firstItem.click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -510,7 +510,7 @@ test.describe('FileTree sidebar create', () => {await sidebarTreeItem(page, `${docNames[0]}.md`).click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -591,7 +591,7 @@ test.describe('FileTree sidebar create', () => {await sidebarTreeItem(page, `${firstDoc}.md`).click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -656,7 +656,7 @@ test.describe('FileTree sidebar create', () => {await selectAllSidebarItems(page, `${fileNames[0]}.md`);await sidebarTreeItem(page, `${fileNames[0]}.md`).click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -720,7 +720,7 @@ test.describe('FileTree sidebar create', () => {await sidebarTreeItem(page, 'New Folder').click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -784,7 +784,7 @@ test.describe('FileTree sidebar create', () => {await selectAllSidebarItems(page, `${fileNames[0]}.md`);await sidebarTreeItem(page, `${fileNames[0]}.md`).click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete selected items/i })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete selected items/i })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();@@ -997,7 +997,7 @@ test.describe('FileTree sidebar create', () => {await sidebarTreeItem(page, 'New Folder').click({ button: 'right' });await page.getByRole('menuitem', { name: /^Delete$/ }).click({ timeout: 5_000 });- await expect(page.getByRole('dialog', { name: /Delete New Folder\// })).toBeVisible({+ await expect(page.getByRole('alertdialog', { name: /Delete New Folder\// })).toBeVisible({timeout: 5_000,});await page.getByRole('button', { name: /^Delete$/ }).click();diff --git a/packages/app/tests/stress/show-ok-folders.e2e.ts b/packages/app/tests/stress/show-ok-folders.e2e.tsindex cb4189dd5..1c529be14 100644--- a/packages/app/tests/stress/show-ok-folders.e2e.ts+++ b/packages/app/tests/stress/show-ok-folders.e2e.ts@@ -237,9 +237,9 @@ test('an activated .ok folder row never becomes a mutation target — create falawait controlRow.focus();await expect(controlRow).toBeFocused();await page.keyboard.press('Delete');- await expect(page.getByRole('dialog')).toBeVisible({ timeout: 10_000 });+ await expect(page.getByRole('alertdialog')).toBeVisible({ timeout: 10_000 });await page.keyboard.press('Escape');- await expect(page.getByRole('dialog')).toHaveCount(0);+ await expect(page.getByRole('alertdialog')).toHaveCount(0);// The same key on the selected-and-focused `.ok` row: no dialog opens, and// the folder (with its probe file) stays on disk.@@ -254,7 +254,7 @@ test('an activated .ok folder row never becomes a mutation target — create falawait okRow.focus();await expect(okRow).toBeFocused();await page.keyboard.press('Delete');- await expect(page.getByRole('dialog')).toHaveCount(0);+ await expect(page.getByRole('alertdialog')).toHaveCount(0);await expect(okRow).toBeVisible();expect(existsSync(join(okDir, `${probeDocBase}.md`))).toBe(true);diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.tsindex dfd95ef49..d7a845280 100644--- a/packages/core/src/bridge/bind-frontmatter-doc.ts+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts@@ -1,4 +1,3 @@-import type * as Y from 'yjs';import type { Err, Ok, Result } from '../config/result.ts';import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.tsindex 8bfdb40cd..005627195 100644--- a/packages/core/src/bridge/bridge-invariant.ts+++ b/packages/core/src/bridge/bridge-invariant.ts@@ -1,4 +1,3 @@-import { fnv1aDigest } from './hash-util.ts';export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.tsindex 2a597ec3d..f4cc8a286 100644--- a/packages/core/src/bridge/compose.ts+++ b/packages/core/src/bridge/compose.ts@@ -1,4 +1,3 @@-import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.tsindex 01ef76a9f..8fb428b90 100644--- a/packages/core/src/bridge/doc-boundary-space.ts+++ b/packages/core/src/bridge/doc-boundary-space.ts@@ -1,4 +1,3 @@-import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.tsindex 463e89595..9d9c244b0 100644--- a/packages/core/src/bridge/growth-detect.ts+++ b/packages/core/src/bridge/growth-detect.ts@@ -1,4 +1,3 @@-const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.tsindex 0939885bb..c43fdd7e7 100644--- a/packages/core/src/bridge/intraline-predicate.ts+++ b/packages/core/src/bridge/intraline-predicate.ts@@ -1,4 +1,3 @@-export function rawLineCounts(doc: string): Map<string, number> {const counts = new Map<string, number>();for (const line of doc.split('\n')) {diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.tsindex c0dc65705..251560a35 100644--- a/packages/core/src/bridge/merge-three-way.ts+++ b/packages/core/src/bridge/merge-three-way.ts@@ -65,7 +65,6 @@ export function tryLineLevelCombine(return { clean: true, merged };}-export type BridgeMergeContentLossSide = 'user' | 'agent';export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.tsindex dcc5b0690..01ac80099 100644--- a/packages/core/src/bridge/normalize.ts+++ b/packages/core/src/bridge/normalize.ts@@ -1,4 +1,3 @@-import { stripFrontmatter } from '../extensions/frontmatter.ts';import { bodyEdgeEmpties } from './doc-boundary-space.ts';diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.tsindex 0be5203e4..754dc5cc2 100644--- a/packages/core/src/bridge/pm-structural-equivalence.ts+++ b/packages/core/src/bridge/pm-structural-equivalence.ts@@ -32,7 +32,6 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };const BR_LITERAL_RE = /^<br\s*\/?>$/i;-interface DegradeEntry {readonly label: string;readonly severity: ToleranceClassSeverity;@@ -128,7 +127,6 @@ export interface ComparePmStructuralOptions {ignoreAttrs?: (attrKey: string) => boolean;}-/** Rebuild a node with `fn` applied to each child; identity when childless.* Shared by the degrade canonicalizers so none re-implements the walk. */function mapChildren(@@ -250,7 +248,6 @@ function applyDegrades(tree: PmStructuralNode): {return { normalized: current, fired };}-export function comparePmStructural(expected: PmStructuralNode,actual: PmStructuralNode,diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.tsindex dca644141..af20de1e2 100644--- a/packages/core/src/bridge/subsequence.ts+++ b/packages/core/src/bridge/subsequence.ts@@ -1,4 +1,3 @@-/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):* insertions in `haystack` are free; any dropped or substituted `needle` byte* fails. */diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.tsindex a363dfd54..83d47404a 100644--- a/packages/core/src/markdown/callout-transformer.ts+++ b/packages/core/src/markdown/callout-transformer.ts@@ -1,4 +1,3 @@-import type { Blockquote, Paragraph, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.tsindex 4499dbc92..9807a7e82 100644--- a/packages/core/src/markdown/code-fence.ts+++ b/packages/core/src/markdown/code-fence.ts@@ -1,4 +1,3 @@-export function selectFenceChar(info: string): '`' | '~' {return info.includes('`') ? '~' : '`';}diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.tsindex 34704165b..7415c474a 100644--- a/packages/core/src/markdown/comment-promoter.ts+++ b/packages/core/src/markdown/comment-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.tsindex b6299a948..ece5c02a1 100644--- a/packages/core/src/markdown/dedent-block-jsx-close.ts+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts@@ -1,4 +1,3 @@-import { findFencedRegions, isInsideFence } from './fence-regions.ts';const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.tsindex acd398aa6..54774764a 100644--- a/packages/core/src/markdown/details-accordion-promoter.ts+++ b/packages/core/src/markdown/details-accordion-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.tsindex ba9b56384..43ecdc709 100644--- a/packages/core/src/markdown/div-align-promoter.ts+++ b/packages/core/src/markdown/div-align-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';import type { MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.tsindex 4513da9bb..6d3f3643e 100644--- a/packages/core/src/markdown/fence-regions.ts+++ b/packages/core/src/markdown/fence-regions.ts@@ -1,4 +1,3 @@-const FENCE_RE = /^(`{3,}|~{3,})/gm;export function findFencedRegions(src: string): Array<[number, number]> {diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.tsindex 6931623c7..00f5771ee 100644--- a/packages/core/src/markdown/fixtures/index.ts+++ b/packages/core/src/markdown/fixtures/index.ts@@ -1,4 +1,3 @@-import { readFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {return resolve(FIXTURES_DIR, ...segments);}-interface GfmExample {section: string;markdown: string;@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];}-interface MdxCrashEntry {id: string;input: string;@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {) as LargeEmbedFixture[];}-export function loadPrd6955Before(): string {return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');}@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');}-export interface NgPinnedCase {id: string;name: string;@@ -97,7 +92,6 @@ export function loadNgPinnedCases(): NgPinnedCase[] {) as NgPinnedCase[];}-export function loadLargeRealistic(): string {return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');}diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.tsindex daa3ef82b..8b1eb8519 100644--- a/packages/core/src/markdown/fixtures/perf/generate.ts+++ b/packages/core/src/markdown/fixtures/perf/generate.ts@@ -1,4 +1,3 @@-import { writeFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;const SEED = 0xf1de1117;-function mulberry32(seed: number): () => number {let a = seed >>> 0;return () => {@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {return items[items.length - 1][0];}-const WORDS = ['lorem','ipsum',@@ -156,7 +153,6 @@ function mdxBlock(rand: () => number): string {return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;}-type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';const MIX: readonly [BlockKind, number][] = [@@ -195,7 +191,6 @@ function generateDocument(blockCount: number, seed: number): string {return `${blocks.join('\n\n')}\n`;}-function main(): void {for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {const doc = generateDocument(count, SEED);diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.tsindex 32c055c5b..420dc0fe5 100644--- a/packages/core/src/markdown/guard-flanking-matrix.ts+++ b/packages/core/src/markdown/guard-flanking-matrix.ts@@ -7,7 +7,6 @@ import {import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';-export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;export type FlankClass = 'whitespace' | 'punctuation' | 'other';diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.tsindex 283913255..2653473da 100644--- a/packages/core/src/markdown/handler-shadow-audit.ts+++ b/packages/core/src/markdown/handler-shadow-audit.ts@@ -1,4 +1,3 @@-export interface HandlerShadowWitness {input: string;expect: 'byte' | 'byte-and-reparse-type';diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.tsindex 5d1000cc4..da0a81d23 100644--- a/packages/core/src/markdown/highlight-promoter.ts+++ b/packages/core/src/markdown/highlight-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';import type { MdxJsxTextElement } from 'mdast-util-mdx';import { SKIP, visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.tsindex 9681c0056..787315157 100644--- a/packages/core/src/markdown/html-to-mdast.ts+++ b/packages/core/src/markdown/html-to-mdast.ts@@ -1,4 +1,3 @@-import type { Element as HastElement, Root as HastRoot } from 'hast';import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';import rehypeParse from 'rehype-parse';@@ -129,8 +128,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRothrow new HtmlPayloadTooLargeError(html.length, maxBytes);}- const processor = unified()- .use(rehypeParse, { fragment: true });+ const processor = unified().use(rehypeParse, { fragment: true });for (const plugin of cleanupPlugins) {processor.use(plugin);diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.tsindex 994eb6917..706fa9afb 100644--- a/packages/core/src/markdown/image-promoter.ts+++ b/packages/core/src/markdown/image-promoter.ts@@ -1,4 +1,3 @@-import type { Image, Paragraph, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.tsindex 69221627d..9075aa7f1 100644--- a/packages/core/src/markdown/index.ts+++ b/packages/core/src/markdown/index.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromPmMark,@@ -207,7 +206,6 @@ export class MarkdownManager {}}-const registry = createRegistry();function destructureAttrs(@@ -256,7 +254,6 @@ function destructureAttrs(return result;}-function hasDirtyDescendant(node: PmNode): boolean {let found = false;node.descendants((child) => {@@ -279,7 +276,6 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChecreturn freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;}-function isEmptyMdastParagraph(node: MdastNodes): boolean {if (node.type !== 'paragraph') return false;const children = node.children ?? [];@@ -348,7 +344,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {return out;}-import {AUDIO_EXTENSIONS,FILE_ATTACHMENT_EXTENSIONS,@@ -601,7 +596,6 @@ function buildMdastToPmHandlers(}));}-if (m.emphasis) {handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({sourceDelimiter: node.data?.sourceDelimiter ?? '*',@@ -682,7 +676,6 @@ function buildMdastToPmHandlers(}));}-if (m.link) {const sourceLiteralMark = m.sourceLiteral;handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {@@ -980,7 +973,6 @@ function buildMdastToPmHandlers(};}-const blockUnknownHandler = (node: {type: string;position?: { start: { offset: number }; end: { offset: number } };@@ -1106,7 +1098,6 @@ function buildMdastToPmHandlers(return handlers as RemarkProseMirrorOptions['handlers'];}-function buildPmToMdastHandlers(schema: Schema,freshness: FreshnessCheckerHolder,diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.tsindex b79e9aef7..fa0be9e86 100644--- a/packages/core/src/markdown/lint/applies-to.ts+++ b/packages/core/src/markdown/lint/applies-to.ts@@ -1,4 +1,3 @@-import picomatch from 'picomatch';import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.tsindex 94b34dee1..312c9c74b 100644--- a/packages/core/src/markdown/lint/config-files.ts+++ b/packages/core/src/markdown/lint/config-files.ts@@ -1,4 +1,3 @@-const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set(['.markdownlint.json','.markdownlint.jsonc',diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.tsindex e413367ef..0ba33b7d8 100644--- a/packages/core/src/markdown/lint/config-schemas.ts+++ b/packages/core/src/markdown/lint/config-schemas.ts@@ -38,7 +38,6 @@ const fullPluginShape = Object.fromEntries(LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),) as z.ZodRawShape;-export const LinterConfigSchema = z.object({enabled: z.boolean(),plugins: z.object(fullPluginShape),diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.tsindex a51f2ffb0..d48eea5e4 100644--- a/packages/core/src/markdown/lint/default-config.ts+++ b/packages/core/src/markdown/lint/default-config.ts@@ -6,7 +6,6 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSettingMD013: false,};-export function resolveMarkdownlintConfig(rules: Record<string, MarkdownlintRuleSetting> | undefined,): Configuration {diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.tsindex 9c9542661..ef478e268 100644--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts@@ -1,4 +1,3 @@-import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';export interface FrontmatterFieldConstraint {diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.tsindex b96d19182..0d4c9a0df 100644--- a/packages/core/src/markdown/lint/frontmatter-validate.ts+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts@@ -1,4 +1,3 @@-import Ajv, { type ValidateFunction } from 'ajv';import Ajv2019 from 'ajv/dist/2019.js';import Ajv2020 from 'ajv/dist/2020.js';diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.tsindex 48d260ed6..00d08265a 100644--- a/packages/core/src/markdown/lint/index.ts+++ b/packages/core/src/markdown/lint/index.ts@@ -1,4 +1,3 @@-import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';import type { LintDiagnostic } from './types.ts';diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.tsindex be5871ed9..5e832aa19 100644--- a/packages/core/src/markdown/lint/plugins.ts+++ b/packages/core/src/markdown/lint/plugins.ts@@ -1,4 +1,3 @@-import { z } from 'zod';import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';import {@@ -14,7 +13,6 @@ import {type MarkdownlintSlice,} from './types.ts';-const MarkdownlintRuleSettingSchema = z.union([z.boolean(),z.enum(MARKDOWNLINT_RULE_SEVERITIES),diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.tsindex 833c3a727..3918e657c 100644--- a/packages/core/src/markdown/lint/types.ts+++ b/packages/core/src/markdown/lint/types.ts@@ -1,4 +1,3 @@-export const LINT_PLUGIN_IDS = ['markdownlint', 'frontmatter'] as const;export type LintPluginId = (typeof LINT_PLUGIN_IDS)[number];@@ -72,7 +71,6 @@ export interface FrontmatterSlice {schemas: ResolvedFrontmatterSchemaEntry[];}-interface RuleOptionSpecBase {key: string;description: string;diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.tsindex 437cc539a..98238656e 100644--- a/packages/core/src/markdown/lint/validation-counts.ts+++ b/packages/core/src/markdown/lint/validation-counts.ts@@ -1,4 +1,3 @@-export interface ValidationSourceCounts {errorCount: number;warningCount: number;diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.tsindex bd79424c7..a5b511f25 100644--- a/packages/core/src/markdown/math-promoter.ts+++ b/packages/core/src/markdown/math-promoter.ts@@ -1,4 +1,3 @@-import type { Code, Root } from 'mdast';import type { Math as MdastMath } from 'mdast-util-math';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.tsindex 00fbc0035..ed89371d0 100644--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts@@ -1,4 +1,3 @@-import type { Comment, Element, ElementContent, Properties } from 'hast';import type { FootnoteDefinition, FootnoteReference } from 'mdast';import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.tsindex df788a80d..8ce2b2492 100644--- a/packages/core/src/markdown/mdast-to-html.ts+++ b/packages/core/src/markdown/mdast-to-html.ts@@ -1,4 +1,3 @@-import type { Element, Root as HastRoot, Text as HastText } from 'hast';import type { Root as MdastRoot, Text as MdastText } from 'mdast';import type { Handler } from 'mdast-util-to-hast';diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.tsindex fa3cfcd86..bfd7e3109 100644--- a/packages/core/src/markdown/merged-walker.ts+++ b/packages/core/src/markdown/merged-walker.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, Root } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.tsindex 17ed2b829..1a897fca8 100644--- a/packages/core/src/markdown/mermaid-promoter.ts+++ b/packages/core/src/markdown/mermaid-promoter.ts@@ -1,4 +1,3 @@-import type { Code, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.tsindex 4aa0490c4..d988f4b8b 100644--- a/packages/core/src/markdown/parse-with-fallback.ts+++ b/packages/core/src/markdown/parse-with-fallback.ts@@ -168,7 +168,6 @@ export function parseRecursive(}}-interface VFilePlace {offset?: number;start?: { offset?: number };@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {return undefined;}-interface Region {start: number;end: number;@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {return null;}-export interface TagEvent {kind: 'open' | 'close' | 'self-close';name: string;@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {return { start: blockStart, end: blockEnd };}-interface SourceBlock {src: string;start: number;@@ -456,7 +452,6 @@ function tryPerBlockFallback(};}-function wholeDocRawText(source: string): JSONContent {return {type: 'doc',diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.tsindex 43d420187..e6ab4fd57 100644--- a/packages/core/src/markdown/parser-drop-closure.ts+++ b/packages/core/src/markdown/parser-drop-closure.ts@@ -1,4 +1,3 @@-export type DroppedTokenAdjudication =| {kind: 'format-dof-axis';diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.tsindex 5af2f05f5..449e6f12f 100644--- a/packages/core/src/markdown/pipeline.ts+++ b/packages/core/src/markdown/pipeline.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromProseMirror,diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.tsindex ccf06e94d..91cdf658f 100644--- a/packages/core/src/markdown/position-aware-join.ts+++ b/packages/core/src/markdown/position-aware-join.ts@@ -1,4 +1,3 @@-import type { Join } from 'mdast-util-to-markdown';import type { Position } from 'unist';import { isBlankLineParagraph } from './zero-emission-blocks.ts';diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.tsindex e5b4c9eba..0f399d34c 100644--- a/packages/core/src/markdown/position-slice.ts+++ b/packages/core/src/markdown/position-slice.ts@@ -1,4 +1,3 @@-import type { Nodes, Root } from 'mdast';import { visit } from 'unist-util-visit';import type { VFile } from 'vfile';@@ -477,8 +476,7 @@ export function applyPositionSliceToNode(const first = source[startOff];if (first !== '[' && first !== '<' && !node.title) {node.data.sourceStyle = 'gfm-autolink';- }- else if (first === '[') {+ } else if (first === '[') {const slice = source.slice(startOff, endOff);const closeBracketIdx = slice.lastIndexOf('](');if (closeBracketIdx !== -1) {diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.tsindex ca225ce9b..db10fa54b 100644--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts@@ -1,4 +1,3 @@-import type { Comment, Element, Root, Text } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.tsindex 3a2524a9a..34068d103 100644--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.tsindex 2279a0189..93151d43b 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.tsindex a0f467c42..188f02d83 100644--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.tsindex 4e8542a21..4ba2c3418 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.tsindex a3c96b24a..1a74b1272 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.tsindex e95cf43d6..de35e7b79 100644--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts@@ -1,4 +1,3 @@-import type { Comment, Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.tsindex ffdb4d5b5..b4be1b2ea 100644--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.tsindex e2a96d1a7..3c8d88b7c 100644--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.tsindex 0389575ac..cf2c9da8e 100644--- a/packages/core/src/markdown/resolve-image-url.ts+++ b/packages/core/src/markdown/resolve-image-url.ts@@ -1,4 +1,3 @@-import { isRelativeUrl } from './safe-url.ts';function isDevDiagnosticContext(): boolean {diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.tsindex 8be632ba4..4d3250d3a 100644--- a/packages/core/src/markdown/safe-url.ts+++ b/packages/core/src/markdown/safe-url.ts@@ -1,4 +1,3 @@-export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.tsindex 96304e7a5..0dd54070e 100644--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts@@ -1,4 +1,3 @@-import type { JSONContent } from '@tiptap/core';import type { Nodes } from 'mdast';import { expect } from 'vitest';diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.tsindex 93798cf83..7cac5b042 100644--- a/packages/core/src/markdown/serialize-helpers.ts+++ b/packages/core/src/markdown/serialize-helpers.ts@@ -1,4 +1,3 @@-import type { Node as PmNode } from '@tiptap/pm/model';import type {MdxJsxAttribute,diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.tsindex 8c08b7a04..b012a5aff 100644--- a/packages/core/src/markdown/single-dollar-math-promoter.ts+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts@@ -1,4 +1,3 @@-import type { PhrasingContent, Root, Text } from 'mdast';import type { InlineMath } from 'mdast-util-math';import { SKIP, visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.tsindex 959cc0bd2..3e79f8cb6 100644--- a/packages/core/src/markdown/to-markdown-handlers.ts+++ b/packages/core/src/markdown/to-markdown-handlers.ts@@ -1,4 +1,3 @@-import type { Nodes, Parents } from 'mdast';import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import type { Handle, Info, State } from 'mdast-util-to-markdown';diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.tsindex 6e6d73400..0f1b0f27d 100644--- a/packages/core/src/markdown/underline-promoter.ts+++ b/packages/core/src/markdown/underline-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, Root } from 'mdast';import type { MdxJsxTextElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.tsindex 932d7d2a8..1a082bda7 100644--- a/packages/core/src/markdown/unknown-mdast-guard.ts+++ b/packages/core/src/markdown/unknown-mdast-guard.ts@@ -1,4 +1,3 @@-import type { Root as MdastRoot } from 'mdast';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.tsindex ac9f5239b..d578476a7 100644--- a/packages/core/src/markdown/whitespace-char-ref.ts+++ b/packages/core/src/markdown/whitespace-char-ref.ts@@ -1,4 +1,3 @@-const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([[0x20, ' '],[0x09, '\t'],diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.tsindex afd9936fe..6dad26200 100644--- a/packages/core/src/markdown/wiki-link-micromark.ts+++ b/packages/core/src/markdown/wiki-link-micromark.ts@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {}}-const CODE_BANG = 33; // !const CODE_LBRACKET = 91; // [const CODE_RBRACKET = 93; // ]@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {};}-function enterWikiLink(this: CompileContext, token: Token) {this.enter({@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {unsafe: [{ character: '[', inConstruct: ['phrasing'] }],};-const MICROMARK_EXT = wikiLinkSyntax();export function remarkWikiLink(this: Processor) {