dsh-enhance 0.1.0 → 0.3.1

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.
package/lib/client.js CHANGED
@@ -7,9 +7,9 @@ window.__ModuleLoader__.load({
7
7
  let react = require("react");
8
8
  let react_dom = require("react-dom");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
- //#region src/client/styles/document-preview.ts
10
+ // src/client/styles/document-preview.ts
11
11
  /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
12
- const css$5 = String.raw`body[data-ds-dark-theme] [data-document-markdown] {
12
+ const css$6 = String.raw`body[data-ds-dark-theme] [data-document-markdown] {
13
13
  --md-text: #e9e9e9;
14
14
  --md-text-strong: #fff;
15
15
  --md-text-muted: #a5a5a5;
@@ -189,10 +189,9 @@ body:not([data-ds-dark-theme]) [data-document-markdown] {
189
189
  border-radius: var(--md-radius-md);
190
190
  }
191
191
  `;
192
- //#endregion
193
- //#region src/client/styles/chat-markdown.ts
192
+ // src/client/styles/chat-markdown.ts
194
193
  /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
195
- const css$4 = String.raw`:is([data-ds-dark-theme], [data-ds-dark-theme] body) :is([data-chat-flow-kind="assistant-step"], [class*="_markdown"]) {
194
+ const css$5 = String.raw`:is([data-ds-dark-theme], [data-ds-dark-theme] body) :is([data-chat-flow-kind="assistant-step"], [class*="_markdown"]) {
196
195
  --md-text: #efefef;
197
196
  --md-text-strong: #fff;
198
197
  --md-text-muted: #a5a5a5;
@@ -424,10 +423,9 @@ body:not([data-ds-dark-theme]) [data-document-markdown] {
424
423
  border-radius: var(--md-radius-md);
425
424
  }
426
425
  `;
427
- //#endregion
428
- //#region src/client/styles/rightbar-handle.ts
426
+ // src/client/styles/rightbar-handle.ts
429
427
  /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
430
- const css$3 = String.raw`[data-side="rightbar"] {
428
+ const css$4 = String.raw`[data-side="rightbar"] {
431
429
  width: 18px !important;
432
430
  margin-left: -9px !important;
433
431
  cursor: col-resize;
@@ -457,10 +455,88 @@ body:not([data-ds-dark-theme]) [data-document-markdown] {
457
455
  opacity: 1;
458
456
  }
459
457
  `;
460
- //#endregion
461
- //#region src/client/styles/sidebar-density.ts
458
+ // src/client/styles/running-spinner.ts
462
459
  /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
463
- const css$2 = String.raw`/* Light-surface sidebar text scale. The app's own de-emphasised label tokens
460
+ const css$3 = String.raw`/* A running session's marker is the host's StateDot in its "ongoing" form: an
461
+ inline SVG holding two circles — a faint track and a dashed arc that spins
462
+ and lengthens. Both circles stroke with currentColor, and the host paints
463
+ that token as label-tertiary, a grey, so a live session reads exactly as
464
+ muted as an idle one.
465
+
466
+ Because the colour arrives through currentColor, one declaration recolours
467
+ the whole ring: the color property on the svg root. The spectrum then comes
468
+ from a hue-rotate on that same root, which walks both circles together, so
469
+ the track stays a dim version of the arc instead of drifting into a second
470
+ hue.
471
+
472
+ Nothing here touches the dash or the spin. Those carry the information
473
+ (something is happening) and belong to the host; only the paint is ours.
474
+ That is also why no stroke rule is written at all — the host's animation on
475
+ the arc would be outranked by any !important on it, freezing the dashes.
476
+
477
+ Scope is the sidebar's status slot. StateDots elsewhere (jobs, approval,
478
+ workflow runs) keep the host's own treatment. */
479
+ [class*="sidebarCol"] svg[data-state="ongoing"][class*="spinner"] {
480
+ color: #3b82f6;
481
+ filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%));
482
+ animation: dsh-enhance-spinner-spectrum 4s linear infinite;
483
+ }
484
+
485
+ /* Blue, violet, magenta, amber, blue: every stop stays legible against both
486
+ the light and the dark sidebar, and the loop returns to its start hue so
487
+ there is no jump at the seam. The glow rotates with the ring. */
488
+ @keyframes dsh-enhance-spinner-spectrum {
489
+ 0% { filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%)) hue-rotate(0deg); }
490
+ 25% { filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%)) hue-rotate(70deg); }
491
+ 50% { filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%)) hue-rotate(150deg); }
492
+ 75% { filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%)) hue-rotate(280deg); }
493
+ to { filter: drop-shadow(0 0 2.5px rgb(96 165 250 / 55%)) hue-rotate(360deg); }
494
+ }
495
+
496
+ /* Motion is decoration here; the colour is the message. Reduced motion keeps
497
+ the ring vivid and stops neither the host's spin nor its dash — only this
498
+ colour cycle goes away, which is also what the host's own reduced-motion
499
+ block asks of a status marker. */
500
+ @media (prefers-reduced-motion: reduce) {
501
+ [class*="sidebarCol"] svg[data-state="ongoing"][class*="spinner"] {
502
+ animation: none;
503
+ color: #6366f1;
504
+ }
505
+ }
506
+ `;
507
+ // src/client/styles/sidebar-density.ts
508
+ /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
509
+ const css$2 = String.raw`/* Workspace rows: swap the folder icon for the disclosure triangle in every
510
+ state, not only on hover.
511
+
512
+ The row already renders both slots — a folder span followed by a chevron span
513
+ that holds a right-pointing filled triangle rotated 90deg when expanded. The
514
+ app's own rules are:
515
+ .projectRow .chevron { display: none }
516
+ .projectRow:hover .chevron { display: inline-flex }
517
+ .projectRow:hover .folder { display: none }
518
+ so the triangle exists all along and only the hover swap is what the folder
519
+ icon wins on. Reversing those two declarations permanently is the whole
520
+ change: the folder is hidden at rest, the chevron shows at rest. Both rows
521
+ keep their own reveal on hover, so the hover state needs no rule of its own.
522
+ Class names are hashed per build, hence the substring selectors. */
523
+ [role="treeitem"][data-row-key^="workspace:"] [class*="folder"] {
524
+ display: none !important;
525
+ }
526
+
527
+ [role="treeitem"][data-row-key^="workspace:"] [class*="chevron"] {
528
+ display: inline-flex !important;
529
+ color: var(--dsw-alias-label-secondary) !important;
530
+ }
531
+
532
+ /* The triangle is the row's only leading glyph now, so it takes the 16px slot
533
+ the folder used to occupy. */
534
+ [role="treeitem"][data-row-key^="workspace:"] [class*="chevron"] svg {
535
+ width: 16px !important;
536
+ height: 16px !important;
537
+ }
538
+
539
+ /* Light-surface sidebar text scale. The app's own de-emphasised label tokens
464
540
  resolve to bluish-600 (3.58:1) against the light sidebar, which reads as dim.
465
541
  Titles and labels move up to label-primary, and the one step below them
466
542
  (section headings, timestamps, key caps) to label-secondary (5.6:1). Both
@@ -512,10 +588,25 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
512
588
  font-size: 11px !important;
513
589
  }
514
590
 
591
+ /* One type scale for both row kinds.
592
+ *
593
+ * The folder title is a span inside projectText and the session title is a bare
594
+ * span; both carry the app's hashed class, and that class rule (14px) outranks a
595
+ * plain descendant selector. The folder name therefore kept 14px while session
596
+ * titles had shrunk — the mismatch that reads as the two titles not being the
597
+ * same size.
598
+ *
599
+ * Each selector below repeats both the sidebar and row attributes, putting
600
+ * specificity at (0,3,x), and the declaration is marked important: together they
601
+ * beat the app's hashed class whatever order the sheets load in. The nested
602
+ * "span span" form covers the projectText > title wrapper. */
515
603
  [class*="sidebarCol"] [role="treeitem"][data-row-key^="workspace:"] span,
