@estiva-app/ui 0.119.0 → 0.120.0

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/dist/index.js CHANGED
@@ -2021,7 +2021,7 @@ function MoveDialog({
2021
2021
  description,
2022
2022
  from,
2023
2023
  folders,
2024
- places: places2,
2024
+ places: places3,
2025
2025
  placesIn,
2026
2026
  startAtTop = false,
2027
2027
  topLabel,
@@ -2039,9 +2039,9 @@ function MoveDialog({
2039
2039
  const offered = (id) => !!id && !!destinations?.some((candidate) => candidate.id === id);
2040
2040
  const [pickedFolder, setPickedFolder] = useState5();
2041
2041
  const folder = pickedFolder ?? [startIn, from].find(offered) ?? "";
2042
- const [read, setRead] = useState5(() => places2 ? { [from]: places2 } : {});
2042
+ const [read, setRead] = useState5(() => places3 ? { [from]: places3 } : {});
2043
2043
  const [picked, setPicked] = useState5();
2044
- const requested = useRef7(new Set(places2 ? [from] : []));
2044
+ const requested = useRef7(new Set(places3 ? [from] : []));
2045
2045
  const readPlaces = (id) => {
2046
2046
  if (!placesIn || requested.current.has(id)) return;
2047
2047
  requested.current.add(id);
@@ -4464,34 +4464,98 @@ function NavItem({
4464
4464
  }
4465
4465
 
4466
4466
  // src/NavTree.tsx
4467
- import { createContext as createContext8, useContext as useContext8, useEffect as useEffect11, useRef as useRef17, useState as useState18 } from "react";
4467
+ import { createContext as createContext9, useContext as useContext9, useEffect as useEffect11, useRef as useRef17, useState as useState18 } from "react";
4468
4468
 
4469
4469
  // src/revealCurrentRow.ts
4470
- import { useEffect as useEffect10, useRef as useRef16 } from "react";
4470
+ import { createContext as createContext8, useContext as useContext8, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useMemo as useMemo4, useRef as useRef16 } from "react";
4471
4471
  var REVEAL_MS = 200;
4472
4472
  function scrollToRow(row) {
4473
4473
  let box = row.parentElement;
4474
4474
  while (box && !(/(auto|scroll)/.test(getComputedStyle(box).overflowY) && box.scrollHeight > box.clientHeight)) box = box.parentElement;
4475
4475
  if (!box || box === document.documentElement || box === document.body) return;
4476
+ scrollRowInto(box, row);
4477
+ }
4478
+ function scrollRowInto(box, row) {
4476
4479
  const at = row.getBoundingClientRect();
4477
4480
  const view = box.getBoundingClientRect();
4478
4481
  if (at.top < view.top) box.scrollTop -= view.top - at.top;
4479
4482
  else if (at.bottom > view.bottom) box.scrollTop += Math.min(at.bottom - view.bottom, at.top - view.top);
4480
4483
  }
4481
- function useRevealCurrentRow(box, current) {
4484
+ var keyOf = (row, current) => current ?? row.getAttribute("href") ?? row.textContent ?? "";
4485
+ var places = /* @__PURE__ */ new Map();
4486
+ var RESTORE_MS = 2e3;
4487
+ var ListPlaceContext = createContext8(null);
4488
+ function useListPlace(box, name) {
4489
+ const restoring = useRef16(false);
4490
+ useLayoutEffect5(() => {
4491
+ const el = box.current;
4492
+ if (!el || !name) return;
4493
+ const want = places.get(name)?.top ?? 0;
4494
+ restoring.current = want > 0;
4495
+ let set = el.scrollTop;
4496
+ const keep = () => places.set(name, { ...places.get(name), top: el.scrollTop });
4497
+ const finish = () => {
4498
+ restoring.current = false;
4499
+ };
4500
+ const restore = () => {
4501
+ if (!restoring.current) return;
4502
+ el.scrollTop = want;
4503
+ set = el.scrollTop;
4504
+ if (Math.abs(el.scrollTop - want) < 1) finish();
4505
+ };
4506
+ restore();
4507
+ const open = el.querySelector('[aria-current="page"]');
4508
+ const key = open && open.getBoundingClientRect().height > 0 ? keyOf(open) : void 0;
4509
+ if (open && key !== void 0 && key !== places.get(name)?.shown) {
4510
+ finish();
4511
+ places.set(name, { ...places.get(name), shown: key });
4512
+ scrollRowInto(el, open);
4513
+ set = el.scrollTop;
4514
+ }
4515
+ const grows = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(restore);
4516
+ if (el.firstElementChild) grows?.observe(el.firstElementChild);
4517
+ const until = setTimeout(finish, RESTORE_MS);
4518
+ const took = () => finish();
4519
+ const scrolled = () => {
4520
+ if (restoring.current && Math.abs(el.scrollTop - set) > 1) finish();
4521
+ if (!restoring.current) keep();
4522
+ };
4523
+ const takes = ["wheel", "touchstart", "pointerdown", "keydown"];
4524
+ el.addEventListener("scroll", scrolled, { passive: true });
4525
+ for (const type of takes) el.addEventListener(type, took, { passive: true });
4526
+ return () => {
4527
+ el.removeEventListener("scroll", scrolled);
4528
+ for (const type of takes) el.removeEventListener(type, took);
4529
+ grows?.disconnect();
4530
+ clearTimeout(until);
4531
+ if (!restoring.current) keep();
4532
+ restoring.current = false;
4533
+ };
4534
+ }, [box, name]);
4535
+ return useMemo4(() => ({ name, restoring }), [name]);
4536
+ }
4537
+ function useRevealCurrentRow(box, current, place) {
4482
4538
  const shown2 = useRef16(void 0);
4539
+ const within = useContext8(ListPlaceContext);
4540
+ const deferred = !place && within !== null;
4483
4541
  useEffect10(() => {
4484
4542
  const root = box.current;
4485
- if (!root) return;
4543
+ if (!root || deferred) return;
4544
+ const was = () => place?.name ? places.get(place.name)?.shown : shown2.current;
4545
+ const showing = (key) => {
4546
+ if (place?.name) places.set(place.name, { ...places.get(place.name), shown: key });
4547
+ else shown2.current = key;
4548
+ };
4486
4549
  let timer;
4487
4550
  const look = () => {
4488
4551
  timer = void 0;
4489
4552
  const row = root.querySelector('[aria-current="page"]');
4490
4553
  if (!row) return;
4491
- const key = current ?? row.getAttribute("href") ?? row.textContent ?? "";
4492
- if (shown2.current === key) return;
4554
+ const key = keyOf(row, current);
4555
+ if (was() === key) return;
4493
4556
  if (row.getBoundingClientRect().height === 0) return;
4494
- shown2.current = key;
4557
+ if (place) place.restoring.current = false;
4558
+ showing(key);
4495
4559
  scrollToRow(row);
4496
4560
  };
4497
4561
  const soon = () => {
@@ -4504,7 +4568,7 @@ function useRevealCurrentRow(box, current) {
4504
4568
  watch?.disconnect();
4505
4569
  if (timer !== void 0) clearTimeout(timer);
4506
4570
  };
4507
- }, [box, current]);
4571
+ }, [box, current, place, deferred]);
4508
4572
  }
4509
4573
 
4510
4574
  // src/NavTree.tsx
@@ -4537,7 +4601,7 @@ function openingFor(groups, selected, selectedParent) {
4537
4601
  function Line({ message }) {
4538
4602
  return /* @__PURE__ */ jsx59(EmptyState, { scope: "rows", message });
4539
4603
  }
4540
- var groupLinked = createContext8(void 0);
4604
+ var groupLinked = createContext9(void 0);
4541
4605
  function groupBox(box, id) {
4542
4606
  const group = [...box?.querySelectorAll("[data-nav-group]") ?? []].find((one) => one.dataset.navGroup === id);
4543
4607
  return group && group.getBoundingClientRect().height > 0 ? group : void 0;
@@ -4601,7 +4665,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
4601
4665
  return () => clearTimeout(wait);
4602
4666
  }, [pending]);
4603
4667
  const intent = onIntent;
4604
- const linkedTo = useContext8(groupLinked);
4668
+ const linkedTo = useContext9(groupLinked);
4605
4669
  const linked = id !== void 0 && linkedTo === id ? id : void 0;
4606
4670
  return /* @__PURE__ */ jsx59(
4607
4671
  "div",
@@ -4668,13 +4732,13 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
4668
4732
  }
4669
4733
 
4670
4734
  // src/Popover.tsx
4671
- import { useMemo as useMemo4 } from "react";
4735
+ import { useMemo as useMemo5 } from "react";
4672
4736
  import { Popover as BasePopover } from "@base-ui/react/popover";
4673
4737
  import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
4674
4738
  var GAP6 = 4;
4675
4739
  var VIEWPORT_PAD6 = 8;
4676
4740
  function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpenChange, finalFocus, actionsRef, ariaLabel, children, className, contentClassName, maxHeight }) {
4677
- const anchorTarget = useMemo4(() => {
4741
+ const anchorTarget = useMemo5(() => {
4678
4742
  if (!anchor) return void 0;
4679
4743
  if (anchor instanceof Element || "getBoundingClientRect" in anchor) return anchor;
4680
4744
  return { getBoundingClientRect: () => anchor };
@@ -4723,11 +4787,11 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
4723
4787
  }
4724
4788
 
4725
4789
  // src/SuggestionMenu.tsx
4726
- import { useCallback as useCallback5, useEffect as useEffect12, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as useRef18, useState as useState19 } from "react";
4790
+ import { useCallback as useCallback5, useEffect as useEffect12, useId as useId5, useImperativeHandle, useMemo as useMemo6, useRef as useRef18, useState as useState19 } from "react";
4727
4791
  import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
4728
4792
  function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
4729
4793
  const last = useRef18(null);
4730
- const anchor = useMemo5(() => {
4794
+ const anchor = useMemo6(() => {
4731
4795
  if (typeof rect !== "function") return rect;
4732
4796
  return {
4733
4797
  getBoundingClientRect: () => {
@@ -4737,8 +4801,8 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
4737
4801
  contextElement: editorElement ?? void 0
4738
4802
  };
4739
4803
  }, [rect, editorElement]);
4740
- const shown2 = useMemo5(() => sections.filter((section) => section.items.length > 0), [sections]);
4741
- const items = useMemo5(() => shown2.flatMap((section) => section.items), [shown2]);
4804
+ const shown2 = useMemo6(() => sections.filter((section) => section.items.length > 0), [sections]);
4805
+ const items = useMemo6(() => shown2.flatMap((section) => section.items), [shown2]);
4742
4806
  const keys = items.map(itemKey).join("\n");
4743
4807
  const [highlight, setHighlight] = useState19(0);
4744
4808
  const base = useId5();
@@ -4836,7 +4900,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
4836
4900
  }
4837
4901
 
4838
4902
  // src/ShowMore.tsx
4839
- import { useLayoutEffect as useLayoutEffect5, useRef as useRef19, useState as useState20 } from "react";
4903
+ import { useLayoutEffect as useLayoutEffect6, useRef as useRef19, useState as useState20 } from "react";
4840
4904
  import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
4841
4905
  import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
4842
4906
  var FADE = "linear-gradient(to top, transparent, black 40px)";
@@ -4844,7 +4908,7 @@ function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
4844
4908
  const box = useRef19(null);
4845
4909
  const [open, setOpen] = useState20(false);
4846
4910
  const [overflows, setOverflows] = useState20(false);
4847
- useLayoutEffect5(() => {
4911
+ useLayoutEffect6(() => {
4848
4912
  const el = box.current;
4849
4913
  if (!el) return;
4850
4914
  const measure = () => setOverflows(el.scrollHeight > maxHeight + 1);
@@ -4948,8 +5012,8 @@ function ReactionPicker({ options, onSelect, "aria-label": ariaLabel = "Reaction
4948
5012
  }
4949
5013
 
4950
5014
  // src/linked.ts
4951
- import { createContext as createContext9 } from "react";
4952
- var inTheBox = createContext9(false);
5015
+ import { createContext as createContext10 } from "react";
5016
+ var inTheBox = createContext10(false);
4953
5017
  function chosenOf(picker) {
4954
5018
  return picker?.value === void 0 ? void 0 : picker.options.find((option) => option.value === picker.value);
4955
5019
  }
@@ -5173,7 +5237,7 @@ function titleOf(object) {
5173
5237
  function idOf(object) {
5174
5238
  return object.address ?? object.eventId ?? object.ref;
5175
5239
  }
5176
- function keyOf(object) {
5240
+ function keyOf2(object) {
5177
5241
  return object.meta.find((slot) => (slot.field === "ref" || slot.field === "key") && !slot.isPubkey && slot.value)?.value;
5178
5242
  }
5179
5243
  function ownerSlotOf(object) {
@@ -5192,7 +5256,7 @@ function childrenOf(object, options) {
5192
5256
  const status = child.slots.status;
5193
5257
  const owner = ownerSlotOf(child);
5194
5258
  const person = owner ? child.people?.[owner.value] : void 0;
5195
- const key = keyOf(child);
5259
+ const key = keyOf2(child);
5196
5260
  return {
5197
5261
  id: idOf(child),
5198
5262
  title: titleOf(child),
@@ -5277,7 +5341,7 @@ function linkedFrom(object, options) {
5277
5341
  };
5278
5342
  }
5279
5343
  const onAct = object.archived ? void 0 : options.onAct;
5280
- const key = keyOf(object);
5344
+ const key = keyOf2(object);
5281
5345
  const noun = nounOf(object);
5282
5346
  const status = statusOf(object, onAct);
5283
5347
  const owner = ownerOf(object, options, onAct);
@@ -5325,7 +5389,7 @@ function linkStateFrom(object, unread, options) {
5325
5389
  }
5326
5390
 
5327
5391
  // src/LinkParts.tsx
5328
- import { useContext as useContext9 } from "react";
5392
+ import { useContext as useContext10 } from "react";
5329
5393
  import { IconCircleCheck, IconCircleDashed as IconCircleDashed3, IconCircleHalf2, IconCircleX, IconFileText, IconMessage2 as IconMessage22 } from "@tabler/icons-react";
5330
5394
  import { jsx as jsx65, jsxs as jsxs47 } from "react/jsx-runtime";
5331
5395
  var STATUS_ICON = {
@@ -5382,7 +5446,7 @@ function countWords(count, noun) {
5382
5446
  }
5383
5447
  function CommentCount({ conversation, noun = "comments" }) {
5384
5448
  const { count, href, unread = false } = conversation;
5385
- const boxed = useContext9(inTheBox);
5449
+ const boxed = useContext10(inTheBox);
5386
5450
  const said = countWords(count, noun);
5387
5451
  if (boxed || !href) {
5388
5452
  return /* @__PURE__ */ jsxs47("span", { className: cn("inline-flex h-6 shrink-0 items-center gap-1 px-1.5 text-small tabular-nums", unread ? "font-medium text-text-primary" : "text-text-secondary"), children: [
@@ -5462,10 +5526,10 @@ function LinkPickers({ status, owner, ownerLabel = "Owner", readOnly = false, di
5462
5526
  import { useSyncExternalStore } from "react";
5463
5527
 
5464
5528
  // src/LinkCard.tsx
5465
- import { useContext as useContext11 } from "react";
5529
+ import { useContext as useContext12 } from "react";
5466
5530
 
5467
5531
  // src/LinkRow.tsx
5468
- import { useContext as useContext10 } from "react";
5532
+ import { useContext as useContext11 } from "react";
5469
5533
  import { jsx as jsx66, jsxs as jsxs48 } from "react/jsx-runtime";
5470
5534
  var ROW_CLASSES2 = "flex items-center gap-3 p-1.5 pr-3";
5471
5535
  function LinkUnavailable({ kind, noun, named: named2 = false, card = false, deleted = false, failed = false }) {
@@ -5476,7 +5540,7 @@ function unavailableWords(noun, { named: named2 = false, deleted = false, failed
5476
5540
  return deleted ? `${named2 ? `File in ${noun}` : noun} deleted` : failed ? `Couldn't load this ${word}` : `You can't open this ${word}`;
5477
5541
  }
5478
5542
  function UnavailableRow({ kind, words, href, card = false }) {
5479
- const wide = useContext10(inTheBox);
5543
+ const wide = useContext11(inTheBox);
5480
5544
  return /* @__PURE__ */ jsxs48(Card, { fill: wide ? "elevated" : "inset", className: cn(card ? "flex items-center gap-3 p-3" : ROW_CLASSES2, "max-w-[480px]"), children: [
5481
5545
  /* @__PURE__ */ jsx66("span", { className: TYPE_TILE_CLASSES, children: /* @__PURE__ */ jsx66(LinkedIcon, { kind }) }),
5482
5546
  /* @__PURE__ */ jsx66("span", { className: "min-w-0 flex-1 truncate text-body-2 text-text-muted", children: href && !wide ? /* @__PURE__ */ jsx66(Link, { href, variant: "quiet", children: words }) : words })
@@ -5538,12 +5602,12 @@ function LinkRow({ link, preview = true }) {
5538
5602
  import { Fragment as Fragment17, jsx as jsx67, jsxs as jsxs49 } from "react/jsx-runtime";
5539
5603
  var CARD_CLASSES = "flex flex-col gap-3 p-3";
5540
5604
  function CardLink({ href, truncate = false, className, children }) {
5541
- const boxed = useContext11(inTheBox);
5605
+ const boxed = useContext12(inTheBox);
5542
5606
  if (boxed || !href) return /* @__PURE__ */ jsx67("span", { className: cn(truncate && "truncate", className), children });
5543
5607
  return /* @__PURE__ */ jsx67(Link, { href, variant: "quiet", truncate, className, children });
5544
5608
  }
5545
5609
  function LinkCard({ link, readOnly = false, bare = false }) {
5546
- const boxed = useContext11(inTheBox);
5610
+ const boxed = useContext12(inTheBox);
5547
5611
  if (link.state === "loading") return /* @__PURE__ */ jsx67(LinkCardLoading, { kind: link.kind, shape: link.shape });
5548
5612
  if (link.state === "unavailable") {
5549
5613
  if (link.url) return /* @__PURE__ */ jsx67(WrittenUrl, { url: link.url, block: true });
@@ -5555,7 +5619,7 @@ function LinkCard({ link, readOnly = false, bare = false }) {
5555
5619
  return /* @__PURE__ */ jsx67(Card, { fill: boxed ? "elevated" : "inset", className: cn(CARD_CLASSES, "max-w-[480px]"), children: body });
5556
5620
  }
5557
5621
  function CardBody({ linked, readOnly }) {
5558
- const boxed = useContext11(inTheBox);
5622
+ const boxed = useContext12(inTheBox);
5559
5623
  const on = boxed ? "elevated" : "inset";
5560
5624
  const meta = linkMetaOf(linked);
5561
5625
  const footed = Boolean(linked.status || linked.owner || linked.authors || linked.updated);
@@ -5629,7 +5693,7 @@ var KIND_SHAPE = {
5629
5693
  };
5630
5694
  function LinkCardLoading({ kind, shape }) {
5631
5695
  const { subtitle = false, summary = true, rows = 0, latest = false, ring = false, footer = "line" } = shape ?? KIND_SHAPE[kind];
5632
- const boxed = useContext11(inTheBox);
5696
+ const boxed = useContext12(inTheBox);
5633
5697
  return /* @__PURE__ */ jsx67("div", { className: "animate-skeleton-in", "aria-busy": true, children: /* @__PURE__ */ jsxs49(Card, { fill: boxed ? "elevated" : "inset", "aria-hidden": true, className: cn(CARD_CLASSES, "max-w-[480px]"), children: [
5634
5698
  /* @__PURE__ */ jsxs49("div", { className: "flex items-center gap-3", children: [
5635
5699
  /* @__PURE__ */ jsx67("span", { className: TYPE_TILE_CLASSES, children: /* @__PURE__ */ jsx67(LinkedIcon, { kind }) }),
@@ -5719,9 +5783,9 @@ function LinkChip({ link, preview = true }) {
5719
5783
  }
5720
5784
 
5721
5785
  // src/AttachedCard.tsx
5722
- import { createContext as createContext10, useContext as useContext12, useEffect as useEffect13, useRef as useRef20 } from "react";
5786
+ import { createContext as createContext11, useContext as useContext13, useEffect as useEffect13, useRef as useRef20 } from "react";
5723
5787
  import { Fragment as Fragment19, jsx as jsx70, jsxs as jsxs51 } from "react/jsx-runtime";
5724
- var Attached = createContext10(false);
5788
+ var Attached = createContext11(false);
5725
5789
  function useRememberedHeight(link, remember, box) {
5726
5790
  const memory = remember?.memory;
5727
5791
  const id = remember?.id;
@@ -5756,7 +5820,7 @@ function AttachedCard({ link, children, onRemove, remember }) {
5756
5820
  const { kept, held } = useRememberedHeight(link, remember, box);
5757
5821
  const shown2 = link?.state === "loading" && !link.shape && kept ? { ...link, shape: kept } : link;
5758
5822
  const card = shown2 ? /* @__PURE__ */ jsx70(LinkCard, { link: shown2 }) : children;
5759
- const inside = useContext12(Attached);
5823
+ const inside = useContext13(Attached);
5760
5824
  if (inside) {
5761
5825
  return remember ? /* @__PURE__ */ jsx70("div", { ref: box, style: held, children: card }) : /* @__PURE__ */ jsx70(Fragment19, { children: card });
5762
5826
  }
@@ -5817,11 +5881,11 @@ function CornerMenu({ children, menu }) {
5817
5881
  }
5818
5882
 
5819
5883
  // src/PartCard.tsx
5820
- import { useContext as useContext13 } from "react";
5884
+ import { useContext as useContext14 } from "react";
5821
5885
  import { jsx as jsx72, jsxs as jsxs53 } from "react/jsx-runtime";
5822
5886
  function PartCard({ state = "ready", kind, heading, href, partKey, noun, children, maxHeight }) {
5823
5887
  const word = noun ?? kindNounOf({ kind }) ?? "File";
5824
- const boxed = useContext13(inTheBox);
5888
+ const boxed = useContext14(inTheBox);
5825
5889
  if (state === "loading") return /* @__PURE__ */ jsx72(LinkCardLoading, { kind, shape: { summary: true, rows: 0, footer: "none" } });
5826
5890
  if (state === "unavailable" || state === "deleted") {
5827
5891
  return /* @__PURE__ */ jsx72(LinkUnavailable, { kind, noun: state === "deleted" ? `A part of this ${word.toLowerCase()}` : word, deleted: state === "deleted", card: true });
@@ -6039,7 +6103,7 @@ function ConversationActions({ options, onReact, onReply, resolved = false, onRe
6039
6103
  }
6040
6104
 
6041
6105
  // src/ConversationCard.tsx
6042
- import { useContext as useContext14, useLayoutEffect as useLayoutEffect7, useRef as useRef21, useState as useState26 } from "react";
6106
+ import { useContext as useContext15, useLayoutEffect as useLayoutEffect8, useRef as useRef21, useState as useState26 } from "react";
6043
6107
  import { IconArrowNarrowRight, IconCircleCheck as IconCircleCheck4, IconDotsVertical as IconDotsVertical5 } from "@tabler/icons-react";
6044
6108
 
6045
6109
  // src/ConversationMenu.tsx
@@ -6075,7 +6139,7 @@ function ConversationMenu({ resolved = false, onResolve, onReopen, resolveHint,
6075
6139
  }
6076
6140
 
6077
6141
  // src/conversationScroll.ts
6078
- import { createContext as createContext11, useEffect as useEffect14, useState as useState22 } from "react";
6142
+ import { createContext as createContext12, useEffect as useEffect14, useState as useState22 } from "react";
6079
6143
  var NEAR_BOTTOM_PX = 80;
6080
6144
  function isNearBottom(el) {
6081
6145
  return el.scrollHeight - el.scrollTop - el.clientHeight <= NEAR_BOTTOM_PX;
@@ -6150,20 +6214,20 @@ function useSteadyScroll(scrollRef, atBottom, ready, key, enabled) {
6150
6214
  }, [scrollRef, atBottom, ready, key, enabled, handle]);
6151
6215
  return handle;
6152
6216
  }
6153
- var places = /* @__PURE__ */ new Map();
6217
+ var places2 = /* @__PURE__ */ new Map();
6154
6218
  function useLeftAt(key) {
6155
6219
  const [taken, setTaken] = useState22();
6156
6220
  if (!key && taken) setTaken(void 0);
6157
6221
  if (key && taken?.key !== key) {
6158
- const left = places.get(key);
6222
+ const left = places2.get(key);
6159
6223
  const at = left && !left.atBottom ? left.leftAt : null;
6160
6224
  setTaken({ key, at });
6161
6225
  return at;
6162
6226
  }
6163
6227
  return key && taken?.key === key ? taken.at : null;
6164
6228
  }
6165
- var sendsInLayout = createContext11(null);
6166
- var repliesDrawn = createContext11(null);
6229
+ var sendsInLayout = createContext12(null);
6230
+ var repliesDrawn = createContext12(null);
6167
6231
 
6168
6232
  // src/EditedMarker.tsx
6169
6233
  import { jsx as jsx81 } from "react/jsx-runtime";
@@ -6303,18 +6367,18 @@ function ResolveDialog({ onResolve, onCancel, refused }) {
6303
6367
  }
6304
6368
 
6305
6369
  // src/threadCard.ts
6306
- import { createContext as createContext12, useLayoutEffect as useLayoutEffect6, useState as useState25 } from "react";
6307
- var InThreadCard = createContext12(false);
6308
- var InConversationItem = createContext12(null);
6309
- var caretOnOpen = createContext12(0);
6310
- var LineByLayout = createContext12(false);
6370
+ import { createContext as createContext13, useLayoutEffect as useLayoutEffect7, useState as useState25 } from "react";
6371
+ var InThreadCard = createContext13(false);
6372
+ var InConversationItem = createContext13(null);
6373
+ var caretOnOpen = createContext13(0);
6374
+ var LineByLayout = createContext13(false);
6311
6375
  var exactTime = (at) => new Date(at).toLocaleString(void 0, { dateStyle: "long", timeStyle: "short" });
6312
6376
  var momentOf = (at) => at !== void 0 && Number.isFinite(at) ? at : void 0;
6313
6377
  var SHOWN_CLASSES = "data-[shown]:animate-shown data-[shown]:rounded-lg motion-reduce:data-[shown]:animate-none motion-reduce:data-[shown]:bg-accent-wash";
6314
6378
  var FACE_GAP = 4;
6315
6379
  function useFaceLine(root, active, toDot = false) {
6316
6380
  const [line, setLine] = useState25(null);
6317
- useLayoutEffect6(() => {
6381
+ useLayoutEffect7(() => {
6318
6382
  const el = root.current;
6319
6383
  if (!active || !el) {
6320
6384
  setLine(null);
@@ -6374,7 +6438,7 @@ function When({ time, at: given, timeHref, timeLabel = "Link to this" }) {
6374
6438
  var fadeBefore = (end) => `linear-gradient(to right, black ${end - 16}px, transparent ${end}px)`;
6375
6439
  function useClearOfStrip(root, strip, shown2) {
6376
6440
  const [end, setEnd] = useState26();
6377
- useLayoutEffect7(() => {
6441
+ useLayoutEffect8(() => {
6378
6442
  const words = root.current?.querySelector("[data-head]");
6379
6443
  if (!shown2 || !words || !strip.current) {
6380
6444
  setEnd(void 0);
@@ -6527,8 +6591,8 @@ function ConversationCard(props) {
6527
6591
  const { author, about, files, reactions, isNew = false, urgent = false, own = false, editor, heading, deleted: isDeleted = false, unseen = false, replies, onReply, resolved, noun = "comment", onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", className, children } = props;
6528
6592
  const deleted = isDeleted || unseen;
6529
6593
  const readOnly = (props.readOnly ?? false) || deleted;
6530
- const inThreadCard = useContext14(InThreadCard);
6531
- const item = useContext14(InConversationItem);
6594
+ const inThreadCard = useContext15(InThreadCard);
6595
+ const item = useContext15(InConversationItem);
6532
6596
  const [hovered, setHovered] = useState26(false);
6533
6597
  const [menuOpen, setMenuOpen] = useState26(false);
6534
6598
  const [picking, setPicking] = useState26(false);
@@ -6682,8 +6746,8 @@ function ReplyCard(props) {
6682
6746
  const strip = useRef21(null);
6683
6747
  const wordsEnd = useClearOfStrip(root, strip, showStrip);
6684
6748
  const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)));
6685
- const drawn = useContext14(repliesDrawn);
6686
- useLayoutEffect7(() => {
6749
+ const drawn = useContext15(repliesDrawn);
6750
+ useLayoutEffect8(() => {
6687
6751
  if (drawn) drawn.added += 1;
6688
6752
  }, [drawn]);
6689
6753
  return /* @__PURE__ */ jsxs64(Fragment23, { children: [
@@ -6755,7 +6819,7 @@ function ReplyCard(props) {
6755
6819
  }
6756
6820
 
6757
6821
  // src/ConversationLayout.tsx
6758
- import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect16, useLayoutEffect as useLayoutEffect8, useRef as useRef22, useState as useState28 } from "react";
6822
+ import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect16, useLayoutEffect as useLayoutEffect9, useRef as useRef22, useState as useState28 } from "react";
6759
6823
 
6760
6824
  // src/Panel.tsx
6761
6825
  import { jsx as jsx87, jsxs as jsxs65 } from "react/jsx-runtime";
@@ -6831,7 +6895,7 @@ function showInConversationWhenDrawn(id, { wait = WAIT_MS, ...options } = {}) {
6831
6895
  }
6832
6896
 
6833
6897
  // src/seenOnScreen.ts
6834
- import { useEffect as useEffect15, useMemo as useMemo6, useState as useState27 } from "react";
6898
+ import { useEffect as useEffect15, useMemo as useMemo7, useState as useState27 } from "react";
6835
6899
  var NONE = /* @__PURE__ */ new Set();
6836
6900
  var DWELL_MS = 1500;
6837
6901
  var TALL_ENOUGH_PX = 120;
@@ -6908,7 +6972,7 @@ function useSeenOnScreen(key) {
6908
6972
  };
6909
6973
  }, [key, watcher]);
6910
6974
  const ids = seen.key === key ? seen.ids : NONE;
6911
- return useMemo6(() => {
6975
+ return useMemo7(() => {
6912
6976
  const handle = { ids };
6913
6977
  watchers.set(handle, watcher);
6914
6978
  return handle;
@@ -7067,7 +7131,7 @@ function ConversationLayout({
7067
7131
  byPress.current = true;
7068
7132
  onOpenChange(next);
7069
7133
  } : void 0;
7070
- useLayoutEffect8(() => {
7134
+ useLayoutEffect9(() => {
7071
7135
  const at = pressed.current;
7072
7136
  pressed.current = null;
7073
7137
  const item = at && itemAt(at.id);
@@ -7087,11 +7151,11 @@ function ConversationLayout({
7087
7151
  const el = body.current;
7088
7152
  if (beside && el) {
7089
7153
  nearBottom.current = isNearBottom(el);
7090
- if (rememberAs && placedFor.current === rememberAs) places.set(rememberAs, { atBottom: nearBottom.current, offset: el.scrollTop, anchor: anchorIn(el), leftAt: Date.now() });
7154
+ if (rememberAs && placedFor.current === rememberAs) places2.set(rememberAs, { atBottom: nearBottom.current, offset: el.scrollTop, anchor: anchorIn(el), leftAt: Date.now() });
7091
7155
  }
7092
7156
  onBodyScroll?.(event);
7093
7157
  };
7094
- useLayoutEffect8(() => {
7158
+ useLayoutEffect9(() => {
7095
7159
  if (!beside) return;
7096
7160
  if (loading) {
7097
7161
  placedFor.current = null;
@@ -7100,13 +7164,13 @@ function ConversationLayout({
7100
7164
  if (placedFor.current === placeKey) return;
7101
7165
  const el = body.current;
7102
7166
  if (!el) return;
7103
- const left = rememberAs ? places.get(rememberAs) : void 0;
7167
+ const left = rememberAs ? places2.get(rememberAs) : void 0;
7104
7168
  const opened2 = open !== void 0 ? itemAt(open) : null;
7105
7169
  if (opened2) {
7106
7170
  landOn(el, opened2);
7107
7171
  markShown(opened2);
7108
7172
  nearBottom.current = isNearBottom(el);
7109
- if (rememberAs) places.set(rememberAs, { atBottom: nearBottom.current, offset: el.scrollTop, anchor: anchorIn(el), leftAt: Date.now() });
7173
+ if (rememberAs) places2.set(rememberAs, { atBottom: nearBottom.current, offset: el.scrollTop, anchor: anchorIn(el), leftAt: Date.now() });
7110
7174
  } else if (left && !left.atBottom) {
7111
7175
  el.scrollTop = left.offset;
7112
7176
  const card = left.anchor && cardIn(el, left.anchor.id);
@@ -7115,11 +7179,11 @@ function ConversationLayout({
7115
7179
  } else {
7116
7180
  el.scrollTop = el.scrollHeight;
7117
7181
  nearBottom.current = true;
7118
- if (rememberAs) places.set(rememberAs, { atBottom: true, offset: el.scrollTop, leftAt: Date.now() });
7182
+ if (rememberAs) places2.set(rememberAs, { atBottom: true, offset: el.scrollTop, leftAt: Date.now() });
7119
7183
  }
7120
7184
  placedFor.current = placeKey;
7121
7185
  }, [beside, placeKey, rememberAs, loading]);
7122
- useLayoutEffect8(() => {
7186
+ useLayoutEffect9(() => {
7123
7187
  const pressedIt = byPress.current;
7124
7188
  byPress.current = false;
7125
7189
  if (!beside || pressedIt || open === void 0 || placedFor.current !== placeKey) return;
@@ -7135,11 +7199,11 @@ function ConversationLayout({
7135
7199
  useEffect16(() => {
7136
7200
  if (!beside || !rememberAs) return;
7137
7201
  return () => {
7138
- const left = places.get(rememberAs);
7139
- if (left) places.set(rememberAs, { ...left, leftAt: Date.now() });
7202
+ const left = places2.get(rememberAs);
7203
+ if (left) places2.set(rememberAs, { ...left, leftAt: Date.now() });
7140
7204
  };
7141
7205
  }, [beside, rememberAs]);
7142
- useLayoutEffect8(() => {
7206
+ useLayoutEffect9(() => {
7143
7207
  if (!beside || loading || !nearBottom.current) return;
7144
7208
  const el = body.current;
7145
7209
  if (el) el.scrollTop = el.scrollHeight;
@@ -7362,7 +7426,7 @@ function NoAccessNotice({ what }) {
7362
7426
  }
7363
7427
 
7364
7428
  // src/Thread.tsx
7365
- import { Children, useCallback as useCallback7, useContext as useContext15, useLayoutEffect as useLayoutEffect9, useRef as useRef23, useState as useState32 } from "react";
7429
+ import { Children, useCallback as useCallback7, useContext as useContext16, useLayoutEffect as useLayoutEffect10, useRef as useRef23, useState as useState32 } from "react";
7366
7430
  import { IconX as IconX6 } from "@tabler/icons-react";
7367
7431
  import { Fragment as Fragment27, jsx as jsx97, jsxs as jsxs74 } from "react/jsx-runtime";
7368
7432
  var always = () => true;
@@ -7403,7 +7467,7 @@ function Thread({
7403
7467
  const [drawn] = useState32(() => ({ added: 0 }));
7404
7468
  const last = useRef23(null);
7405
7469
  const steady = useSteadyScroll(body, void 0, always, start?.id, place === "beside");
7406
- useLayoutEffect9(() => {
7470
+ useLayoutEffect10(() => {
7407
7471
  const el = body.current;
7408
7472
  if (place !== "beside" || !el) return;
7409
7473
  const now = { added: drawn.added, start: start?.id };
@@ -7413,7 +7477,7 @@ function Thread({
7413
7477
  steady.rebase();
7414
7478
  });
7415
7479
  const foot = notice ?? box;
7416
- const layoutLine = useContext15(LineByLayout);
7480
+ const layoutLine = useContext16(LineByLayout);
7417
7481
  if (place === "under") {
7418
7482
  return /* @__PURE__ */ jsxs74("div", { ref: under, "data-thread": "under", className: cn("flex flex-col", className), children: [
7419
7483
  (loading || anyIn(children)) && // The replies hang from a line under the comment's face (20px in: its 8px and half its 24px), one step in (Ship's way).
@@ -7516,9 +7580,10 @@ function PageHeader({ title, leading, private: locked = false, after, meta, time
7516
7580
  // src/ListColumn.tsx
7517
7581
  import { useRef as useRef24 } from "react";
7518
7582
  import { jsx as jsx100, jsxs as jsxs77 } from "react/jsx-runtime";
7519
- function Column({ title, chevron = false, titleMenu, actions, above, collapsed = false, children, className, broken = false }) {
7583
+ function Column({ title, chevron = false, titleMenu, actions, above, collapsed = false, children, rememberAs, className, broken = false }) {
7520
7584
  const rows = useRef24(null);
7521
- useRevealCurrentRow(rows);
7585
+ const place = useListPlace(rows, broken ? void 0 : rememberAs);
7586
+ useRevealCurrentRow(rows, void 0, place);
7522
7587
  return /* @__PURE__ */ jsxs77(
7523
7588
  "div",
7524
7589
  {
@@ -7537,7 +7602,7 @@ function Column({ title, chevron = false, titleMenu, actions, above, collapsed =
7537
7602
  broken ? (
7538
7603
  // The message takes the room the list had and centres itself in it (Katerina, 19 September).
7539
7604
  /* @__PURE__ */ jsx100("div", { className: "flex min-h-0 flex-1 flex-col px-3", children })
7540
- ) : /* @__PURE__ */ jsx100(ScrollArea, { className: "flex-1", viewportRef: rows, contentClassName: "flex flex-col gap-0.5 px-3 pt-4 pb-3", children })
7605
+ ) : /* @__PURE__ */ jsx100(ScrollArea, { className: "flex-1", viewportRef: rows, contentClassName: "flex flex-col gap-0.5 px-3 pt-4 pb-3", children: /* @__PURE__ */ jsx100(ListPlaceContext.Provider, { value: place, children }) })
7541
7606
  ]
7542
7607
  }
7543
7608
  );
@@ -7557,7 +7622,7 @@ function ListColumn(props) {
7557
7622
  }
7558
7623
 
7559
7624
  // src/ListTable.tsx
7560
- import { createContext as createContext13, useCallback as useCallback8, useContext as useContext16, useLayoutEffect as useLayoutEffect10, useRef as useRef25, useState as useState33 } from "react";
7625
+ import { createContext as createContext14, useCallback as useCallback8, useContext as useContext17, useLayoutEffect as useLayoutEffect11, useRef as useRef25, useState as useState33 } from "react";
7561
7626
  import { jsx as jsx101, jsxs as jsxs78 } from "react/jsx-runtime";
7562
7627
  var WIDTH_PX = { small: 80, medium: 96, large: 112 };
7563
7628
  var WIDTH_CLASSES = { small: "w-20", medium: "w-24", large: "w-28" };
@@ -7567,7 +7632,7 @@ var sizeOf = (column) => column.width ?? DEFAULT_WIDTH;
7567
7632
  var ROW_FRAME_PX = 24 + 16 + 12;
7568
7633
  var GAP_PX = 12;
7569
7634
  var END_PX = 64;
7570
- var ListTableContext = createContext13(null);
7635
+ var ListTableContext = createContext14(null);
7571
7636
  var showsColumn = (column, shown2) => shown2 === "all" || shown2 === "high" && (column.keep ?? "high") === "high";
7572
7637
  var widthOf = (columns, end) => ROW_FRAME_PX + NAME_LEAST_PX + columns.reduce((sum, column) => sum + GAP_PX + WIDTH_PX[sizeOf(column)], 0) + (end ? GAP_PX + END_PX : 0);
7573
7638
  function ListTable({ "aria-label": label, nameLabel = "Name", columns, end = false, headings = true, children, className }) {
@@ -7579,7 +7644,7 @@ function ListTable({ "aria-label": label, nameLabel = "Name", columns, end = fal
7579
7644
  const high = columns.filter((column) => (column.keep ?? "high") === "high");
7580
7645
  setShown(width >= widthOf(columns, end) ? "all" : width >= widthOf(high, end) ? "high" : "none");
7581
7646
  }, [columns, end]);
7582
- useLayoutEffect10(() => {
7647
+ useLayoutEffect11(() => {
7583
7648
  measure();
7584
7649
  const list = box.current;
7585
7650
  if (!list || typeof ResizeObserver === "undefined") return;
@@ -7600,7 +7665,7 @@ function ListTable({ "aria-label": label, nameLabel = "Name", columns, end = fal
7600
7665
  ] }) });
7601
7666
  }
7602
7667
  function ListTableRow({ href, label, description, icon, cells, end, onClick, ...rest }) {
7603
- const table = useContext16(ListTableContext);
7668
+ const table = useContext17(ListTableContext);
7604
7669
  if (!table) throw new Error("ListTableRow is a row of a ListTable: put it inside one.");
7605
7670
  return (
7606
7671
  // A row's look in every list: 8px corners, the fill under the pointer and no edge.
@@ -7677,7 +7742,7 @@ function Tabs({ tabs, active, onChange, size = "default", className, ...aria })
7677
7742
  }
7678
7743
 
7679
7744
  // src/Toast.tsx
7680
- import { createContext as createContext14, useContext as useContext17, useMemo as useMemo7 } from "react";
7745
+ import { createContext as createContext15, useContext as useContext18, useMemo as useMemo8 } from "react";
7681
7746
  import { Toast as BaseToast } from "@base-ui/react/toast";
7682
7747
  import { IconAlertCircle as IconAlertCircle2, IconCircleCheck as IconCircleCheck5, IconCircleX as IconCircleX2 } from "@tabler/icons-react";
7683
7748
  import { jsx as jsx103, jsxs as jsxs80 } from "react/jsx-runtime";
@@ -7728,11 +7793,11 @@ function Toast({ label, type = "neutral", leadingIcon = true, actionLabel, onAct
7728
7793
  hasAction && /* @__PURE__ */ jsx103(Button, { variant: "outlined", size: "small", onClick: onAction, children: actionLabel })
7729
7794
  ] });
7730
7795
  }
7731
- var ToastContext = createContext14(null);
7796
+ var ToastContext = createContext15(null);
7732
7797
  var VISIBLE_TOASTS = 3;
7733
7798
  function ToastProvider({ children }) {
7734
- const manager = useMemo7(() => BaseToast.createToastManager(), []);
7735
- const value = useMemo7(
7799
+ const manager = useMemo8(() => BaseToast.createToastManager(), []);
7800
+ const value = useMemo8(
7736
7801
  () => ({
7737
7802
  showToast: ({ label, type = "neutral", leadingIcon = true, actionLabel, onAction, durationMs = 5e3, onClose }) => manager.add({
7738
7803
  title: label,
@@ -7785,7 +7850,7 @@ function ToastList() {
7785
7850
  });
7786
7851
  }
7787
7852
  function useToast() {
7788
- const ctx = useContext17(ToastContext);
7853
+ const ctx = useContext18(ToastContext);
7789
7854
  if (!ctx) throw new Error("useToast must be used within ToastProvider");
7790
7855
  return ctx;
7791
7856
  }