@agimon-ai/doompi-web-components 0.0.1-alpha.14 → 0.0.1-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/components/MediaPreview.d.cts +37 -2
  2. package/dist/components/MediaPreview.d.cts.map +1 -1
  3. package/dist/components/PdfPreview.d.cts +53 -0
  4. package/dist/components/PdfPreview.d.cts.map +1 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.cts +4 -3
  7. package/dist/index.d.mts +4 -3
  8. package/dist/index.mjs +1 -1
  9. package/dist/lib/editorTheme.d.cts.map +1 -1
  10. package/dist/src/components/CodeEditorView.cjs +1 -1
  11. package/dist/src/components/CodeEditorView.cjs.map +1 -1
  12. package/dist/src/components/CodeEditorView.mjs +1 -1
  13. package/dist/src/components/CodeEditorView.mjs.map +1 -1
  14. package/dist/src/components/MediaPreview.cjs +1 -1
  15. package/dist/src/components/MediaPreview.cjs.map +1 -1
  16. package/dist/src/components/MediaPreview.d.mts +37 -2
  17. package/dist/src/components/MediaPreview.d.mts.map +1 -1
  18. package/dist/src/components/MediaPreview.mjs +1 -1
  19. package/dist/src/components/MediaPreview.mjs.map +1 -1
  20. package/dist/src/components/PdfPreview.cjs +2 -0
  21. package/dist/src/components/PdfPreview.cjs.map +1 -0
  22. package/dist/src/components/PdfPreview.d.mts +53 -0
  23. package/dist/src/components/PdfPreview.d.mts.map +1 -0
  24. package/dist/src/components/PdfPreview.mjs +2 -0
  25. package/dist/src/components/PdfPreview.mjs.map +1 -0
  26. package/dist/src/lib/editorController.cjs +2 -0
  27. package/dist/src/lib/editorController.cjs.map +1 -0
  28. package/dist/src/lib/editorController.mjs +2 -0
  29. package/dist/src/lib/editorController.mjs.map +1 -0
  30. package/dist/src/lib/editorTheme.cjs +1 -1
  31. package/dist/src/lib/editorTheme.cjs.map +1 -1
  32. package/dist/src/lib/editorTheme.d.mts.map +1 -1
  33. package/dist/src/lib/editorTheme.mjs +1 -1
  34. package/dist/src/lib/editorTheme.mjs.map +1 -1
  35. package/dist/src/lib/mediaPlayback.cjs +2 -0
  36. package/dist/src/lib/mediaPlayback.cjs.map +1 -0
  37. package/dist/src/lib/mediaPlayback.mjs +2 -0
  38. package/dist/src/lib/mediaPlayback.mjs.map +1 -0
  39. package/dist/src/types/editor.cjs.map +1 -1
  40. package/dist/src/types/editor.d.mts +36 -1
  41. package/dist/src/types/editor.d.mts.map +1 -1
  42. package/dist/src/types/editor.mjs.map +1 -1
  43. package/dist/types/editor.d.cts +36 -1
  44. package/dist/types/editor.d.cts.map +1 -1
  45. package/package.json +3 -2
@@ -1,4 +1,5 @@
1
1
  import { MediaKind } from "../types/editor.cjs";
2
+ import { PdfPreviewController } from "./PdfPreview.cjs";
2
3
  //#region src/components/MediaPreview.d.ts
3
4
  /**
4
5
  * A file the browser can show but not edit.
@@ -9,6 +10,34 @@ import { MediaKind } from "../types/editor.cjs";
9
10
  * turned into HTML is a different document, and offering to edit that one
10
11
  * would be offering to overwrite the real one with it.
11
12
  */