516
- [class*="sidebarCol"] [role="treeitem"][data-row-key^="session:"] span {
517
- font-size: 11px !important;
518
- line-height: 15px !important;
604
+ [class*="sidebarCol"] [role="treeitem"][data-row-key^="workspace:"] span span,
605
+ [class*="sidebarCol"] [role="treeitem"][data-row-key^="workspace:"] [class*="projectText"] span,
606
+ [class*="sidebarCol"] [role="treeitem"][data-row-key^="session:"] span,
607
+ [class*="sidebarCol"] [role="treeitem"][data-row-key^="session:"] span span {
608
+ font-size: 12px !important;
609
+ line-height: 16px !important;
519
610
  }
520
611
 
521
612
  [class*="sidebarCol"] [class*="brandName"] {
@@ -535,9 +626,52 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
535
626
  font-size: 12px !important;
536
627
  }
537
628
 
629
+
630
+ /* Fold the folder title in beside its triangle.
631
+ *
632
+ * The row spends a 16px glyph lane plus its gap before the title, so the folder
633
+ * name starts well right of the session titles underneath it even though both
634
+ * now use the same type scale. Only the text container moves — the triangle
635
+ * keeps its native size, its lane, and its position — which closes most of the
636
+ * visible step without dragging the row past the sidebar edge (an earlier
637
+ * row-level negative margin did exactly that and hid every glyph).
638
+ *
639
+ * Percentage-free: -8px reclaims the row gap and part of the lane, leaving the
640
+ * glyph clear of the first letter at both 11px and the app's default scales. */
641
+ [role="treeitem"][data-row-key^="workspace:"] [class*="projectText"] {
642
+ /* Measured in the browser against the live DOM: the session title starts at
643
+ 37px (row 12 + padding 5 + its own 4px margin + the workspace indent), the
644
+ folder title at 39px before this shift. -2px lands the folder title on the
645
+ same 37px edge while keeping the 16px triangle lane untouched. */
646
+ margin-inline-start: -2px !important;
647
+ }
648
+
649
+ /* Same-row attribute, same proven selector shape as the rule above (which does
650
+ take effect), applied to the text itself. The folder title's own hashed class
651
+ sets 14px and wins over an inherited value, so the size is set on every
652
+ descendant rather than on the container. Matching the session titles is what
653
+ removes the "two or three pixel" step the reader sees between the two rows. */
654
+ [role="treeitem"][data-row-key^="workspace:"] [class*="projectText"] * {
655
+ font-size: 12px !important;
656
+ line-height: 16px !important;
657
+ }
658
+
659
+ /* Force the folder title onto the session titles' type scale.
660
+ *
661
+ * The folder title is projectText > span, and the span carries the app's own
662
+ * hashed class whose 14px rule wins against inherited values. The rows also live
663
+ * in a hashed container class, so this selector keys off the row attribute only,
664
+ * with no assumption about the sidebar wrapper. Measured against a screenshot:
665
+ * the folder title rendered at 14px while session titles rendered at 11px, which
666
+ * is the "two or three pixels" size step the reader reports. */
667
+ [role="treeitem"][data-row-key^="workspace:"] [class*="projectText"],
668
+ [role="treeitem"][data-row-key^="workspace:"] [class*="projectText"] span,
669
+ [role="treeitem"][data-row-key^="workspace:"] [class*="_title"] {
670
+ font-size: 12px !important;
671
+ line-height: 16px !important;
672
+ }
538
673
  `;
539
- //#endregion
540
- //#region src/client/styles/sidebar-layout.ts
674
+ // src/client/styles/sidebar-layout.ts
541
675
  /** Global presentation owned by dsh-enhance (migrated from the installer's injected styles). */
542
676
  const css$1 = String.raw`[class*="sidebarCol"] [class*="_root"] { position: relative !important; }
543
677
  [class*="sidebarCol"] [class*="logoRow"] { display: none !important; }
@@ -548,22 +682,52 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
548
682
  [class*="sidebarCol"] [class*="sectionLabel"] {
549
683
  margin-left: 4px !important;
550
684
  }
551
- [role="treeitem"][data-row-key^="session:"] {
552
- padding-left: 10px !important;
685
+ /* One indent for both row kinds.
686
+ *
687
+ * Session rows and workspace rows previously used different start insets, which
688
+ * made the tree look ragged: the folder title sat further right than the session
689
+ * titles under it. Both now start at 5px.
690
+ *
691
+ * A negative margin on the workspace row was tried and reverted: it dragged the
692
+ * whole row — glyph included — past the sidebar's left edge, so every triangle
693
+ * disappeared. The indent is the only lever that stays inside the column. */
694
+ [role="treeitem"][data-row-key^="session:"],
695
+ [role="treeitem"][data-row-key^="workspace:"] {
696
+ padding-inline-start: 5px !important;
553
697
  }
554
- [class*="sidebarCol"] [class*="panelList"] {
555
- position: absolute !important;
556
- right: 12px !important;
557
- bottom: 14px !important;
558
- z-index: 5;
559
- /* Upstream stacks the Plugins and Automation icons in a column. A row keeps
560
- both reachable on one line beside the account name instead. */
698
+
699
+
700
+
701
+ /* Panel shortcuts open the sidebar, above the workspace tree.
702
+ *
703
+ * The sidebar's own DOM already puts this nav between the (hidden) New Session
704
+ * bar and the region tree, so the top placement needs no move at all: upstream
705
+ * simply starts the nav wherever its flex column lands, and releasing it from
706
+ * the bottom-right absolute position (this plugin's earlier choice) leaves it
707
+ * above WORKSPACES.
708
+ *
709
+ * The row is kept — upstream stacks these icons in a column, which costs one
710
+ * row per shortcut at the top of the tree.
711
+ *
712
+ * Five per line, wrapping beyond that. The count is enforced by max-width
713
+ * rather than by the sidebar's own width: five 36px buttons and four 2px gaps
714
+ * are 188px, so a wider sidebar cannot fit a sixth on the first line.
715
+ *
716
+ * Scope excludes the collapsed rail: there the column is the app's 56px icon
717
+ * strip (0px on macOS), a row of 36px buttons cannot fit it, and the host's own
718
+ * vertical layout is the right shape. The rail is not reachable on macOS
719
+ * desktop, but this plugin also loads in the web profile.
720
+ */
721
+ [class*="sidebarCol"] [class*="_root"]:not([class*="collapsed"]) [class*="panelList"] {
561
722
  flex-direction: row !important;
723
+ flex-wrap: wrap !important;
562
724
  align-items: center !important;
563
- justify-content: flex-end !important;
564
- gap: 0 !important;
565
- margin: 0 !important;
725
+ justify-content: flex-start !important;
726
+ gap: 2px !important;
727
+ margin: 0 0 6px 0 !important;
728
+ max-width: calc(36px * 5 + 2px * 4) !important;
566
729
  }
730
+
567
731
  [class*="sidebarCol"] [class*="panelList"] [class*="panelTitle"] { display: none !important; }
568
732
  [class*="sidebarCol"] [class*="panelList"] button[class*="panelRow"] {
569
733
  width: 36px !important;
@@ -575,15 +739,70 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
575
739
  padding: 0 !important;
576
740
  border-radius: 12px !important;
577
741
  }
742
+
743
+ /* Plugin icons that the host renders in the sidebar footer join the same row.
744
+ *
745
+ * The footer keeps its own flex layout, which is why the moved container is
746
+ * dissolved rather than laid out: display:contents drops its box, and every
747
+ * wrapper up to the actual button is dissolved the same way, so each plugin's
748
+ * button becomes a direct item of the panel row and takes its turn in the
749
+ * five-per-line count. The buttons keep their own look; only size and shape
750
+ * are normalised to the row's rhythm.
751
+ *
752
+ * One level of wrapper is dissolved generically (every non-button child), one
753
+ * more by the host's own entry-row class: the installed plugins wrap their
754
+ * button in an entry row, and a future plugin that omits it still lands as a
755
+ * direct child.
756
+ */
757
+ [class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries],
758
+ [class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] > :not(button),
759
+ [class*="sidebarCol"] [class*="panelList"] [class*="entryRow"] {
760
+ display: contents !important;
761
+ }
762
+ /* The plugin's own "wide" variant is built for the footer row: it turns the
763
+ * trigger into an icon+label pill that fills that row's width, which means
764
+ * justify-content:flex-start and a gap. In a 36px square that reads as an icon
765
+ * glued to the left edge, so the box model is normalised here: centred, no
766
+ * gap, no padding, one icon size for the whole row. */
767
+ [class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] button {
768
+ flex: none !important;
769
+ display: inline-flex !important;
770
+ justify-content: center !important;
771
+ align-items: center !important;
772
+ gap: 0 !important;
773
+ width: 36px !important;
774
+ height: 36px !important;
775
+ margin: 0 !important;
776
+ padding: 0 !important;
777
+ border-radius: 12px !important;
778
+ }
779
+ [class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] button svg {
780
+ flex: none !important;
781
+ width: 16px !important;
782
+ height: 16px !important;
783
+ }
784
+ /* The rail keeps the host's own treatment: the footer action block is hidden
785
+ there exactly as the host hides it, so the strip keeps only the app's icons. */
786
+ [class*="sidebarCol"] [class*="_root"][class*="collapsed"] [data-dsh-enhance-entries] {
787
+ display: none !important;
788
+ }
578
789
  `;
579
- //#endregion
580
- //#region src/client/styles/toolbar.ts
790
+ // src/client/styles/toolbar.ts
581
791
  /** Global presentation owned by dsh-enhance: annotation popover and tray. */
582
792
  const css = String.raw`/* The passage being annotated, painted through the Custom Highlight API so the
583
793
  mark survives focus moving into the note field (a native selection would not).
584
794
  Same blue as the app's document selection, so it reads as the same gesture. */
585
795
  ::highlight(dsh-enhance-annotation) {
586
- background-color: var(--dsw-alias-bg-document-selection);
796
+ /* Literal, not a token: a highlight pseudo-element does not inherit custom
797
+ properties from the element it paints, so the document-selection token
798
+ resolved to nothing and clicking an annotation showed no
799
+ selection wash at all. Same blue the app uses for its own selection. */
800
+ background-color: rgb(59 130 246 / 32%);
801
+ color: inherit;
802
+ }
803
+
804
+ body[data-ds-dark-theme] ::highlight(dsh-enhance-annotation) {
805
+ background-color: rgb(96 165 250 / 34%);
587
806
  color: inherit;
588
807
  }
589
808
 
@@ -616,9 +835,9 @@ body[data-ds-dark-theme] ::highlight(dsh-enhance-annotation-mark) {
616
835
  display: inline-flex;
617
836
  align-items: center;
618
837
  justify-content: center;
619
- width: 30px;
620
- height: 30px;
621
- margin: 0 5px;
838
+ width: 26px;
839
+ height: 26px;
840
+ margin: 0 4px;
622
841
  padding: 0;
623
842
  border: 0;
624
843
  border-radius: 0;
@@ -635,10 +854,12 @@ body[data-ds-dark-theme] ::highlight(dsh-enhance-annotation-mark) {
635
854
  transition: transform 110ms ease, filter 110ms ease;
636
855
  }
637
856
 
857
+ /* The badge is one numbered disc. Height drives the scale and the width follows
858
+ the viewBox, so a two-digit pill stays the same height as a single digit. */
638
859
  .dsh-enhance-badge svg {
639
860
  display: block;
640
- width: 22px;
641
861
  height: 22px;
862
+ width: auto;
642
863
  }
643
864
 
644
865
  .dsh-enhance-badge:hover {
@@ -666,7 +887,10 @@ body[data-ds-dark-theme] ::highlight(dsh-enhance-annotation-mark) {
666
887
  flex-direction: column;
667
888
  width: 340px;
668
889
  max-width: calc(100vw - 24px);
669
- padding: 6px;
890
+ /* No inset of its own: the textarea sits on the frame's surface, flush with
891
+ the top and both sides. The only breathing room is the field's own
892
+ horizontal padding, so text never touches the rounded corners. */
893
+ padding: 0;
670
894
  border-radius: 18px;
671
895
  border: 0.5px solid color-mix(in srgb, var(--dsw-alias-label-primary) 14%, transparent);
672
896
  background: color-mix(in srgb, var(--dsw-alias-bg-elevated, var(--dsw-alias-bg-l1, #fff)) 76%, transparent);
@@ -689,22 +913,28 @@ body[data-ds-dark-theme] .dsh-enhance-popover {
689
913
  .dsh-enhance-popover { animation: none; }
690
914
  }
691
915
 
692
- /* The field owns the whole top row; the confirm affordance sits inside it. */
916
+ /* The field row carries no inset and no panel of its own: the textarea sits
917
+ flush with the popover's own surface, so the words line up with the frame
918
+ instead of floating in a lighter box inside it. */
693
919
  .dsh-enhance-popover__field {
694
920
  display: flex;
695
921
  align-items: flex-end;
696
922
  gap: 6px;
697
- padding: 6px 6px 6px 12px;
698
- border-radius: 13px;
699
- background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
923
+ padding: 10px 8px 6px 14px;
924
+ border-radius: 0;
925
+ background: transparent;
700
926
  }
701
927
 
928
+ /* Height follows the text. The element is a textarea because the note is
929
+ multi-line, but it must never grow a scrollbar: no max-height, no vertical
930
+ overflow, and the rows are driven from JS on every input (see the seat), so
931
+ the panel grows with what is typed rather than clipping it. */
702
932
  .dsh-enhance-popover__input {
703
933
  flex: 1;
704
934
  min-width: 0;
705
935
  min-height: 24px;
706
- max-height: 96px;
707
- padding: 3px 0;
936
+ max-height: none;
937
+ padding: 0;
708
938
  border: 0;
709
939
  background: transparent;
710
940
  color: var(--dsw-alias-label-primary);
@@ -712,6 +942,7 @@ body[data-ds-dark-theme] .dsh-enhance-popover {
712
942
  font-size: 13px;
713
943
  line-height: 20px;
714
944
  resize: none;
945
+ overflow-y: hidden;
715
946
  }
716
947
 
717
948
  .dsh-enhance-popover__input::placeholder {
@@ -753,12 +984,14 @@ body[data-ds-dark-theme] .dsh-enhance-popover {
753
984
  }
754
985
 
755
986
  /* Footer: the quoted passage on the left, the side-chat action on the right. */
987
+ /* The popover frame has no inset of its own (the field is flush with it), so
988
+ the footer carries the frame's own horizontal and bottom spacing. */
756
989
  .dsh-enhance-popover__footer {
757
990
  display: flex;
758
991
  align-items: center;
759
992
  justify-content: space-between;
760
993
  gap: 10px;
761
- padding: 6px 8px 2px 12px;
994
+ padding: 6px 14px 10px;
762
995
  }
763
996
 
764
997
  .dsh-enhance-popover__quote {
@@ -973,8 +1206,9 @@ body[data-ds-dark-theme] .dsh-enhance-tray__list {
973
1206
  display: flex;
974
1207
  align-items: center;
975
1208
  gap: 2px;
976
- padding: 2px;
977
- border-radius: 10px;
1209
+ padding: 3px;
1210
+ /* Capsule, matching the shape language of the rest of the composer chrome. */
1211
+ border-radius: 999px;
978
1212
  /* A solid pill, not a gradient: fading over text looked like a smudge, and the
979
1213
  icons must stay readable on top of the note they cover. */
980
1214
  background: var(--dsw-alias-bg-elevated, #1b1b1c);
@@ -994,10 +1228,10 @@ body[data-ds-dark-theme] .dsh-enhance-tray__actions {
994
1228
  display: inline-flex;
995
1229
  align-items: center;
996
1230
  justify-content: center;
997
- width: 30px;
998
- height: 30px;
1231
+ width: 26px;
1232
+ height: 26px;
999
1233
  border: 0;
1000
- border-radius: 8px;
1234
+ border-radius: 999px;
1001
1235
  background: transparent;
1002
1236
  color: var(--dsw-alias-label-secondary);
1003
1237
  cursor: pointer;
@@ -1066,8 +1300,12 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1066
1300
  /* The header is text, not a bar: it names the passage and doubles as the drag
1067
1301
  surface, so no grip row is spent on it. */
1068
1302
  .dsh-enhance-edit__head {
1303
+ display: flex;
1304
+ align-items: center;
1305
+ gap: 6px;
1069
1306
  min-width: 0;
1070
- padding: 2px 4px 6px;
1307
+ /* Carries the dialog's own top inset now that the frame has no padding. */
1308
+ padding: 10px 14px 6px;
1071
1309
  cursor: grab;
1072
1310
  touch-action: none;
1073
1311
  user-select: none;
@@ -1079,6 +1317,8 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1079
1317
 
1080
1318
  .dsh-enhance-edit__label {
1081
1319
  display: block;
1320
+ flex: 1;
1321
+ min-width: 0;
1082
1322
  overflow: hidden;
1083
1323
  color: var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary));
1084
1324
  font-size: 11px;
@@ -1087,12 +1327,47 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1087
1327
  white-space: nowrap;
1088
1328
  }
1089
1329
 
1330
+ /* Removal action on the editor header. Quiet by default — it sits beside the
1331
+ quoted passage, which is the header's real job — and takes the danger colour
1332
+ only on hover, so it never competes with the confirm check. */
1333
+ .dsh-enhance-edit__delete {
1334
+ appearance: none;
1335
+ -webkit-appearance: none;
1336
+ display: inline-flex;
1337
+ align-items: center;
1338
+ justify-content: center;
1339
+ flex: none;
1340
+ width: 30px;
1341
+ height: 30px;
1342
+ padding: 0;
1343
+ border: 0;
1344
+ border-radius: 999px;
1345
+ background: transparent;
1346
+ color: var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary));
1347
+ cursor: pointer;
1348
+ opacity: 0.7;
1349
+ transition: background-color 110ms ease, color 110ms ease, opacity 110ms ease;
1350
+ }
1351
+
1352
+ .dsh-enhance-edit__delete:hover {
1353
+ opacity: 1;
1354
+ color: #e5484d;
1355
+ background: rgb(229 72 77 / 12%);
1356
+ }
1357
+
1358
+ .dsh-enhance-edit__delete:focus-visible {
1359
+ outline: 2px solid var(--dsw-alias-state-business-primary, #4d6bfe);
1360
+ outline-offset: 1px;
1361
+ }
1362
+
1090
1363
  /* The field and its one action share a row: the check sits at the end of the text
1091
1364
  it publishes rather than in a footer of its own. */
1092
1365
  .dsh-enhance-edit__body {
1093
1366
  display: flex;
1094
1367
  align-items: flex-end;
1095
1368
  gap: 6px;
1369
+ /* Matches the header's inset so the note and the quoted passage line up. */
1370
+ padding: 0 8px 8px 12px;
1096
1371
  }
1097
1372
 
1098
1373
  .dsh-enhance-edit__field {
@@ -1122,8 +1397,8 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1122
1397
  align-items: center;
1123
1398
  justify-content: center;
1124
1399
  flex: none;
1125
- width: 30px;
1126
- height: 30px;
1400
+ width: 24px;
1401
+ height: 24px;
1127
1402
  margin-bottom: 2px;
1128
1403
  padding: 0;
1129
1404
  border: 0;
@@ -1191,7 +1466,11 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1191
1466
  align-items: center;
1192
1467
  gap: 7px;
1193
1468
  min-width: 0;
1194
- padding: 2px 4px 0;
1469
+ /* Sits on the dialog's own edge: a small inset on every side is enough to
1470
+ keep the text off the rounded corner, no wider. Both the header and the
1471
+ field share the same left inset so the quote and the note start on one
1472
+ line. */
1473
+ padding: 8px 8px 4px 12px;
1195
1474
  cursor: grab;
1196
1475
  touch-action: none;
1197
1476
  user-select: none;
@@ -1300,10 +1579,12 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1300
1579
  transform: translate(-50%, -50%);
1301
1580
  display: flex;
1302
1581
  flex-direction: column;
1303
- gap: 8px;
1582
+ gap: 0;
1304
1583
  width: 420px;
1305
1584
  max-width: calc(100vw - 32px);
1306
- padding: 12px;
1585
+ /* Flush like the selection popover: the field and the header sit on the
1586
+ dialog's own surface instead of inside a second inset frame. */
1587
+ padding: 0;
1307
1588
  border: 0.5px solid color-mix(in srgb, var(--dsw-alias-label-primary) 14%, transparent);
1308
1589
  border-radius: 16px;
1309
1590
  background: color-mix(in srgb, var(--dsw-alias-bg-elevated, var(--dsw-alias-bg-l1, #fff)) 90%, transparent);
@@ -1328,25 +1609,30 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1328
1609
  box-sizing: border-box;
1329
1610
  display: block;
1330
1611
  width: 100%;
1331
- min-height: 68px;
1332
- padding: 8px 10px;
1612
+ /* Height follows the text, never a scrollbar: no max-height, no vertical
1613
+ overflow, sized from scrollHeight on every change (see the editor). */
1614
+ min-height: 24px;
1615
+ max-height: none;
1616
+ /* No horizontal inset of its own: the body row already carries the dialog's
1617
+ left edge, and doubling it pushed the note 12px right of the quote. */
1618
+ padding: 4px 0 8px;
1333
1619
  max-width: 100%;
1334
1620
  border: 0;
1335
- border-radius: 11px;
1336
- /* No second frame inside the dialog: the dialog itself is the surface, and a
1337
- nested border plus wash read as a stray box. The field only tints slightly
1338
- so the caret area is still distinguishable. */
1339
- background: color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent);
1621
+ border-radius: 0;
1622
+ /* No frame of its own: the dialog is the surface, so the words sit directly
1623
+ on it. */
1624
+ background: transparent;
1340
1625
  color: var(--dsw-alias-label-primary);
1341
1626
  font: inherit;
1342
1627
  font-size: 13px;
1343
1628
  line-height: 20px;
1344
- resize: vertical;
1629
+ resize: none;
1630
+ overflow-y: hidden;
1345
1631
  }
1346
1632
 
1347
1633
  .dsh-enhance-edit__field:focus {
1348
1634
  outline: none;
1349
- background: color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent);
1635
+ background: transparent;
1350
1636
  }
1351
1637
 
1352
1638
  .dsh-enhance-edit__row {
@@ -1390,15 +1676,15 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1390
1676
  opacity: .88;
1391
1677
  }
1392
1678
  `;
1393
- //#endregion
1394
- //#region src/client/styles.ts
1679
+ // src/client/styles.ts
1395
1680
  /** Stable plugin identity stamped onto every injected style tag. */
1396
1681
  const PLUGIN_ID = "dsh-enhance";
1397
1682
  /** Sheet name to CSS, in cascade order: later sheets win ties against earlier ones. */
1398
1683
  const SHEETS = [
1399
- ["document-preview.css", css$5],
1400
- ["chat-markdown.css", css$4],
1401
- ["rightbar-handle.css", css$3],
1684
+ ["document-preview.css", css$6],
1685
+ ["chat-markdown.css", css$5],
1686
+ ["rightbar-handle.css", css$4],
1687
+ ["running-spinner.css", css$3],
1402
1688
  ["sidebar-density.css", css$2],
1403
1689
  ["sidebar-layout.css", css$1],
1404
1690
  ["toolbar.css", css]
@@ -1423,8 +1709,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1423
1709
  };
1424
1710
  }, `dsh-enhance: ${name} stylesheet`);
1425
1711
  }
1426
- //#endregion
1427
- //#region src/client/sidebar-floor.ts
1712
+ // src/client/sidebar-floor.ts
1428
1713
  /**
1429
1714
  * A sidebar drag floor 50px below the app's own.
1430
1715
  *
@@ -1439,7 +1724,11 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1439
1724
  * owns the gesture. One writer, one width, no fighting.
1440
1725
  *
1441
1726
  * Three places paint the same number and all three are written here: the shell's
1442
- * grid track, the sidebar content's inline width, and the handle's `left`.
1727
+ * grid track, the sidebar content's inline width, and the handle's `left`. Only
1728
+ * elements that actually mirror the column width are rewritten — an element
1729
+ * carrying some other fixed px width (a row's timestamp column, an icon box)
1730
+ * must not be stamped with the sidebar width, or the row's inner layout breaks
1731
+ * into a dead strip.
1443
1732
  */
1444
1733
  /** This plugin's floor: 50px below the app's own 264px minimum. */
1445
1734
  const RELAXED_FLOOR = 214;
@@ -1447,12 +1736,15 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1447
1736
  const CEILING = 420;
1448
1737
  /** Attribute marking the shell frame this module is driving. */
1449
1738
  const FRAME_ATTRIBUTE = "data-dsh-enhance-frame";
1739
+ /** Attribute the shell sets on the frame while the sidebar is collapsed. */
1740
+ const COLLAPSED_ATTRIBUTE = "data-sidebar-collapsed";
1450
1741
  /**
1451
1742
  * Install the relaxed drag floor.
1452
1743
  * @param root - document the plugin is mounted in.
1744
+ * @param options - startup width and drag commit hook.
1453
1745
  * @returns disposer that stops intercepting and restores the app's own value.
1454
1746
  */
1455
- function installSidebarFloor(root) {
1747
+ function installSidebarFloor(root, options = {}) {
1456
1748
  /** Shell grid frame, once located. */
1457
1749
  let frame = null;
1458
1750
  /** The width the plugin last painted, when it is below the app's floor. */
@@ -1461,6 +1753,16 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1461
1753
  const restored = /* @__PURE__ */ new Map();
1462
1754
  let dragStart = null;
1463
1755
  let applying = false;
1756
+ /** Clamp a width into the range this module is willing to paint. */
1757
+ const clampWidth = (width) => Math.min(Math.max(width, RELAXED_FLOOR), CEILING);
1758
+ /**
1759
+ * The width the column belongs at, across collapses.
1760
+ *
1761
+ * Kept apart from `held` because a collapse is painted by the app as a 0px
1762
+ * track: the module has nothing to hold then, but it must still know where to
1763
+ * put the column when the reader expands it again.
1764
+ */
1765
+ let preferred = options.initialWidth === void 0 ? void 0 : clampWidth(options.initialWidth);
1464
1766
  /** Find the shell frame: the grid whose first child is the sidebar column. */
1465
1767
  const findFrame = () => {
1466
1768
  for (const element of root.querySelectorAll("div[style*=\"grid-template-columns\"]")) {
@@ -1474,16 +1776,31 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1474
1776
  const match = /^\s*(\d+(?:\.\d+)?)px/.exec(frame?.style.gridTemplateColumns ?? "");
1475
1777
  return match === null ? 0 : Number(match[1]);
1476
1778
  };
1477
- /** Every element inside the column that carries a px inline width. */
1478
- const widthCarriers = () => {
1779
+ /**
1780
+ * Elements inside the column that mirror the sidebar width.
1781
+ *
1782
+ * Only a child whose inline width equals the width the app just painted on
1783
+ * the track (or the width this module last painted) counts as a mirror.
1784
+ * Foreign fixed widths — a co-installed plugin's panel, an icon box — must
1785
+ * never be stamped, or their internal layout breaks into a dead strip.
1786
+ * @param mirrors - widths to accept as "the column's own value".
1787
+ * @returns the mirror elements, in document order.
1788
+ */
1789
+ const widthCarriers = (mirrors) => {
1479
1790
  const column = frame?.firstElementChild;
1480
1791
  if (column === null || column === void 0) return [];
1481
1792
  const carriers = [];
1793
+ const qualifies = (element) => {
1794
+ const match = /^(\d+(?:\.\d+)?)px$/.exec(element.style.width);
1795
+ if (match === null) return false;
1796
+ const width = Number(match[1]);
1797
+ return mirrors.some((mirror) => Math.abs(width - mirror) <= 1);
1798
+ };
1482
1799
  const visit = (element, depth) => {
1483
1800
  if (depth > 3) return;
1484
1801
  for (const child of element.children) {
1485
1802
  if (!(child instanceof HTMLElement)) continue;
1486
- if (/^\d+(?:\.\d+)?px$/.test(child.style.width)) carriers.push(child);
1803
+ if (qualifies(child)) carriers.push(child);
1487
1804
  visit(child, depth + 1);
1488
1805
  }
1489
1806
  };
@@ -1497,8 +1814,11 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1497
1814
  applying = true;
1498
1815
  try {
1499
1816
  const rounded = Math.round(width);
1817
+ const mirrors = [painted(), rounded];
1500
1818
  target.style.gridTemplateColumns = target.style.gridTemplateColumns.replace(/^\s*\d+(?:\.\d+)?px/, `${rounded}px`);
1501
- for (const carrier of widthCarriers()) {
1819
+ const carriers = new Set(widthCarriers(mirrors));
1820
+ for (const element of restored.keys()) if (element.isConnected) carriers.add(element);
1821
+ for (const carrier of carriers) {
1502
1822
  if (!restored.has(carrier)) restored.set(carrier, carrier.style.width);
1503
1823
  carrier.style.width = `${rounded}px`;
1504
1824
  }
@@ -1516,22 +1836,36 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1516
1836
  held = void 0;
1517
1837
  };
1518
1838
  /**
1519
- * Keep the plugin's width while the app still reports its own floor.
1839
+ * Keep the column at the width the reader left it at.
1520
1840
  *
1521
- * The app repaints the grid whenever unrelated layout state changes. Re-applying
1522
- * only when the painted value differs from the held one keeps that cheap and
1523
- * keeps the sidebar where the reader put it.
1841
+ * The app repaints the grid whenever unrelated layout state changes, and it
1842
+ * re-renders the content element's width (React re-mounts it on right-panel
1843
+ * transitions) without touching the grid string at all. Watching both: a
1844
+ * drifted track is re-held, a drifted mirror is re-stamped even when the track
1845
+ * still reads the held width, and a column the app re-expanded is moved back
1846
+ * to the remembered width instead of the app's own 280px default.
1524
1847
  */
1525
1848
  const reconcile = () => {
1526
1849
  if (applying) return;
1527
1850
  frame ??= findFrame();
1528
1851
  if (frame === null) return;
1529
- if (held === void 0) return;
1852
+ for (const element of [...restored.keys()]) if (!element.isConnected) restored.delete(element);
1853
+ if (frame.hasAttribute(COLLAPSED_ATTRIBUTE)) {
1854
+ if (held !== void 0) restore();
1855
+ return;
1856
+ }
1857
+ if (preferred === void 0) return;
1858
+ if (held === void 0) {
1859
+ held = clampWidth(preferred);
1860
+ apply(held);
1861
+ return;
1862
+ }
1863
+ const drifted = restored.size === 0 ? false : [...restored.keys()].some((element) => element.style.width !== `${Math.round(held)}px`);
1530
1864
  if (Math.abs(painted() - held) > .5) {
1531
- adoptAppWidth();
1532
- if (held === void 0) return;
1533
1865
  apply(held);
1866
+ return;
1534
1867
  }
1868
+ if (drifted) apply(held);
1535
1869
  };
1536
1870
  const frameObserver = new MutationObserver(() => {
1537
1871
  reconcile();
@@ -1544,10 +1878,17 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1544
1878
  frame = target;
1545
1879
  frame.setAttribute(FRAME_ATTRIBUTE, "");
1546
1880
  frameObserver.observe(frame, {
1881
+ attributes: true,
1882
+ attributeFilter: ["style", COLLAPSED_ATTRIBUTE]
1883
+ });
1884
+ const column = frame.firstElementChild;
1885
+ if (column !== null) frameObserver.observe(column, {
1886
+ childList: true,
1887
+ subtree: true,
1547
1888
  attributes: true,
1548
1889
  attributeFilter: ["style"]
1549
1890
  });
1550
- if (held !== void 0) apply(held);
1891
+ reconcile();
1551
1892
  };
1552
1893
  const onPointerDown = (event) => {
1553
1894
  const handle = event.target;
@@ -1571,24 +1912,16 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1571
1912
  }
1572
1913
  event.stopPropagation();
1573
1914
  const wanted = dragStart.width + (event.clientX - dragStart.x);
1574
- const next = Math.min(Math.max(wanted, RELAXED_FLOOR), CEILING);
1915
+ const next = clampWidth(wanted);
1575
1916
  held = next;
1576
1917
  apply(next);
1577
1918
  };
1578
1919
  const endDrag = () => {
1579
1920
  if (dragStart === null) return;
1580
1921
  dragStart = null;
1581
- };
1582
- /**
1583
- * Drop the overrides when the app takes the column over on its own.
1584
- *
1585
- * A collapse (to the 56px rail) is the app's gesture, not this module's: the
1586
- * plugin has no width to hold there, and repainting one would fight the rail.
1587
- */
1588
- const adoptAppWidth = () => {
1589
1922
  if (held === void 0) return;
1590
- const current = painted();
1591
- if (current > 0 && current < RELAXED_FLOOR) restore();
1923
+ preferred = held;
1924
+ options.onCommit?.(held);
1592
1925
  };
1593
1926
  attach();
1594
1927
  root.addEventListener("pointerdown", onPointerDown, true);
@@ -1613,8 +1946,482 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1613
1946
  frame?.removeAttribute(FRAME_ATTRIBUTE);
1614
1947
  };
1615
1948
  }
1616
- //#endregion
1617
- //#region src/client/locales.ts
1949
+ // src/client/sidebar-top-row.ts
1950
+ /**
1951
+ * Put the sidebar's footer plugin icons into the top panel row.
1952
+ *
1953
+ * Plugins that add a sidebar entry choose a slot; two are in use in practice.
1954
+ * A *panel* (`panelList`, the nav the app renders) is already at the top. A
1955
+ * *footer action* (`sidebar.footer.action`, rendered inside `footArea`) lands
1956
+ * next to the account row at the bottom — which is why a newly installed plugin
1957
+ * shows up there and reads as a different kind of control from the icons above.
1958
+ *
1959
+ * CSS cannot merge the two: they are separate flex containers with separate
1960
+ * parents, and no amount of `order` moves a node into a sibling container. So
1961
+ * this module moves the footer's action container into the panel nav once the
1962
+ * shell exists, and the stylesheet dissolves it (`display: contents`) so its
1963
+ * buttons join the row the nav lays out. Five per line, wrapping beyond that:
1964
+ * the nav's own max-width does the counting (see sidebar-layout.css).
1965
+ *
1966
+ * The relocated element is the *container* the host owns, not the entries a
1967
+ * plugin renders. React updates those entries inside it and removes them from
1968
+ * it, and both keep working because their parent never changed; the container
1969
+ * itself is rendered unconditionally by the sidebar shell, so it is not a node
1970
+ * React re-parents. Verified on a live web instance: moving it, opening the
1971
+ * plugin's own panel (a fixed overlay), collapsing and expanding the sidebar
1972
+ * produced no console errors, no duplicated container, and no lost entry.
1973
+ *
1974
+ * If a future re-render does put the container back, the observer moves it
1975
+ * again on the next frame; the move is idempotent.
1976
+ */
1977
+ /** Marks the relocated container, for both the stylesheet and the disposer. */
1978
+ const ENTRIES_ATTRIBUTE = "data-dsh-enhance-entries";
1979
+ /**
1980
+ * Install the relocation.
1981
+ * @param root - document the plugin is mounted in.
1982
+ * @returns disposer that puts the container back where the host rendered it.
1983
+ */
1984
+ function installSidebarTopRow(root) {
1985
+ /** Original parent and the sibling it sat before, for the disposer. */
1986
+ let home = null;
1987
+ let homeNext = null;
1988
+ let frame = 0;
1989
+ /** The sidebar's panel nav and footer action container, re-queried each pass. */
1990
+ const locate = () => {
1991
+ for (const column of root.querySelectorAll("[class*=\"sidebarCol\"]")) {
1992
+ const nav = column.querySelector("[class*=\"panelList\"]");
1993
+ const actions = column.querySelector("[class*=\"footerActions\"]");
1994
+ if (nav !== null && actions !== null) return {
1995
+ nav,
1996
+ actions
1997
+ };
1998
+ }
1999
+ return null;
2000
+ };
2001
+ /** Move the footer's action container into the panel row, once. */
2002
+ const relocate = () => {
2003
+ const found = locate();
2004
+ if (found === null) return;
2005
+ const { nav, actions } = found;
2006
+ if (actions.parentElement === nav) return;
2007
+ home = actions.parentElement;
2008
+ homeNext = actions.nextElementSibling;
2009
+ actions.setAttribute(ENTRIES_ATTRIBUTE, "");
2010
+ nav.append(actions);
2011
+ };
2012
+ const schedule = () => {
2013
+ if (frame !== 0) return;
2014
+ frame = requestAnimationFrame(() => {
2015
+ frame = 0;
2016
+ relocate();
2017
+ });
2018
+ };
2019
+ let observer = null;
2020
+ let observed = null;
2021
+ const watch = () => {
2022
+ const column = root.querySelector("[class*=\"sidebarCol\"]");
2023
+ if (column === observed) return;
2024
+ observer?.disconnect();
2025
+ observer = new MutationObserver(schedule);
2026
+ observed = column;
2027
+ observer.observe(column ?? root.documentElement, {
2028
+ childList: true,
2029
+ subtree: true
2030
+ });
2031
+ };
2032
+ const start = () => {
2033
+ watch();
2034
+ relocate();
2035
+ };
2036
+ start();
2037
+ const mountWatcher = new MutationObserver(() => {
2038
+ if (observed !== null && observed.isConnected) return;
2039
+ watch();
2040
+ schedule();
2041
+ });
2042
+ mountWatcher.observe(root.documentElement, {
2043
+ childList: true,
2044
+ subtree: true
2045
+ });
2046
+ return () => {
2047
+ if (frame !== 0) cancelAnimationFrame(frame);
2048
+ observer?.disconnect();
2049
+ mountWatcher.disconnect();
2050
+ const moved = root.querySelector(`[${ENTRIES_ATTRIBUTE}]`);
2051
+ if (moved === null || home === null) return;
2052
+ moved.removeAttribute(ENTRIES_ATTRIBUTE);
2053
+ if (homeNext !== null && homeNext.parentElement === home) home.insertBefore(moved, homeNext);
2054
+ else home.append(moved);
2055
+ };
2056
+ }
2057
+ // src/client/sidebar-width.ts
2058
+ /**
2059
+ * The sidebar width the shell opens with, and the one it is left at.
2060
+ *
2061
+ * The app keeps its sidebar width in an in-memory store created fresh on every
2062
+ * load (`sidebar: 280`), so a reload snaps the column back to 280 and nothing
2063
+ * outside the layout package can read or write that value. The one persistent
2064
+ * handle a plugin has is the painted px, which this plugin already owns through
2065
+ * the relaxed drag floor — so the width is remembered here instead: first run
2066
+ * opens at the narrowest width the gesture allows, later runs at whatever the
2067
+ * reader dragged it to.
2068
+ *
2069
+ * Only the drag that this plugin performs is recorded. The app's own collapse
2070
+ * (and any width it paints on its own) never reaches this module, so a rail or
2071
+ * a reset cannot overwrite the remembered value.
2072
+ */
2073
+ /** localStorage key holding the last width this plugin settled on. */
2074
+ const STORAGE_KEY$1 = "dsh-enhance.sidebar-width.v1";
2075
+ /**
2076
+ * Read a remembered width, rejecting anything outside the contract range.
2077
+ * @param raw - the stored string, or null.
2078
+ * @returns the width in px, or undefined when absent or unusable.
2079
+ */
2080
+ function readSidebarWidth(raw) {
2081
+ if (raw === null || raw.trim() === "") return void 0;
2082
+ const width = Number(raw);
2083
+ if (!Number.isFinite(width) || width < 214 || width > 420) return void 0;
2084
+ return Math.round(width);
2085
+ }
2086
+ /**
2087
+ * The width the shell should open with.
2088
+ * @param store - storage to read, or null where storage is blocked.
2089
+ * @returns the remembered width, or the narrow default on a first run.
2090
+ */
2091
+ function startupSidebarWidth(store) {
2092
+ if (store === null) return 214;
2093
+ try {
2094
+ return readSidebarWidth(store.getItem("dsh-enhance.sidebar-width.v1")) ?? 214;
2095
+ } catch {
2096
+ return 214;
2097
+ }
2098
+ }
2099
+ /**
2100
+ * Remember the width a drag settled on.
2101
+ * @param store - storage to write, or null where storage is blocked.
2102
+ * @param width - the settled width in px.
2103
+ */
2104
+ function rememberSidebarWidth(store, width) {
2105
+ if (store === null) return;
2106
+ const bounded = Math.round(Math.min(Math.max(width, 214), 420));
2107
+ try {
2108
+ store.setItem(STORAGE_KEY$1, String(bounded));
2109
+ } catch {}
2110
+ }
2111
+ /**
2112
+ * The page's localStorage, or null where storage is blocked.
2113
+ * @returns the storage face, or null.
2114
+ */
2115
+ function pageStorage() {
2116
+ try {
2117
+ return globalThis.localStorage ?? null;
2118
+ } catch {
2119
+ return null;
2120
+ }
2121
+ }
2122
+ // src/client/window-geometry.ts
2123
+ /**
2124
+ * Fill the screen on the first desktop launch, then remember the geometry.
2125
+ *
2126
+ * The Electron shell creates its main window at a fixed 1280x820 and records
2127
+ * nothing about where it was left, so every launch re-centres it. The bundle
2128
+ * cannot be patched here: `/Applications/DeepSeek Harness.app` ships a signed,
2129
+ * integrity-fused `app.asar`, and its preload exposes no window API to plugins.
2130
+ * The renderer half of that same window, however, is allowed to call
2131
+ * `window.resizeTo` / `window.moveTo` — verified to drive a sandboxed,
2132
+ * context-isolated Electron 44 window whose size is then reported as
2133
+ * maximized by the main process.
2134
+ *
2135
+ * So this module owns the geometry from the page: first launch (nothing saved)
2136
+ * fills the work area, later launches restore what the last one closed with.
2137
+ * Only the dimensions and the maximized flag are stored; the position is kept
2138
+ * so a window left on a second display reopens there. A saved frame that no
2139
+ * longer fits — monitor unplugged, resolution changed — is clamped into the
2140
+ * work area rather than restored off-screen.
2141
+ *
2142
+ * A plain browser tab has no work area of its own and `resizeTo` is a no-op
2143
+ * there, so the whole module stays inert outside the Electron shell.
2144
+ */
2145
+ /** localStorage key holding the last close's frame. */
2146
+ const STORAGE_KEY = "dsh-enhance.window-geometry.v1";
2147
+ /**
2148
+ * Read the work area out of a window's screen.
2149
+ *
2150
+ * `availLeft` / `availTop` exist in Chromium (they are how a maximized window
2151
+ * knows where the menu bar is), but not in the DOM typings, so they are read
2152
+ * defensively and default to the origin.
2153
+ * @param win - the driven window.
2154
+ * @returns the area a maximized window would fill.
2155
+ */
2156
+ function workAreaOf(win) {
2157
+ return {
2158
+ left: win.screen.availLeft ?? 0,
2159
+ top: win.screen.availTop ?? 0,
2160
+ width: win.screen.availWidth,
2161
+ height: win.screen.availHeight
2162
+ };
2163
+ }
2164
+ /** How long a resize or move must settle before the frame is written. */
2165
+ const SAVE_DELAY_MS = 400;
2166
+ /** How long the startup paint must settle before its own events stop counting. */
2167
+ const RESTORE_SETTLE_MS = 600;
2168
+ /**
2169
+ * A window within this many pixels of the work area counts as filled.
2170
+ *
2171
+ * Measured on macOS: a maximized window settles at exactly the work area, but
2172
+ * reports a few pixels less for the frame between the resize and the next
2173
+ * layout pass (1420x923 for a 1424x923 area). The tolerance covers that
2174
+ * transient without letting an ordinary window pass as maximized — 8px is
2175
+ * under 0.6% of the width on any display this app runs on.
2176
+ */
2177
+ const MAXIMIZED_TOLERANCE = 8;
2178
+ /**
2179
+ * Whether the page runs inside the Electron shell.
2180
+ *
2181
+ * The desktop preload has no window-geometry bridge to probe, and `resizeTo`
2182
+ * exists in every browser while doing nothing for a tab, so the user agent is
2183
+ * the discriminator: only the packaged shell reports `Electron/`.
2184
+ * @returns true when the module may drive its own window.
2185
+ */
2186
+ function isDesktopShell() {
2187
+ if (typeof navigator === "undefined") return false;
2188
+ return navigator.userAgent.includes("Electron/");
2189
+ }
2190
+ /**
2191
+ * Read a persisted frame, ignoring anything that is not a sane rectangle.
2192
+ * @param raw - the stored JSON string, or null.
2193
+ * @returns the parsed record, or undefined when absent or malformed.
2194
+ */
2195
+ function readSavedGeometry(raw) {
2196
+ if (raw === null || raw === "") return void 0;
2197
+ let parsed;
2198
+ try {
2199
+ parsed = JSON.parse(raw);
2200
+ } catch {
2201
+ return;
2202
+ }
2203
+ if (typeof parsed !== "object" || parsed === null) return void 0;
2204
+ const record = parsed;
2205
+ if (!isFrame(record.normal)) return void 0;
2206
+ return {
2207
+ normal: record.normal,
2208
+ maximized: record.maximized === true
2209
+ };
2210
+ }
2211
+ /**
2212
+ * Whether a value is a frame with positive dimensions.
2213
+ * @param value - candidate record.
2214
+ * @returns true when it can be restored.
2215
+ */
2216
+ function isFrame(value) {
2217
+ if (typeof value !== "object" || value === null) return false;
2218
+ const frame = value;
2219
+ return [
2220
+ "x",
2221
+ "y",
2222
+ "width",
2223
+ "height"
2224
+ ].every((key) => typeof frame[key] === "number" && Number.isFinite(frame[key])) && frame.width > 0 && frame.height > 0;
2225
+ }
2226
+ /**
2227
+ * Keep a frame inside the work area, without shrinking it below a usable size.
2228
+ *
2229
+ * A frame is never enlarged here: a window saved small stays small. It only
2230
+ * ensures enough of the title bar is on screen to grab, and that the whole
2231
+ * window fits when the display got smaller than the window.
2232
+ * @param frame - the frame to restore.
2233
+ * @param area - the work area it must live in.
2234
+ * @returns a frame that can be painted on screen.
2235
+ */
2236
+ function clampToArea(frame, area) {
2237
+ const width = Math.min(frame.width, area.width);
2238
+ const height = Math.min(frame.height, area.height);
2239
+ const minVisible = 120;
2240
+ const x = Math.min(Math.max(frame.x, area.left - width + minVisible), area.left + area.width - minVisible);
2241
+ const y = Math.min(Math.max(frame.y, area.top), area.top + area.height - 40);
2242
+ return {
2243
+ x: Math.round(x),
2244
+ y: Math.round(y),
2245
+ width: Math.round(width),
2246
+ height: Math.round(height)
2247
+ };
2248
+ }
2249
+ /**
2250
+ * Whether the window currently fills its work area.
2251
+ * @param frame - the live frame.
2252
+ * @param area - the work area.
2253
+ * @returns true when the dimensions match the work area.
2254
+ */
2255
+ function isFilled(frame, area) {
2256
+ return Math.abs(frame.width - area.width) <= MAXIMIZED_TOLERANCE && Math.abs(frame.height - area.height) <= MAXIMIZED_TOLERANCE;
2257
+ }
2258
+ /**
2259
+ * The frame the window reports right now.
2260
+ * @param win - the driven window.
2261
+ * @returns its current outer frame.
2262
+ */
2263
+ function currentFrame(win) {
2264
+ return {
2265
+ x: Math.round(win.screenX),
2266
+ y: Math.round(win.screenY),
2267
+ width: Math.round(win.outerWidth),
2268
+ height: Math.round(win.outerHeight)
2269
+ };
2270
+ }
2271
+ /**
2272
+ * Fill the work area.
2273
+ *
2274
+ * Resizing before moving keeps the final position exact: the platform clamps a
2275
+ * move against the *new* size, so moving a 1280-wide window to the work-area
2276
+ * origin first and then widening it would leave it offset.
2277
+ * @param win - the driven window.
2278
+ * @param area - the work area to fill.
2279
+ */
2280
+ function fill(win, area) {
2281
+ win.resizeTo(area.width, area.height);
2282
+ win.moveTo(area.left, area.top);
2283
+ }
2284
+ /**
2285
+ * Drive the window's startup geometry and keep the frame it closes with.
2286
+ *
2287
+ * The caller decides whether this applies at all — see {@link isDesktopShell}.
2288
+ * A plain browser tab ignores `resizeTo` / `moveTo`, so calling it there is
2289
+ * harmless, but a tab also has no work area of its own to fill.
2290
+ * @param win - the Electron window's renderer `window`.
2291
+ * @param store - storage to read and write; omit to use the page's localStorage.
2292
+ * @returns disposer that stops persisting further changes.
2293
+ */
2294
+ function installStartupGeometry(win, store) {
2295
+ const storage = store ?? safeStorage();
2296
+ const area = workAreaOf(win);
2297
+ if (!(area.width > 0) || !(area.height > 0)) return () => {};
2298
+ /** The last frame seen while the window was not filling the area. */
2299
+ let normal = currentFrame(win);
2300
+ /** True while this module's own paint is still settling. */
2301
+ let restoring = false;
2302
+ let timer;
2303
+ let settle;
2304
+ /**
2305
+ * Paint the saved frame, or fill the screen when nothing was saved.
2306
+ * @param geometry - what the previous launch left behind.
2307
+ */
2308
+ const restore = (geometry) => {
2309
+ restoring = true;
2310
+ if (geometry === void 0 || geometry.maximized) fill(win, area);
2311
+ else {
2312
+ const frame = clampToArea(geometry.normal, area);
2313
+ normal = frame;
2314
+ win.resizeTo(frame.width, frame.height);
2315
+ win.moveTo(frame.x, frame.y);
2316
+ }
2317
+ settle = setTimeout(() => {
2318
+ restoring = false;
2319
+ save();
2320
+ }, RESTORE_SETTLE_MS);
2321
+ };
2322
+ /** Write the current state, keeping the last non-filled frame as "normal". */
2323
+ const save = () => {
2324
+ if (storage === null || restoring) return;
2325
+ const frame = currentFrame(win);
2326
+ const maximized = isFilled(frame, area);
2327
+ if (!maximized) normal = frame;
2328
+ try {
2329
+ storage.setItem(STORAGE_KEY, JSON.stringify({
2330
+ normal,
2331
+ maximized
2332
+ }));
2333
+ } catch {}
2334
+ };
2335
+ const schedule = () => {
2336
+ if (restoring) return;
2337
+ if (timer !== void 0) clearTimeout(timer);
2338
+ timer = setTimeout(save, SAVE_DELAY_MS);
2339
+ };
2340
+ /** Persist as soon as the page is hidden, which is what a close looks like. */
2341
+ const onVisibilityChange = () => {
2342
+ if (win.document.visibilityState === "hidden") save();
2343
+ };
2344
+ restore(storage === null ? void 0 : readSavedGeometry(storage.getItem(STORAGE_KEY)));
2345
+ win.addEventListener("resize", schedule);
2346
+ win.addEventListener("blur", schedule);
2347
+ win.addEventListener("visibilitychange", onVisibilityChange);
2348
+ win.addEventListener("pagehide", save);
2349
+ return () => {
2350
+ if (timer !== void 0) clearTimeout(timer);
2351
+ if (settle !== void 0) clearTimeout(settle);
2352
+ win.removeEventListener("resize", schedule);
2353
+ win.removeEventListener("blur", schedule);
2354
+ win.removeEventListener("visibilitychange", onVisibilityChange);
2355
+ win.removeEventListener("pagehide", save);
2356
+ restoring = false;
2357
+ save();
2358
+ };
2359
+ }
2360
+ /**
2361
+ * The page's localStorage, or null where storage is blocked (a sandboxed
2362
+ * iframe, a privacy mode that throws on access).
2363
+ * @returns the storage face, or null.
2364
+ */
2365
+ function safeStorage() {
2366
+ try {
2367
+ return globalThis.localStorage ?? null;
2368
+ } catch {
2369
+ return null;
2370
+ }
2371
+ }
2372
+ // src/client/turn-badge.ts
2373
+ /** localStorage key of the pre-v2 accumulating badge; cleared once on mount. */
2374
+ const LEGACY_STORAGE_KEY = "dsh-enhance.turn-badge.v1";
2375
+ /**
2376
+ * Ids of visible (non-blank, non-subagent) sessions whose completion is
2377
+ * unread. Statuses of rows the list no longer carries are skipped: a deleted
2378
+ * conversation shows no dot in the sidebar either.
2379
+ * @param byId - the list snapshot's rows by id.
2380
+ * @param status - the Session status snapshot.
2381
+ * @returns the ids to count on the tile, in list order.
2382
+ */
2383
+ function unreadVisibleIds(byId, status) {
2384
+ const unread = [];
2385
+ for (const [id, row] of Object.entries(byId)) {
2386
+ if (row.blank === true || row.origin === "subagent") continue;
2387
+ if (status.get(id)?.completionUnread === true) unread.push(id);
2388
+ }
2389
+ return unread;
2390
+ }
2391
+ /**
2392
+ * Install the unread-session Dock badge.
2393
+ * @param ctx - client root context providing the sessions and uiSession services.
2394
+ * @param deps - seams, overridable in tests.
2395
+ * @returns disposer.
2396
+ */
2397
+ function installTurnBadge(ctx, deps = {}) {
2398
+ const badgeNavigator = navigator;
2399
+ const badge = deps.badge ?? (typeof badgeNavigator.setAppBadge === "function" ? {
2400
+ set: (contents) => badgeNavigator.setAppBadge?.(contents) ?? Promise.resolve(),
2401
+ clear: () => badgeNavigator.clearAppBadge?.() ?? Promise.resolve()
2402
+ } : void 0);
2403
+ if (badge === void 0) return () => {};
2404
+ const statusStore = deps.statusSource ?? ctx.uiSession?.sessionStatus;
2405
+ if (statusStore === void 0) return () => {};
2406
+ try {
2407
+ localStorage.removeItem(LEGACY_STORAGE_KEY);
2408
+ } catch {}
2409
+ let painted;
2410
+ const paint = () => {
2411
+ const count = unreadVisibleIds(ctx.sessions.list.getSnapshot().byId, statusStore.getSnapshot()).length;
2412
+ if (painted === count) return;
2413
+ painted = count;
2414
+ (count > 0 ? badge.set(count) : badge.clear()).catch(() => {});
2415
+ };
2416
+ const stopStatus = statusStore.subscribe(paint);
2417
+ const stopList = ctx.sessions.list.subscribe(paint);
2418
+ paint();
2419
+ return () => {
2420
+ stopStatus();
2421
+ stopList();
2422
+ };
2423
+ }
2424
+ // src/client/locales.ts
1618
2425
  /** Copy for the transcript selection toolbar, in every shipped locale. */
1619
2426
  /** Locale namespace this plugin owns. */
1620
2427
  const LOCALE_NS = "dshEnhance";
@@ -1749,8 +2556,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1749
2556
  left: Math.min(Math.max(8, centered), Math.max(8, viewport.width - width - 8))
1750
2557
  };
1751
2558
  }
1752
- //#endregion
1753
- //#region src/client/anchors.ts
2559
+ // src/client/anchors.ts
1754
2560
  /** Any transcript row the plugin may anchor to. */
1755
2561
  const ROW_SELECTOR = "[data-chat-flow-key], [data-chat-anchor-key]";
1756
2562
  /**
@@ -1947,17 +2753,47 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
1947
2753
  if (transcript !== null && transcript !== void 0 && !roots.includes(transcript)) roots.push(transcript);
1948
2754
  const ranges = [];
1949
2755
  for (const root of roots) for (const text of textNodesOf(root)) {
1950
- const index = text.data.replace(/\s+/g, " ").indexOf(needle);
1951
- if (index < 0) continue;
2756
+ const hit = text.data.replace(/\s+/g, " ").indexOf(needle);
2757
+ if (hit < 0) continue;
2758
+ const start = rawIndexOf(text.data, hit);
2759
+ const end = rawIndexOf(text.data, hit + needle.length);
2760
+ if (start === void 0 || end === void 0) continue;
1952
2761
  const range = document.createRange();
1953
- range.setStart(text, index);
1954
- range.setEnd(text, Math.min(index + needle.length, text.data.length));
2762
+ range.setStart(text, start);
2763
+ range.setEnd(text, end);
1955
2764
  ranges.push(range);
1956
2765
  return ranges;
1957
2766
  }
1958
2767
  return ranges;
1959
2768
  }
1960
2769
  /**
2770
+ * Map an offset in the whitespace-collapsed text back to the raw text.
2771
+ *
2772
+ * `collapsedOffset` counts characters after every run of whitespace became a
2773
+ * single space, so walking the raw string while emitting one position per
2774
+ * collapsed character gives the matching raw index. A collapsed offset equal to
2775
+ * the collapsed length maps to the end of the raw string.
2776
+ * @param raw - the node's actual text.
2777
+ * @param collapsedOffset - the index in `raw.replace(/\s+/g, ' ')`.
2778
+ * @returns the equivalent index in `raw`.
2779
+ */
2780
+ function rawIndexOf(raw, collapsedOffset) {
2781
+ if (collapsedOffset < 0) return void 0;
2782
+ let produced = 0;
2783
+ let index = 0;
2784
+ while (index < raw.length) {
2785
+ if (produced === collapsedOffset) return index;
2786
+ if (/\s/.test(raw[index] ?? "")) {
2787
+ while (index < raw.length && /\s/.test(raw[index] ?? "")) index += 1;
2788
+ produced += 1;
2789
+ continue;
2790
+ }
2791
+ index += 1;
2792
+ produced += 1;
2793
+ }
2794
+ return produced === collapsedOffset ? raw.length : void 0;
2795
+ }
2796
+ /**
1961
2797
  * Scroll a marked passage into view and paint it.
1962
2798
  * @param annotation - the annotation whose row should be shown.
1963
2799
  * @returns whether the passage was found and revealed.
@@ -2073,17 +2909,33 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2073
2909
  /** Attribute marking an inline annotation badge this plugin inserted. */
2074
2910
  const BADGE_ATTRIBUTE = "data-dsh-enhance-badge";
2075
2911
  /**
2076
- * Pin glyph for the inline badge.
2912
+ * One solid disc carrying the reading-order number.
2077
2913
  *
2078
- * Drawn rather than typed: an emoji renders at the platform's own size and
2079
- * baseline, which made the marker look different in every app it appeared in.
2080
- * `currentColor` keeps it on the badge's own palette in both themes.
2081
- */
2082
- const PIN_GLYPH = `<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true" focusable="false">
2083
- <path d="M8 1.6c2.5 0 4.5 2 4.5 4.5 0 3.2-4.5 8.3-4.5 8.3S3.5 9.3 3.5 6.1C3.5 3.6 5.5 1.6 8 1.6Z"
2084
- fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
2085
- <circle cx="8" cy="6.2" r="1.7" fill="currentColor"/>
2914
+ * Earlier takes drew a pin with a counter beside it, or a counter notched into
2915
+ * the pin's outline; both read as two shapes on one line. A single filled disc
2916
+ * with the digits inside is one mark with one silhouette, which is what the
2917
+ * inline marker needs to be. The disc grows into a pill for two and three
2918
+ * digits so the number never outgrows the shape.
2919
+ * @param number - the annotation's 1-based position.
2920
+ * @returns the SVG markup for one badge.
2921
+ */
2922
+ function badgeGlyph(number) {
2923
+ const digits = String(number);
2924
+ const length = digits.length;
2925
+ const side = 22;
2926
+ const width = length > 1 ? side + (length - 1) * 11 : side;
2927
+ const ring = 1.1;
2928
+ const radius = 8.6;
2929
+ const fontSize = length > 2 ? 10.5 : length > 1 ? 12 : 13.5;
2930
+ return `<svg viewBox="0 0 ${width} ${side}" width="${width}" height="${side}" aria-hidden="true" focusable="false">
2931
+ <rect x="${ring / 2}" y="${ring / 2}" width="${width - ring}" height="20.9"
2932
+ rx="${radius}" fill="#0268cc" stroke="#e9e9e9" stroke-width="${ring}"/>
2933
+ <text x="${width / 2}" y="11.5" text-anchor="middle" dominant-baseline="central"
2934
+ font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"
2935
+ font-size="${fontSize}" font-weight="500" fill="#fff"
2936
+ style="font-variant-numeric: tabular-nums">${digits}</text>
2086
2937
  </svg>`;
2938
+ }
2087
2939
  /**
2088
2940
  * Place one annotation badge at the end of every marked passage.
2089
2941
  *
@@ -2097,14 +2949,24 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2097
2949
  * @returns how many badges are currently mounted.
2098
2950
  */
2099
2951
  function mountBadges(annotations, onClick) {
2100
- const existing = new Set([...document.querySelectorAll(`[${BADGE_ATTRIBUTE}]`)].map((badge) => badge.getAttribute("data-dsh-enhance-badge") ?? ""));
2952
+ const existing = /* @__PURE__ */ new Map();
2953
+ for (const badge of document.querySelectorAll(`[${BADGE_ATTRIBUTE}]`)) existing.set(badge.getAttribute("data-dsh-enhance-badge") ?? "", badge);
2101
2954
  let mounted = 0;
2102
- for (const annotation of annotations) {
2103
- if (existing.has(annotation.id)) continue;
2955
+ annotations.forEach((annotation, offset) => {
2956
+ const number = offset + 1;
2957
+ const live = existing.get(annotation.id);
2958
+ if (live !== void 0) {
2959
+ live.dataset.dshEnhanceBadgeNumber = String(number);
2960
+ live.setAttribute("aria-label", badgeLabel(annotation, number));
2961
+ live.title = badgeLabel(annotation, number);
2962
+ const slot = live.querySelector("svg text");
2963
+ if (slot !== null && slot.textContent !== String(number)) live.innerHTML = badgeGlyph(number);
2964
+ return;
2965
+ }
2104
2966
  const ranges = rangesOf(annotation);
2105
2967
  const last = ranges[ranges.length - 1];
2106
- if (last === void 0) continue;
2107
- const badge = createBadge(annotation, onClick);
2968
+ if (last === void 0) return;
2969
+ const badge = createBadge(annotation, number, onClick);
2108
2970
  const anchor = document.createElement("span");
2109
2971
  anchor.setAttribute("data-dsh-enhance-badge-anchor", "");
2110
2972
  anchor.appendChild(badge);
@@ -2116,24 +2978,42 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2116
2978
  else text.parentNode?.insertBefore(anchor, text.splitText(at));
2117
2979
  } else container.parentNode?.insertBefore(anchor, container.nextSibling);
2118
2980
  mounted += 1;
2119
- }
2981
+ });
2120
2982
  return mounted;
2121
2983
  }
2122
2984
  /**
2985
+ * Accessible name for one badge: the reading order number, then the note (or
2986
+ * the passage when the reader left the note empty).
2987
+ * @param annotation - the annotation it marks.
2988
+ * @param number - its 1-based position in the Session's annotation list.
2989
+ * @returns the label shared by `title` and `aria-label`.
2990
+ */
2991
+ function badgeLabel(annotation, number) {
2992
+ return `${number}. ${annotation.note.trim().length > 0 ? annotation.note : annotation.passage}`;
2993
+ }
2994
+ /**
2123
2995
  * Build one badge button.
2996
+ *
2997
+ * The badge carries the annotation's position, not just a pin: with several
2998
+ * passages marked in one conversation, an unnumbered pin says "something here"
2999
+ * where the reader needs "this is the one the tray's first row refers to". The
3000
+ * number sits in a filled circle beside the pin, matching the marker shape the
3001
+ * annotation list uses.
2124
3002
  * @param annotation - the annotation it marks.
3003
+ * @param number - its 1-based position among the Session's annotations.
2125
3004
  * @param onClick - called with the annotation id when activated.
2126
3005
  * @returns the detached button.
2127
3006
  */
2128
- function createBadge(annotation, onClick) {
3007
+ function createBadge(annotation, number, onClick) {
2129
3008
  const badge = document.createElement("button");
2130
3009
  badge.type = "button";
2131
3010
  badge.setAttribute(BADGE_ATTRIBUTE, annotation.id);
2132
3011
  badge.className = "dsh-enhance-badge";
2133
- const label = annotation.note.trim().length > 0 ? annotation.note : annotation.passage;
3012
+ badge.dataset.dshEnhanceBadgeNumber = String(number);
3013
+ const label = badgeLabel(annotation, number);
2134
3014
  badge.title = label;
2135
3015
  badge.setAttribute("aria-label", label);
2136
- badge.innerHTML = PIN_GLYPH;
3016
+ badge.innerHTML = badgeGlyph(number);
2137
3017
  badge.addEventListener("click", (event) => {
2138
3018
  event.stopPropagation();
2139
3019
  event.preventDefault();
@@ -2151,8 +3031,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2151
3031
  parent?.normalize();
2152
3032
  }
2153
3033
  }
2154
- //#endregion
2155
- //#region src/client/SelectionToolbar.tsx
3034
+ // src/client/SelectionToolbar.tsx
2156
3035
  /**
2157
3036
  * Annotation popover: the small composer that appears next to a transcript
2158
3037
  * selection.
@@ -2261,8 +3140,17 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2261
3140
  width: window.innerWidth,
2262
3141
  height: window.innerHeight
2263
3142
  }));
2264
- input.current?.focus({ preventScroll: true });
2265
3143
  }, [captured]);
3144
+ (0, react.useEffect)(() => {
3145
+ if (placement === void 0) return;
3146
+ input.current?.focus({ preventScroll: true });
3147
+ }, [placement]);
3148
+ (0, react.useLayoutEffect)(() => {
3149
+ const field = input.current;
3150
+ if (field === null) return;
3151
+ field.style.height = "auto";
3152
+ field.style.height = `${field.scrollHeight}px`;
3153
+ }, [note, placement]);
2266
3154
  const confirm = (0, react.useCallback)(() => {
2267
3155
  const current = latest.current;
2268
3156
  if (current === void 0) return;
@@ -2298,7 +3186,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2298
3186
  t
2299
3187
  ]);
2300
3188
  if (captured === void 0 || placement === void 0) return null;
2301
- return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3189
+ const portal = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2302
3190
  ref: surface,
2303
3191
  className: "dsh-enhance-popover",
2304
3192
  "data-dsh-enhance-toolbar": "",
@@ -2350,7 +3238,8 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2350
3238
  children: busy ? t("toolbar.sideChat.busy") : t("toolbar.sideChat")
2351
3239
  })]
2352
3240
  })]
2353
- }), document.body);
3241
+ });
3242
+ return (0, react_dom.createPortal)(portal, document.body);
2354
3243
  }
2355
3244
  /**
2356
3245
  * Whether a node sits inside the popover surface.
@@ -2389,8 +3278,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2389
3278
  })
2390
3279
  });
2391
3280
  }
2392
- //#endregion
2393
- //#region src/client/annotations.ts
3281
+ // src/client/annotations.ts
2394
3282
  /** Session id → its ordered annotations. */
2395
3283
  const store = /* @__PURE__ */ new Map();
2396
3284
  /** Identity counter per Session, so ids never repeat within a list. */
@@ -2550,8 +3438,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2550
3438
  }
2551
3439
  return visible.length === 0 ? EMPTY : visible;
2552
3440
  }
2553
- //#endregion
2554
- //#region src/client/AnnotationTray.tsx
3441
+ // src/client/AnnotationTray.tsx
2555
3442
  /**
2556
3443
  * Annotation tray: the pill above the composer, its hover preview, and the
2557
3444
  * editing dialog.
@@ -2575,6 +3462,13 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2575
3462
  const [editing, setEditing] = (0, react.useState)(void 0);
2576
3463
  const [editAnchor, setEditAnchor] = (0, react.useState)(void 0);
2577
3464
  /** Open the editor for one annotation, anchored under the badge that asked. */
3465
+ /**
3466
+ * Whether the editor dialog is open, read from inside timer and pointer
3467
+ * callbacks. A ref keeps the dismissal callbacks stable instead of rebuilding
3468
+ * them on every keystroke in the note field.
3469
+ */
3470
+ const editorOpen = (0, react.useRef)(false);
3471
+ editorOpen.current = editing !== void 0;
2578
3472
  const setEditingAt = (annotation, anchor) => {
2579
3473
  setEditing(annotation);
2580
3474
  setEditAnchor(anchor);
@@ -2589,7 +3483,10 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2589
3483
  (0, react.useEffect)(() => {
2590
3484
  if (editRequest === void 0) return;
2591
3485
  const target = annotations.find((annotation) => annotation.id === editRequest);
2592
- if (target !== void 0) setEditingAt(target, document.querySelector(`[data-dsh-enhance-badge="${editRequest}"]`)?.getBoundingClientRect());
3486
+ if (target !== void 0) {
3487
+ const badge = document.querySelector(`[data-dsh-enhance-badge="${editRequest}"]`);
3488
+ setEditingAt(target, badge?.getBoundingClientRect());
3489
+ }
2593
3490
  onEditRequestHandled?.();
2594
3491
  }, [
2595
3492
  annotations,
@@ -2617,6 +3514,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2617
3514
  closeTimer.current = setTimeout(() => {
2618
3515
  closeTimer.current = null;
2619
3516
  setOpen(false);
3517
+ if (editorOpen.current) return;
2620
3518
  clearHighlight();
2621
3519
  }, 180);
2622
3520
  }, [keepOpen]);
@@ -2624,11 +3522,19 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2624
3522
  const dismissAll = (0, react.useCallback)(() => {
2625
3523
  keepOpen();
2626
3524
  setOpen(false);
3525
+ if (editorOpen.current) return;
2627
3526
  clearHighlight();
2628
3527
  }, [keepOpen]);
2629
3528
  (0, react.useEffect)(() => () => {
2630
3529
  keepOpen();
2631
3530
  }, [keepOpen]);
3531
+ (0, react.useEffect)(() => {
3532
+ if (editing === void 0) return;
3533
+ highlightAnnotation(editing);
3534
+ return () => {
3535
+ clearHighlight();
3536
+ };
3537
+ }, [editing]);
2632
3538
  (0, react.useLayoutEffect)(() => {
2633
3539
  if (!open) {
2634
3540
  setListStyle(void 0);
@@ -2664,7 +3570,8 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2664
3570
  const { clientX: x, clientY: y } = event;
2665
3571
  const overPill = inside(pill.current, x, y);
2666
3572
  const overList = inside(list.current, x, y);
2667
- if (overPill || overList) {
3573
+ const overEditor = editing !== void 0 && inside(document.querySelector("[data-dsh-enhance-edit]"), x, y);
3574
+ if (overPill || overList || overEditor) {
2668
3575
  keepOpen();
2669
3576
  setOpen(true);
2670
3577
  return;
@@ -2677,6 +3584,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2677
3584
  };
2678
3585
  }, [
2679
3586
  annotations.length,
3587
+ editing,
2680
3588
  keepOpen,
2681
3589
  scheduleClose
2682
3590
  ]);
@@ -2780,10 +3688,10 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2780
3688
  className: "dsh-enhance-tray__row",
2781
3689
  "aria-label": t("tray.reveal"),
2782
3690
  onMouseEnter: () => {
2783
- highlightAnnotation(annotation);
3691
+ if (editing === void 0) highlightAnnotation(annotation);
2784
3692
  },
2785
3693
  onMouseLeave: () => {
2786
- clearHighlight();
3694
+ if (editing === void 0) clearHighlight();
2787
3695
  },
2788
3696
  onClick: () => {
2789
3697
  revealAnnotation(annotation);
@@ -2810,7 +3718,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2810
3718
  "aria-label": t("tray.edit"),
2811
3719
  title: t("tray.edit"),
2812
3720
  onMouseEnter: () => {
2813
- highlightAnnotation(annotation);
3721
+ if (editing === void 0) highlightAnnotation(annotation);
2814
3722
  },
2815
3723
  onClick: () => {
2816
3724
  setEditingAt(annotation);
@@ -2839,6 +3747,11 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2839
3747
  onSave: (note) => {
2840
3748
  onEdit(editing.id, note);
2841
3749
  setEditingAt(void 0);
3750
+ },
3751
+ onDelete: () => {
3752
+ onRemove(editing.id);
3753
+ setEditingAt(void 0);
3754
+ dismissAll();
2842
3755
  }
2843
3756
  })
2844
3757
  ]
@@ -2851,15 +3764,25 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2851
3764
  * reading the passage behind it, so the header doubles as a drag handle and the
2852
3765
  * panel never blocks the page.
2853
3766
  */
2854
- function AnnotationEditor({ t, annotation, anchor, onCancel, onSave }) {
3767
+ function AnnotationEditor({ t, annotation, anchor, onCancel, onSave, onDelete }) {
2855
3768
  const [value, setValue] = (0, react.useState)(annotation.note);
2856
3769
  const field = (0, react.useRef)(null);
2857
3770
  const surface = (0, react.useRef)(null);
2858
3771
  const [style, setStyle] = (0, react.useState)(void 0);
2859
3772
  const drag = (0, react.useRef)(null);
2860
3773
  (0, react.useEffect)(() => {
2861
- field.current?.focus({ preventScroll: true });
3774
+ const element = field.current;
3775
+ if (element === null) return;
3776
+ element.focus({ preventScroll: true });
3777
+ const end = element.value.length;
3778
+ element.setSelectionRange(end, end);
2862
3779
  }, []);
3780
+ (0, react.useLayoutEffect)(() => {
3781
+ const element = field.current;
3782
+ if (element === null) return;
3783
+ element.style.height = "auto";
3784
+ element.style.height = `${element.scrollHeight}px`;
3785
+ }, [value]);
2863
3786
  (0, react.useLayoutEffect)(() => {
2864
3787
  if (anchor === void 0) return;
2865
3788
  const element = surface.current;
@@ -2910,17 +3833,29 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
2910
3833
  role: "dialog",
2911
3834
  "aria-label": t("tray.edit"),
2912
3835
  style,
2913
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3836
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2914
3837
  className: "dsh-enhance-edit__head",
2915
3838
  title: annotation.passage,
2916
3839
  onPointerDown,
2917
3840
  onPointerMove,
2918
3841
  onPointerUp: endDrag,
2919
3842
  onPointerCancel: endDrag,
2920
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3843
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2921
3844
  className: "dsh-enhance-edit__label",
2922
3845
  children: collapse(annotation.passage)
2923
- })
3846
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3847
+ type: "button",
3848
+ className: "dsh-enhance-edit__delete",
3849
+ "aria-label": t("tray.remove"),
3850
+ title: t("tray.remove"),
3851
+ onPointerDown: (event) => {
3852
+ event.stopPropagation();
3853
+ },
3854
+ onClick: () => {
3855
+ onDelete();
3856
+ },
3857
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrashGlyph, {})
3858
+ })]
2924
3859
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2925
3860
  className: "dsh-enhance-edit__body",
2926
3861
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
@@ -3002,24 +3937,40 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3002
3937
  }
3003
3938
  /** Trash glyph. */
3004
3939
  function TrashGlyph() {
3005
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
3940
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
3006
3941
  viewBox: "0 0 16 16",
3007
- width: "18",
3008
- height: "18",
3942
+ width: "16",
3943
+ height: "16",
3009
3944
  "aria-hidden": "true",
3010
3945
  focusable: "false",
3011
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
3012
- d: "M3.4 4.6h9.2M6.4 4.6V3.2h3.2v1.4M4.8 4.6l.6 8.2h5.2l.6-8.2",
3013
- fill: "none",
3014
- stroke: "currentColor",
3015
- strokeWidth: "1.2",
3016
- strokeLinecap: "round",
3017
- strokeLinejoin: "round"
3018
- })
3946
+ children: [
3947
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
3948
+ d: "M2.6 4.4h10.8M6.1 4.4V2.9h3.8v1.5",
3949
+ fill: "none",
3950
+ stroke: "currentColor",
3951
+ strokeWidth: "1.35",
3952
+ strokeLinecap: "round",
3953
+ strokeLinejoin: "round"
3954
+ }),
3955
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
3956
+ d: "M4.1 4.4h7.8l-.7 8.1a2 2 0 0 1-2 1.8H6.8a2 2 0 0 1-2-1.8Z",
3957
+ fill: "none",
3958
+ stroke: "currentColor",
3959
+ strokeWidth: "1.35",
3960
+ strokeLinecap: "round",
3961
+ strokeLinejoin: "round"
3962
+ }),
3963
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
3964
+ d: "M6.7 7.2v4.2M9.3 7.2v4.2",
3965
+ fill: "none",
3966
+ stroke: "currentColor",
3967
+ strokeWidth: "1.35",
3968
+ strokeLinecap: "round"
3969
+ })
3970
+ ]
3019
3971
  });
3020
3972
  }
3021
- //#endregion
3022
- //#region src/client/AnnotationSeat.tsx
3973
+ // src/client/AnnotationSeat.tsx
3023
3974
  /**
3024
3975
  * Mount point for the annotation tray and its popover.
3025
3976
  *
@@ -3060,6 +4011,8 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3060
4011
  */
3061
4012
  (0, react.useEffect)(() => {
3062
4013
  const onClick = (id) => {
4014
+ const target = annotationsVisibleIn(sessionId).find((annotation) => annotation.id === id);
4015
+ if (target !== void 0) highlightAnnotation(target);
3063
4016
  setEditingId(id);
3064
4017
  };
3065
4018
  /** Repaint marks and badges; idempotent, so calling it twice costs nothing. */
@@ -3097,6 +4050,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3097
4050
  return () => {
3098
4051
  observer.disconnect();
3099
4052
  removeBadges();
4053
+ clearHighlight();
3100
4054
  clearMarks(sessionId);
3101
4055
  };
3102
4056
  }, [annotations, sessionId]);
@@ -3107,18 +4061,46 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3107
4061
  if (annotations.length === 0) return;
3108
4062
  const card = root.current?.closest("[data-composer-card]");
3109
4063
  if (card === null || card === void 0) return;
4064
+ const primaryOf = () => {
4065
+ return card.querySelector("button[class*=\"_primary\"]") ?? void 0;
4066
+ };
4067
+ /**
4068
+ * Lift the composer's own `empty` decision off the send button.
4069
+ *
4070
+ * React re-renders the button on every draft/store change and puts
4071
+ * `disabled` back, so this runs from the observer below as well as up front.
4072
+ * The attribute is removed rather than faked with CSS: a `disabled` button
4073
+ * swallows the click entirely, and the click is what carries the passages.
4074
+ */
4075
+ const enable = () => {
4076
+ const button = primaryOf();
4077
+ if (button === void 0) return;
4078
+ if (button.disabled) button.disabled = false;
4079
+ if (button.getAttribute("aria-disabled") === "true") button.removeAttribute("aria-disabled");
4080
+ button.dataset.dshEnhanceSendReady = "";
4081
+ };
4082
+ let carrying = false;
3110
4083
  const carry = () => {
3111
- const text = `${annotationsPrompt(annotations)}\n\n`;
3112
- const insertion = inputActions.captureInsertion();
3113
- if (!inputActions.insertText(text, insertion)) {
3114
- inputActions.setDraft(`${draft}${draft === "" ? "" : "\n\n"}${text}`);
3115
- inputActions.persistDraft();
4084
+ if (carrying) return;
4085
+ carrying = true;
4086
+ try {
4087
+ const missing = annotations.filter((annotation) => !draft.includes(annotationLine(annotation)));
4088
+ if (missing.length > 0) {
4089
+ const text = `${annotationsPrompt(missing)}\n\n`;
4090
+ const insertion = inputActions.captureInsertion();
4091
+ if (!inputActions.insertText(text, insertion)) {
4092
+ inputActions.setDraft(`${draft}${draft === "" ? "" : "\n\n"}${text}`);
4093
+ inputActions.persistDraft();
4094
+ }
4095
+ }
4096
+ clearAnnotations(sessionId);
4097
+ } finally {
4098
+ carrying = false;
3116
4099
  }
3117
- clearAnnotations(sessionId);
3118
4100
  };
3119
- const onPointer = (event) => {
4101
+ const onClick = (event) => {
3120
4102
  const target = event.target;
3121
- if (target instanceof Element && target.closest("[class*=\"_primary\"]") !== null) carry();
4103
+ if (target instanceof Element && target.closest("button[class*=\"_primary\"]") !== null) carry();
3122
4104
  };
3123
4105
  const onKey = (event) => {
3124
4106
  if (!(event instanceof KeyboardEvent)) return;
@@ -3126,11 +4108,23 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3126
4108
  const target = event.target;
3127
4109
  if (target instanceof Element && target.closest("[contenteditable=\"true\"]") !== null) carry();
3128
4110
  };
3129
- card.addEventListener("click", onPointer, true);
4111
+ enable();
4112
+ const observer = new MutationObserver(() => {
4113
+ enable();
4114
+ });
4115
+ const button = primaryOf();
4116
+ if (button !== void 0) observer.observe(button, {
4117
+ attributes: true,
4118
+ attributeFilter: ["disabled"]
4119
+ });
4120
+ card.addEventListener("click", onClick, true);
3130
4121
  card.addEventListener("keydown", onKey, true);
3131
4122
  return () => {
3132
- card.removeEventListener("click", onPointer, true);
4123
+ observer.disconnect();
4124
+ card.removeEventListener("click", onClick, true);
3133
4125
  card.removeEventListener("keydown", onKey, true);
4126
+ const current = primaryOf();
4127
+ if (current !== void 0) delete current.dataset.dshEnhanceSendReady;
3134
4128
  };
3135
4129
  }, [
3136
4130
  annotations,
@@ -3186,8 +4180,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3186
4180
  return element.closest("[data-sidebar-chat], [data-dsh-enhance-side-chat]") === null;
3187
4181
  }, [root]);
3188
4182
  }
3189
- //#endregion
3190
- //#region src/client/SideChatBody.tsx
4183
+ // src/client/SideChatBody.tsx
3191
4184
  /**
3192
4185
  * Bind the tab's retained conversation around its slot.
3193
4186
  * @param props - slot shares for this tab occurrence.
@@ -3222,8 +4215,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3222
4215
  hero: false
3223
4216
  }, { slots: { views: FixedChatConversationView } });
3224
4217
  }
3225
- //#endregion
3226
- //#region src/client/side-chat.ts
4218
+ // src/client/side-chat.ts
3227
4219
  /** Stable implementation identity for this plugin's tab type and body. */
3228
4220
  const SIDE_CHAT_TAB_ID = "dsh-enhance";
3229
4221
  /** Resource scheme for one side conversation. */
@@ -3248,7 +4240,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3248
4240
  * @returns the session id, or undefined when the address is not ours.
3249
4241
  */
3250
4242
  function parseSideChatAddress(address) {
3251
- if (!address.startsWith(SIDE_CHAT_ADDRESS)) return void 0;
4243
+ if (!address.startsWith("dsh-resource://dshenhancechat/session/")) return void 0;
3252
4244
  const raw = address.slice(SIDE_CHAT_ADDRESS.length);
3253
4245
  if (raw.length === 0 || raw.includes("/") || raw.includes("?")) return void 0;
3254
4246
  try {
@@ -3338,15 +4330,15 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3338
4330
  locale: LOCALE_NS
3339
4331
  }, SideChatConversation)), "dsh-enhance: side chat conversation");
