@crewlethq/ui 0.97.1 → 0.98.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/AddPill/AddPill.d.ts +3 -1
- package/dist/AddPill/index.js +1 -1
- package/dist/{AddPill-FPM5RUKI.css → AddPill-OP3MMVZG.css} +13 -0
- package/dist/AgentHandoffPanel/index.js +12 -8
- package/dist/AppShell/index.js +9 -8
- package/dist/ArrangeFrame/index.js +9 -2
- package/dist/ArrangeList/index.js +10 -5
- package/dist/ArtifactBar/index.js +12 -11
- package/dist/ArtifactCard/index.js +9 -4
- package/dist/ArtifactPanel/index.js +8 -4
- package/dist/AttentionList/index.js +9 -2
- package/dist/AvatarPicker/index.js +13 -10
- package/dist/BriefCard/index.js +9 -2
- package/dist/Button/Button.d.ts +6 -0
- package/dist/Button/index.js +8 -1
- package/dist/Canvas/Canvas.d.ts +18 -1
- package/dist/Canvas/index.js +9 -8
- package/dist/{Canvas-4QJHVLJ4.css → Canvas-UQVR7IUL.css} +43 -0
- package/dist/CanvasBoard/index.js +11 -10
- package/dist/CanvasToolbar/index.js +10 -9
- package/dist/ChangeMark/index.js +4 -4
- package/dist/ChatMessage/index.js +9 -2
- package/dist/ChatThread/index.js +9 -2
- package/dist/CheckGrid/index.js +9 -4
- package/dist/Checkbox/index.js +8 -3
- package/dist/ChipField/index.js +1 -1
- package/dist/CodeBlock/index.js +11 -4
- package/dist/ColorField/index.js +8 -3
- package/dist/ColorSwatch/index.js +11 -4
- package/dist/Combobox/index.js +8 -3
- package/dist/CommandPalette/index.js +10 -7
- package/dist/CommentThread/index.js +10 -6
- package/dist/CompactNav/index.js +3 -3
- package/dist/Composer/index.js +8 -4
- package/dist/ConfirmField/index.js +8 -3
- package/dist/ConflictNote/index.js +9 -2
- package/dist/ContrastHelp/index.js +7 -4
- package/dist/Copyable/index.js +10 -3
- package/dist/DataGrid/index.js +10 -5
- package/dist/DataTable/index.js +12 -9
- package/dist/DataView/index.js +16 -13
- package/dist/DateTimePicker/index.js +9 -6
- package/dist/DeepWorkCard/index.js +10 -3
- package/dist/DocTabsEditor/index.js +10 -7
- package/dist/DownloadButton/index.js +9 -2
- package/dist/{Editor-63L5QQDN.js → Editor-QWGTLJHM.js} +9 -6
- package/dist/EmojiPicker/index.js +9 -8
- package/dist/EntityChip/EntityChip.d.ts +9 -1
- package/dist/EntityChip/index.js +1 -1
- package/dist/ErrorBoundary/index.js +9 -2
- package/dist/FactList/index.js +4 -4
- package/dist/FileDrop/index.js +9 -2
- package/dist/FilterPill/index.js +9 -2
- package/dist/FollowBanner/index.js +7 -3
- package/dist/HuePicker/index.js +11 -8
- package/dist/IconButton/IconButton.d.ts +6 -0
- package/dist/IconButton/index.js +8 -1
- package/dist/InlineEditor/index.js +7 -3
- package/dist/Input/index.js +7 -2
- package/dist/KeyValueRows/index.js +9 -4
- package/dist/Layer/index.d.ts +1 -1
- package/dist/Layer/index.js +1 -1
- package/dist/Layer/place.d.ts +6 -0
- package/dist/Link/Link.d.ts +6 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-CLURSR2O.css → Link-Z23PLCVS.css} +9 -0
- package/dist/LinkInterstitial/index.js +9 -6
- package/dist/ListInput/index.js +9 -5
- package/dist/LogoSlot/index.js +10 -3
- package/dist/MarkdownEditor/index.js +12 -9
- package/dist/MemberPicker/index.js +9 -4
- package/dist/Menu/Menu.d.ts +7 -1
- package/dist/Menu/index.js +8 -5
- package/dist/MergeConflicts/index.js +12 -9
- package/dist/MessageActions/index.js +10 -10
- package/dist/Modal/index.js +8 -5
- package/dist/ObjectHeader/index.js +2 -2
- package/dist/OpenInAppCard/index.js +10 -3
- package/dist/OrgLabel/OrgLabel.d.ts +14 -0
- package/dist/OrgLabel/index.js +1 -1
- package/dist/{OrgLabel-R5KY7C3W.css → OrgLabel-6UGWHDQQ.css} +38 -0
- package/dist/OrgNode/index.js +2 -2
- package/dist/OrgTable/OrgTable.d.ts +28 -3
- package/dist/OrgTable/index.d.ts +1 -1
- package/dist/OrgTable/index.js +17 -7
- package/dist/{OrgTable-JZSYTUIK.css → OrgTable-GBRYKTDH.css} +68 -2
- package/dist/PeekRail/index.js +10 -3
- package/dist/PeopleRail/index.js +10 -3
- package/dist/PinTile/index.js +9 -2
- package/dist/Popover/index.js +2 -2
- package/dist/PresenterView/index.js +9 -5
- package/dist/PrincipalPicker/index.js +9 -4
- package/dist/PropertyList/index.js +3 -3
- package/dist/ProposalCard/index.js +11 -6
- package/dist/RailList/index.js +3 -3
- package/dist/ReactionBar/index.js +10 -10
- package/dist/ReceiptStrip/index.js +9 -2
- package/dist/RecordChip/index.js +3 -3
- package/dist/ResultTableCard/index.js +10 -3
- package/dist/RichEditor/index.js +9 -2
- package/dist/SandboxedFrame/index.js +9 -2
- package/dist/SegmentedControl/index.js +11 -8
- package/dist/{SegmentedControl-7GY2KM44.css → SegmentedControl-PWTB7KEE.css} +4 -1
- package/dist/Select/index.js +2 -2
- package/dist/SelectionBar/index.js +7 -3
- package/dist/SendButton/index.js +9 -2
- package/dist/ShareDialog/index.js +11 -8
- package/dist/SheetColumnEditor/index.js +15 -12
- package/dist/SheetGrid/index.js +11 -10
- package/dist/Shortcut/index.js +1 -1
- package/dist/SidePanel/index.js +7 -3
- package/dist/SlideCompare/index.js +7 -3
- package/dist/SlideFilmstrip/index.js +9 -6
- package/dist/SlideGrid/index.js +1 -1
- package/dist/SlideNav/index.js +9 -2
- package/dist/SlideStage/index.js +1 -1
- package/dist/StatusLegend/StatusLegend.d.ts +31 -0
- package/dist/StatusLegend/index.d.ts +3 -0
- package/dist/StatusLegend/index.js +4 -0
- package/dist/StatusLegend-7MS2SBVC.css +77 -0
- package/dist/StatusLine/StatusLine.d.ts +32 -0
- package/dist/StatusLine/index.d.ts +3 -0
- package/dist/StatusLine/index.js +10 -0
- package/dist/StatusLine-C6IY3U2F.css +55 -0
- package/dist/Switch/Switch.d.ts +2 -0
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-XJE34BZH.css → Switch-M3VVQMCY.css} +21 -0
- package/dist/Switcher/index.js +11 -8
- package/dist/TableCells/index.js +2 -2
- package/dist/Tabs/index.js +9 -6
- package/dist/TagsInput/index.js +7 -3
- package/dist/ThemeSwitcher/index.js +12 -9
- package/dist/ThemeToggle/index.js +9 -2
- package/dist/TimeRangePicker/index.js +14 -11
- package/dist/TimeWindowPicker/index.js +11 -8
- package/dist/Toaster/index.js +2 -2
- package/dist/Toolbar/index.js +1 -1
- package/dist/Tooltip/index.js +3 -3
- package/dist/TreeCanvas/TreeCanvas.d.ts +38 -2
- package/dist/TreeCanvas/index.d.ts +1 -1
- package/dist/TreeCanvas/index.js +10 -9
- package/dist/{TreeCanvas-5FPK4CII.css → TreeCanvas-X5RCUSTP.css} +24 -0
- package/dist/TreeGrid/TreeGrid.d.ts +26 -3
- package/dist/TreeGrid/index.js +8 -4
- package/dist/{TreeGrid-522U6WBG.css → TreeGrid-PZ3DFVRO.css} +24 -0
- package/dist/ValueField/index.js +10 -6
- package/dist/VersionCompare/index.js +12 -9
- package/dist/VersionTimeline/index.js +9 -2
- package/dist/{chunk-QF5UNP4T.js → chunk-2PB5D4TI.js} +1 -1
- package/dist/{chunk-7ZJ662U4.js → chunk-2W4US3JO.js} +3 -3
- package/dist/{chunk-NCUSI4ZU.js → chunk-33632WEN.js} +54 -14
- package/dist/{chunk-VB3FVKNI.js → chunk-3JAGO633.js} +1 -1
- package/dist/{chunk-XA2QKGBJ.js → chunk-3QBQY2XK.js} +1 -1
- package/dist/{chunk-2BZ2W2YU.js → chunk-3Z2BSKS5.js} +5 -5
- package/dist/{chunk-5U6XAUYM.js → chunk-4FNAPCCK.js} +1 -1
- package/dist/{chunk-IJ7KLXUZ.js → chunk-4OHBHPIB.js} +1 -1
- package/dist/{chunk-3LKOXQWZ.js → chunk-4QTOAMQN.js} +1 -1
- package/dist/{chunk-5YXMKZUA.js → chunk-4XYKBZJE.js} +8 -3
- package/dist/{chunk-EHFQMY3B.js → chunk-52UBOSNQ.js} +1 -1
- package/dist/{chunk-KCLHYBIZ.js → chunk-56ES76ST.js} +1 -1
- package/dist/{chunk-B3BJ66GQ.js → chunk-5JGEEUWQ.js} +2 -2
- package/dist/{chunk-WJZTI2WC.js → chunk-5KJOG5YP.js} +7 -7
- package/dist/{chunk-IUBOLGHG.js → chunk-5KKZCSER.js} +1 -1
- package/dist/{chunk-7K6LVM5I.js → chunk-63NRTOGO.js} +3 -3
- package/dist/chunk-6FS6W3P5.js +37 -0
- package/dist/chunk-6FVTKYH6.js +37 -0
- package/dist/{chunk-DGXZ635L.js → chunk-6KUOHUY5.js} +29 -24
- package/dist/{chunk-5AJR6X75.js → chunk-6V465OCU.js} +1 -1
- package/dist/{chunk-FRERGOW3.js → chunk-7IW4BVZF.js} +1 -1
- package/dist/{chunk-G3JY2DLC.js → chunk-7L6JJ7VJ.js} +1 -1
- package/dist/{chunk-CWJLDCB7.js → chunk-A5ISYHW7.js} +3 -3
- package/dist/{chunk-SDHLAW3G.js → chunk-AAP7A6WV.js} +2 -2
- package/dist/{chunk-AQCWYVE3.js → chunk-AC255TMQ.js} +1 -1
- package/dist/{chunk-K4LZXSKZ.js → chunk-AEFR4M2W.js} +1 -1
- package/dist/{chunk-GC3UQZPL.js → chunk-AEUZU5SA.js} +1 -1
- package/dist/{chunk-5MOBCUNA.js → chunk-AHPMAPVN.js} +2 -2
- package/dist/{chunk-2HBY3FOZ.js → chunk-AP6SM6BL.js} +3 -3
- package/dist/{chunk-NTGAPLMJ.js → chunk-BC4H2EMM.js} +1 -1
- package/dist/{chunk-OGOLTPFQ.js → chunk-BCZQDB3U.js} +1 -1
- package/dist/{chunk-QW4LAFTX.js → chunk-BK4KUIAZ.js} +1 -1
- package/dist/{chunk-T2GC7UAP.js → chunk-C34CKBKF.js} +1 -1
- package/dist/{chunk-LAZ72JOP.js → chunk-CQIODINH.js} +2 -2
- package/dist/{chunk-HZBXC3YD.js → chunk-CTNQOSQF.js} +2 -2
- package/dist/{chunk-3N3XK2G5.js → chunk-CZKEABMI.js} +3 -1
- package/dist/{chunk-HZPUMGQV.js → chunk-D4MMW2NF.js} +3 -3
- package/dist/{chunk-K66TAOJA.js → chunk-DBH7ORCH.js} +2 -2
- package/dist/{chunk-FXGQWLZ6.js → chunk-DK7CXQFY.js} +1 -1
- package/dist/{chunk-RO5JU6SN.js → chunk-E23AXDKL.js} +1 -1
- package/dist/{chunk-SKGOKLJD.js → chunk-E2XDYCFO.js} +1 -1
- package/dist/{chunk-XSJSDNRR.js → chunk-EF3CJDZO.js} +3 -3
- package/dist/{chunk-ZXXZESCD.js → chunk-EMDRNB23.js} +3 -3
- package/dist/{chunk-BHVEHAAX.js → chunk-EMXUREKE.js} +3 -3
- package/dist/{chunk-3P7XS5VT.js → chunk-FBNGCPKZ.js} +2 -2
- package/dist/{chunk-OMV5W53A.js → chunk-FIX72ZEC.js} +15 -1
- package/dist/{chunk-QWRAWKB2.js → chunk-FMOYO5OO.js} +2 -2
- package/dist/{chunk-GYVEKHVI.js → chunk-FP6OFRAU.js} +1 -1
- package/dist/{chunk-AVWEXCJ4.js → chunk-GA773IOZ.js} +2 -2
- package/dist/{chunk-XJMES7AE.js → chunk-GBBRSZ2J.js} +1 -1
- package/dist/{chunk-SNQ7PH3D.js → chunk-GDYZPBLI.js} +1 -1
- package/dist/{chunk-DRFOTWJE.js → chunk-GWRU4JHQ.js} +2 -2
- package/dist/{chunk-3NO5GRZY.js → chunk-HMXTZKAI.js} +4 -4
- package/dist/{chunk-QDGHOGSW.js → chunk-HTCNTCBE.js} +2 -2
- package/dist/{chunk-SRHLFQ4J.js → chunk-HU5PAZMU.js} +3 -3
- package/dist/{chunk-T5HZ5AYW.js → chunk-IA3NL54W.js} +4 -4
- package/dist/{chunk-3IWZVEXA.js → chunk-IAR2ULSK.js} +1 -1
- package/dist/{chunk-4ME4J3YY.js → chunk-IDBGDMQS.js} +1 -1
- package/dist/{chunk-WSHKY7SH.js → chunk-IGECN5B6.js} +1 -1
- package/dist/{chunk-OMMHKM6I.js → chunk-IYJCJOHW.js} +1 -1
- package/dist/{chunk-YTIXNVS7.js → chunk-J3QFTG4B.js} +3 -3
- package/dist/{chunk-TGGYSQRD.js → chunk-JK6WLRYP.js} +34 -22
- package/dist/{chunk-NKBKHOMU.js → chunk-JQCKRABK.js} +1 -1
- package/dist/{chunk-PICHV3PC.js → chunk-JZADK2FT.js} +3 -3
- package/dist/{chunk-4RLUVHYP.js → chunk-L72GPZ56.js} +1 -1
- package/dist/{chunk-EC6EUIAD.js → chunk-LCAKSEMB.js} +1 -1
- package/dist/{chunk-IPMJGK2Q.js → chunk-LYVWOAUN.js} +1 -1
- package/dist/{chunk-CFJ7FQZI.js → chunk-M6EVTMTK.js} +1 -1
- package/dist/{chunk-TGSOHXXH.js → chunk-M6G7XLLP.js} +1 -1
- package/dist/{chunk-JIBWNHTC.js → chunk-MIQNKO2R.js} +1 -1
- package/dist/{chunk-QGEDXYLB.js → chunk-MJ73YBP2.js} +2 -2
- package/dist/{chunk-BBKYJQZ6.js → chunk-MOP4D5HF.js} +5 -5
- package/dist/{chunk-Y7PPKQFQ.js → chunk-MTKHMGJH.js} +5 -5
- package/dist/{chunk-KQWJWTED.js → chunk-N7H5TFQK.js} +1 -1
- package/dist/{chunk-LJ3KWQLP.js → chunk-NBOHNPZB.js} +1 -1
- package/dist/{chunk-M576OESX.js → chunk-NKNG6YER.js} +1 -1
- package/dist/{chunk-ZDMZP5H4.js → chunk-OAKECTYH.js} +6 -6
- package/dist/{chunk-LMEMH6DO.js → chunk-OSU4ELU3.js} +2 -2
- package/dist/{chunk-5ILRWUE7.js → chunk-P667Y6NQ.js} +1 -1
- package/dist/{chunk-LGPTZGHJ.js → chunk-PF6X74C5.js} +8 -8
- package/dist/{chunk-6FAI4VLM.js → chunk-PJMDZEWY.js} +1 -1
- package/dist/{chunk-OSH55AKI.js → chunk-PMO6W5NE.js} +3 -3
- package/dist/{chunk-ZPTKAYJK.js → chunk-QH2YJDRI.js} +1 -1
- package/dist/{chunk-VTQSSU2E.js → chunk-QND44ROZ.js} +1 -1
- package/dist/{chunk-AELKT34H.js → chunk-QPRTTTUN.js} +1 -1
- package/dist/{chunk-7ZSEUO5Q.js → chunk-QZKGFBAR.js} +2 -2
- package/dist/{chunk-OC6BMY3C.js → chunk-RBR4AHBT.js} +1 -1
- package/dist/chunk-ROFAWLFS.js +352 -0
- package/dist/{chunk-VONEKR3J.js → chunk-RPCIU4S5.js} +1 -1
- package/dist/{chunk-2NNMBEJV.js → chunk-RSI6EJSH.js} +5 -5
- package/dist/{chunk-GNJXUNEU.js → chunk-RVJJZVVS.js} +1 -1
- package/dist/{chunk-V6WDJUYK.js → chunk-SF6FUU42.js} +1 -1
- package/dist/{chunk-CVKANYHD.js → chunk-SSN7Y3UY.js} +1 -1
- package/dist/{chunk-BMBQ6UMD.js → chunk-TAWPKNNZ.js} +1 -1
- package/dist/{chunk-I4IO56EY.js → chunk-TKAERQQF.js} +1 -1
- package/dist/{chunk-AXEXOAZQ.js → chunk-TVGTMKYO.js} +1 -1
- package/dist/{chunk-FPU7AA3X.js → chunk-UUDQEDHQ.js} +72 -26
- package/dist/{chunk-2SVQBQAD.js → chunk-V7WDP3HR.js} +3 -3
- package/dist/{chunk-65RFU7LF.js → chunk-VDQGWPGQ.js} +4 -1
- package/dist/{chunk-H4WQWCHP.js → chunk-VULZ4FAA.js} +2 -2
- package/dist/{chunk-UAUP6XGK.js → chunk-WDLAAZFZ.js} +30 -24
- package/dist/{chunk-6EZX26BD.js → chunk-WF2UJYCT.js} +1 -1
- package/dist/{chunk-EVM6GYZ2.js → chunk-WSR4OB4T.js} +1 -1
- package/dist/{chunk-LM3ISVJA.js → chunk-X4HBZSXA.js} +1 -1
- package/dist/{chunk-CDNZTCP2.js → chunk-XHQ2JJCB.js} +2 -2
- package/dist/{chunk-O3II3KJY.js → chunk-XLVWSNW3.js} +3 -3
- package/dist/{chunk-TXOTL7AA.js → chunk-YEQTGPCE.js} +3 -3
- package/dist/{chunk-ZWCK4N4L.js → chunk-YS4PWTNL.js} +1 -1
- package/dist/{chunk-B3PK2LND.js → chunk-YYKLPEOS.js} +1 -1
- package/dist/chunk-Z6E3WOWS.js +189 -0
- package/dist/{chunk-ETNQYT5O.js → chunk-ZGKGSW42.js} +2 -2
- package/dist/{chunk-OPVTNHPH.js → chunk-ZKC3QFDX.js} +2 -2
- package/dist/{chunk-NTRKC2JV.js → chunk-ZUWEVSDP.js} +1 -1
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +132 -130
- package/dist/index.js +132 -130
- package/dist/styles.css +391 -12
- package/dist/utils/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-DWQYV5AV.js +0 -141
- package/dist/chunk-ZDWAIVWL.js +0 -310
- /package/dist/{chunk-VNACAMDK.js → chunk-2DYEPDT7.js} +0 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { useTreeState, treeExpandable, treeLevel, treePosInSet, treeSetSize, treeItemAction, treePrevious, treeNext, treeStep } from './chunk-MY374UUD.js';
|
|
2
|
+
import { LayerNodeBridge } from './chunk-X4HBZSXA.js';
|
|
3
|
+
import { IconButton } from './chunk-WDLAAZFZ.js';
|
|
4
|
+
import { LayerHost, LAYER_REPOSITION_EVENT } from './chunk-FIX72ZEC.js';
|
|
5
|
+
import { focusables } from './chunk-TUEM2XIW.js';
|
|
6
|
+
import { VisuallyHidden } from './chunk-UT6CW3C7.js';
|
|
7
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
8
|
+
import './TreeGrid-PZ3DFVRO.css';
|
|
9
|
+
import { useRef, useState, useLayoutEffect, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
|
|
10
|
+
import { ChevronRightGlyph } from '@crewlethq/icons/glyphs';
|
|
11
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var LABELS = {
|
|
14
|
+
expand: (label) => `Expand ${label}`,
|
|
15
|
+
collapse: (label) => `Collapse ${label}`
|
|
16
|
+
};
|
|
17
|
+
function controlIn(cell) {
|
|
18
|
+
return focusables(cell).find((el) => !el.closest('[aria-hidden="true"]')) ?? null;
|
|
19
|
+
}
|
|
20
|
+
var TEXT_INPUTS = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password", "number"]);
|
|
21
|
+
function caretKey(target, key) {
|
|
22
|
+
const lines = target instanceof HTMLTextAreaElement || target.isContentEditable;
|
|
23
|
+
const field = lines || target instanceof HTMLInputElement && TEXT_INPUTS.has(target.type);
|
|
24
|
+
if (!field) return false;
|
|
25
|
+
if (key === "ArrowLeft" || key === "ArrowRight" || key === "Home" || key === "End") return true;
|
|
26
|
+
return lines && (key === "ArrowUp" || key === "ArrowDown");
|
|
27
|
+
}
|
|
28
|
+
function TreeGrid({
|
|
29
|
+
label,
|
|
30
|
+
columns,
|
|
31
|
+
rows: forest,
|
|
32
|
+
renderCell,
|
|
33
|
+
cellHasControl,
|
|
34
|
+
onRowKey,
|
|
35
|
+
onRowKeyDown,
|
|
36
|
+
hasRowMenu,
|
|
37
|
+
addRow,
|
|
38
|
+
selectedId = null,
|
|
39
|
+
onSelect,
|
|
40
|
+
readOnly,
|
|
41
|
+
defaultExpanded,
|
|
42
|
+
expanded: held,
|
|
43
|
+
onExpandedChange,
|
|
44
|
+
headless = false,
|
|
45
|
+
layout = "scroll",
|
|
46
|
+
onWidthChange,
|
|
47
|
+
labels,
|
|
48
|
+
ref,
|
|
49
|
+
className
|
|
50
|
+
}) {
|
|
51
|
+
const text = { ...LABELS, ...labels };
|
|
52
|
+
const frame = useRef(null);
|
|
53
|
+
const [width, setWidth] = useState(0);
|
|
54
|
+
const reportWidth = useRef(onWidthChange);
|
|
55
|
+
reportWidth.current = onWidthChange;
|
|
56
|
+
const measures = onWidthChange !== void 0 || columns.some((one) => one.hideBelow !== void 0);
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
const el = frame.current;
|
|
59
|
+
if (!measures || !el) return;
|
|
60
|
+
const read = (next) => setWidth(Math.round(next));
|
|
61
|
+
read(el.getBoundingClientRect().width);
|
|
62
|
+
if (typeof ResizeObserver !== "function") return;
|
|
63
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
64
|
+
if (entry) read(entry.contentRect.width);
|
|
65
|
+
});
|
|
66
|
+
observer.observe(el);
|
|
67
|
+
return () => observer.disconnect();
|
|
68
|
+
}, [measures]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (width > 0) reportWidth.current?.(width);
|
|
71
|
+
}, [width]);
|
|
72
|
+
const drawn = useMemo(
|
|
73
|
+
() => columns.filter((one) => one.hideBelow === void 0 || width <= 0 || width >= one.hideBelow),
|
|
74
|
+
[columns, width]
|
|
75
|
+
);
|
|
76
|
+
const tree = useTreeState(forest, selectedId, { defaultExpanded, expanded: held, onExpandedChange });
|
|
77
|
+
const { model, expanded, rows, active, setActive, toggle } = tree;
|
|
78
|
+
const [column, setColumn] = useState(null);
|
|
79
|
+
const [menuFor, setMenuFor] = useState(null);
|
|
80
|
+
const current = useRef({ addRow, onSelect });
|
|
81
|
+
current.current = { addRow, onSelect };
|
|
82
|
+
const isAddRow = (id) => current.current.addRow?.(id) ?? null;
|
|
83
|
+
const rowEls = useRef(/* @__PURE__ */ new Map());
|
|
84
|
+
const refs = useRef(/* @__PURE__ */ new Map());
|
|
85
|
+
const rowRef = (id) => {
|
|
86
|
+
let callback = refs.current.get(id);
|
|
87
|
+
if (!callback) {
|
|
88
|
+
callback = (el) => {
|
|
89
|
+
if (el) rowEls.current.set(id, el);
|
|
90
|
+
else rowEls.current.delete(id);
|
|
91
|
+
};
|
|
92
|
+
refs.current.set(id, callback);
|
|
93
|
+
}
|
|
94
|
+
return callback;
|
|
95
|
+
};
|
|
96
|
+
const [request, setRequest] = useState(null);
|
|
97
|
+
const focusAt = useCallback(
|
|
98
|
+
(id, col) => {
|
|
99
|
+
if (current.current.addRow?.(id) == null) current.current.onSelect?.(id);
|
|
100
|
+
setActive(id);
|
|
101
|
+
setColumn(col);
|
|
102
|
+
setRequest({ id, column: col });
|
|
103
|
+
},
|
|
104
|
+
[setActive]
|
|
105
|
+
);
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
const row = request ? rowEls.current.get(request.id) : void 0;
|
|
108
|
+
if (!request || !row) return;
|
|
109
|
+
if (request.column === null) {
|
|
110
|
+
row.focus();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const cell = row.querySelector(`[aria-colindex="${request.column}"]`);
|
|
114
|
+
const control = cell ? controlIn(cell) : null;
|
|
115
|
+
(control ?? cell ?? row).focus();
|
|
116
|
+
}, [request]);
|
|
117
|
+
const focusRef = useRef(() => {
|
|
118
|
+
});
|
|
119
|
+
focusRef.current = (id) => {
|
|
120
|
+
if (!model.parent.has(id)) return;
|
|
121
|
+
tree.open(id);
|
|
122
|
+
focusAt(id, null);
|
|
123
|
+
};
|
|
124
|
+
const { expandAll, collapseAll } = tree;
|
|
125
|
+
useImperativeHandle(
|
|
126
|
+
ref,
|
|
127
|
+
() => ({ focusNode: (id) => focusRef.current(id), expandAll, collapseAll }),
|
|
128
|
+
[expandAll, collapseAll]
|
|
129
|
+
);
|
|
130
|
+
function onKeyDownCapture(event) {
|
|
131
|
+
const target = event.target;
|
|
132
|
+
const row = target.closest("[data-tree-id]");
|
|
133
|
+
if (!row) return;
|
|
134
|
+
const id = row.getAttribute("data-tree-id");
|
|
135
|
+
const onRow = target === row;
|
|
136
|
+
const cellIndex = target.closest("[role='gridcell']")?.getAttribute("aria-colindex");
|
|
137
|
+
const col = onRow || !cellIndex ? null : Number(cellIndex);
|
|
138
|
+
const add = isAddRow(id);
|
|
139
|
+
const cells = add ? add.cells : drawn.length;
|
|
140
|
+
const handled = () => {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
event.stopPropagation();
|
|
143
|
+
};
|
|
144
|
+
if (onRow && add === null) {
|
|
145
|
+
if (onRowKeyDown?.(id, event)) {
|
|
146
|
+
handled();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const action = treeItemAction(event);
|
|
150
|
+
if (action === "menu") {
|
|
151
|
+
if (hasRowMenu?.(id)) {
|
|
152
|
+
handled();
|
|
153
|
+
setMenuFor(id);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (action !== null) {
|
|
158
|
+
if (onRowKey?.(id, action)) handled();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
163
|
+
const sameColumn = (next) => {
|
|
164
|
+
if (next === null) return;
|
|
165
|
+
const other = isAddRow(next);
|
|
166
|
+
const count = other ? other.cells : drawn.length;
|
|
167
|
+
focusAt(next, col === null ? null : Math.min(col, count));
|
|
168
|
+
};
|
|
169
|
+
if (col !== null && caretKey(target, event.key)) return;
|
|
170
|
+
if (col !== null) {
|
|
171
|
+
switch (event.key) {
|
|
172
|
+
case "ArrowRight":
|
|
173
|
+
handled();
|
|
174
|
+
if (col < cells) focusAt(id, col + 1);
|
|
175
|
+
return;
|
|
176
|
+
case "ArrowLeft":
|
|
177
|
+
handled();
|
|
178
|
+
focusAt(id, col > 1 ? col - 1 : null);
|
|
179
|
+
return;
|
|
180
|
+
case "Home":
|
|
181
|
+
handled();
|
|
182
|
+
focusAt(id, 1);
|
|
183
|
+
return;
|
|
184
|
+
case "End":
|
|
185
|
+
handled();
|
|
186
|
+
focusAt(id, cells);
|
|
187
|
+
return;
|
|
188
|
+
case "ArrowDown":
|
|
189
|
+
handled();
|
|
190
|
+
sameColumn(treeNext(model, expanded, id));
|
|
191
|
+
return;
|
|
192
|
+
case "ArrowUp":
|
|
193
|
+
handled();
|
|
194
|
+
sameColumn(treePrevious(model, expanded, id));
|
|
195
|
+
return;
|
|
196
|
+
default:
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (event.key === "ArrowRight" && !(treeExpandable(model, id) && !expanded.has(id))) {
|
|
201
|
+
handled();
|
|
202
|
+
focusAt(id, 1);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (add !== null && event.key === "Enter") {
|
|
206
|
+
handled();
|
|
207
|
+
focusAt(id, 1);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const step = treeStep(tree, id, event);
|
|
211
|
+
if (step === void 0) return;
|
|
212
|
+
handled();
|
|
213
|
+
if (step === null) return;
|
|
214
|
+
if ("toggle" in step) toggle(step.toggle);
|
|
215
|
+
else focusAt(step.focus, null);
|
|
216
|
+
}
|
|
217
|
+
const [layer, setLayer] = useState(null);
|
|
218
|
+
const onScroll = () => layer?.dispatchEvent(new CustomEvent(LAYER_REPOSITION_EVENT));
|
|
219
|
+
const stop = (id, col) => id === active && column === col;
|
|
220
|
+
const grid = {
|
|
221
|
+
expanded: (id) => expanded.has(id),
|
|
222
|
+
expandable: (id) => treeExpandable(model, id),
|
|
223
|
+
toggle,
|
|
224
|
+
tabStop: stop,
|
|
225
|
+
opened: (id, col) => {
|
|
226
|
+
setActive(id);
|
|
227
|
+
setColumn(col);
|
|
228
|
+
},
|
|
229
|
+
press: (id) => ({
|
|
230
|
+
onMouseDown: (event) => {
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
focusAt(id, null);
|
|
233
|
+
}
|
|
234
|
+
}),
|
|
235
|
+
menuOpen: (id) => menuFor === id,
|
|
236
|
+
setMenuOpen: (id, open) => setMenuFor((was) => open ? id : was === id ? null : was),
|
|
237
|
+
columnKey: (col) => drawn[col - 1]?.key,
|
|
238
|
+
shown: (key) => drawn.some((one) => one.key === key)
|
|
239
|
+
};
|
|
240
|
+
const template = drawn.map((one) => one.width ?? "minmax(0, 1fr)").join(" ");
|
|
241
|
+
return /* @__PURE__ */ jsx(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
ref: frame,
|
|
245
|
+
className: cx(
|
|
246
|
+
"crewlet-tree-grid",
|
|
247
|
+
headless && "crewlet-tree-grid--headless",
|
|
248
|
+
layout === "container" && "crewlet-tree-grid--container",
|
|
249
|
+
className
|
|
250
|
+
),
|
|
251
|
+
children: /* @__PURE__ */ jsxs(LayerHost, { className: "crewlet-tree-grid__layer", children: [
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "crewlet-tree-grid__scroller", onScroll, children: /* @__PURE__ */ jsxs(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
role: "treegrid",
|
|
256
|
+
"aria-label": label,
|
|
257
|
+
"aria-colcount": drawn.length,
|
|
258
|
+
"aria-readonly": readOnly || void 0,
|
|
259
|
+
className: "crewlet-tree-grid__grid",
|
|
260
|
+
style: { "--crewlet-tree-grid-columns": template },
|
|
261
|
+
onKeyDownCapture,
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsx("div", { role: "rowgroup", className: "crewlet-tree-grid__head", children: /* @__PURE__ */ jsx("div", { role: "row", className: "crewlet-tree-grid__row", children: drawn.map((one, index) => /* @__PURE__ */ jsx("div", { role: "columnheader", "aria-colindex": index + 1, children: one.headerHidden ? /* @__PURE__ */ jsx(VisuallyHidden, { children: one.header }) : one.header }, one.key)) }) }),
|
|
264
|
+
/* @__PURE__ */ jsx("div", { role: "rowgroup", children: rows.map((id) => {
|
|
265
|
+
const add = isAddRow(id);
|
|
266
|
+
const cells = add ? add.cells : drawn.length;
|
|
267
|
+
const expandable = treeExpandable(model, id);
|
|
268
|
+
const open = expanded.has(id);
|
|
269
|
+
const name = model.label.get(id) ?? "";
|
|
270
|
+
return (
|
|
271
|
+
/* The row's keys are the GRID's, captured at the treegrid so
|
|
272
|
+
one handler serves every row and reaches a cell's control
|
|
273
|
+
first. A listener on the row itself would be a second
|
|
274
|
+
place for them to live. */
|
|
275
|
+
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events -- see above */
|
|
276
|
+
/* @__PURE__ */ jsx(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
role: "row",
|
|
280
|
+
"data-tree-id": id,
|
|
281
|
+
ref: rowRef(id),
|
|
282
|
+
tabIndex: id === active && column === null ? 0 : -1,
|
|
283
|
+
"aria-level": treeLevel(model, id),
|
|
284
|
+
"aria-setsize": treeSetSize(model, id),
|
|
285
|
+
"aria-posinset": treePosInSet(model, id),
|
|
286
|
+
"aria-expanded": expandable ? open : void 0,
|
|
287
|
+
"aria-selected": add ? void 0 : id === selectedId,
|
|
288
|
+
"aria-label": add ? add.label : void 0,
|
|
289
|
+
className: cx("crewlet-tree-grid__row", add && "crewlet-tree-grid__row--add"),
|
|
290
|
+
style: { "--crewlet-tree-grid-depth": treeLevel(model, id) - 1 },
|
|
291
|
+
onClick: (event) => {
|
|
292
|
+
if (!event.currentTarget.contains(event.target)) return;
|
|
293
|
+
if (event.target.closest("button, input, label, [role='menu']")) return;
|
|
294
|
+
focusAt(id, null);
|
|
295
|
+
},
|
|
296
|
+
children: Array.from({ length: cells }, (_, index) => {
|
|
297
|
+
const col = index + 1;
|
|
298
|
+
return /* @__PURE__ */ jsxs(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
role: "gridcell",
|
|
302
|
+
"aria-colindex": col,
|
|
303
|
+
tabIndex: stop(id, col) && !cellHasControl?.(id, col, drawn[col - 1]?.key ?? "") ? 0 : -1,
|
|
304
|
+
"data-size": !add && drawn[col - 1]?.size === "sm" ? "sm" : void 0,
|
|
305
|
+
className: "crewlet-tree-grid__cell",
|
|
306
|
+
children: [
|
|
307
|
+
col === 1 && /* THE PRESS LANDS ON THE ROW. The chevron is a
|
|
308
|
+
pointer-only control hidden from assistive
|
|
309
|
+
technology (the keyboard opens and closes a row
|
|
310
|
+
with Right and Left), and focus inside a hidden
|
|
311
|
+
subtree is focus nowhere, so the press is stopped
|
|
312
|
+
from focusing it and the row takes the focus. */
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
"span",
|
|
315
|
+
{
|
|
316
|
+
className: "crewlet-tree-grid__toggle",
|
|
317
|
+
"data-open": open ? "" : void 0,
|
|
318
|
+
"aria-hidden": "true",
|
|
319
|
+
...grid.press(id),
|
|
320
|
+
children: expandable && /* @__PURE__ */ jsx(
|
|
321
|
+
IconButton,
|
|
322
|
+
{
|
|
323
|
+
size: "sm",
|
|
324
|
+
label: open ? text.collapse(name) : text.expand(name),
|
|
325
|
+
icon: /* @__PURE__ */ jsx(ChevronRightGlyph, {}),
|
|
326
|
+
tabIndex: -1,
|
|
327
|
+
onClick: () => toggle(id)
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
renderCell(id, col, grid)
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
col
|
|
336
|
+
);
|
|
337
|
+
})
|
|
338
|
+
},
|
|
339
|
+
id
|
|
340
|
+
)
|
|
341
|
+
);
|
|
342
|
+
}) })
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
) }),
|
|
346
|
+
/* @__PURE__ */ jsx(LayerNodeBridge, { onNode: setLayer })
|
|
347
|
+
] })
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export { TreeGrid };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMediaMatch, REDUCED_MOTION_QUERY } from './chunk-YJQXESOJ.js';
|
|
2
|
-
import { Button } from './chunk-
|
|
2
|
+
import { Button } from './chunk-6KUOHUY5.js';
|
|
3
3
|
import { VisuallyHidden } from './chunk-UT6CW3C7.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
5
|
import './ChatThread-HAECJMP6.css';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Modal } from './chunk-
|
|
1
|
+
import { Modal } from './chunk-EMDRNB23.js';
|
|
2
2
|
import { useClipboard } from './chunk-STJ7QBC3.js';
|
|
3
3
|
import { EmptyValue } from './chunk-RE3FBGQQ.js';
|
|
4
4
|
import { useCardHeaderSlot } from './chunk-AV2DXAEL.js';
|
|
5
|
-
import { Checkbox } from './chunk-
|
|
6
|
-
import { Menu } from './chunk-
|
|
7
|
-
import { Button } from './chunk-
|
|
8
|
-
import { IconButton } from './chunk-
|
|
5
|
+
import { Checkbox } from './chunk-M6G7XLLP.js';
|
|
6
|
+
import { Menu } from './chunk-JK6WLRYP.js';
|
|
7
|
+
import { Button } from './chunk-6KUOHUY5.js';
|
|
8
|
+
import { IconButton } from './chunk-WDLAAZFZ.js';
|
|
9
9
|
import { VisuallyHidden } from './chunk-UT6CW3C7.js';
|
|
10
10
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
11
11
|
import './DataTable-GSLDFY5U.css';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeHex, parseColourInput } from './chunk-7W3LYIOC.js';
|
|
2
|
-
import { FormField, Input, InputAffix } from './chunk-
|
|
2
|
+
import { FormField, Input, InputAffix } from './chunk-56ES76ST.js';
|
|
3
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
4
|
import './ColorField-2OIOWT3Z.css';
|
|
5
5
|
import { useId, useState } from 'react';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { frameThemeMessage, readFrameHello, frameOriginMatches, negotiateBridge, FRAME_MESSAGE, portTargetOrigin, checkFrameSandbox, httpOrigin, isFrameNonce, frameFragment, readOpenLink, externalUrl, isFocusExit } from './chunk-F6V2PTN6.js';
|
|
2
2
|
import { Callout } from './chunk-BPCY7ZID.js';
|
|
3
3
|
import { Skeleton } from './chunk-I4IUX3JF.js';
|
|
4
|
-
import { Button } from './chunk-
|
|
4
|
+
import { Button } from './chunk-6KUOHUY5.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
6
|
import './SandboxedFrame-P5NASXB7.css';
|
|
7
7
|
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VisuallyHidden } from './chunk-UT6CW3C7.js';
|
|
2
2
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './AddPill-
|
|
3
|
+
import './AddPill-OP3MMVZG.css';
|
|
4
4
|
import { useState, useId, useRef, useCallback, useEffect, Fragment } from 'react';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Table } from './chunk-75NQV4R4.js';
|
|
2
|
-
import { DownloadButton } from './chunk-
|
|
2
|
+
import { DownloadButton } from './chunk-52UBOSNQ.js';
|
|
3
3
|
import { StatusCard } from './chunk-4BEMS6Q7.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
5
|
import './ResultTableCard-AP355LQM.css';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useTreeState, useMeasuredSizes, layoutForest, treeAncestors, useLayoutAnchor, treeExpandable, layoutConnectors, treeItemAction, treeStep, treePosInSet, treeSetSize, treeLevel, placeGroups } from './chunk-MY374UUD.js';
|
|
2
|
-
import { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, Canvas } from './chunk-
|
|
2
|
+
import { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, Canvas } from './chunk-33632WEN.js';
|
|
3
3
|
import { useMediaMatch, REDUCED_MOTION_QUERY } from './chunk-YJQXESOJ.js';
|
|
4
4
|
import { focusables } from './chunk-TUEM2XIW.js';
|
|
5
5
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
|
-
import './TreeCanvas-
|
|
7
|
-
import { useState, useRef, useMemo,
|
|
6
|
+
import './TreeCanvas-X5RCUSTP.css';
|
|
7
|
+
import { useState, useRef, useMemo, useCallback, useLayoutEffect, useImperativeHandle, useId } from 'react';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
var ENTRANCE_STEP_MS = 60;
|
|
@@ -94,6 +94,7 @@ function useReflow(layout, still) {
|
|
|
94
94
|
}, [layout, still]);
|
|
95
95
|
return drawn;
|
|
96
96
|
}
|
|
97
|
+
var TREE_ADD_MARK_MIN_ZOOM = 0.4;
|
|
97
98
|
var GAP_PROBE = "crewlet:tree-canvas-gap";
|
|
98
99
|
var MARGIN_PROBE = "crewlet:tree-canvas-margin";
|
|
99
100
|
var GROUP_PAD_PROBE = "crewlet:tree-canvas-group-pad";
|
|
@@ -120,15 +121,25 @@ function TreeCanvas({
|
|
|
120
121
|
controlsPlacement,
|
|
121
122
|
controlsExtra,
|
|
122
123
|
controlsBelow,
|
|
124
|
+
controlsStart,
|
|
125
|
+
overlayEnd,
|
|
123
126
|
hint,
|
|
124
127
|
dimmed = false,
|
|
125
128
|
ground,
|
|
126
129
|
composing = null,
|
|
127
130
|
labels,
|
|
131
|
+
minZoom,
|
|
132
|
+
expanded: held,
|
|
133
|
+
onExpandedChange,
|
|
134
|
+
onViewChange,
|
|
135
|
+
fitKey,
|
|
136
|
+
initialView,
|
|
137
|
+
refitOnResize,
|
|
138
|
+
cardDimmed,
|
|
128
139
|
ref,
|
|
129
140
|
className
|
|
130
141
|
}) {
|
|
131
|
-
const tree = useTreeState(nodes, selectedId);
|
|
142
|
+
const tree = useTreeState(nodes, selectedId, { expanded: held, onExpandedChange });
|
|
132
143
|
const { model, expanded, active, setActive, toggle } = tree;
|
|
133
144
|
const [menuFor, setMenuFor] = useState(null);
|
|
134
145
|
const composeId = composing?.id ?? null;
|
|
@@ -160,11 +171,13 @@ function TreeCanvas({
|
|
|
160
171
|
}, [groups, cardIds]);
|
|
161
172
|
const spacing = ranks ?? (appearance === "node" ? "shared" : "per-parent");
|
|
162
173
|
const previousLayout = useRef(null);
|
|
174
|
+
const probes = useMemo(() => {
|
|
175
|
+
const out = [GAP_PROBE, MARGIN_PROBE];
|
|
176
|
+
if (shownGroups.length > 0) out.push(GROUP_PAD_PROBE, ...shownGroups.map(({ group }) => groupHeadKey(group.id)));
|
|
177
|
+
return out;
|
|
178
|
+
}, [shownGroups]);
|
|
179
|
+
const placed = measured([...cardIds, ...probes]);
|
|
163
180
|
const layout = useMemo(() => {
|
|
164
|
-
const probes = [GAP_PROBE, MARGIN_PROBE];
|
|
165
|
-
if (shownGroups.length > 0) {
|
|
166
|
-
probes.push(GROUP_PAD_PROBE, ...shownGroups.map(({ group }) => groupHeadKey(group.id)));
|
|
167
|
-
}
|
|
168
181
|
if (!measured([...cardIds, ...probes])) return previousLayout.current;
|
|
169
182
|
const size = (id) => sizes.get(id);
|
|
170
183
|
const gap = size(GAP_PROBE);
|
|
@@ -187,7 +200,7 @@ function TreeCanvas({
|
|
|
187
200
|
margin: size(MARGIN_PROBE).width,
|
|
188
201
|
groups: boxes
|
|
189
202
|
});
|
|
190
|
-
}, [cardForest, cardIds, measured, sizes, spacing, shownGroups]);
|
|
203
|
+
}, [cardForest, cardIds, measured, sizes, spacing, shownGroups, probes]);
|
|
191
204
|
previousLayout.current = layout;
|
|
192
205
|
const still = useStillness();
|
|
193
206
|
const drawn = useReflow(layout, still) ?? layout;
|
|
@@ -197,6 +210,18 @@ function TreeCanvas({
|
|
|
197
210
|
[layout]
|
|
198
211
|
);
|
|
199
212
|
const canvas = useRef(null);
|
|
213
|
+
const root = useRef(null);
|
|
214
|
+
const viewChanged = useCallback(
|
|
215
|
+
(view, viewport) => {
|
|
216
|
+
const el = root.current;
|
|
217
|
+
if (el) {
|
|
218
|
+
el.style.setProperty("--crewlet-tree-canvas-zoom", String(view.k));
|
|
219
|
+
el.toggleAttribute("data-zoomed-out", view.k < TREE_ADD_MARK_MIN_ZOOM);
|
|
220
|
+
}
|
|
221
|
+
onViewChange?.(view, viewport);
|
|
222
|
+
},
|
|
223
|
+
[onViewChange]
|
|
224
|
+
);
|
|
200
225
|
const shownPositions = useRef(null);
|
|
201
226
|
const anchorId = useMemo(() => {
|
|
202
227
|
const was = shownPositions.current;
|
|
@@ -214,6 +239,19 @@ function TreeCanvas({
|
|
|
214
239
|
useLayoutEffect(() => {
|
|
215
240
|
shownPositions.current = positions;
|
|
216
241
|
}, [positions]);
|
|
242
|
+
const fittedFor = useRef(fitKey);
|
|
243
|
+
const placedOnce = useRef(false);
|
|
244
|
+
useLayoutEffect(() => {
|
|
245
|
+
if (!placed || !layout) return;
|
|
246
|
+
if (!placedOnce.current) {
|
|
247
|
+
placedOnce.current = true;
|
|
248
|
+
fittedFor.current = fitKey;
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (fitKey === fittedFor.current) return;
|
|
252
|
+
fittedFor.current = fitKey;
|
|
253
|
+
canvas.current?.fit();
|
|
254
|
+
}, [fitKey, layout, placed]);
|
|
217
255
|
const items = useRef(/* @__PURE__ */ new Map());
|
|
218
256
|
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
219
257
|
const refFor = (id) => {
|
|
@@ -231,16 +269,16 @@ function TreeCanvas({
|
|
|
231
269
|
const focusNow = useCallback(
|
|
232
270
|
(id) => {
|
|
233
271
|
const el = items.current.get(id);
|
|
234
|
-
const
|
|
235
|
-
if (!el || !el.isConnected || !
|
|
272
|
+
const placed2 = layout?.byId.get(cardOf(id));
|
|
273
|
+
if (!el || !el.isConnected || !placed2) return false;
|
|
236
274
|
el.focus({ preventScroll: true });
|
|
237
275
|
const card2 = el.closest(".crewlet-tree-canvas__card");
|
|
238
276
|
const top = card2 ? offsetWithin(el, card2) : 0;
|
|
239
277
|
const rect = {
|
|
240
|
-
x:
|
|
241
|
-
y:
|
|
242
|
-
width:
|
|
243
|
-
height: el.offsetHeight > 0 && top > 0 ? el.offsetHeight :
|
|
278
|
+
x: placed2.x,
|
|
279
|
+
y: placed2.y + top,
|
|
280
|
+
width: placed2.width,
|
|
281
|
+
height: el.offsetHeight > 0 && top > 0 ? el.offsetHeight : placed2.height
|
|
244
282
|
};
|
|
245
283
|
canvas.current?.reveal(rect);
|
|
246
284
|
return true;
|
|
@@ -274,8 +312,8 @@ function TreeCanvas({
|
|
|
274
312
|
expandAll,
|
|
275
313
|
collapseAll,
|
|
276
314
|
focusRegion: (id) => {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
315
|
+
const placed2 = placedRef.current?.byId.get(cardOfRef.current(id));
|
|
316
|
+
if (placed2) canvas.current?.focusRegion(placed2);
|
|
279
317
|
},
|
|
280
318
|
restoreView: () => canvas.current?.restoreView()
|
|
281
319
|
}),
|
|
@@ -434,6 +472,7 @@ function TreeCanvas({
|
|
|
434
472
|
return /* @__PURE__ */ jsx(
|
|
435
473
|
"div",
|
|
436
474
|
{
|
|
475
|
+
ref: root,
|
|
437
476
|
className: cx(
|
|
438
477
|
"crewlet-tree-canvas",
|
|
439
478
|
appearance === "node" && "crewlet-tree-canvas--node",
|
|
@@ -449,17 +488,23 @@ function TreeCanvas({
|
|
|
449
488
|
controlsPlacement: controlsPlacement ?? (appearance === "node" ? "top-right" : void 0),
|
|
450
489
|
controlsExtra,
|
|
451
490
|
controlsBelow,
|
|
491
|
+
controlsStart,
|
|
492
|
+
overlayEnd,
|
|
452
493
|
hint,
|
|
453
494
|
dimmed,
|
|
454
495
|
ground,
|
|
455
496
|
largestItemWidth: widestCard,
|
|
456
497
|
labels,
|
|
498
|
+
minZoom,
|
|
499
|
+
onViewChange: viewChanged,
|
|
500
|
+
initialView,
|
|
501
|
+
refitOnResize,
|
|
457
502
|
children: [
|
|
458
503
|
/* @__PURE__ */ jsx("div", { className: "crewlet-tree-canvas__gap", ref: measure(GAP_PROBE), "aria-hidden": "true" }),
|
|
459
504
|
/* @__PURE__ */ jsx("div", { className: "crewlet-tree-canvas__margin", ref: measure(MARGIN_PROBE), "aria-hidden": "true" }),
|
|
460
505
|
shownGroups.length > 0 && /* @__PURE__ */ jsx("div", { className: "crewlet-tree-canvas__group-pad", ref: measure(GROUP_PAD_PROBE), "aria-hidden": "true" }),
|
|
461
506
|
shownGroups.map(({ group, members }) => {
|
|
462
|
-
const
|
|
507
|
+
const placed2 = drawn?.groups?.find((one) => one.id === group.id);
|
|
463
508
|
return /* @__PURE__ */ jsx(
|
|
464
509
|
"div",
|
|
465
510
|
{
|
|
@@ -467,7 +512,7 @@ function TreeCanvas({
|
|
|
467
512
|
"aria-hidden": "true",
|
|
468
513
|
"data-group-id": group.id,
|
|
469
514
|
"data-enter": enterOf(members, arrived),
|
|
470
|
-
style: placedStyle(
|
|
515
|
+
style: placedStyle(placed2, true)
|
|
471
516
|
},
|
|
472
517
|
group.id
|
|
473
518
|
);
|
|
@@ -492,7 +537,7 @@ function TreeCanvas({
|
|
|
492
537
|
}
|
|
493
538
|
),
|
|
494
539
|
shownGroups.map(({ group, members }) => {
|
|
495
|
-
const
|
|
540
|
+
const placed2 = drawn?.groups?.find((one) => one.id === group.id);
|
|
496
541
|
return /* @__PURE__ */ jsxs(
|
|
497
542
|
"div",
|
|
498
543
|
{
|
|
@@ -501,7 +546,7 @@ function TreeCanvas({
|
|
|
501
546
|
className: "crewlet-tree-canvas__group-head",
|
|
502
547
|
"aria-hidden": "true",
|
|
503
548
|
"data-enter": enterOf(members, arrived),
|
|
504
|
-
style: placedStyle(
|
|
549
|
+
style: placedStyle(placed2, false),
|
|
505
550
|
children: [
|
|
506
551
|
group.lead === void 0 || group.lead === null ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
507
552
|
/* @__PURE__ */ jsx("span", { className: "crewlet-tree-canvas__group-lead", children: group.lead }),
|
|
@@ -514,7 +559,7 @@ function TreeCanvas({
|
|
|
514
559
|
);
|
|
515
560
|
}),
|
|
516
561
|
/* @__PURE__ */ jsx("div", { role: "tree", "aria-label": label, className: "crewlet-tree-canvas__tree", onKeyDown, children: cardIds.filter((id) => id !== composeId).map((id) => {
|
|
517
|
-
const
|
|
562
|
+
const placed2 = drawn?.byId.get(id);
|
|
518
563
|
return /* @__PURE__ */ jsxs(
|
|
519
564
|
"div",
|
|
520
565
|
{
|
|
@@ -522,8 +567,9 @@ function TreeCanvas({
|
|
|
522
567
|
ref: measure(id),
|
|
523
568
|
className: "crewlet-tree-canvas__card",
|
|
524
569
|
"data-tone": cardTone?.(id),
|
|
570
|
+
"data-dimmed": cardDimmed?.(id) ? "" : void 0,
|
|
525
571
|
"data-enter": arrived === null ? void 0 : arrived.has(id) ? "shown" : "waiting",
|
|
526
|
-
style:
|
|
572
|
+
style: placed2 ? { transform: `translate(${placed2.x}px, ${placed2.y}px)` } : { visibility: "hidden" },
|
|
527
573
|
children: [
|
|
528
574
|
renderCard(id, card),
|
|
529
575
|
renderUnder ? /* @__PURE__ */ jsx(UnderSlot, { id, card, render: renderUnder }) : null
|
|
@@ -554,8 +600,8 @@ function TreeCanvas({
|
|
|
554
600
|
composing.onCancel();
|
|
555
601
|
},
|
|
556
602
|
style: (() => {
|
|
557
|
-
const
|
|
558
|
-
return
|
|
603
|
+
const placed2 = composeId === null ? void 0 : drawn?.byId.get(composeId) ?? placedCards?.get(composeId);
|
|
604
|
+
return placed2 ? { transform: `translate(${placed2.x}px, ${placed2.y}px)` } : { visibility: "hidden" };
|
|
559
605
|
})(),
|
|
560
606
|
children: composing.render()
|
|
561
607
|
}
|
|
@@ -595,4 +641,4 @@ function offsetWithin(el, container) {
|
|
|
595
641
|
return top;
|
|
596
642
|
}
|
|
597
643
|
|
|
598
|
-
export { TreeCanvas };
|
|
644
|
+
export { TREE_ADD_MARK_MIN_ZOOM, TreeCanvas };
|