13
+ interface MediaPlaybackState {
14
+ playing: boolean;
15
+ currentTime: number;
16
+ duration: number;
17
+ }
18
+ interface MediaIntrinsicSize {
19
+ width: number;
20
+ height: number;
21
+ }
22
+ interface MediaFrameMetadata {
23
+ mediaTime: number;
24
+ presentedFrames?: number;
25
+ }
26
+ interface MediaFrameCapture {
27
+ blob: Blob;
28
+ width: number;
29
+ height: number;
30
+ timeSeconds: number;
31
+ metadata?: MediaFrameMetadata;
32
+ }
33
+ interface MediaPreviewController {
34
+ play: () => Promise<void>;
35
+ pause: () => void;
36
+ seek: (seconds: number) => void;
37
+ getState: () => MediaPlaybackState;
38
+ getIntrinsicSize: () => MediaIntrinsicSize | null;
39
+ captureFrame: (type?: 'image/png' | 'image/jpeg', quality?: number) => Promise<MediaFrameCapture | null>;
40
+ }
12
41
  interface MediaPreviewProps {
13
42
  /** Where the bytes are served from. */
14
43
  src: string;
@@ -18,8 +47,14 @@ interface MediaPreviewProps {
18
47
  kind?: MediaKind;
19
48
  className?: string;
20
49
  'data-testid'?: string;
50
+ /** Video-only controller. It is assigned while the video element is mounted. */
51
+ controllerRef?: import('react').Ref<MediaPreviewController>;
52
+ /** PDF-only page and geometry controller. */
53
+ pdfControllerRef?: import('react').Ref<PdfPreviewController>;
54
+ /** Reports browser playback state changes for video previews. */
55
+ onPlaybackStateChange?: (state: MediaPlaybackState) => void;
21
56
  }
22
- declare function MediaPreview({ src, path, kind, className, 'data-testid': testId }: MediaPreviewProps): import("react").JSX.Element;
57
+ declare function MediaPreview({ src, path, kind, className, controllerRef, pdfControllerRef, onPlaybackStateChange, 'data-testid': testId }: MediaPreviewProps): import("react").JSX.Element;
23
58
  //#endregion
24
- export { MediaPreview, MediaPreviewProps };
59
+ export { MediaFrameCapture, MediaFrameMetadata, MediaIntrinsicSize, MediaPlaybackState, MediaPreview, MediaPreviewController, MediaPreviewProps };
25
60
  //# sourceMappingURL=MediaPreview.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MediaPreview.d.cts","names":[],"sources":["../../src/components/MediaPreview.tsx"],"mappings":";;;;;;;;;;;UAgBiB;;EAEf;;EAEA;;EAEA,OAAO;EACP;EACA;;iBAKc,eAAe,KAAK,MAAM,MAAM,0BAA0B,UAAU,oCAAiB,IAAA"}
1
+ {"version":3,"file":"MediaPreview.d.cts","names":[],"sources":["../../src/components/MediaPreview.tsx"],"mappings":";;;;;;;;;;;;UAkBiB;EACf;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;UAGe;EACf,MAAM;EACN;EACA;EACA;EACA,WAAW;;UAGI;EACf,YAAY;EACZ;EACA,OAAO;EACP,gBAAgB;EAChB,wBAAwB;EACxB,eAAe,mCAAmC,qBAAqB,QAAQ;;UAGhE;;EAEf;;EAEA;;EAEA,OAAO;EACP;EACA;;EAEA,gCAAgC,IAAI;;EAEpC,mCAAmC,IAAI;;EAEvC,yBAAyB,OAAO;;iBA8GlB,eACd,KACA,MACA,MACA,WACA,eACA,kBACA,sCACe,UACd,oCAAiB,IAAA"}
@@ -0,0 +1,53 @@
1
+ //#region src/components/PdfPreview.d.ts
2
+ interface PdfNormalizedRectangle {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ interface PdfPageState {
9
+ page: number;
10
+ pageCount: number;
11
+ sourceWidth: number;
12
+ sourceHeight: number;
13
+ }
14
+ interface PdfPageRegion {
15
+ page: number;
16
+ rect: PdfNormalizedRectangle;
17
+ }
18
+ interface PdfPreviewController {
19
+ getState: () => PdfPageState;
20
+ setPage: (page: number) => void;
21
+ resolveViewportRegion: (rectangle: {
22
+ left: number;
23
+ top: number;
24
+ right: number;
25
+ bottom: number;
26
+ }) => PdfPageRegion | null;
27
+ capturePage: (type?: 'image/png' | 'image/jpeg', quality?: number) => Promise<Blob | null>;
28
+ }
29
+ interface PdfPreviewProps {
30
+ src: string;
31
+ path: string;
32
+ className?: string;
33
+ 'data-testid'?: string;
34
+ controllerRef?: import('react').Ref<PdfPreviewController>;
35
+ }
36
+ declare function resolvePdfViewportRegion(page: number, bounds: {
37
+ left: number;
38
+ top: number;
39
+ right: number;
40
+ bottom: number;
41
+ width: number;
42
+ height: number;
43
+ }, rectangle: {
44
+ left: number;
45
+ top: number;
46
+ right: number;
47
+ bottom: number;
48
+ }): PdfPageRegion | null;
49
+ /** A page-aware PDF canvas. Coordinates resolve against PDF page geometry rather than an opaque browser iframe. */
50
+ declare function PdfPreview({ src, path, className, controllerRef, 'data-testid': testId }: PdfPreviewProps): import("react").JSX.Element;
51
+ //#endregion
52
+ export { PdfNormalizedRectangle, PdfPageRegion, PdfPageState, PdfPreview, PdfPreviewController, PdfPreviewProps, resolvePdfViewportRegion };
53
+ //# sourceMappingURL=PdfPreview.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdfPreview.d.cts","names":[],"sources":["../../src/components/PdfPreview.tsx"],"mappings":";UAKiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf,gBAAgB;EAChB,UAAU;EACV,wBAAwB;IACtB;IACA;IACA;IACA;QACI;EACN,cAAc,mCAAmC,qBAAqB,QAAQ;;UAG/D;EACf;EACA;EACA;EACA;EACA,gCAAgC,IAAI;;iBAUtB,yBACd,cACA;EAAU;EAAc;EAAa;EAAe;EAAgB;EAAe;GACnF;EAAa;EAAc;EAAa;EAAe;IACtD;;iBA0Ba,aAAa,KAAK,MAAM,WAAW,8BAA8B,UAAU,kCAAe,IAAA"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("./src/icons/icons.cjs");const e=require("./src/lib/cn.cjs"),t=require("./src/components/Accordion.cjs"),n=require("./src/lib/ansiSpans.cjs"),r=require("./src/components/AnsiText.cjs"),i=require("./src/components/Avatar.cjs"),a=require("./src/components/Badge.cjs"),o=require("./src/components/Tooltip.cjs"),s=require("./src/components/Breadcrumb.cjs"),c=require("./src/components/Spinner.cjs"),l=require("./src/components/Button.cjs"),u=require("./src/components/Dialog.cjs"),d=require("./src/components/Dot.cjs"),f=require("./src/components/DropdownMenu.cjs"),p=require("./src/components/Checkbox.cjs"),ee=require("./src/components/Skeleton.cjs"),te=require("./src/components/CodeEditor.cjs"),m=require("./src/components/Collapsible.cjs"),h=require("./src/components/Input.cjs"),g=require("./src/lib/optionList.cjs"),_=require("./src/components/OptionList.cjs"),v=require("./src/components/Command.cjs"),y=require("./src/components/EmptyState.cjs"),b=require("./src/lib/hashlineHighlight.cjs"),x=require("./src/lib/editorLanguage.cjs"),S=require("./src/lib/syntaxHighlight.cjs"),C=require("./src/components/SyntaxText.cjs"),w=require("./src/components/HashlineLines.cjs"),T=require("./src/components/Kbd.cjs"),E=require("./src/components/Label.cjs"),D=require("./src/components/Markdown.cjs"),O=require("./src/lib/media.cjs"),k=require("./src/components/MediaPreview.cjs"),A=require("./src/components/StatusBadge.cjs"),j=require("./src/components/MessageItem.cjs"),M=require("./src/components/MessageLines.cjs"),N=require("./src/components/Panel.cjs"),P=require("./src/components/Popover.cjs"),F=require("./src/components/Progress.cjs"),I=require("./src/components/RadioGroup.cjs"),L=require("./src/components/ScrollArea.cjs"),R=require("./src/components/SectionLabel.cjs"),z=require("./src/components/Select.cjs"),B=require("./src/components/Separator.cjs"),V=require("./src/components/Sheet.cjs"),H=require("./src/components/StreamCursor.cjs"),U=require("./src/components/Switch.cjs"),W=require("./src/components/Tabs.cjs"),G=require("./src/components/Textarea.cjs"),K=require("./src/components/Toast.cjs"),q=require("./src/components/ToolPathLink.cjs"),J=require("./src/lib/collapse.cjs"),Y=require("./src/lib/hashlineView.cjs"),X=require("./src/lib/tone.cjs"),Z=require("./src/types/editor.cjs"),Q=require("./src/types/tone.cjs");let $=require("lucide-react");exports.ACCENT_TONES=Q.ACCENT_TONES,exports.Accordion=t.Accordion,exports.AccordionContent=t.AccordionContent,exports.AccordionItem=t.AccordionItem,exports.AccordionTrigger=t.AccordionTrigger,Object.defineProperty(exports,"ActivityIcon",{enumerable:!0,get:function(){return $.Activity}}),Object.defineProperty(exports,"AlertIcon",{enumerable:!0,get:function(){return $.CircleAlert}}),exports.AnsiLine=r.AnsiLine,exports.AnsiText=r.AnsiText,Object.defineProperty(exports,"AudioLinesIcon",{enumerable:!0,get:function(){return $.AudioLines}}),exports.Avatar=i.Avatar,exports.AvatarFallback=i.AvatarFallback,exports.AvatarImage=i.AvatarImage,exports.BREADCRUMB_ELLIPSIS=s.BREADCRUMB_ELLIPSIS,exports.Badge=a.Badge,Object.defineProperty(exports,"BranchIcon",{enumerable:!0,get:function(){return $.GitBranch}}),exports.Breadcrumb=s.Breadcrumb,exports.Button=l.Button,exports.CHIP_TONES=Q.CHIP_TONES,exports.CHIP_TO_STATUS=X.CHIP_TO_STATUS,Object.defineProperty(exports,"CheckIcon",{enumerable:!0,get:function(){return $.Check}}),exports.Checkbox=p.Checkbox,Object.defineProperty(exports,"ChevronDownIcon",{enumerable:!0,get:function(){return $.ChevronDown}}),Object.defineProperty(exports,"ChevronRightIcon",{enumerable:!0,get:function(){return $.ChevronRight}}),Object.defineProperty(exports,"ChevronUpIcon",{enumerable:!0,get:function(){return $.ChevronUp}}),Object.defineProperty(exports,"CloseIcon",{enumerable:!0,get:function(){return $.X}}),exports.CodeEditor=te.CodeEditor,exports.Collapsible=m.Collapsible,exports.CollapsibleContent=m.CollapsibleContent,exports.CollapsibleTrigger=m.CollapsibleTrigger,exports.CommandDialog=v.CommandDialog,exports.CommandEmpty=v.CommandEmpty,exports.CommandFooter=v.CommandFooter,exports.CommandGroup=v.CommandGroup,exports.CommandGroupLabel=v.CommandGroupLabel,exports.CommandHeader=v.CommandHeader,exports.CommandInput=v.CommandInput,exports.CommandItem=v.CommandItem,exports.CommandItemLabel=v.CommandItemLabel,exports.CommandList=v.CommandList,exports.DOT_TONES=Q.DOT_TONES,exports.Dialog=u.Dialog,exports.DialogBody=u.DialogBody,exports.DialogClose=u.DialogClose,exports.DialogContent=u.DialogContent,exports.DialogDescription=u.DialogDescription,exports.DialogFooter=u.DialogFooter,exports.DialogHeader=u.DialogHeader,exports.DialogTitle=u.DialogTitle,exports.DialogTrigger=u.DialogTrigger,exports.Dot=d.Dot,exports.DropdownMenu=f.DropdownMenu,exports.DropdownMenuCheckboxItem=f.DropdownMenuCheckboxItem,exports.DropdownMenuContent=f.DropdownMenuContent,exports.DropdownMenuGroup=f.DropdownMenuGroup,exports.DropdownMenuItem=f.DropdownMenuItem,exports.DropdownMenuLabel=f.DropdownMenuLabel,exports.DropdownMenuRadioGroup=f.DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=f.DropdownMenuRadioItem,exports.DropdownMenuSeparator=f.DropdownMenuSeparator,exports.DropdownMenuShortcut=f.DropdownMenuShortcut,exports.DropdownMenuSub=f.DropdownMenuSub,exports.DropdownMenuSubContent=f.DropdownMenuSubContent,exports.DropdownMenuSubTrigger=f.DropdownMenuSubTrigger,exports.DropdownMenuTrigger=f.DropdownMenuTrigger,Object.defineProperty(exports,"EditIcon",{enumerable:!0,get:function(){return $.Pencil}}),exports.EmptyState=y.EmptyState,Object.defineProperty(exports,"EnterIcon",{enumerable:!0,get:function(){return $.CornerDownLeft}}),Object.defineProperty(exports,"ExternalLinkIcon",{enumerable:!0,get:function(){return $.ExternalLink}}),Object.defineProperty(exports,"FileIcon",{enumerable:!0,get:function(){return $.FileText}}),exports.GREP_COLLAPSED_LINES=Y.GREP_COLLAPSED_LINES,Object.defineProperty(exports,"GearIcon",{enumerable:!0,get:function(){return $.Settings}}),exports.HashlineLines=w.HashlineLines,exports.Input=h.Input,exports.Kbd=T.Kbd,Object.defineProperty(exports,"KebabIcon",{enumerable:!0,get:function(){return $.MoreVertical}}),exports.LINE_TONE_TO_STATUS=X.LINE_TONE_TO_STATUS,exports.Label=E.Label,Object.defineProperty(exports,"LoaderIcon",{enumerable:!0,get:function(){return $.Loader2}}),exports.MAX_DIGIT_SHORTCUT=g.MAX_DIGIT_SHORTCUT,exports.MEDIA_KINDS=Z.MEDIA_KINDS,exports.MESSAGE_LINE_TONES=Q.MESSAGE_LINE_TONES,exports.Markdown=D.Markdown,exports.MediaPreview=k.MediaPreview,Object.defineProperty(exports,"MessageIcon",{enumerable:!0,get:function(){return $.MessageCircle}}),exports.MessageItem=j.MessageItem,exports.MessageItemBody=j.MessageItemBody,exports.MessageItemGroup=j.MessageItemGroup,exports.MessageItemHeader=j.MessageItemHeader,exports.MessageItemStatus=j.MessageItemStatus,exports.MessageLines=M.MessageLines,Object.defineProperty(exports,"MicIcon",{enumerable:!0,get:function(){return $.Mic}}),exports.NavTab=W.NavTab,exports.NavTabBadge=W.NavTabBadge,exports.OptionLabel=_.OptionLabel,exports.OptionList=_.OptionList,exports.OptionRow=_.OptionRow,Object.defineProperty(exports,"PaletteIcon",{enumerable:!0,get:function(){return $.Palette}}),exports.Panel=N.Panel,exports.PanelBody=N.PanelBody,exports.PanelHeader=N.PanelHeader,Object.defineProperty(exports,"PlusIcon",{enumerable:!0,get:function(){return $.Plus}}),exports.Popover=P.Popover,exports.PopoverAnchor=P.PopoverAnchor,exports.PopoverClose=P.PopoverClose,exports.PopoverContent=P.PopoverContent,exports.PopoverFooter=P.PopoverFooter,exports.PopoverHeader=P.PopoverHeader,exports.PopoverTrigger=P.PopoverTrigger,exports.Progress=F.Progress,Object.defineProperty(exports,"QuoteIcon",{enumerable:!0,get:function(){return $.Quote}}),exports.READ_COLLAPSED_LINES=Y.READ_COLLAPSED_LINES,exports.RadioGroup=I.RadioGroup,exports.RadioGroupCard=I.RadioGroupCard,exports.RadioGroupItem=I.RadioGroupItem,Object.defineProperty(exports,"RefreshIcon",{enumerable:!0,get:function(){return $.RefreshCw}}),Object.defineProperty(exports,"RewindIcon",{enumerable:!0,get:function(){return $.Rewind}}),exports.STATUS_EDGE=A.STATUS_EDGE,exports.STATUS_GLYPH=j.STATUS_GLYPH,exports.STATUS_LABEL=j.STATUS_LABEL,exports.STATUS_TONES=Q.STATUS_TONES,exports.STATUS_TO_CHIP=X.STATUS_TO_CHIP,exports.STATUS_TO_DOT=X.STATUS_TO_DOT,exports.ScrollArea=L.ScrollArea,exports.ScrollBar=L.ScrollBar,Object.defineProperty(exports,"SearchIcon",{enumerable:!0,get:function(){return $.Search}}),exports.SectionLabel=R.SectionLabel,exports.Select=z.Select,exports.SelectContent=z.SelectContent,exports.SelectGroup=z.SelectGroup,exports.SelectItem=z.SelectItem,exports.SelectLabel=z.SelectLabel,exports.SelectSeparator=z.SelectSeparator,exports.SelectTrigger=z.SelectTrigger,exports.SelectValue=z.SelectValue,Object.defineProperty(exports,"SendIcon",{enumerable:!0,get:function(){return $.Send}}),exports.Separator=B.Separator,exports.Sheet=V.Sheet,exports.SheetBody=V.SheetBody,exports.SheetClose=V.SheetClose,exports.SheetContent=V.SheetContent,exports.SheetDescription=V.SheetDescription,exports.SheetFooter=V.SheetFooter,exports.SheetHeader=V.SheetHeader,exports.SheetOverlay=V.SheetOverlay,exports.SheetTitle=V.SheetTitle,exports.SheetTrigger=V.SheetTrigger,Object.defineProperty(exports,"ShieldIcon",{enumerable:!0,get:function(){return $.ShieldCheck}}),exports.Skeleton=ee.Skeleton,exports.Spinner=c.Spinner,exports.StatusBadge=A.StatusBadge,Object.defineProperty(exports,"StopIcon",{enumerable:!0,get:function(){return $.Square}}),exports.StreamCursor=H.StreamCursor,exports.Switch=U.Switch,exports.SyntaxLine=C.SyntaxLine,exports.SyntaxText=C.SyntaxText,exports.Tabs=W.Tabs,exports.TabsContent=W.TabsContent,exports.TabsList=W.TabsList,exports.TabsTrigger=W.TabsTrigger,exports.Textarea=G.Textarea,exports.Toast=K.Toast,exports.ToastAction=K.ToastAction,exports.ToastClose=K.ToastClose,exports.ToastDescription=K.ToastDescription,exports.ToastProvider=K.ToastProvider,exports.ToastTitle=K.ToastTitle,exports.ToastViewport=K.ToastViewport,exports.ToolPathLink=q.ToolPathLink,exports.Tooltip=o.Tooltip,exports.TooltipContent=o.TooltipContent,exports.TooltipProvider=o.TooltipProvider,exports.TooltipTrigger=o.TooltipTrigger,Object.defineProperty(exports,"TrashIcon",{enumerable:!0,get:function(){return $.Trash2}}),Object.defineProperty(exports,"UserIcon",{enumerable:!0,get:function(){return $.UserRound}}),Object.defineProperty(exports,"VolumeIcon",{enumerable:!0,get:function(){return $.Volume2}}),exports.ansiSpans=n.ansiSpans,exports.badgeVariants=a.badgeVariants,exports.breadcrumbSegments=s.breadcrumbSegments,exports.buttonVariants=l.buttonVariants,exports.cn=e.cn,exports.collapseLines=J.collapseLines,exports.compactDetails=Y.compactDetails,exports.detectGrammar=S.detectGrammar,exports.dialogFooterVariants=u.dialogFooterVariants,exports.dotVariants=d.dotVariants,exports.dropdownMenuItemVariants=f.dropdownMenuItemVariants,exports.fieldVariants=h.fieldVariants,exports.grammarKeyOf=x.grammarKeyOf,exports.handleOptionListKey=g.handleOptionListKey,exports.hashlineBody=Y.hashlineBody,exports.hashlineGroups=b.hashlineGroups,exports.hashlineGroupsKey=b.hashlineGroupsKey,exports.highlightToLines=S.highlightToLines,exports.mediaKindOf=O.mediaKindOf,exports.messageItemRowVariants=j.messageItemRowVariants,exports.messageItemStatusVariants=j.messageItemStatusVariants,exports.messageItemVariants=j.messageItemVariants,exports.messageLineVariants=M.messageLineVariants,exports.optionListHint=g.optionListHint,exports.optionListVariants=_.optionListVariants,exports.optionMarker=g.optionMarker,exports.optionMarkerVariants=_.optionMarkerVariants,exports.optionRowVariants=_.optionRowVariants,exports.parseFileHeader=Y.parseFileHeader,exports.parseTaggedLine=Y.parseTaggedLine,exports.presentHashlineLines=Y.presentHashlineLines,exports.resultTextLines=Y.resultTextLines,exports.statusBadgeVariants=A.statusBadgeVariants,exports.syntaxStyleOf=S.syntaxStyleOf,exports.tabBadgeVariants=W.tabBadgeVariants,exports.tabVariants=W.tabVariants,exports.takeTrailingNotice=Y.takeTrailingNotice,exports.toastVariants=K.toastVariants,exports.toolTone=j.toolTone,exports.useMessageItem=j.useMessageItem,exports.useSyntaxLines=C.useSyntaxLines;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("./src/icons/icons.cjs");const e=require("./src/lib/cn.cjs"),t=require("./src/components/Accordion.cjs"),n=require("./src/lib/ansiSpans.cjs"),r=require("./src/components/AnsiText.cjs"),i=require("./src/components/Avatar.cjs"),a=require("./src/components/Badge.cjs"),o=require("./src/components/Tooltip.cjs"),s=require("./src/components/Breadcrumb.cjs"),c=require("./src/components/Spinner.cjs"),l=require("./src/components/Button.cjs"),u=require("./src/components/Dialog.cjs"),d=require("./src/components/Dot.cjs"),f=require("./src/components/DropdownMenu.cjs"),p=require("./src/components/Checkbox.cjs"),m=require("./src/components/Skeleton.cjs"),ee=require("./src/components/CodeEditor.cjs"),h=require("./src/components/Collapsible.cjs"),g=require("./src/components/Input.cjs"),_=require("./src/lib/optionList.cjs"),v=require("./src/components/OptionList.cjs"),y=require("./src/components/Command.cjs"),te=require("./src/components/EmptyState.cjs"),b=require("./src/lib/hashlineHighlight.cjs"),x=require("./src/lib/editorLanguage.cjs"),S=require("./src/lib/syntaxHighlight.cjs"),C=require("./src/components/SyntaxText.cjs"),w=require("./src/components/HashlineLines.cjs"),T=require("./src/components/Kbd.cjs"),E=require("./src/components/Label.cjs"),D=require("./src/components/Markdown.cjs"),O=require("./src/lib/media.cjs"),k=require("./src/components/PdfPreview.cjs"),A=require("./src/components/MediaPreview.cjs"),j=require("./src/components/StatusBadge.cjs"),M=require("./src/components/MessageItem.cjs"),N=require("./src/components/MessageLines.cjs"),P=require("./src/components/Panel.cjs"),F=require("./src/components/Popover.cjs"),I=require("./src/components/Progress.cjs"),L=require("./src/components/RadioGroup.cjs"),R=require("./src/components/ScrollArea.cjs"),z=require("./src/components/SectionLabel.cjs"),B=require("./src/components/Select.cjs"),V=require("./src/components/Separator.cjs"),H=require("./src/components/Sheet.cjs"),U=require("./src/components/StreamCursor.cjs"),W=require("./src/components/Switch.cjs"),G=require("./src/components/Tabs.cjs"),K=require("./src/components/Textarea.cjs"),q=require("./src/components/Toast.cjs"),J=require("./src/components/ToolPathLink.cjs"),Y=require("./src/lib/collapse.cjs"),X=require("./src/lib/hashlineView.cjs"),Z=require("./src/lib/tone.cjs"),ne=require("./src/types/editor.cjs"),Q=require("./src/types/tone.cjs");let $=require("lucide-react");exports.ACCENT_TONES=Q.ACCENT_TONES,exports.Accordion=t.Accordion,exports.AccordionContent=t.AccordionContent,exports.AccordionItem=t.AccordionItem,exports.AccordionTrigger=t.AccordionTrigger,Object.defineProperty(exports,"ActivityIcon",{enumerable:!0,get:function(){return $.Activity}}),Object.defineProperty(exports,"AlertIcon",{enumerable:!0,get:function(){return $.CircleAlert}}),exports.AnsiLine=r.AnsiLine,exports.AnsiText=r.AnsiText,Object.defineProperty(exports,"AudioLinesIcon",{enumerable:!0,get:function(){return $.AudioLines}}),exports.Avatar=i.Avatar,exports.AvatarFallback=i.AvatarFallback,exports.AvatarImage=i.AvatarImage,exports.BREADCRUMB_ELLIPSIS=s.BREADCRUMB_ELLIPSIS,exports.Badge=a.Badge,Object.defineProperty(exports,"BranchIcon",{enumerable:!0,get:function(){return $.GitBranch}}),exports.Breadcrumb=s.Breadcrumb,exports.Button=l.Button,exports.CHIP_TONES=Q.CHIP_TONES,exports.CHIP_TO_STATUS=Z.CHIP_TO_STATUS,Object.defineProperty(exports,"CheckIcon",{enumerable:!0,get:function(){return $.Check}}),exports.Checkbox=p.Checkbox,Object.defineProperty(exports,"ChevronDownIcon",{enumerable:!0,get:function(){return $.ChevronDown}}),Object.defineProperty(exports,"ChevronRightIcon",{enumerable:!0,get:function(){return $.ChevronRight}}),Object.defineProperty(exports,"ChevronUpIcon",{enumerable:!0,get:function(){return $.ChevronUp}}),Object.defineProperty(exports,"CloseIcon",{enumerable:!0,get:function(){return $.X}}),exports.CodeEditor=ee.CodeEditor,exports.Collapsible=h.Collapsible,exports.CollapsibleContent=h.CollapsibleContent,exports.CollapsibleTrigger=h.CollapsibleTrigger,exports.CommandDialog=y.CommandDialog,exports.CommandEmpty=y.CommandEmpty,exports.CommandFooter=y.CommandFooter,exports.CommandGroup=y.CommandGroup,exports.CommandGroupLabel=y.CommandGroupLabel,exports.CommandHeader=y.CommandHeader,exports.CommandInput=y.CommandInput,exports.CommandItem=y.CommandItem,exports.CommandItemLabel=y.CommandItemLabel,exports.CommandList=y.CommandList,exports.DOT_TONES=Q.DOT_TONES,exports.Dialog=u.Dialog,exports.DialogBody=u.DialogBody,exports.DialogClose=u.DialogClose,exports.DialogContent=u.DialogContent,exports.DialogDescription=u.DialogDescription,exports.DialogFooter=u.DialogFooter,exports.DialogHeader=u.DialogHeader,exports.DialogTitle=u.DialogTitle,exports.DialogTrigger=u.DialogTrigger,exports.Dot=d.Dot,exports.DropdownMenu=f.DropdownMenu,exports.DropdownMenuCheckboxItem=f.DropdownMenuCheckboxItem,exports.DropdownMenuContent=f.DropdownMenuContent,exports.DropdownMenuGroup=f.DropdownMenuGroup,exports.DropdownMenuItem=f.DropdownMenuItem,exports.DropdownMenuLabel=f.DropdownMenuLabel,exports.DropdownMenuRadioGroup=f.DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=f.DropdownMenuRadioItem,exports.DropdownMenuSeparator=f.DropdownMenuSeparator,exports.DropdownMenuShortcut=f.DropdownMenuShortcut,exports.DropdownMenuSub=f.DropdownMenuSub,exports.DropdownMenuSubContent=f.DropdownMenuSubContent,exports.DropdownMenuSubTrigger=f.DropdownMenuSubTrigger,exports.DropdownMenuTrigger=f.DropdownMenuTrigger,Object.defineProperty(exports,"EditIcon",{enumerable:!0,get:function(){return $.Pencil}}),exports.EmptyState=te.EmptyState,Object.defineProperty(exports,"EnterIcon",{enumerable:!0,get:function(){return $.CornerDownLeft}}),Object.defineProperty(exports,"ExternalLinkIcon",{enumerable:!0,get:function(){return $.ExternalLink}}),Object.defineProperty(exports,"FileIcon",{enumerable:!0,get:function(){return $.FileText}}),exports.GREP_COLLAPSED_LINES=X.GREP_COLLAPSED_LINES,Object.defineProperty(exports,"GearIcon",{enumerable:!0,get:function(){return $.Settings}}),exports.HashlineLines=w.HashlineLines,exports.Input=g.Input,exports.Kbd=T.Kbd,Object.defineProperty(exports,"KebabIcon",{enumerable:!0,get:function(){return $.MoreVertical}}),exports.LINE_TONE_TO_STATUS=Z.LINE_TONE_TO_STATUS,exports.Label=E.Label,Object.defineProperty(exports,"LoaderIcon",{enumerable:!0,get:function(){return $.Loader2}}),exports.MAX_DIGIT_SHORTCUT=_.MAX_DIGIT_SHORTCUT,exports.MEDIA_KINDS=ne.MEDIA_KINDS,exports.MESSAGE_LINE_TONES=Q.MESSAGE_LINE_TONES,exports.Markdown=D.Markdown,exports.MediaPreview=A.MediaPreview,Object.defineProperty(exports,"MessageIcon",{enumerable:!0,get:function(){return $.MessageCircle}}),exports.MessageItem=M.MessageItem,exports.MessageItemBody=M.MessageItemBody,exports.MessageItemGroup=M.MessageItemGroup,exports.MessageItemHeader=M.MessageItemHeader,exports.MessageItemStatus=M.MessageItemStatus,exports.MessageLines=N.MessageLines,Object.defineProperty(exports,"MicIcon",{enumerable:!0,get:function(){return $.Mic}}),exports.NavTab=G.NavTab,exports.NavTabBadge=G.NavTabBadge,exports.OptionLabel=v.OptionLabel,exports.OptionList=v.OptionList,exports.OptionRow=v.OptionRow,Object.defineProperty(exports,"PaletteIcon",{enumerable:!0,get:function(){return $.Palette}}),exports.Panel=P.Panel,exports.PanelBody=P.PanelBody,exports.PanelHeader=P.PanelHeader,exports.PdfPreview=k.PdfPreview,Object.defineProperty(exports,"PlusIcon",{enumerable:!0,get:function(){return $.Plus}}),exports.Popover=F.Popover,exports.PopoverAnchor=F.PopoverAnchor,exports.PopoverClose=F.PopoverClose,exports.PopoverContent=F.PopoverContent,exports.PopoverFooter=F.PopoverFooter,exports.PopoverHeader=F.PopoverHeader,exports.PopoverTrigger=F.PopoverTrigger,exports.Progress=I.Progress,Object.defineProperty(exports,"QuoteIcon",{enumerable:!0,get:function(){return $.Quote}}),exports.READ_COLLAPSED_LINES=X.READ_COLLAPSED_LINES,exports.RadioGroup=L.RadioGroup,exports.RadioGroupCard=L.RadioGroupCard,exports.RadioGroupItem=L.RadioGroupItem,Object.defineProperty(exports,"RefreshIcon",{enumerable:!0,get:function(){return $.RefreshCw}}),Object.defineProperty(exports,"RewindIcon",{enumerable:!0,get:function(){return $.Rewind}}),exports.STATUS_EDGE=j.STATUS_EDGE,exports.STATUS_GLYPH=M.STATUS_GLYPH,exports.STATUS_LABEL=M.STATUS_LABEL,exports.STATUS_TONES=Q.STATUS_TONES,exports.STATUS_TO_CHIP=Z.STATUS_TO_CHIP,exports.STATUS_TO_DOT=Z.STATUS_TO_DOT,exports.ScrollArea=R.ScrollArea,exports.ScrollBar=R.ScrollBar,Object.defineProperty(exports,"SearchIcon",{enumerable:!0,get:function(){return $.Search}}),exports.SectionLabel=z.SectionLabel,exports.Select=B.Select,exports.SelectContent=B.SelectContent,exports.SelectGroup=B.SelectGroup,exports.SelectItem=B.SelectItem,exports.SelectLabel=B.SelectLabel,exports.SelectSeparator=B.SelectSeparator,exports.SelectTrigger=B.SelectTrigger,exports.SelectValue=B.SelectValue,Object.defineProperty(exports,"SendIcon",{enumerable:!0,get:function(){return $.Send}}),exports.Separator=V.Separator,exports.Sheet=H.Sheet,exports.SheetBody=H.SheetBody,exports.SheetClose=H.SheetClose,exports.SheetContent=H.SheetContent,exports.SheetDescription=H.SheetDescription,exports.SheetFooter=H.SheetFooter,exports.SheetHeader=H.SheetHeader,exports.SheetOverlay=H.SheetOverlay,exports.SheetTitle=H.SheetTitle,exports.SheetTrigger=H.SheetTrigger,Object.defineProperty(exports,"ShieldIcon",{enumerable:!0,get:function(){return $.ShieldCheck}}),exports.Skeleton=m.Skeleton,exports.Spinner=c.Spinner,exports.StatusBadge=j.StatusBadge,Object.defineProperty(exports,"StopIcon",{enumerable:!0,get:function(){return $.Square}}),exports.StreamCursor=U.StreamCursor,exports.Switch=W.Switch,exports.SyntaxLine=C.SyntaxLine,exports.SyntaxText=C.SyntaxText,exports.Tabs=G.Tabs,exports.TabsContent=G.TabsContent,exports.TabsList=G.TabsList,exports.TabsTrigger=G.TabsTrigger,exports.Textarea=K.Textarea,exports.Toast=q.Toast,exports.ToastAction=q.ToastAction,exports.ToastClose=q.ToastClose,exports.ToastDescription=q.ToastDescription,exports.ToastProvider=q.ToastProvider,exports.ToastTitle=q.ToastTitle,exports.ToastViewport=q.ToastViewport,exports.ToolPathLink=J.ToolPathLink,exports.Tooltip=o.Tooltip,exports.TooltipContent=o.TooltipContent,exports.TooltipProvider=o.TooltipProvider,exports.TooltipTrigger=o.TooltipTrigger,Object.defineProperty(exports,"TrashIcon",{enumerable:!0,get:function(){return $.Trash2}}),Object.defineProperty(exports,"UserIcon",{enumerable:!0,get:function(){return $.UserRound}}),Object.defineProperty(exports,"VolumeIcon",{enumerable:!0,get:function(){return $.Volume2}}),exports.ansiSpans=n.ansiSpans,exports.badgeVariants=a.badgeVariants,exports.breadcrumbSegments=s.breadcrumbSegments,exports.buttonVariants=l.buttonVariants,exports.cn=e.cn,exports.collapseLines=Y.collapseLines,exports.compactDetails=X.compactDetails,exports.detectGrammar=S.detectGrammar,exports.dialogFooterVariants=u.dialogFooterVariants,exports.dotVariants=d.dotVariants,exports.dropdownMenuItemVariants=f.dropdownMenuItemVariants,exports.fieldVariants=g.fieldVariants,exports.grammarKeyOf=x.grammarKeyOf,exports.handleOptionListKey=_.handleOptionListKey,exports.hashlineBody=X.hashlineBody,exports.hashlineGroups=b.hashlineGroups,exports.hashlineGroupsKey=b.hashlineGroupsKey,exports.highlightToLines=S.highlightToLines,exports.mediaKindOf=O.mediaKindOf,exports.messageItemRowVariants=M.messageItemRowVariants,exports.messageItemStatusVariants=M.messageItemStatusVariants,exports.messageItemVariants=M.messageItemVariants,exports.messageLineVariants=N.messageLineVariants,exports.optionListHint=_.optionListHint,exports.optionListVariants=v.optionListVariants,exports.optionMarker=_.optionMarker,exports.optionMarkerVariants=v.optionMarkerVariants,exports.optionRowVariants=v.optionRowVariants,exports.parseFileHeader=X.parseFileHeader,exports.parseTaggedLine=X.parseTaggedLine,exports.presentHashlineLines=X.presentHashlineLines,exports.resolvePdfViewportRegion=k.resolvePdfViewportRegion,exports.resultTextLines=X.resultTextLines,exports.statusBadgeVariants=j.statusBadgeVariants,exports.syntaxStyleOf=S.syntaxStyleOf,exports.tabBadgeVariants=G.tabBadgeVariants,exports.tabVariants=G.tabVariants,exports.takeTrailingNotice=X.takeTrailingNotice,exports.toastVariants=q.toastVariants,exports.toolTone=M.toolTone,exports.useMessageItem=M.useMessageItem,exports.useSyntaxLines=C.useSyntaxLines;
package/dist/index.d.cts CHANGED
@@ -9,7 +9,7 @@ import { Dialog, DialogBody, DialogClose, DialogContent, DialogContentProps, Dia
9
9
  import { Dot, DotProps, DotTone, dotVariants } from "./components/Dot.cjs";
10
10
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants } from "./components/DropdownMenu.cjs";
11
11
  import { Checkbox } from "./components/Checkbox.cjs";
12
- import { CodeEditorProps, EditorSelectionRange, MEDIA_KINDS, MediaKind } from "./types/editor.cjs";
12
+ import { CodeEditorController, CodeEditorProps, EditorEdit, EditorMarkedRange, EditorSelectionRange, EditorTextRange, EditorViewportRectangle, MEDIA_KINDS, MediaKind } from "./types/editor.cjs";
13
13
  import { CodeEditor } from "./components/CodeEditor.cjs";
14
14
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/Collapsible.cjs";
15
15
  import { FieldSize, FieldVariant, Input, InputProps, fieldVariants } from "./components/Input.cjs";
@@ -21,7 +21,8 @@ import { HashlineLines, HashlineLinesProps } from "./components/HashlineLines.cj
21
21
  import { Kbd } from "./components/Kbd.cjs";
22
22
  import { Label } from "./components/Label.cjs";
23
23
  import { Markdown } from "./components/Markdown.cjs";
24
- import { MediaPreview, MediaPreviewProps } from "./components/MediaPreview.cjs";
24
+ import { PdfNormalizedRectangle, PdfPageRegion, PdfPageState, PdfPreview, PdfPreviewController, PdfPreviewProps, resolvePdfViewportRegion } from "./components/PdfPreview.cjs";
25
+ import { MediaFrameCapture, MediaFrameMetadata, MediaIntrinsicSize, MediaPlaybackState, MediaPreview, MediaPreviewController, MediaPreviewProps } from "./components/MediaPreview.cjs";
25
26
  import { STATUS_EDGE, StatusBadge, StatusBadgeProps, StatusTone, statusBadgeVariants } from "./components/StatusBadge.cjs";
26
27
  import { MessageItem, MessageItemBody, MessageItemGroup, MessageItemGroupProps, MessageItemHeader, MessageItemHeaderProps, MessageItemProps, MessageItemState, MessageItemStatus, MessageItemStatusProps, STATUS_GLYPH, STATUS_LABEL, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, toolTone, useMessageItem } from "./components/MessageItem.cjs";
27
28
  import { MessageLine, MessageLineTone, MessageLines, MessageLinesProps, messageLineVariants } from "./components/MessageLines.cjs";
@@ -54,4 +55,4 @@ import { mediaKindOf } from "./lib/media.cjs";
54
55
  import { MAX_DIGIT_SHORTCUT, handleOptionListKey, optionListHint, optionMarker } from "./lib/optionList.cjs";
55
56
  import { CHIP_TO_STATUS, LINE_TONE_TO_STATUS, STATUS_TO_CHIP, STATUS_TO_DOT } from "./lib/tone.cjs";
56
57
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/Tooltip.cjs";
57
- export { ACCENT_TONES, type AccentTone, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityIcon, AlertIcon, AnsiLine, type AnsiLineProps, type AnsiSpan, AnsiText, type AnsiTextProps, AudioLinesIcon, Avatar, AvatarFallback, AvatarImage, BREADCRUMB_ELLIPSIS, Badge, type BadgeProps, type BadgeTone, BranchIcon, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHIP_TONES, CHIP_TO_STATUS, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, type ChipTone, CloseIcon, CodeEditor, type CodeEditorProps, type CollapsedLines, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandDialog, type CommandDialogProps, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandHeader, CommandInput, CommandItem, CommandItemLabel, CommandList, DOT_TONES, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, DialogTrigger, Dot, type DotProps, type DotTone, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditIcon, type EditorSelectionRange, EmptyState, type EmptyStateProps, EnterIcon, ExternalLinkIcon, type FieldSize, type FieldVariant, FileIcon, GREP_COLLAPSED_LINES, GearIcon, type GrammarKey, type GrammarQuery, type HashlineBody, type HashlineGroup, HashlineLines, type HashlineLinesProps, type HashlineResult, type HashlineResultKind, Input, type InputProps, Kbd, KebabIcon, LINE_TONE_TO_STATUS, Label, LoaderIcon, MAX_DIGIT_SHORTCUT, MEDIA_KINDS, MESSAGE_LINE_TONES, Markdown, type MediaKind, MediaPreview, type MediaPreviewProps, MessageIcon, MessageItem, MessageItemBody, MessageItemGroup, type MessageItemGroupProps, MessageItemHeader, type MessageItemHeaderProps, type MessageItemProps, type MessageItemState, MessageItemStatus, type MessageItemStatusProps, type MessageLine, type MessageLineTone, MessageLines, type MessageLinesProps, MicIcon, NavTab, NavTabBadge, type NavTabProps, OptionLabel, OptionList, type OptionListProps, OptionRow, type OptionRowProps, PaletteIcon, Panel, PanelBody, PanelHeader, type PanelProps, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, type PresentedLine, Progress, QuoteIcon, READ_COLLAPSED_LINES, RadioGroup, RadioGroupCard, RadioGroupItem, RefreshIcon, RewindIcon, STATUS_EDGE, STATUS_GLYPH, STATUS_LABEL, STATUS_TONES, STATUS_TO_CHIP, STATUS_TO_DOT, ScrollArea, ScrollBar, SearchIcon, SectionLabel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator, Sheet, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, SheetOverlay, SheetTitle, SheetTrigger, ShieldIcon, Skeleton, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusTone, StopIcon, StreamCursor, Switch, SyntaxLine, type SyntaxLineProps, type SyntaxLines, type SyntaxQuery, type SyntaxSpan, SyntaxText, type SyntaxTextProps, type SyntaxToken, Tabs, TabsContent, TabsList, TabsTrigger, type TaggedLine, type TaggedLineMarker, Textarea, type TextareaProps, Toast, ToastAction, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, ToolPathLink, type ToolPathLinkProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TrashIcon, UserIcon, VolumeIcon, ansiSpans, badgeVariants, breadcrumbSegments, buttonVariants, cn, collapseLines, compactDetails, detectGrammar, dialogFooterVariants, dotVariants, dropdownMenuItemVariants, fieldVariants, grammarKeyOf, handleOptionListKey, hashlineBody, hashlineGroups, hashlineGroupsKey, highlightToLines, mediaKindOf, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, messageLineVariants, optionListHint, optionListVariants, optionMarker, optionMarkerVariants, optionRowVariants, parseFileHeader, parseTaggedLine, presentHashlineLines, resultTextLines, statusBadgeVariants, syntaxStyleOf, tabBadgeVariants, tabVariants, takeTrailingNotice, toastVariants, toolTone, useMessageItem, useSyntaxLines };
58
+ export { ACCENT_TONES, type AccentTone, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityIcon, AlertIcon, AnsiLine, type AnsiLineProps, type AnsiSpan, AnsiText, type AnsiTextProps, AudioLinesIcon, Avatar, AvatarFallback, AvatarImage, BREADCRUMB_ELLIPSIS, Badge, type BadgeProps, type BadgeTone, BranchIcon, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHIP_TONES, CHIP_TO_STATUS, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, type ChipTone, CloseIcon, CodeEditor, type CodeEditorController, type CodeEditorProps, type CollapsedLines, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandDialog, type CommandDialogProps, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandHeader, CommandInput, CommandItem, CommandItemLabel, CommandList, DOT_TONES, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, DialogTrigger, Dot, type DotProps, type DotTone, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditIcon, type EditorEdit, type EditorMarkedRange, type EditorSelectionRange, type EditorTextRange, type EditorViewportRectangle, EmptyState, type EmptyStateProps, EnterIcon, ExternalLinkIcon, type FieldSize, type FieldVariant, FileIcon, GREP_COLLAPSED_LINES, GearIcon, type GrammarKey, type GrammarQuery, type HashlineBody, type HashlineGroup, HashlineLines, type HashlineLinesProps, type HashlineResult, type HashlineResultKind, Input, type InputProps, Kbd, KebabIcon, LINE_TONE_TO_STATUS, Label, LoaderIcon, MAX_DIGIT_SHORTCUT, MEDIA_KINDS, MESSAGE_LINE_TONES, Markdown, type MediaFrameCapture, type MediaFrameMetadata, type MediaIntrinsicSize, type MediaKind, type MediaPlaybackState, MediaPreview, type MediaPreviewController, type MediaPreviewProps, MessageIcon, MessageItem, MessageItemBody, MessageItemGroup, type MessageItemGroupProps, MessageItemHeader, type MessageItemHeaderProps, type MessageItemProps, type MessageItemState, MessageItemStatus, type MessageItemStatusProps, type MessageLine, type MessageLineTone, MessageLines, type MessageLinesProps, MicIcon, NavTab, NavTabBadge, type NavTabProps, OptionLabel, OptionList, type OptionListProps, OptionRow, type OptionRowProps, PaletteIcon, Panel, PanelBody, PanelHeader, type PanelProps, type PdfNormalizedRectangle, type PdfPageRegion, type PdfPageState, PdfPreview, type PdfPreviewController, type PdfPreviewProps, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, type PresentedLine, Progress, QuoteIcon, READ_COLLAPSED_LINES, RadioGroup, RadioGroupCard, RadioGroupItem, RefreshIcon, RewindIcon, STATUS_EDGE, STATUS_GLYPH, STATUS_LABEL, STATUS_TONES, STATUS_TO_CHIP, STATUS_TO_DOT, ScrollArea, ScrollBar, SearchIcon, SectionLabel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator, Sheet, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, SheetOverlay, SheetTitle, SheetTrigger, ShieldIcon, Skeleton, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusTone, StopIcon, StreamCursor, Switch, SyntaxLine, type SyntaxLineProps, type SyntaxLines, type SyntaxQuery, type SyntaxSpan, SyntaxText, type SyntaxTextProps, type SyntaxToken, Tabs, TabsContent, TabsList, TabsTrigger, type TaggedLine, type TaggedLineMarker, Textarea, type TextareaProps, Toast, ToastAction, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, ToolPathLink, type ToolPathLinkProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TrashIcon, UserIcon, VolumeIcon, ansiSpans, badgeVariants, breadcrumbSegments, buttonVariants, cn, collapseLines, compactDetails, detectGrammar, dialogFooterVariants, dotVariants, dropdownMenuItemVariants, fieldVariants, grammarKeyOf, handleOptionListKey, hashlineBody, hashlineGroups, hashlineGroupsKey, highlightToLines, mediaKindOf, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, messageLineVariants, optionListHint, optionListVariants, optionMarker, optionMarkerVariants, optionRowVariants, parseFileHeader, parseTaggedLine, presentHashlineLines, resolvePdfViewportRegion, resultTextLines, statusBadgeVariants, syntaxStyleOf, tabBadgeVariants, tabVariants, takeTrailingNotice, toastVariants, toolTone, useMessageItem, useSyntaxLines };
package/dist/index.d.mts CHANGED
@@ -9,7 +9,7 @@ import { Dialog, DialogBody, DialogClose, DialogContent, DialogContentProps, Dia
9
9
  import { Dot, DotProps, DotTone, dotVariants } from "./src/components/Dot.mjs";
10
10
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants } from "./src/components/DropdownMenu.mjs";
11
11
  import { Checkbox } from "./src/components/Checkbox.mjs";
12
- import { CodeEditorProps, EditorSelectionRange, MEDIA_KINDS, MediaKind } from "./src/types/editor.mjs";
12
+ import { CodeEditorController, CodeEditorProps, EditorEdit, EditorMarkedRange, EditorSelectionRange, EditorTextRange, EditorViewportRectangle, MEDIA_KINDS, MediaKind } from "./src/types/editor.mjs";
13
13
  import { CodeEditor } from "./src/components/CodeEditor.mjs";
14
14
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./src/components/Collapsible.mjs";
15
15
  import { FieldSize, FieldVariant, Input, InputProps, fieldVariants } from "./src/components/Input.mjs";
@@ -21,7 +21,8 @@ import { HashlineLines, HashlineLinesProps } from "./src/components/HashlineLine
21
21
  import { Kbd } from "./src/components/Kbd.mjs";
22
22
  import { Label } from "./src/components/Label.mjs";
23
23
  import { Markdown } from "./src/components/Markdown.mjs";
24
- import { MediaPreview, MediaPreviewProps } from "./src/components/MediaPreview.mjs";
24
+ import { PdfNormalizedRectangle, PdfPageRegion, PdfPageState, PdfPreview, PdfPreviewController, PdfPreviewProps, resolvePdfViewportRegion } from "./src/components/PdfPreview.mjs";
25
+ import { MediaFrameCapture, MediaFrameMetadata, MediaIntrinsicSize, MediaPlaybackState, MediaPreview, MediaPreviewController, MediaPreviewProps } from "./src/components/MediaPreview.mjs";
25
26
  import { STATUS_EDGE, StatusBadge, StatusBadgeProps, StatusTone, statusBadgeVariants } from "./src/components/StatusBadge.mjs";
26
27
  import { MessageItem, MessageItemBody, MessageItemGroup, MessageItemGroupProps, MessageItemHeader, MessageItemHeaderProps, MessageItemProps, MessageItemState, MessageItemStatus, MessageItemStatusProps, STATUS_GLYPH, STATUS_LABEL, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, toolTone, useMessageItem } from "./src/components/MessageItem.mjs";
27
28
  import { MessageLine, MessageLineTone, MessageLines, MessageLinesProps, messageLineVariants } from "./src/components/MessageLines.mjs";
@@ -54,4 +55,4 @@ import { mediaKindOf } from "./src/lib/media.mjs";
54
55
  import { MAX_DIGIT_SHORTCUT, handleOptionListKey, optionListHint, optionMarker } from "./src/lib/optionList.mjs";
55
56
  import { CHIP_TO_STATUS, LINE_TONE_TO_STATUS, STATUS_TO_CHIP, STATUS_TO_DOT } from "./src/lib/tone.mjs";
56
57
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./src/components/Tooltip.mjs";
57
- export { ACCENT_TONES, type AccentTone, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityIcon, AlertIcon, AnsiLine, type AnsiLineProps, type AnsiSpan, AnsiText, type AnsiTextProps, AudioLinesIcon, Avatar, AvatarFallback, AvatarImage, BREADCRUMB_ELLIPSIS, Badge, type BadgeProps, type BadgeTone, BranchIcon, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHIP_TONES, CHIP_TO_STATUS, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, type ChipTone, CloseIcon, CodeEditor, type CodeEditorProps, type CollapsedLines, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandDialog, type CommandDialogProps, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandHeader, CommandInput, CommandItem, CommandItemLabel, CommandList, DOT_TONES, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, DialogTrigger, Dot, type DotProps, type DotTone, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditIcon, type EditorSelectionRange, EmptyState, type EmptyStateProps, EnterIcon, ExternalLinkIcon, type FieldSize, type FieldVariant, FileIcon, GREP_COLLAPSED_LINES, GearIcon, type GrammarKey, type GrammarQuery, type HashlineBody, type HashlineGroup, HashlineLines, type HashlineLinesProps, type HashlineResult, type HashlineResultKind, Input, type InputProps, Kbd, KebabIcon, LINE_TONE_TO_STATUS, Label, LoaderIcon, MAX_DIGIT_SHORTCUT, MEDIA_KINDS, MESSAGE_LINE_TONES, Markdown, type MediaKind, MediaPreview, type MediaPreviewProps, MessageIcon, MessageItem, MessageItemBody, MessageItemGroup, type MessageItemGroupProps, MessageItemHeader, type MessageItemHeaderProps, type MessageItemProps, type MessageItemState, MessageItemStatus, type MessageItemStatusProps, type MessageLine, type MessageLineTone, MessageLines, type MessageLinesProps, MicIcon, NavTab, NavTabBadge, type NavTabProps, OptionLabel, OptionList, type OptionListProps, OptionRow, type OptionRowProps, PaletteIcon, Panel, PanelBody, PanelHeader, type PanelProps, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, type PresentedLine, Progress, QuoteIcon, READ_COLLAPSED_LINES, RadioGroup, RadioGroupCard, RadioGroupItem, RefreshIcon, RewindIcon, STATUS_EDGE, STATUS_GLYPH, STATUS_LABEL, STATUS_TONES, STATUS_TO_CHIP, STATUS_TO_DOT, ScrollArea, ScrollBar, SearchIcon, SectionLabel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator, Sheet, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, SheetOverlay, SheetTitle, SheetTrigger, ShieldIcon, Skeleton, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusTone, StopIcon, StreamCursor, Switch, SyntaxLine, type SyntaxLineProps, type SyntaxLines, type SyntaxQuery, type SyntaxSpan, SyntaxText, type SyntaxTextProps, type SyntaxToken, Tabs, TabsContent, TabsList, TabsTrigger, type TaggedLine, type TaggedLineMarker, Textarea, type TextareaProps, Toast, ToastAction, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, ToolPathLink, type ToolPathLinkProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TrashIcon, UserIcon, VolumeIcon, ansiSpans, badgeVariants, breadcrumbSegments, buttonVariants, cn, collapseLines, compactDetails, detectGrammar, dialogFooterVariants, dotVariants, dropdownMenuItemVariants, fieldVariants, grammarKeyOf, handleOptionListKey, hashlineBody, hashlineGroups, hashlineGroupsKey, highlightToLines, mediaKindOf, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, messageLineVariants, optionListHint, optionListVariants, optionMarker, optionMarkerVariants, optionRowVariants, parseFileHeader, parseTaggedLine, presentHashlineLines, resultTextLines, statusBadgeVariants, syntaxStyleOf, tabBadgeVariants, tabVariants, takeTrailingNotice, toastVariants, toolTone, useMessageItem, useSyntaxLines };
58
+ export { ACCENT_TONES, type AccentTone, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityIcon, AlertIcon, AnsiLine, type AnsiLineProps, type AnsiSpan, AnsiText, type AnsiTextProps, AudioLinesIcon, Avatar, AvatarFallback, AvatarImage, BREADCRUMB_ELLIPSIS, Badge, type BadgeProps, type BadgeTone, BranchIcon, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHIP_TONES, CHIP_TO_STATUS, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, type ChipTone, CloseIcon, CodeEditor, type CodeEditorController, type CodeEditorProps, type CollapsedLines, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandDialog, type CommandDialogProps, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandHeader, CommandInput, CommandItem, CommandItemLabel, CommandList, DOT_TONES, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, DialogTrigger, Dot, type DotProps, type DotTone, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditIcon, type EditorEdit, type EditorMarkedRange, type EditorSelectionRange, type EditorTextRange, type EditorViewportRectangle, EmptyState, type EmptyStateProps, EnterIcon, ExternalLinkIcon, type FieldSize, type FieldVariant, FileIcon, GREP_COLLAPSED_LINES, GearIcon, type GrammarKey, type GrammarQuery, type HashlineBody, type HashlineGroup, HashlineLines, type HashlineLinesProps, type HashlineResult, type HashlineResultKind, Input, type InputProps, Kbd, KebabIcon, LINE_TONE_TO_STATUS, Label, LoaderIcon, MAX_DIGIT_SHORTCUT, MEDIA_KINDS, MESSAGE_LINE_TONES, Markdown, type MediaFrameCapture, type MediaFrameMetadata, type MediaIntrinsicSize, type MediaKind, type MediaPlaybackState, MediaPreview, type MediaPreviewController, type MediaPreviewProps, MessageIcon, MessageItem, MessageItemBody, MessageItemGroup, type MessageItemGroupProps, MessageItemHeader, type MessageItemHeaderProps, type MessageItemProps, type MessageItemState, MessageItemStatus, type MessageItemStatusProps, type MessageLine, type MessageLineTone, MessageLines, type MessageLinesProps, MicIcon, NavTab, NavTabBadge, type NavTabProps, OptionLabel, OptionList, type OptionListProps, OptionRow, type OptionRowProps, PaletteIcon, Panel, PanelBody, PanelHeader, type PanelProps, type PdfNormalizedRectangle, type PdfPageRegion, type PdfPageState, PdfPreview, type PdfPreviewController, type PdfPreviewProps, PlusIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, type PresentedLine, Progress, QuoteIcon, READ_COLLAPSED_LINES, RadioGroup, RadioGroupCard, RadioGroupItem, RefreshIcon, RewindIcon, STATUS_EDGE, STATUS_GLYPH, STATUS_LABEL, STATUS_TONES, STATUS_TO_CHIP, STATUS_TO_DOT, ScrollArea, ScrollBar, SearchIcon, SectionLabel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SendIcon, Separator, Sheet, SheetBody, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, SheetOverlay, SheetTitle, SheetTrigger, ShieldIcon, Skeleton, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusTone, StopIcon, StreamCursor, Switch, SyntaxLine, type SyntaxLineProps, type SyntaxLines, type SyntaxQuery, type SyntaxSpan, SyntaxText, type SyntaxTextProps, type SyntaxToken, Tabs, TabsContent, TabsList, TabsTrigger, type TaggedLine, type TaggedLineMarker, Textarea, type TextareaProps, Toast, ToastAction, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, ToolPathLink, type ToolPathLinkProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TrashIcon, UserIcon, VolumeIcon, ansiSpans, badgeVariants, breadcrumbSegments, buttonVariants, cn, collapseLines, compactDetails, detectGrammar, dialogFooterVariants, dotVariants, dropdownMenuItemVariants, fieldVariants, grammarKeyOf, handleOptionListKey, hashlineBody, hashlineGroups, hashlineGroupsKey, highlightToLines, mediaKindOf, messageItemRowVariants, messageItemStatusVariants, messageItemVariants, messageLineVariants, optionListHint, optionListVariants, optionMarker, optionMarkerVariants, optionRowVariants, parseFileHeader, parseTaggedLine, presentHashlineLines, resolvePdfViewportRegion, resultTextLines, statusBadgeVariants, syntaxStyleOf, tabBadgeVariants, tabVariants, takeTrailingNotice, toastVariants, toolTone, useMessageItem, useSyntaxLines };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{ActivityIcon as e,AlertIcon as t,AudioLinesIcon as n,BranchIcon as r,CheckIcon as i,ChevronDownIcon as a,ChevronRightIcon as o,ChevronUpIcon as s,CloseIcon as c,EditIcon as l,EnterIcon as u,ExternalLinkIcon as d,FileIcon as f,GearIcon as p,KebabIcon as m,LoaderIcon as h,MessageIcon as g,MicIcon as _,PaletteIcon as v,PlusIcon as y,QuoteIcon as b,RefreshIcon as x,RewindIcon as S,SearchIcon as C,SendIcon as w,ShieldIcon as T,StopIcon as E,TrashIcon as D,UserIcon as O,VolumeIcon as k}from"./src/icons/icons.mjs";import{cn as A}from"./src/lib/cn.mjs";import{Accordion as j,AccordionContent as M,AccordionItem as N,AccordionTrigger as P}from"./src/components/Accordion.mjs";import{ansiSpans as F}from"./src/lib/ansiSpans.mjs";import{AnsiLine as I,AnsiText as L}from"./src/components/AnsiText.mjs";import{Avatar as R,AvatarFallback as z,AvatarImage as B}from"./src/components/Avatar.mjs";import{Badge as V,badgeVariants as H}from"./src/components/Badge.mjs";import{Tooltip as U,TooltipContent as W,TooltipProvider as G,TooltipTrigger as K}from"./src/components/Tooltip.mjs";import{BREADCRUMB_ELLIPSIS as q,Breadcrumb as J,breadcrumbSegments as Y}from"./src/components/Breadcrumb.mjs";import{Spinner as X}from"./src/components/Spinner.mjs";import{Button as Z,buttonVariants as Q}from"./src/components/Button.mjs";import{Dialog as $,DialogBody as ee,DialogClose as te,DialogContent as ne,DialogDescription as re,DialogFooter as ie,DialogHeader as ae,DialogTitle as oe,DialogTrigger as se,dialogFooterVariants as ce}from"./src/components/Dialog.mjs";import{Dot as le,dotVariants as ue}from"./src/components/Dot.mjs";import{DropdownMenu as de,DropdownMenuCheckboxItem as fe,DropdownMenuContent as pe,DropdownMenuGroup as me,DropdownMenuItem as he,DropdownMenuLabel as ge,DropdownMenuRadioGroup as _e,DropdownMenuRadioItem as ve,DropdownMenuSeparator as ye,DropdownMenuShortcut as be,DropdownMenuSub as xe,DropdownMenuSubContent as Se,DropdownMenuSubTrigger as Ce,DropdownMenuTrigger as we,dropdownMenuItemVariants as Te}from"./src/components/DropdownMenu.mjs";import{Checkbox as Ee}from"./src/components/Checkbox.mjs";import{Skeleton as De}from"./src/components/Skeleton.mjs";import{CodeEditor as Oe}from"./src/components/CodeEditor.mjs";import{Collapsible as ke,CollapsibleContent as Ae,CollapsibleTrigger as je}from"./src/components/Collapsible.mjs";import{Input as Me,fieldVariants as Ne}from"./src/components/Input.mjs";import{MAX_DIGIT_SHORTCUT as Pe,handleOptionListKey as Fe,optionListHint as Ie,optionMarker as Le}from"./src/lib/optionList.mjs";import{OptionLabel as Re,OptionList as ze,OptionRow as Be,optionListVariants as Ve,optionMarkerVariants as He,optionRowVariants as Ue}from"./src/components/OptionList.mjs";import{CommandDialog as We,CommandEmpty as Ge,CommandFooter as Ke,CommandGroup as qe,CommandGroupLabel as Je,CommandHeader as Ye,CommandInput as Xe,CommandItem as Ze,CommandItemLabel as Qe,CommandList as $e}from"./src/components/Command.mjs";import{EmptyState as et}from"./src/components/EmptyState.mjs";import{hashlineGroups as tt,hashlineGroupsKey as nt}from"./src/lib/hashlineHighlight.mjs";import{grammarKeyOf as rt}from"./src/lib/editorLanguage.mjs";import{detectGrammar as it,highlightToLines as at,syntaxStyleOf as ot}from"./src/lib/syntaxHighlight.mjs";import{SyntaxLine as st,SyntaxText as ct,useSyntaxLines as lt}from"./src/components/SyntaxText.mjs";import{HashlineLines as ut}from"./src/components/HashlineLines.mjs";import{Kbd as dt}from"./src/components/Kbd.mjs";import{Label as ft}from"./src/components/Label.mjs";import{Markdown as pt}from"./src/components/Markdown.mjs";import{mediaKindOf as mt}from"./src/lib/media.mjs";import{MediaPreview as ht}from"./src/components/MediaPreview.mjs";import{STATUS_EDGE as gt,StatusBadge as _t,statusBadgeVariants as vt}from"./src/components/StatusBadge.mjs";import{MessageItem as yt,MessageItemBody as bt,MessageItemGroup as xt,MessageItemHeader as St,MessageItemStatus as Ct,STATUS_GLYPH as wt,STATUS_LABEL as Tt,messageItemRowVariants as Et,messageItemStatusVariants as Dt,messageItemVariants as Ot,toolTone as kt,useMessageItem as At}from"./src/components/MessageItem.mjs";import{MessageLines as jt,messageLineVariants as Mt}from"./src/components/MessageLines.mjs";import{Panel as Nt,PanelBody as Pt,PanelHeader as Ft}from"./src/components/Panel.mjs";import{Popover as It,PopoverAnchor as Lt,PopoverClose as Rt,PopoverContent as zt,PopoverFooter as Bt,PopoverHeader as Vt,PopoverTrigger as Ht}from"./src/components/Popover.mjs";import{Progress as Ut}from"./src/components/Progress.mjs";import{RadioGroup as Wt,RadioGroupCard as Gt,RadioGroupItem as Kt}from"./src/components/RadioGroup.mjs";import{ScrollArea as qt,ScrollBar as Jt}from"./src/components/ScrollArea.mjs";import{SectionLabel as Yt}from"./src/components/SectionLabel.mjs";import{Select as Xt,SelectContent as Zt,SelectGroup as Qt,SelectItem as $t,SelectLabel as en,SelectSeparator as tn,SelectTrigger as nn,SelectValue as rn}from"./src/components/Select.mjs";import{Separator as an}from"./src/components/Separator.mjs";import{Sheet as on,SheetBody as sn,SheetClose as cn,SheetContent as ln,SheetDescription as un,SheetFooter as dn,SheetHeader as fn,SheetOverlay as pn,SheetTitle as mn,SheetTrigger as hn}from"./src/components/Sheet.mjs";import{StreamCursor as gn}from"./src/components/StreamCursor.mjs";import{Switch as _n}from"./src/components/Switch.mjs";import{NavTab as vn,NavTabBadge as yn,Tabs as bn,TabsContent as xn,TabsList as Sn,TabsTrigger as Cn,tabBadgeVariants as wn,tabVariants as Tn}from"./src/components/Tabs.mjs";import{Textarea as En}from"./src/components/Textarea.mjs";import{Toast as Dn,ToastAction as On,ToastClose as kn,ToastDescription as An,ToastProvider as jn,ToastTitle as Mn,ToastViewport as Nn,toastVariants as Pn}from"./src/components/Toast.mjs";import{ToolPathLink as Fn}from"./src/components/ToolPathLink.mjs";import{collapseLines as In}from"./src/lib/collapse.mjs";import{GREP_COLLAPSED_LINES as Ln,READ_COLLAPSED_LINES as Rn,compactDetails as zn,hashlineBody as Bn,parseFileHeader as Vn,parseTaggedLine as Hn,presentHashlineLines as Un,resultTextLines as Wn,takeTrailingNotice as Gn}from"./src/lib/hashlineView.mjs";import{CHIP_TO_STATUS as Kn,LINE_TONE_TO_STATUS as qn,STATUS_TO_CHIP as Jn,STATUS_TO_DOT as Yn}from"./src/lib/tone.mjs";import{MEDIA_KINDS as Xn}from"./src/types/editor.mjs";import{ACCENT_TONES as Zn,CHIP_TONES as Qn,DOT_TONES as $n,MESSAGE_LINE_TONES as er,STATUS_TONES as tr}from"./src/types/tone.mjs";export{Zn as ACCENT_TONES,j as Accordion,M as AccordionContent,N as AccordionItem,P as AccordionTrigger,e as ActivityIcon,t as AlertIcon,I as AnsiLine,L as AnsiText,n as AudioLinesIcon,R as Avatar,z as AvatarFallback,B as AvatarImage,q as BREADCRUMB_ELLIPSIS,V as Badge,r as BranchIcon,J as Breadcrumb,Z as Button,Qn as CHIP_TONES,Kn as CHIP_TO_STATUS,i as CheckIcon,Ee as Checkbox,a as ChevronDownIcon,o as ChevronRightIcon,s as ChevronUpIcon,c as CloseIcon,Oe as CodeEditor,ke as Collapsible,Ae as CollapsibleContent,je as CollapsibleTrigger,We as CommandDialog,Ge as CommandEmpty,Ke as CommandFooter,qe as CommandGroup,Je as CommandGroupLabel,Ye as CommandHeader,Xe as CommandInput,Ze as CommandItem,Qe as CommandItemLabel,$e as CommandList,$n as DOT_TONES,$ as Dialog,ee as DialogBody,te as DialogClose,ne as DialogContent,re as DialogDescription,ie as DialogFooter,ae as DialogHeader,oe as DialogTitle,se as DialogTrigger,le as Dot,de as DropdownMenu,fe as DropdownMenuCheckboxItem,pe as DropdownMenuContent,me as DropdownMenuGroup,he as DropdownMenuItem,ge as DropdownMenuLabel,_e as DropdownMenuRadioGroup,ve as DropdownMenuRadioItem,ye as DropdownMenuSeparator,be as DropdownMenuShortcut,xe as DropdownMenuSub,Se as DropdownMenuSubContent,Ce as DropdownMenuSubTrigger,we as DropdownMenuTrigger,l as EditIcon,et as EmptyState,u as EnterIcon,d as ExternalLinkIcon,f as FileIcon,Ln as GREP_COLLAPSED_LINES,p as GearIcon,ut as HashlineLines,Me as Input,dt as Kbd,m as KebabIcon,qn as LINE_TONE_TO_STATUS,ft as Label,h as LoaderIcon,Pe as MAX_DIGIT_SHORTCUT,Xn as MEDIA_KINDS,er as MESSAGE_LINE_TONES,pt as Markdown,ht as MediaPreview,g as MessageIcon,yt as MessageItem,bt as MessageItemBody,xt as MessageItemGroup,St as MessageItemHeader,Ct as MessageItemStatus,jt as MessageLines,_ as MicIcon,vn as NavTab,yn as NavTabBadge,Re as OptionLabel,ze as OptionList,Be as OptionRow,v as PaletteIcon,Nt as Panel,Pt as PanelBody,Ft as PanelHeader,y as PlusIcon,It as Popover,Lt as PopoverAnchor,Rt as PopoverClose,zt as PopoverContent,Bt as PopoverFooter,Vt as PopoverHeader,Ht as PopoverTrigger,Ut as Progress,b as QuoteIcon,Rn as READ_COLLAPSED_LINES,Wt as RadioGroup,Gt as RadioGroupCard,Kt as RadioGroupItem,x as RefreshIcon,S as RewindIcon,gt as STATUS_EDGE,wt as STATUS_GLYPH,Tt as STATUS_LABEL,tr as STATUS_TONES,Jn as STATUS_TO_CHIP,Yn as STATUS_TO_DOT,qt as ScrollArea,Jt as ScrollBar,C as SearchIcon,Yt as SectionLabel,Xt as Select,Zt as SelectContent,Qt as SelectGroup,$t as SelectItem,en as SelectLabel,tn as SelectSeparator,nn as SelectTrigger,rn as SelectValue,w as SendIcon,an as Separator,on as Sheet,sn as SheetBody,cn as SheetClose,ln as SheetContent,un as SheetDescription,dn as SheetFooter,fn as SheetHeader,pn as SheetOverlay,mn as SheetTitle,hn as SheetTrigger,T as ShieldIcon,De as Skeleton,X as Spinner,_t as StatusBadge,E as StopIcon,gn as StreamCursor,_n as Switch,st as SyntaxLine,ct as SyntaxText,bn as Tabs,xn as TabsContent,Sn as TabsList,Cn as TabsTrigger,En as Textarea,Dn as Toast,On as ToastAction,kn as ToastClose,An as ToastDescription,jn as ToastProvider,Mn as ToastTitle,Nn as ToastViewport,Fn as ToolPathLink,U as Tooltip,W as TooltipContent,G as TooltipProvider,K as TooltipTrigger,D as TrashIcon,O as UserIcon,k as VolumeIcon,F as ansiSpans,H as badgeVariants,Y as breadcrumbSegments,Q as buttonVariants,A as cn,In as collapseLines,zn as compactDetails,it as detectGrammar,ce as dialogFooterVariants,ue as dotVariants,Te as dropdownMenuItemVariants,Ne as fieldVariants,rt as grammarKeyOf,Fe as handleOptionListKey,Bn as hashlineBody,tt as hashlineGroups,nt as hashlineGroupsKey,at as highlightToLines,mt as mediaKindOf,Et as messageItemRowVariants,Dt as messageItemStatusVariants,Ot as messageItemVariants,Mt as messageLineVariants,Ie as optionListHint,Ve as optionListVariants,Le as optionMarker,He as optionMarkerVariants,Ue as optionRowVariants,Vn as parseFileHeader,Hn as parseTaggedLine,Un as presentHashlineLines,Wn as resultTextLines,vt as statusBadgeVariants,ot as syntaxStyleOf,wn as tabBadgeVariants,Tn as tabVariants,Gn as takeTrailingNotice,Pn as toastVariants,kt as toolTone,At as useMessageItem,lt as useSyntaxLines};
1
+ import{ActivityIcon as e,AlertIcon as t,AudioLinesIcon as n,BranchIcon as r,CheckIcon as i,ChevronDownIcon as a,ChevronRightIcon as o,ChevronUpIcon as s,CloseIcon as c,EditIcon as l,EnterIcon as u,ExternalLinkIcon as d,FileIcon as f,GearIcon as p,KebabIcon as m,LoaderIcon as h,MessageIcon as g,MicIcon as _,PaletteIcon as v,PlusIcon as y,QuoteIcon as b,RefreshIcon as x,RewindIcon as S,SearchIcon as C,SendIcon as w,ShieldIcon as T,StopIcon as E,TrashIcon as D,UserIcon as O,VolumeIcon as k}from"./src/icons/icons.mjs";import{cn as A}from"./src/lib/cn.mjs";import{Accordion as j,AccordionContent as M,AccordionItem as N,AccordionTrigger as P}from"./src/components/Accordion.mjs";import{ansiSpans as F}from"./src/lib/ansiSpans.mjs";import{AnsiLine as I,AnsiText as L}from"./src/components/AnsiText.mjs";import{Avatar as R,AvatarFallback as z,AvatarImage as B}from"./src/components/Avatar.mjs";import{Badge as V,badgeVariants as H}from"./src/components/Badge.mjs";import{Tooltip as U,TooltipContent as W,TooltipProvider as G,TooltipTrigger as K}from"./src/components/Tooltip.mjs";import{BREADCRUMB_ELLIPSIS as q,Breadcrumb as J,breadcrumbSegments as Y}from"./src/components/Breadcrumb.mjs";import{Spinner as X}from"./src/components/Spinner.mjs";import{Button as Z,buttonVariants as Q}from"./src/components/Button.mjs";import{Dialog as $,DialogBody as ee,DialogClose as te,DialogContent as ne,DialogDescription as re,DialogFooter as ie,DialogHeader as ae,DialogTitle as oe,DialogTrigger as se,dialogFooterVariants as ce}from"./src/components/Dialog.mjs";import{Dot as le,dotVariants as ue}from"./src/components/Dot.mjs";import{DropdownMenu as de,DropdownMenuCheckboxItem as fe,DropdownMenuContent as pe,DropdownMenuGroup as me,DropdownMenuItem as he,DropdownMenuLabel as ge,DropdownMenuRadioGroup as _e,DropdownMenuRadioItem as ve,DropdownMenuSeparator as ye,DropdownMenuShortcut as be,DropdownMenuSub as xe,DropdownMenuSubContent as Se,DropdownMenuSubTrigger as Ce,DropdownMenuTrigger as we,dropdownMenuItemVariants as Te}from"./src/components/DropdownMenu.mjs";import{Checkbox as Ee}from"./src/components/Checkbox.mjs";import{Skeleton as De}from"./src/components/Skeleton.mjs";import{CodeEditor as Oe}from"./src/components/CodeEditor.mjs";import{Collapsible as ke,CollapsibleContent as Ae,CollapsibleTrigger as je}from"./src/components/Collapsible.mjs";import{Input as Me,fieldVariants as Ne}from"./src/components/Input.mjs";import{MAX_DIGIT_SHORTCUT as Pe,handleOptionListKey as Fe,optionListHint as Ie,optionMarker as Le}from"./src/lib/optionList.mjs";import{OptionLabel as Re,OptionList as ze,OptionRow as Be,optionListVariants as Ve,optionMarkerVariants as He,optionRowVariants as Ue}from"./src/components/OptionList.mjs";import{CommandDialog as We,CommandEmpty as Ge,CommandFooter as Ke,CommandGroup as qe,CommandGroupLabel as Je,CommandHeader as Ye,CommandInput as Xe,CommandItem as Ze,CommandItemLabel as Qe,CommandList as $e}from"./src/components/Command.mjs";import{EmptyState as et}from"./src/components/EmptyState.mjs";import{hashlineGroups as tt,hashlineGroupsKey as nt}from"./src/lib/hashlineHighlight.mjs";import{grammarKeyOf as rt}from"./src/lib/editorLanguage.mjs";import{detectGrammar as it,highlightToLines as at,syntaxStyleOf as ot}from"./src/lib/syntaxHighlight.mjs";import{SyntaxLine as st,SyntaxText as ct,useSyntaxLines as lt}from"./src/components/SyntaxText.mjs";import{HashlineLines as ut}from"./src/components/HashlineLines.mjs";import{Kbd as dt}from"./src/components/Kbd.mjs";import{Label as ft}from"./src/components/Label.mjs";import{Markdown as pt}from"./src/components/Markdown.mjs";import{mediaKindOf as mt}from"./src/lib/media.mjs";import{PdfPreview as ht,resolvePdfViewportRegion as gt}from"./src/components/PdfPreview.mjs";import{MediaPreview as _t}from"./src/components/MediaPreview.mjs";import{STATUS_EDGE as vt,StatusBadge as yt,statusBadgeVariants as bt}from"./src/components/StatusBadge.mjs";import{MessageItem as xt,MessageItemBody as St,MessageItemGroup as Ct,MessageItemHeader as wt,MessageItemStatus as Tt,STATUS_GLYPH as Et,STATUS_LABEL as Dt,messageItemRowVariants as Ot,messageItemStatusVariants as kt,messageItemVariants as At,toolTone as jt,useMessageItem as Mt}from"./src/components/MessageItem.mjs";import{MessageLines as Nt,messageLineVariants as Pt}from"./src/components/MessageLines.mjs";import{Panel as Ft,PanelBody as It,PanelHeader as Lt}from"./src/components/Panel.mjs";import{Popover as Rt,PopoverAnchor as zt,PopoverClose as Bt,PopoverContent as Vt,PopoverFooter as Ht,PopoverHeader as Ut,PopoverTrigger as Wt}from"./src/components/Popover.mjs";import{Progress as Gt}from"./src/components/Progress.mjs";import{RadioGroup as Kt,RadioGroupCard as qt,RadioGroupItem as Jt}from"./src/components/RadioGroup.mjs";import{ScrollArea as Yt,ScrollBar as Xt}from"./src/components/ScrollArea.mjs";import{SectionLabel as Zt}from"./src/components/SectionLabel.mjs";import{Select as Qt,SelectContent as $t,SelectGroup as en,SelectItem as tn,SelectLabel as nn,SelectSeparator as rn,SelectTrigger as an,SelectValue as on}from"./src/components/Select.mjs";import{Separator as sn}from"./src/components/Separator.mjs";import{Sheet as cn,SheetBody as ln,SheetClose as un,SheetContent as dn,SheetDescription as fn,SheetFooter as pn,SheetHeader as mn,SheetOverlay as hn,SheetTitle as gn,SheetTrigger as _n}from"./src/components/Sheet.mjs";import{StreamCursor as vn}from"./src/components/StreamCursor.mjs";import{Switch as yn}from"./src/components/Switch.mjs";import{NavTab as bn,NavTabBadge as xn,Tabs as Sn,TabsContent as Cn,TabsList as wn,TabsTrigger as Tn,tabBadgeVariants as En,tabVariants as Dn}from"./src/components/Tabs.mjs";import{Textarea as On}from"./src/components/Textarea.mjs";import{Toast as kn,ToastAction as An,ToastClose as jn,ToastDescription as Mn,ToastProvider as Nn,ToastTitle as Pn,ToastViewport as Fn,toastVariants as In}from"./src/components/Toast.mjs";import{ToolPathLink as Ln}from"./src/components/ToolPathLink.mjs";import{collapseLines as Rn}from"./src/lib/collapse.mjs";import{GREP_COLLAPSED_LINES as zn,READ_COLLAPSED_LINES as Bn,compactDetails as Vn,hashlineBody as Hn,parseFileHeader as Un,parseTaggedLine as Wn,presentHashlineLines as Gn,resultTextLines as Kn,takeTrailingNotice as qn}from"./src/lib/hashlineView.mjs";import{CHIP_TO_STATUS as Jn,LINE_TONE_TO_STATUS as Yn,STATUS_TO_CHIP as Xn,STATUS_TO_DOT as Zn}from"./src/lib/tone.mjs";import{MEDIA_KINDS as Qn}from"./src/types/editor.mjs";import{ACCENT_TONES as $n,CHIP_TONES as er,DOT_TONES as tr,MESSAGE_LINE_TONES as nr,STATUS_TONES as rr}from"./src/types/tone.mjs";export{$n as ACCENT_TONES,j as Accordion,M as AccordionContent,N as AccordionItem,P as AccordionTrigger,e as ActivityIcon,t as AlertIcon,I as AnsiLine,L as AnsiText,n as AudioLinesIcon,R as Avatar,z as AvatarFallback,B as AvatarImage,q as BREADCRUMB_ELLIPSIS,V as Badge,r as BranchIcon,J as Breadcrumb,Z as Button,er as CHIP_TONES,Jn as CHIP_TO_STATUS,i as CheckIcon,Ee as Checkbox,a as ChevronDownIcon,o as ChevronRightIcon,s as ChevronUpIcon,c as CloseIcon,Oe as CodeEditor,ke as Collapsible,Ae as CollapsibleContent,je as CollapsibleTrigger,We as CommandDialog,Ge as CommandEmpty,Ke as CommandFooter,qe as CommandGroup,Je as CommandGroupLabel,Ye as CommandHeader,Xe as CommandInput,Ze as CommandItem,Qe as CommandItemLabel,$e as CommandList,tr as DOT_TONES,$ as Dialog,ee as DialogBody,te as DialogClose,ne as DialogContent,re as DialogDescription,ie as DialogFooter,ae as DialogHeader,oe as DialogTitle,se as DialogTrigger,le as Dot,de as DropdownMenu,fe as DropdownMenuCheckboxItem,pe as DropdownMenuContent,me as DropdownMenuGroup,he as DropdownMenuItem,ge as DropdownMenuLabel,_e as DropdownMenuRadioGroup,ve as DropdownMenuRadioItem,ye as DropdownMenuSeparator,be as DropdownMenuShortcut,xe as DropdownMenuSub,Se as DropdownMenuSubContent,Ce as DropdownMenuSubTrigger,we as DropdownMenuTrigger,l as EditIcon,et as EmptyState,u as EnterIcon,d as ExternalLinkIcon,f as FileIcon,zn as GREP_COLLAPSED_LINES,p as GearIcon,ut as HashlineLines,Me as Input,dt as Kbd,m as KebabIcon,Yn as LINE_TONE_TO_STATUS,ft as Label,h as LoaderIcon,Pe as MAX_DIGIT_SHORTCUT,Qn as MEDIA_KINDS,nr as MESSAGE_LINE_TONES,pt as Markdown,_t as MediaPreview,g as MessageIcon,xt as MessageItem,St as MessageItemBody,Ct as MessageItemGroup,wt as MessageItemHeader,Tt as MessageItemStatus,Nt as MessageLines,_ as MicIcon,bn as NavTab,xn as NavTabBadge,Re as OptionLabel,ze as OptionList,Be as OptionRow,v as PaletteIcon,Ft as Panel,It as PanelBody,Lt as PanelHeader,ht as PdfPreview,y as PlusIcon,Rt as Popover,zt as PopoverAnchor,Bt as PopoverClose,Vt as PopoverContent,Ht as PopoverFooter,Ut as PopoverHeader,Wt as PopoverTrigger,Gt as Progress,b as QuoteIcon,Bn as READ_COLLAPSED_LINES,Kt as RadioGroup,qt as RadioGroupCard,Jt as RadioGroupItem,x as RefreshIcon,S as RewindIcon,vt as STATUS_EDGE,Et as STATUS_GLYPH,Dt as STATUS_LABEL,rr as STATUS_TONES,Xn as STATUS_TO_CHIP,Zn as STATUS_TO_DOT,Yt as ScrollArea,Xt as ScrollBar,C as SearchIcon,Zt as SectionLabel,Qt as Select,$t as SelectContent,en as SelectGroup,tn as SelectItem,nn as SelectLabel,rn as SelectSeparator,an as SelectTrigger,on as SelectValue,w as SendIcon,sn as Separator,cn as Sheet,ln as SheetBody,un as SheetClose,dn as SheetContent,fn as SheetDescription,pn as SheetFooter,mn as SheetHeader,hn as SheetOverlay,gn as SheetTitle,_n as SheetTrigger,T as ShieldIcon,De as Skeleton,X as Spinner,yt as StatusBadge,E as StopIcon,vn as StreamCursor,yn as Switch,st as SyntaxLine,ct as SyntaxText,Sn as Tabs,Cn as TabsContent,wn as TabsList,Tn as TabsTrigger,On as Textarea,kn as Toast,An as ToastAction,jn as ToastClose,Mn as ToastDescription,Nn as ToastProvider,Pn as ToastTitle,Fn as ToastViewport,Ln as ToolPathLink,U as Tooltip,W as TooltipContent,G as TooltipProvider,K as TooltipTrigger,D as TrashIcon,O as UserIcon,k as VolumeIcon,F as ansiSpans,H as badgeVariants,Y as breadcrumbSegments,Q as buttonVariants,A as cn,Rn as collapseLines,Vn as compactDetails,it as detectGrammar,ce as dialogFooterVariants,ue as dotVariants,Te as dropdownMenuItemVariants,Ne as fieldVariants,rt as grammarKeyOf,Fe as handleOptionListKey,Hn as hashlineBody,tt as hashlineGroups,nt as hashlineGroupsKey,at as highlightToLines,mt as mediaKindOf,Ot as messageItemRowVariants,kt as messageItemStatusVariants,At as messageItemVariants,Pt as messageLineVariants,Ie as optionListHint,Ve as optionListVariants,Le as optionMarker,He as optionMarkerVariants,Ue as optionRowVariants,Un as parseFileHeader,Wn as parseTaggedLine,Gn as presentHashlineLines,gt as resolvePdfViewportRegion,Kn as resultTextLines,bt as statusBadgeVariants,ot as syntaxStyleOf,En as tabBadgeVariants,Dn as tabVariants,qn as takeTrailingNotice,In as toastVariants,jt as toolTone,Mt as useMessageItem,lt as useSyntaxLines};
@@ -1 +1 @@
1
- {"version":3,"file":"editorTheme.d.cts","names":[],"sources":["../../src/lib/editorTheme.ts"],"mappings":";;;;;;cAqGa;WACX;aAAW;aAA4B;;WACvC;aAAW;;WACX;aAAY;;WACZ;aAAW;;WACX;aAAU;;WACV;aAAU;;WACV;aAAY;;WACZ;aAAe;;WACf;aAAY;;WACZ;aAAY;;WACZ;aAAY;;WACZ;aAAQ;;WACR;aAAO;;WACP;aAAa;;WACb;aAAQ;;WACR;aAAW;aAAyB;;WACpC;aAAQ;aAA2B;;WACnC;aAAY;;WACZ;aAAU;;WACV;aAAiB;;WACjB;aAAW"}
1
+ {"version":3,"file":"editorTheme.d.cts","names":[],"sources":["../../src/lib/editorTheme.ts"],"mappings":";;;;;;cA0Ga;WACX;aAAW;aAA4B;;WACvC;aAAW;;WACX;aAAY;;WACZ;aAAW;;WACX;aAAU;;WACV;aAAU;;WACV;aAAY;;WACZ;aAAe;;WACf;aAAY;;WACZ;aAAY;;WACZ;aAAY;;WACZ;aAAQ;;WACR;aAAO;;WACP;aAAa;;WACb;aAAQ;;WACR;aAAW;aAAyB;;WACpC;aAAQ;aAA2B;;WACnC;aAAY;;WACZ;aAAU;;WACV;aAAiB;;WACjB;aAAW"}
@@ -1,2 +1,2 @@
1
- const e=require("../lib/cn.cjs"),t=require("../lib/editorTheme.cjs"),n=require("../lib/editorLanguage.cjs");let r=require("react/jsx-runtime"),i=require("react"),a=require("@codemirror/commands"),o=require("@codemirror/language"),s=require("@codemirror/search"),c=require("@codemirror/state"),l=require("@codemirror/view"),u=require("@lezer/highlight");const d=l.EditorView.theme(t.DOOM_EDITOR_STYLES),f=o.HighlightStyle.define([{tag:u.tags.comment,...t.DOOM_SYNTAX_STYLES.comment},{tag:u.tags.keyword,...t.DOOM_SYNTAX_STYLES.keyword},{tag:[u.tags.atom,u.tags.bool,u.tags.null,u.tags.self],...t.DOOM_SYNTAX_STYLES.constant},{tag:u.tags.number,...t.DOOM_SYNTAX_STYLES.literal},{tag:[u.tags.string,u.tags.special(u.tags.string),u.tags.character],...t.DOOM_SYNTAX_STYLES.string},{tag:u.tags.regexp,...t.DOOM_SYNTAX_STYLES.regexp},{tag:u.tags.operator,...t.DOOM_SYNTAX_STYLES.operator},{tag:u.tags.punctuation,...t.DOOM_SYNTAX_STYLES.punctuation},{tag:u.tags.variableName,...t.DOOM_SYNTAX_STYLES.variable},{tag:u.tags.propertyName,...t.DOOM_SYNTAX_STYLES.property},{tag:[u.tags.function(u.tags.variableName),u.tags.function(u.tags.propertyName)],...t.DOOM_SYNTAX_STYLES.callable},{tag:[u.tags.typeName,u.tags.className,u.tags.namespace],...t.DOOM_SYNTAX_STYLES.type},{tag:u.tags.tagName,...t.DOOM_SYNTAX_STYLES.tag},{tag:u.tags.attributeName,...t.DOOM_SYNTAX_STYLES.attribute},{tag:[u.tags.meta,u.tags.processingInstruction],...t.DOOM_SYNTAX_STYLES.meta},{tag:u.tags.heading,...t.DOOM_SYNTAX_STYLES.heading},{tag:[u.tags.link,u.tags.url],...t.DOOM_SYNTAX_STYLES.link},{tag:u.tags.emphasis,...t.DOOM_SYNTAX_STYLES.emphasis},{tag:u.tags.strong,...t.DOOM_SYNTAX_STYLES.strong},{tag:u.tags.strikethrough,...t.DOOM_SYNTAX_STYLES.strikethrough},{tag:u.tags.invalid,...t.DOOM_SYNTAX_STYLES.invalid}]),p=[(0,l.lineNumbers)(),(0,l.highlightActiveLineGutter)(),(0,o.foldGutter)(),(0,l.highlightActiveLine)(),(0,l.drawSelection)(),(0,l.rectangularSelection)(),(0,o.indentOnInput)(),(0,o.bracketMatching)(),(0,a.history)(),(0,s.search)({top:!0}),(0,s.highlightSelectionMatches)(),l.keymap.of([...a.defaultKeymap,...a.historyKeymap,...s.searchKeymap,...o.foldKeymap,a.indentWithTab]),(0,o.syntaxHighlighting)(f),d];function m({value:t,path:a,readOnly:o=!1,lineWrapping:s=!0,className:u,onChange:d,onSelect:f,"data-testid":m}){let h=(0,i.useRef)(null),g=(0,i.useRef)(null),_=(0,i.useRef)({onChange:d,onSelect:f}),v=(0,i.useRef)(t),y=(0,i.useRef)({language:new c.Compartment,readOnly:new c.Compartment,wrapping:new c.Compartment});return(0,i.useEffect)(()=>{_.current={onChange:d,onSelect:f}}),(0,i.useEffect)(()=>{let e=h.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=y.current,i=new l.EditorView({parent:e,state:c.EditorState.create({doc:v.current,extensions:[...p,t.of([]),n.of([]),r.of([]),l.EditorView.updateListener.of(e=>{if(e.docChanged&&_.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=_.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t({text:e.state.sliceDoc(n.from,n.to),startLine:e.state.doc.lineAt(n.from).number,endLine:e.state.doc.lineAt(n.to).number})})]})});return g.current=i,()=>{i.destroy(),g.current=null}},[]),(0,i.useEffect)(()=>{let e=g.current;e!==null&&e.state.doc.toString()!==t&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}})},[t]),(0,i.useEffect)(()=>{g.current?.dispatch({effects:y.current.readOnly.reconfigure([c.EditorState.readOnly.of(o),l.EditorView.editable.of(!o)])})},[o]),(0,i.useEffect)(()=>{g.current?.dispatch({effects:y.current.wrapping.reconfigure(s?l.EditorView.lineWrapping:[])})},[s]),(0,i.useEffect)(()=>{let e=a===void 0?void 0:n.grammarKeyOf(a),{language:t}=y.current;if(e===void 0){g.current?.dispatch({effects:t.reconfigure([])});return}let r=!1;return n.loadGrammar(e).then(e=>{r||g.current?.dispatch({effects:t.reconfigure(e)})}).catch(()=>{r||g.current?.dispatch({effects:t.reconfigure([])})}),()=>{r=!0}},[a]),(0,r.jsx)(`div`,{ref:h,"data-testid":m,className:e.cn(`min-h-0 overflow-hidden`,u)})}exports.CodeEditorView=m;
1
+ const e=require("../lib/cn.cjs"),t=require("../lib/editorTheme.cjs"),n=require("../lib/editorLanguage.cjs"),r=require("../lib/editorController.cjs");let i=require("react/jsx-runtime"),a=require("react"),o=require("@codemirror/commands"),s=require("@codemirror/language"),c=require("@codemirror/search"),l=require("@codemirror/state"),u=require("@codemirror/view"),d=require("@lezer/highlight");function f(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return{text:e.state.sliceDoc(r,i),from:r,to:i,startLine:e.state.doc.lineAt(r).number,endLine:e.state.doc.lineAt(i).number}}function p(e,t){let n=e.posAtCoords({x:t.left,y:t.top}),r=e.posAtCoords({x:t.right,y:t.bottom});return n===null||r===null?null:f(e,n,r)}const m=u.EditorView.theme(t.DOOM_EDITOR_STYLES),h=s.HighlightStyle.define([{tag:d.tags.comment,...t.DOOM_SYNTAX_STYLES.comment},{tag:d.tags.keyword,...t.DOOM_SYNTAX_STYLES.keyword},{tag:[d.tags.atom,d.tags.bool,d.tags.null,d.tags.self],...t.DOOM_SYNTAX_STYLES.constant},{tag:d.tags.number,...t.DOOM_SYNTAX_STYLES.literal},{tag:[d.tags.string,d.tags.special(d.tags.string),d.tags.character],...t.DOOM_SYNTAX_STYLES.string},{tag:d.tags.regexp,...t.DOOM_SYNTAX_STYLES.regexp},{tag:d.tags.operator,...t.DOOM_SYNTAX_STYLES.operator},{tag:d.tags.punctuation,...t.DOOM_SYNTAX_STYLES.punctuation},{tag:d.tags.variableName,...t.DOOM_SYNTAX_STYLES.variable},{tag:d.tags.propertyName,...t.DOOM_SYNTAX_STYLES.property},{tag:[d.tags.function(d.tags.variableName),d.tags.function(d.tags.propertyName)],...t.DOOM_SYNTAX_STYLES.callable},{tag:[d.tags.typeName,d.tags.className,d.tags.namespace],...t.DOOM_SYNTAX_STYLES.type},{tag:d.tags.tagName,...t.DOOM_SYNTAX_STYLES.tag},{tag:d.tags.attributeName,...t.DOOM_SYNTAX_STYLES.attribute},{tag:[d.tags.meta,d.tags.processingInstruction],...t.DOOM_SYNTAX_STYLES.meta},{tag:d.tags.heading,...t.DOOM_SYNTAX_STYLES.heading},{tag:[d.tags.link,d.tags.url],...t.DOOM_SYNTAX_STYLES.link},{tag:d.tags.emphasis,...t.DOOM_SYNTAX_STYLES.emphasis},{tag:d.tags.strong,...t.DOOM_SYNTAX_STYLES.strong},{tag:d.tags.strikethrough,...t.DOOM_SYNTAX_STYLES.strikethrough},{tag:d.tags.invalid,...t.DOOM_SYNTAX_STYLES.invalid}]),g=l.StateEffect.define(),_=l.StateField.define({create:()=>u.Decoration.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(g)&&(n=e.value);return n},provide:e=>u.EditorView.decorations.from(e)}),v=l.StateEffect.define(),y=l.StateField.define({create:()=>u.Decoration.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(v)&&(n=e.value);return n},provide:e=>u.EditorView.decorations.from(e)});var b=class extends u.WidgetType{label;constructor(e){super(),this.label=e}eq(e){return e.label===this.label}toDOM(){let e=document.createElement(`span`);return e.className=`cm-marked-region-label`,e.dataset.authorRegionLabel=this.label,e.textContent=this.label,e}};const x=u.EditorView.baseTheme({".cm-marked-region":{backgroundColor:`var(--doom-tint-yellow)`,borderBottom:`1px solid var(--doom-edge-yellow)`},".cm-marked-region-label":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:`16px`,height:`16px`,marginRight:`4px`,borderRadius:`999px`,backgroundColor:`var(--doom-yellow)`,color:`var(--doom-deep)`,fontSize:`9px`,fontWeight:`700`,lineHeight:`1`,verticalAlign:`text-bottom`}}),S=[(0,u.lineNumbers)(),(0,u.highlightActiveLineGutter)(),(0,s.foldGutter)(),(0,u.highlightActiveLine)(),(0,u.drawSelection)(),(0,u.rectangularSelection)(),(0,s.indentOnInput)(),(0,s.bracketMatching)(),(0,o.history)(),(0,c.search)({top:!0}),(0,c.highlightSelectionMatches)(),u.keymap.of([...o.defaultKeymap,...o.historyKeymap,...c.searchKeymap,...s.foldKeymap,o.indentWithTab]),(0,s.syntaxHighlighting)(h),_,y,x,m];function C({value:t,path:o,readOnly:s=!1,lineWrapping:c=!0,className:d,onChange:m,onSelect:h,controllerRef:_,"data-testid":y}){let x=(0,a.useRef)(null),C=(0,a.useRef)(null),w=(0,a.useRef)({onChange:m,onSelect:h}),T=(0,a.useRef)(t),E=(0,a.useRef)({language:new l.Compartment,readOnly:new l.Compartment,wrapping:new l.Compartment});return(0,a.useEffect)(()=>{w.current={onChange:m,onSelect:h}}),(0,a.useLayoutEffect)(()=>{let e=x.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=E.current,i=new u.EditorView({parent:e,state:l.EditorState.create({doc:T.current,extensions:[...S,t.of([]),n.of([]),r.of([]),u.EditorView.updateListener.of(e=>{if(e.docChanged&&w.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=w.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t(f(e.view,n.from,n.to))})]})});return C.current=i,()=>{i.destroy(),C.current=null}},[]),(0,a.useImperativeHandle)(_,()=>({focus:()=>C.current?.focus(),revealAndSelect:e=>{let t=C.current;if(t===null)return;let[n]=r.boundedEditorRanges(t.state.doc.length,[e]);n!==void 0&&t.dispatch({selection:{anchor:n.from,head:n.to},effects:u.EditorView.scrollIntoView(n.from,{y:`center`})})},applyEdits:e=>{let t=C.current;t!==null&&e.length!==0&&t.dispatch({changes:r.boundedEditorEdits(t.state.doc.length,e)})},setClosedRanges:e=>{let t=C.current;if(t===null)return;let n=r.boundedEditorRanges(t.state.doc.length,e).map(e=>e.from===e.to?u.Decoration.line({attributes:{class:`cm-closed-tone`,"data-tone":`closed`}}).range(t.state.doc.lineAt(e.from).from):u.Decoration.mark({class:`cm-closed-tone`,attributes:{"data-tone":`closed`}}).range(e.from,e.to));t.dispatch({effects:g.of(u.Decoration.set(n))})},setMarkedRanges:e=>{let t=C.current;if(t===null)return;let n=e.flatMap(e=>{let[n]=r.boundedEditorRanges(t.state.doc.length,[e]);return n===void 0||n.from===n.to?[]:[u.Decoration.widget({widget:new b(e.label),side:-1}).range(n.from),u.Decoration.mark({class:`cm-marked-region`,attributes:{"data-author-region":e.label}}).range(n.from,n.to)]});t.dispatch({effects:v.of(u.Decoration.set(n,!0))})},resolveViewportRegion:e=>{let t=C.current;return t===null?null:p(t,e)}}),[]),(0,a.useEffect)(()=>{let e=C.current;e!==null&&e.state.doc.toString()!==t&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}})},[t]),(0,a.useEffect)(()=>{C.current?.dispatch({effects:E.current.readOnly.reconfigure([l.EditorState.readOnly.of(s),u.EditorView.editable.of(!s)])})},[s]),(0,a.useEffect)(()=>{C.current?.dispatch({effects:E.current.wrapping.reconfigure(c?u.EditorView.lineWrapping:[])})},[c]),(0,a.useEffect)(()=>{let e=o===void 0?void 0:n.grammarKeyOf(o),{language:t}=E.current;if(e===void 0){C.current?.dispatch({effects:t.reconfigure([])});return}let r=!1;return n.loadGrammar(e).then(e=>{r||C.current?.dispatch({effects:t.reconfigure(e)})}).catch(()=>{r||C.current?.dispatch({effects:t.reconfigure([])})}),()=>{r=!0}},[o]),(0,i.jsx)(`div`,{ref:x,"data-testid":y,className:e.cn(`min-h-0 overflow-hidden`,d)})}exports.CodeEditorView=C,exports.resolveEditorViewportRegion=p;
2
2
  //# sourceMappingURL=CodeEditorView.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditorView.cjs","names":["EditorView","DOOM_EDITOR_STYLES","HighlightStyle","tags","DOOM_SYNTAX_STYLES","lineNumbers","highlightActiveLineGutter","foldGutter","highlightActiveLine","drawSelection","rectangularSelection","indentOnInput","bracketMatching","history","search","highlightSelectionMatches","keymap","defaultKeymap","historyKeymap","searchKeymap","foldKeymap","indentWithTab","syntaxHighlighting","useRef","Compartment","EditorState","grammarKeyOf","loadGrammar","cn"],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState } from '@codemirror/state';\nimport {\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useRef } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage.ts';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme.ts';\nimport type { CodeEditorProps } from '../types/editor.ts';\n\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n // The document is seeded once from the value of the first render; the sync effect\n // below owns every later change.\n const initialValue = useRef(value);\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: initialValue.current,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report({\n text: update.state.sliceDoc(range.from, range.to),\n startLine: update.state.doc.lineAt(range.from).number,\n endLine: update.state.doc.lineAt(range.to).number,\n });\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once.\n }, []);\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]);\n\n return <div ref={host} data-testid={testId} className={cn('min-h-0 overflow-hidden', className)} />;\n}\n"],"mappings":"iWA0CA,MAAM,EAAaA,EAAAA,WAAW,MAAMC,EAAAA,kBAAkB,EAEhD,EAAiBC,EAAAA,eAAe,OAAO,CAC3C,CAAE,IAAKC,EAAAA,KAAK,QAAS,GAAGC,EAAAA,mBAAmB,OAAQ,EACnD,CAAE,IAAKD,EAAAA,KAAK,QAAS,GAAGC,EAAAA,mBAAmB,OAAQ,EACnD,CAAE,IAAK,CAACD,EAAAA,KAAK,KAAMA,EAAAA,KAAK,KAAMA,EAAAA,KAAK,KAAMA,EAAAA,KAAK,IAAI,EAAG,GAAGC,EAAAA,mBAAmB,QAAS,EACpF,CAAE,IAAKD,EAAAA,KAAK,OAAQ,GAAGC,EAAAA,mBAAmB,OAAQ,EACl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getType","lineNumbers","highlightActiveLineGutter","foldGutter","highlightActiveLine","drawSelection","rectangularSelection","indentOnInput","bracketMatching","history","search","highlightSelectionMatches","keymap","defaultKeymap","historyKeymap","searchKeymap","foldKeymap","indentWithTab","syntaxHighlighting","useRef","Compartment","EditorState","boundedEditorRanges","boundedEditorEdits","grammarKeyOf","loadGrammar","cn"],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState, StateEffect, StateField } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n WidgetType,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { boundedEditorEdits, boundedEditorRanges } from '../lib/editorController.ts';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage.ts';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme.ts';\nimport type { CodeEditorProps, EditorSelectionRange, EditorViewportRectangle } from '../types/editor.ts';\n\nfunction selectionRange(editor: { readonly state: EditorState }, from: number, to: number): EditorSelectionRange {\n const start = Math.min(from, to);\n const end = Math.max(from, to);\n return {\n text: editor.state.sliceDoc(start, end),\n from: start,\n to: end,\n startLine: editor.state.doc.lineAt(start).number,\n endLine: editor.state.doc.lineAt(end).number,\n };\n}\n\nexport function resolveEditorViewportRegion(\n editor: {\n readonly state: EditorState;\n posAtCoords(coords: { x: number; y: number }): number | null;\n },\n rectangle: EditorViewportRectangle,\n): EditorSelectionRange | null {\n const start = editor.posAtCoords({ x: rectangle.left, y: rectangle.top });\n const end = editor.posAtCoords({ x: rectangle.right, y: rectangle.bottom });\n if (start === null || end === null) return null;\n return selectionRange(editor, start, end);\n}\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\nconst setClosedDecorations = StateEffect.define<DecorationSet>();\nconst closedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setClosedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nconst setMarkedDecorations = StateEffect.define<DecorationSet>();\nconst markedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setMarkedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nclass MarkedRangeLabel extends WidgetType {\n constructor(private readonly label: string) {\n super();\n }\n\n eq(other: MarkedRangeLabel): boolean {\n return other.label === this.label;\n }\n\n toDOM(): HTMLElement {\n const label = document.createElement('span');\n label.className = 'cm-marked-region-label';\n label.dataset.authorRegionLabel = this.label;\n label.textContent = this.label;\n return label;\n }\n}\n\nconst MARKED_REGION_THEME = EditorView.baseTheme({\n '.cm-marked-region': {\n backgroundColor: 'var(--doom-tint-yellow)',\n borderBottom: '1px solid var(--doom-edge-yellow)',\n },\n '.cm-marked-region-label': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '16px',\n height: '16px',\n marginRight: '4px',\n borderRadius: '999px',\n backgroundColor: 'var(--doom-yellow)',\n color: 'var(--doom-deep)',\n fontSize: '9px',\n fontWeight: '700',\n lineHeight: '1',\n verticalAlign: 'text-bottom',\n },\n});\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n closedDecorations,\n markedDecorations,\n MARKED_REGION_THEME,\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n controllerRef,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n // The document is seeded once from the value of the first render; the sync effect\n // below owns every later change.\n const initialValue = useRef(value);\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useLayoutEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: initialValue.current,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report(selectionRange(update.view, range.from, range.to));\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once.\n }, []);\n\n useImperativeHandle(\n controllerRef,\n () => ({\n focus: () => view.current?.focus(),\n revealAndSelect: (range) => {\n const editor = view.current;\n if (editor === null) return;\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined) return;\n editor.dispatch({\n selection: { anchor: bounded.from, head: bounded.to },\n effects: EditorView.scrollIntoView(bounded.from, { y: 'center' }),\n });\n },\n applyEdits: (edits) => {\n const editor = view.current;\n if (editor === null || edits.length === 0) return;\n editor.dispatch({ changes: boundedEditorEdits(editor.state.doc.length, edits) });\n },\n setClosedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const bounded = boundedEditorRanges(editor.state.doc.length, ranges);\n const decorations = bounded.map((range) =>\n range.from === range.to\n ? Decoration.line({ attributes: { class: 'cm-closed-tone', 'data-tone': 'closed' } }).range(\n editor.state.doc.lineAt(range.from).from,\n )\n : Decoration.mark({ class: 'cm-closed-tone', attributes: { 'data-tone': 'closed' } }).range(\n range.from,\n range.to,\n ),\n );\n editor.dispatch({ effects: setClosedDecorations.of(Decoration.set(decorations)) });\n },\n setMarkedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const decorations = ranges.flatMap((range) => {\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined || bounded.from === bounded.to) return [];\n return [\n Decoration.widget({ widget: new MarkedRangeLabel(range.label), side: -1 }).range(bounded.from),\n Decoration.mark({\n class: 'cm-marked-region',\n attributes: { 'data-author-region': range.label },\n }).range(bounded.from, bounded.to),\n ];\n });\n editor.dispatch({ effects: setMarkedDecorations.of(Decoration.set(decorations, true)) });\n },\n resolveViewportRegion: (rectangle) => {\n const editor = view.current;\n return editor === null ? null : resolveEditorViewportRegion(editor, rectangle);\n },\n }),\n [],\n );\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]);\n\n return <div ref={host} data-testid={testId} className={cn('min-h-0 overflow-hidden', className)} />;\n}\n"],"mappings":"0YA+BA,SAAS,EAAe,EAAyC,EAAc,EAAkC,CAC/G,IAAM,EAAQ,KAAK,IAAI,EAAM,CAAE,EACzB,EAAM,KAAK,IAAI,EAAM,CAAE,EAC7B,MAAO,CACL,KAAM,EAAO,MAAM,SAAS,EAAO,CAAG,EACtC,KAAM,EACN,GAAI,EACJ,UAAW,EAAO,MAAM,IAAI,OAAO,CAAK,CAAC,CAAC,OAC1C,QAAS,EAAO,MAAM,IAAI,OAAO,CAAG,CAAC,CAAC,MACxC,CACF,CAEA,SAAgB,EACd,EAIA,EAC6B,CAC7B,IAAM,EAAQ,EAAO,Y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,EAAK,SAAS,SAAS,CACrB,QAAS,EAAa,QAAQ,SAAS,YAAY,CACjDsB,EAAAA,YAAY,SAAS,GAAG,CAAQ,EAChC7B,EAAAA,WAAW,SAAS,GAAG,CAAC,CAAQ,CAClC,CAAC,CACH,CAAC,CACH,EAAG,CAAC,CAAQ,CAAC,GAEb,EAAA,EAAA,UAAA,KAAgB,CACd,EAAK,SAAS,SAAS,CACrB,QAAS,EAAa,QAAQ,SAAS,YAAY,EAAeA,EAAAA,WAAW,aAAe,CAAC,CAAC,CAChG,CAAC,CACH,EAAG,CAAC,CAAY,CAAC,GAEjB,EAAA,EAAA,UAAA,KAAgB,CACd,IAAM,EAAM,IAAS,IAAA,GAAY,IAAA,GAAYgC,EAAAA,aAAa,CAAI,EACxD,CAAE,YAAa,EAAa,QAClC,GAAI,IAAQ,IAAA,GAAW,CACrB,EAAK,SAAS,SAAS,CAAE,QAAS,EAAS,YAAY,CAAC,CAAC,CAAE,CAAC,EAC5D,MACF,CACA,IAAI,EAAY,GAWhB,OAVA,EAAKC,YAAY,CAAG,CAAC,CAClB,KAAM,GAAY,CACZ,GAAW,EAAK,SAAS,SAAS,CAAE,QAAS,EAAS,YAAY,CAAO,CAAE,CAAC,CACnF,CAAC,CAAC,CACD,UAAY,CAIN,GAAW,EAAK,SAAS,SAAS,CAAE,QAAS,EAAS,YAAY,CAAC,CAAC,CAAE,CAAC,CAC9E,CAAC,MACU,CACX,EAAY,EACd,CACF,EAAG,CAAC,CAAI,CAAC,GAEF,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAM,cAAa,EAAQ,UAAWC,EAAAA,GAAG,0BAA2B,CAAS,CAAI,CAAA,CACpG"}