3340
4332
  }
3341
- //#endregion
3342
- //#region src/client/index.tsx
4333
+ // src/client/index.tsx
3343
4334
  /** The one side conversation this page opens; later requests add to it. */
3344
4335
  let openSideChat;
3345
- /** Required services: slots, dictionaries, session creation, and the right Sidebar. */
4336
+ /** Required services: slots, dictionaries, session status, the Workspace list, and the right Sidebar. */
3346
4337
  const inject = [
3347
4338
  "slots",
3348
4339
  "locale",
3349
4340
  "sessions",
4341
+ "uiSession",
3350
4342
  "workspaces",
3351
4343
  "conversation",
3352
4344
  "sidebarRight",
@@ -3364,7 +4356,16 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3364
4356
  en
3365
4357
  }), "dsh-enhance: dictionaries");
3366
4358
  installStyles(ctx);
3367
- ctx.effect(() => installSidebarFloor(document), "dsh-enhance: sidebar floor");
4359
+ const widthStore = pageStorage();
4360
+ ctx.effect(() => installSidebarFloor(document, {
4361
+ initialWidth: startupSidebarWidth(widthStore),
4362
+ onCommit: (width) => {
4363
+ rememberSidebarWidth(widthStore, width);
4364
+ }
4365
+ }), "dsh-enhance: sidebar floor");
4366
+ ctx.effect(() => installSidebarTopRow(document), "dsh-enhance: sidebar top row");
4367
+ if (isDesktopShell()) ctx.effect(() => installStartupGeometry(window), "dsh-enhance: window geometry");
4368
+ ctx.effect(() => installTurnBadge(ctx), "dsh-enhance: turn badge");
3368
4369
  registerSideChat(ctx, t);
3369
4370
  /**
3370
4371
  * Open a side conversation beside the current one and hand it the passage as
@@ -3423,7 +4424,6 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
3423
4424
  const trimmed = (text.split("\n").find((candidate) => candidate.trim().length > 0) ?? text).replace(/^>\s?/, "").trim();
3424
4425
  return trimmed.length > 48 ? `${trimmed.slice(0, 47)}…` : trimmed;
3425
4426
  }
3426
- //#endregion
3427
4427
  exports.apply = apply;
3428
4428
  exports.inject = inject;
3429
4429
  return module.exports;