@@ -1,2 +1,2 @@
1
- import{cn as e}from"../lib/cn.mjs";import{DOOM_EDITOR_STYLES as t,DOOM_SYNTAX_STYLES as n}from"../lib/editorTheme.mjs";import{grammarKeyOf as r,loadGrammar as i}from"../lib/editorLanguage.mjs";import{jsx as a}from"react/jsx-runtime";import{useEffect as o,useRef as s}from"react";import{defaultKeymap as c,history as l,historyKeymap as u,indentWithTab as d}from"@codemirror/commands";import{HighlightStyle as f,bracketMatching as p,foldGutter as m,foldKeymap as h,indentOnInput as g,syntaxHighlighting as _}from"@codemirror/language";import{highlightSelectionMatches as v,search as y,searchKeymap as b}from"@codemirror/search";import{Compartment as x,EditorState as S}from"@codemirror/state";import{EditorView as C,drawSelection as w,highlightActiveLine as T,highlightActiveLineGutter as E,keymap as D,lineNumbers as O,rectangularSelection as k}from"@codemirror/view";import{tags as A}from"@lezer/highlight";const j=C.theme(t),M=f.define([{tag:A.comment,...n.comment},{tag:A.keyword,...n.keyword},{tag:[A.atom,A.bool,A.null,A.self],...n.constant},{tag:A.number,...n.literal},{tag:[A.string,A.special(A.string),A.character],...n.string},{tag:A.regexp,...n.regexp},{tag:A.operator,...n.operator},{tag:A.punctuation,...n.punctuation},{tag:A.variableName,...n.variable},{tag:A.propertyName,...n.property},{tag:[A.function(A.variableName),A.function(A.propertyName)],...n.callable},{tag:[A.typeName,A.className,A.namespace],...n.type},{tag:A.tagName,...n.tag},{tag:A.attributeName,...n.attribute},{tag:[A.meta,A.processingInstruction],...n.meta},{tag:A.heading,...n.heading},{tag:[A.link,A.url],...n.link},{tag:A.emphasis,...n.emphasis},{tag:A.strong,...n.strong},{tag:A.strikethrough,...n.strikethrough},{tag:A.invalid,...n.invalid}]),N=[O(),E(),m(),T(),w(),k(),g(),p(),l(),y({top:!0}),v(),D.of([...c,...u,...b,...h,d]),_(M),j];function P({value:t,path:n,readOnly:c=!1,lineWrapping:l=!0,className:u,onChange:d,onSelect:f,"data-testid":p}){let m=s(null),h=s(null),g=s({onChange:d,onSelect:f}),_=s(t),v=s({language:new x,readOnly:new x,wrapping:new x});return o(()=>{g.current={onChange:d,onSelect:f}}),o(()=>{let e=m.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=v.current,i=new C({parent:e,state:S.create({doc:_.current,extensions:[...N,t.of([]),n.of([]),r.of([]),C.updateListener.of(e=>{if(e.docChanged&&g.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=g.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t({text:e.state.sliceDoc(n.from,n.to),startLine:e.state.doc.lineAt(n.from).number,endLine:e.state.doc.lineAt(n.to).number})})]})});return h.current=i,()=>{i.destroy(),h.current=null}},[]),o(()=>{let e=h.current;e!==null&&e.state.doc.toString()!==t&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}})},[t]),o(()=>{h.current?.dispatch({effects:v.current.readOnly.reconfigure([S.readOnly.of(c),C.editable.of(!c)])})},[c]),o(()=>{h.current?.dispatch({effects:v.current.wrapping.reconfigure(l?C.lineWrapping:[])})},[l]),o(()=>{let e=n===void 0?void 0:r(n),{language:t}=v.current;if(e===void 0){h.current?.dispatch({effects:t.reconfigure([])});return}let a=!1;return i(e).then(e=>{a||h.current?.dispatch({effects:t.reconfigure(e)})}).catch(()=>{a||h.current?.dispatch({effects:t.reconfigure([])})}),()=>{a=!0}},[n]),a(`div`,{ref:m,"data-testid":p,className:e(`min-h-0 overflow-hidden`,u)})}export{P as CodeEditorView};
1
+ import{cn as e}from"../lib/cn.mjs";import{DOOM_EDITOR_STYLES as t,DOOM_SYNTAX_STYLES as n}from"../lib/editorTheme.mjs";import{grammarKeyOf as r,loadGrammar as i}from"../lib/editorLanguage.mjs";import{boundedEditorEdits as a,boundedEditorRanges as o}from"../lib/editorController.mjs";import{jsx as s}from"react/jsx-runtime";import{useEffect as c,useImperativeHandle as l,useLayoutEffect as u,useRef as d}from"react";import{defaultKeymap as f,history as p,historyKeymap as m,indentWithTab as h}from"@codemirror/commands";import{HighlightStyle as g,bracketMatching as _,foldGutter as v,foldKeymap as y,indentOnInput as b,syntaxHighlighting as x}from"@codemirror/language";import{highlightSelectionMatches as S,search as C,searchKeymap as w}from"@codemirror/search";import{Compartment as T,EditorState as E,StateEffect as D,StateField as O}from"@codemirror/state";import{Decoration as k,EditorView as A,WidgetType as j,drawSelection as M,highlightActiveLine as N,highlightActiveLineGutter as P,keymap as F,lineNumbers as I,rectangularSelection as L}from"@codemirror/view";import{tags as R}from"@lezer/highlight";function z(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return{text:e.state.sliceDoc(r,i),from:r,to:i,startLine:e.state.doc.lineAt(r).number,endLine:e.state.doc.lineAt(i).number}}function B(e,t){let n=e.posAtCoords({x:t.left,y:t.top}),r=e.posAtCoords({x:t.right,y:t.bottom});return n===null||r===null?null:z(e,n,r)}const V=A.theme(t),H=g.define([{tag:R.comment,...n.comment},{tag:R.keyword,...n.keyword},{tag:[R.atom,R.bool,R.null,R.self],...n.constant},{tag:R.number,...n.literal},{tag:[R.string,R.special(R.string),R.character],...n.string},{tag:R.regexp,...n.regexp},{tag:R.operator,...n.operator},{tag:R.punctuation,...n.punctuation},{tag:R.variableName,...n.variable},{tag:R.propertyName,...n.property},{tag:[R.function(R.variableName),R.function(R.propertyName)],...n.callable},{tag:[R.typeName,R.className,R.namespace],...n.type},{tag:R.tagName,...n.tag},{tag:R.attributeName,...n.attribute},{tag:[R.meta,R.processingInstruction],...n.meta},{tag:R.heading,...n.heading},{tag:[R.link,R.url],...n.link},{tag:R.emphasis,...n.emphasis},{tag:R.strong,...n.strong},{tag:R.strikethrough,...n.strikethrough},{tag:R.invalid,...n.invalid}]),U=D.define(),W=O.define({create:()=>k.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(U)&&(n=e.value);return n},provide:e=>A.decorations.from(e)}),G=D.define(),K=O.define({create:()=>k.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(G)&&(n=e.value);return n},provide:e=>A.decorations.from(e)});var q=class extends j{label;constructor(e){super(),this.label=e}eq(e){return e.label===this.label}toDOM(){let e=document.createElement(`span`);return e.className=`cm-marked-region-label`,e.dataset.authorRegionLabel=this.label,e.textContent=this.label,e}};const J=A.baseTheme({".cm-marked-region":{backgroundColor:`var(--doom-tint-yellow)`,borderBottom:`1px solid var(--doom-edge-yellow)`},".cm-marked-region-label":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:`16px`,height:`16px`,marginRight:`4px`,borderRadius:`999px`,backgroundColor:`var(--doom-yellow)`,color:`var(--doom-deep)`,fontSize:`9px`,fontWeight:`700`,lineHeight:`1`,verticalAlign:`text-bottom`}}),Y=[I(),P(),v(),N(),M(),L(),b(),_(),p(),C({top:!0}),S(),F.of([...f,...m,...w,...y,h]),x(H),W,K,J,V];function X({value:t,path:n,readOnly:f=!1,lineWrapping:p=!0,className:m,onChange:h,onSelect:g,controllerRef:_,"data-testid":v}){let y=d(null),b=d(null),x=d({onChange:h,onSelect:g}),S=d(t),C=d({language:new T,readOnly:new T,wrapping:new T});return c(()=>{x.current={onChange:h,onSelect:g}}),u(()=>{let e=y.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=C.current,i=new A({parent:e,state:E.create({doc:S.current,extensions:[...Y,t.of([]),n.of([]),r.of([]),A.updateListener.of(e=>{if(e.docChanged&&x.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=x.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t(z(e.view,n.from,n.to))})]})});return b.current=i,()=>{i.destroy(),b.current=null}},[]),l(_,()=>({focus:()=>b.current?.focus(),revealAndSelect:e=>{let t=b.current;if(t===null)return;let[n]=o(t.state.doc.length,[e]);n!==void 0&&t.dispatch({selection:{anchor:n.from,head:n.to},effects:A.scrollIntoView(n.from,{y:`center`})})},applyEdits:e=>{let t=b.current;t!==null&&e.length!==0&&t.dispatch({changes:a(t.state.doc.length,e)})},setClosedRanges:e=>{let t=b.current;if(t===null)return;let n=o(t.state.doc.length,e).map(e=>e.from===e.to?k.line({attributes:{class:`cm-closed-tone`,"data-tone":`closed`}}).range(t.state.doc.lineAt(e.from).from):k.mark({class:`cm-closed-tone`,attributes:{"data-tone":`closed`}}).range(e.from,e.to));t.dispatch({effects:U.of(k.set(n))})},setMarkedRanges:e=>{let t=b.current;if(t===null)return;let n=e.flatMap(e=>{let[n]=o(t.state.doc.length,[e]);return n===void 0||n.from===n.to?[]:[k.widget({widget:new q(e.label),side:-1}).range(n.from),k.mark({class:`cm-marked-region`,attributes:{"data-author-region":e.label}}).range(n.from,n.to)]});t.dispatch({effects:G.of(k.set(n,!0))})},resolveViewportRegion:e=>{let t=b.current;return t===null?null:B(t,e)}}),[]),c(()=>{let e=b.current;e!==null&&e.state.doc.toString()!==t&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}})},[t]),c(()=>{b.current?.dispatch({effects:C.current.readOnly.reconfigure([E.readOnly.of(f),A.editable.of(!f)])})},[f]),c(()=>{b.current?.dispatch({effects:C.current.wrapping.reconfigure(p?A.lineWrapping:[])})},[p]),c(()=>{let e=n===void 0?void 0:r(n),{language:t}=C.current;if(e===void 0){b.current?.dispatch({effects:t.reconfigure([])});return}let a=!1;return i(e).then(e=>{a||b.current?.dispatch({effects:t.reconfigure(e)})}).catch(()=>{a||b.current?.dispatch({effects:t.reconfigure([])})}),()=>{a=!0}},[n]),s(`div`,{ref:y,"data-testid":v,className:e(`min-h-0 overflow-hidden`,m)})}export{X as CodeEditorView,B as resolveEditorViewportRegion};
2
2
  //# sourceMappingURL=CodeEditorView.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditorView.mjs","names":[],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState } from '@codemirror/state';\nimport {\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useRef } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage.ts';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme.ts';\nimport type { CodeEditorProps } from '../types/editor.ts';\n\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n // The document is seeded once from the value of the first render; the sync effect\n // below owns every later change.\n const initialValue = useRef(value);\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: initialValue.current,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report({\n text: update.state.sliceDoc(range.from, range.to),\n startLine: update.state.doc.lineAt(range.from).number,\n endLine: update.state.doc.lineAt(range.to).number,\n });\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once.\n }, []);\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]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AS,EAAS,YAAY,CAAC,CAAC,CAAE,CAAC,EAC5D,MACF,CACA,IAAI,EAAY,GAWhB,OAVA,EAAiB,CAAG,CAAC,CAClB,KAAM,GAAY,CACZ,GAAW,EAAK,SAAS,SAAS,CAAE,QAAS,EAAS,YAAY,CAAO,CAAE,CAAC,CACnF,CAAC,CAAC,CACD,UAAY,CAIN,GAAW,EAAK,SAAS,SAAS,CAAE,QAAS,EAAS,YAAY,CAAC,CAAC,CAAE,CAAC,CAC9E,CAAC,MACU,CACX,EAAY,EACd,CACF,EAAG,CAAC,CAAI,CAAC,EAEF,EAAC,MAAD,CAAK,IAAK,EAAM,cAAa,EAAQ,UAAW,EAAG,0BAA2B,CAAS,CAAI,CAAA,CACpG"}
1
+ {"version":3,"file":"CodeEditorView.mjs","names":[],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState, StateEffect, StateField } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n WidgetType,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { boundedEditorEdits, boundedEditorRanges } from '../lib/editorController.ts';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage.ts';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme.ts';\nimport type { CodeEditorProps, EditorSelectionRange, EditorViewportRectangle } from '../types/editor.ts';\n\nfunction selectionRange(editor: { readonly state: EditorState }, from: number, to: number): EditorSelectionRange {\n const start = Math.min(from, to);\n const end = Math.max(from, to);\n return {\n text: editor.state.sliceDoc(start, end),\n from: start,\n to: end,\n startLine: editor.state.doc.lineAt(start).number,\n endLine: editor.state.doc.lineAt(end).number,\n };\n}\n\nexport function resolveEditorViewportRegion(\n editor: {\n readonly state: EditorState;\n posAtCoords(coords: { x: number; y: number }): number | null;\n },\n rectangle: EditorViewportRectangle,\n): EditorSelectionRange | null {\n const start = editor.posAtCoords({ x: rectangle.left, y: rectangle.top });\n const end = editor.posAtCoords({ x: rectangle.right, y: rectangle.bottom });\n if (start === null || end === null) return null;\n return selectionRange(editor, start, end);\n}\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\nconst setClosedDecorations = StateEffect.define<DecorationSet>();\nconst closedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setClosedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nconst setMarkedDecorations = StateEffect.define<DecorationSet>();\nconst markedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setMarkedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nclass MarkedRangeLabel extends WidgetType {\n constructor(private readonly label: string) {\n super();\n }\n\n eq(other: MarkedRangeLabel): boolean {\n return other.label === this.label;\n }\n\n toDOM(): HTMLElement {\n const label = document.createElement('span');\n label.className = 'cm-marked-region-label';\n label.dataset.authorRegionLabel = this.label;\n label.textContent = this.label;\n return label;\n }\n}\n\nconst MARKED_REGION_THEME = EditorView.baseTheme({\n '.cm-marked-region': {\n backgroundColor: 'var(--doom-tint-yellow)',\n borderBottom: '1px solid var(--doom-edge-yellow)',\n },\n '.cm-marked-region-label': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '16px',\n height: '16px',\n marginRight: '4px',\n borderRadius: '999px',\n backgroundColor: 'var(--doom-yellow)',\n color: 'var(--doom-deep)',\n fontSize: '9px',\n fontWeight: '700',\n lineHeight: '1',\n verticalAlign: 'text-bottom',\n },\n});\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n closedDecorations,\n markedDecorations,\n MARKED_REGION_THEME,\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n controllerRef,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n // The document is seeded once from the value of the first render; the sync effect\n // below owns every later change.\n const initialValue = useRef(value);\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useLayoutEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: initialValue.current,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report(selectionRange(update.view, range.from, range.to));\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once.\n }, []);\n\n useImperativeHandle(\n controllerRef,\n () => ({\n focus: () => view.current?.focus(),\n revealAndSelect: (range) => {\n const editor = view.current;\n if (editor === null) return;\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined) return;\n editor.dispatch({\n selection: { anchor: bounded.from, head: bounded.to },\n effects: EditorView.scrollIntoView(bounded.from, { y: 'center' }),\n });\n },\n applyEdits: (edits) => {\n const editor = view.current;\n if (editor === null || edits.length === 0) return;\n editor.dispatch({ changes: boundedEditorEdits(editor.state.doc.length, edits) });\n },\n setClosedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const bounded = boundedEditorRanges(editor.state.doc.length, ranges);\n const decorations = bounded.map((range) =>\n range.from === range.to\n ? Decoration.line({ attributes: { class: 'cm-closed-tone', 'data-tone': 'closed' } }).range(\n editor.state.doc.lineAt(range.from).from,\n )\n : Decoration.mark({ class: 'cm-closed-tone', attributes: { 'data-tone': 'closed' } }).range(\n range.from,\n range.to,\n ),\n );\n editor.dispatch({ effects: setClosedDecorations.of(Decoration.set(decorations)) });\n },\n setMarkedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const decorations = ranges.flatMap((range) => {\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined || bounded.from === bounded.to) return [];\n return [\n Decoration.widget({ widget: new MarkedRangeLabel(range.label), side: -1 }).range(bounded.from),\n Decoration.mark({\n class: 'cm-marked-region',\n attributes: { 'data-author-region': range.label },\n }).range(bounded.from, bounded.to),\n ];\n });\n editor.dispatch({ effects: setMarkedDecorations.of(Decoration.set(decorations, true)) });\n },\n resolveViewportRegion: (rectangle) => {\n const editor = view.current;\n return editor === null ? null : resolveEditorViewportRegion(editor, rectangle);\n },\n }),\n [],\n );\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]);\n\n return <div ref={host} data-testid={testId} className={cn('min-h-0 overflow-hidden', className)} />;\n}\n"],"mappings":"olCA+BA,SAAS,EAAe,EAAyC,EAAc,EAAkC,CAC/G,IAAM,EAAQ,KAAK,IAAI,EAAM,CAAE,EACzB,EAAM,KAAK,IAA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