@industry-theme/github-panels 0.1.46 → 0.1.48
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/panels.bundle.js
CHANGED
|
@@ -2181,7 +2181,7 @@ const GitHubIssuesPanelContent = ({
|
|
|
2181
2181
|
context,
|
|
2182
2182
|
events
|
|
2183
2183
|
}) => {
|
|
2184
|
-
var _a, _b, _c, _d,
|
|
2184
|
+
var _a, _b, _c, _d, _e2;
|
|
2185
2185
|
const { theme: theme2 } = useTheme();
|
|
2186
2186
|
const issuesSlice = context.getSlice("github-issues");
|
|
2187
2187
|
const isLoading = context.isSliceLoading("github-issues");
|
|
@@ -2190,7 +2190,7 @@ const GitHubIssuesPanelContent = ({
|
|
|
2190
2190
|
const owner = ((_b = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _b.owner) ?? "";
|
|
2191
2191
|
const repo = ((_c = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _c.repo) ?? "";
|
|
2192
2192
|
const isAuthenticated = ((_d = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _d.isAuthenticated) ?? false;
|
|
2193
|
-
const sliceError = (
|
|
2193
|
+
const sliceError = (_e2 = issuesSlice == null ? void 0 : issuesSlice.data) == null ? void 0 : _e2.error;
|
|
2194
2194
|
const [selectedLabel, setSelectedLabel] = useState("");
|
|
2195
2195
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
2196
2196
|
const [selectedIssueId, setSelectedIssueId] = useState(null);
|
|
@@ -39532,20 +39532,20 @@ class EditMap {
|
|
|
39532
39532
|
this.map.length = 0;
|
|
39533
39533
|
}
|
|
39534
39534
|
}
|
|
39535
|
-
function addImplementation(editMap,
|
|
39535
|
+
function addImplementation(editMap, at2, remove, add) {
|
|
39536
39536
|
let index2 = 0;
|
|
39537
39537
|
if (remove === 0 && add.length === 0) {
|
|
39538
39538
|
return;
|
|
39539
39539
|
}
|
|
39540
39540
|
while (index2 < editMap.map.length) {
|
|
39541
|
-
if (editMap.map[index2][0] ===
|
|
39541
|
+
if (editMap.map[index2][0] === at2) {
|
|
39542
39542
|
editMap.map[index2][1] += remove;
|
|
39543
39543
|
editMap.map[index2][2].push(...add);
|
|
39544
39544
|
return;
|
|
39545
39545
|
}
|
|
39546
39546
|
index2 += 1;
|
|
39547
39547
|
}
|
|
39548
|
-
editMap.map.push([
|
|
39548
|
+
editMap.map.push([at2, remove, add]);
|
|
39549
39549
|
}
|
|
39550
39550
|
function gfmTableAlign(events, index2) {
|
|
39551
39551
|
let inDelimiterRow = false;
|
|
@@ -41702,7 +41702,7 @@ var css_248z = ".transform-component-module_wrapper__SPB86 {\n position: relati
|
|
|
41702
41702
|
var styles = { "wrapper": "transform-component-module_wrapper__SPB86", "content": "transform-component-module_content__FBWxo" };
|
|
41703
41703
|
styleInject(css_248z);
|
|
41704
41704
|
var TransformComponent = function(_a) {
|
|
41705
|
-
var children2 = _a.children, _b = _a.wrapperClass, wrapperClass = _b === void 0 ? "" : _b, _c = _a.contentClass, contentClass = _c === void 0 ? "" : _c, wrapperStyle = _a.wrapperStyle, contentStyle = _a.contentStyle, _d = _a.wrapperProps, wrapperProps = _d === void 0 ? {} : _d,
|
|
41705
|
+
var children2 = _a.children, _b = _a.wrapperClass, wrapperClass = _b === void 0 ? "" : _b, _c = _a.contentClass, contentClass = _c === void 0 ? "" : _c, wrapperStyle = _a.wrapperStyle, contentStyle = _a.contentStyle, _d = _a.wrapperProps, wrapperProps = _d === void 0 ? {} : _d, _e2 = _a.contentProps, contentProps = _e2 === void 0 ? {} : _e2;
|
|
41706
41706
|
var _f = useContext(Context), init = _f.init, cleanupWindowEvents = _f.cleanupWindowEvents;
|
|
41707
41707
|
var wrapperRef = useRef(null);
|
|
41708
41708
|
var contentRef = useRef(null);
|
|
@@ -43109,7 +43109,8 @@ var createIndustryMarkdownComponents = ({
|
|
|
43109
43109
|
enableHtmlPopout,
|
|
43110
43110
|
slideHeaderMarginTopOverride,
|
|
43111
43111
|
index: index2,
|
|
43112
|
-
repositoryInfo
|
|
43112
|
+
repositoryInfo,
|
|
43113
|
+
editable = false
|
|
43113
43114
|
}) => {
|
|
43114
43115
|
const getLuminance = (hex) => {
|
|
43115
43116
|
const rgb = hex.replace("#", "").match(/.{2}/g);
|
|
@@ -43197,7 +43198,7 @@ var createIndustryMarkdownComponents = ({
|
|
|
43197
43198
|
...props
|
|
43198
43199
|
}, children2),
|
|
43199
43200
|
li: ({ children: children2, ...props }) => {
|
|
43200
|
-
var _a, _b, _c, _d,
|
|
43201
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h;
|
|
43201
43202
|
const isTaskListItem = Array.isArray(children2) && children2.length > 0 && React2__default.isValidElement(children2[0]) && ((_b = (_a = children2[0]) == null ? void 0 : _a.props) == null ? void 0 : _b.type) === "checkbox";
|
|
43202
43203
|
if (isTaskListItem) {
|
|
43203
43204
|
const checkbox = children2[0];
|
|
@@ -43212,7 +43213,7 @@ var createIndustryMarkdownComponents = ({
|
|
|
43212
43213
|
}
|
|
43213
43214
|
});
|
|
43214
43215
|
const checked = ((_c = checkbox == null ? void 0 : checkbox.props) == null ? void 0 : _c.checked) || false;
|
|
43215
|
-
const lineNumber = ((
|
|
43216
|
+
const lineNumber = ((_e2 = (_d = props.sourcePosition) == null ? void 0 : _d.start) == null ? void 0 : _e2.line) || ((_h = (_g = (_f = props.node) == null ? void 0 : _f.position) == null ? void 0 : _g.start) == null ? void 0 : _h.line) || 1;
|
|
43216
43217
|
const id = `${slideIdPrefix}-checkbox-${lineNumber}`;
|
|
43217
43218
|
const isChecked = checkedItems[id] ?? checked;
|
|
43218
43219
|
const handleChange = (e) => {
|
|
@@ -43241,19 +43242,20 @@ var createIndustryMarkdownComponents = ({
|
|
|
43241
43242
|
checked: isChecked,
|
|
43242
43243
|
onChange: handleChange,
|
|
43243
43244
|
onClick: (e) => e.stopPropagation(),
|
|
43245
|
+
disabled: !editable,
|
|
43244
43246
|
style: {
|
|
43245
43247
|
marginRight: theme2.space[2],
|
|
43246
43248
|
marginTop: theme2.space[1],
|
|
43247
43249
|
width: "16px",
|
|
43248
43250
|
height: "16px",
|
|
43249
|
-
cursor: "pointer"
|
|
43251
|
+
cursor: editable ? "pointer" : "default"
|
|
43250
43252
|
},
|
|
43251
43253
|
id
|
|
43252
43254
|
}), /* @__PURE__ */ React2__default.createElement("label", {
|
|
43253
43255
|
htmlFor: id,
|
|
43254
43256
|
style: {
|
|
43255
43257
|
flex: 1,
|
|
43256
|
-
cursor: "pointer",
|
|
43258
|
+
cursor: editable ? "pointer" : "default",
|
|
43257
43259
|
color: isChecked ? theme2.colors.textMuted : "inherit",
|
|
43258
43260
|
lineHeight: theme2.lineHeights.relaxed
|
|
43259
43261
|
}
|
|
@@ -43356,7 +43358,7 @@ var createIndustryMarkdownComponents = ({
|
|
|
43356
43358
|
});
|
|
43357
43359
|
},
|
|
43358
43360
|
code: ({ node: node2, className, children: children2, ...props }) => {
|
|
43359
|
-
var _a, _b, _c, _d,
|
|
43361
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
43360
43362
|
const hasLanguageClass = className && (className.includes("language-") || className.includes("hljs"));
|
|
43361
43363
|
const codeString = extractTextFromChildren(children2);
|
|
43362
43364
|
const matchLang = /language-(\w+)/.exec(className || "");
|
|
@@ -43568,7 +43570,7 @@ var createIndustryMarkdownComponents = ({
|
|
|
43568
43570
|
...props
|
|
43569
43571
|
}, children2)));
|
|
43570
43572
|
}
|
|
43571
|
-
const cleanClassName = (_f = (
|
|
43573
|
+
const cleanClassName = (_f = (_e2 = (_d = className == null ? void 0 : className.replace(/hljs(-\w+)?/g, "")) == null ? void 0 : _d.replace(/language-\w+/g, "")) == null ? void 0 : _e2.replace(/\s+/g, " ")) == null ? void 0 : _f.trim();
|
|
43572
43574
|
return /* @__PURE__ */ React2__default.createElement("code", {
|
|
43573
43575
|
style: {
|
|
43574
43576
|
color: theme2.colors.accent,
|
|
@@ -44335,7 +44337,8 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44335
44337
|
maxScreenWidth: _maxScreenWidth,
|
|
44336
44338
|
enableKeyboardScrolling = true,
|
|
44337
44339
|
keyboardScrollConfig,
|
|
44338
|
-
repositoryInfo
|
|
44340
|
+
repositoryInfo,
|
|
44341
|
+
editable = false
|
|
44339
44342
|
}) {
|
|
44340
44343
|
const slideRef = useRef(null);
|
|
44341
44344
|
const scrollPositionsRef = useRef(/* @__PURE__ */ new Map());
|
|
@@ -44606,7 +44609,7 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44606
44609
|
}
|
|
44607
44610
|
}, [slideIndex]);
|
|
44608
44611
|
const sanitizeSchema = useMemo(() => {
|
|
44609
|
-
var _a, _b, _c, _d,
|
|
44612
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
|
|
44610
44613
|
return {
|
|
44611
44614
|
...defaultSchema,
|
|
44612
44615
|
tagNames: [...defaultSchema.tagNames || [], "picture", "source", "mark"],
|
|
@@ -44617,7 +44620,7 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44617
44620
|
span: [...((_b = defaultSchema.attributes) == null ? void 0 : _b.span) || [], "className", "style"],
|
|
44618
44621
|
pre: [...((_c = defaultSchema.attributes) == null ? void 0 : _c.pre) || [], "className", "style"],
|
|
44619
44622
|
div: [...((_d = defaultSchema.attributes) == null ? void 0 : _d.div) || [], "style", "className", "id"],
|
|
44620
|
-
p: [...((
|
|
44623
|
+
p: [...((_e2 = defaultSchema.attributes) == null ? void 0 : _e2.p) || [], "style", "className", "id"],
|
|
44621
44624
|
h1: [...((_f = defaultSchema.attributes) == null ? void 0 : _f.h1) || [], "style", "className", "id"],
|
|
44622
44625
|
h2: [...((_g = defaultSchema.attributes) == null ? void 0 : _g.h2) || [], "style", "className", "id"],
|
|
44623
44626
|
h3: [...((_h = defaultSchema.attributes) == null ? void 0 : _h.h3) || [], "style", "className", "id"],
|
|
@@ -44691,7 +44694,8 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44691
44694
|
enableHtmlPopout,
|
|
44692
44695
|
slideHeaderMarginTopOverride,
|
|
44693
44696
|
index: chunkIndex,
|
|
44694
|
-
repositoryInfo
|
|
44697
|
+
repositoryInfo,
|
|
44698
|
+
editable
|
|
44695
44699
|
});
|
|
44696
44700
|
if (searchQuery) {
|
|
44697
44701
|
return {
|
|
@@ -44724,7 +44728,8 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44724
44728
|
enableHtmlPopout,
|
|
44725
44729
|
slideHeaderMarginTopOverride,
|
|
44726
44730
|
repositoryInfo,
|
|
44727
|
-
searchQuery
|
|
44731
|
+
searchQuery,
|
|
44732
|
+
editable
|
|
44728
44733
|
]);
|
|
44729
44734
|
return /* @__PURE__ */ React2__default.createElement("div", {
|
|
44730
44735
|
className: "markdown-slide",
|
|
@@ -44809,9 +44814,9 @@ var IndustryMarkdownSlide = React2__default.memo(function IndustryMarkdownSlide2
|
|
|
44809
44814
|
theme: theme2
|
|
44810
44815
|
}));
|
|
44811
44816
|
});
|
|
44812
|
-
var PanelGroupContext = createContext(null);
|
|
44813
|
-
PanelGroupContext.displayName = "PanelGroupContext";
|
|
44814
|
-
var DATA_ATTRIBUTES = {
|
|
44817
|
+
var PanelGroupContext$1 = createContext(null);
|
|
44818
|
+
PanelGroupContext$1.displayName = "PanelGroupContext";
|
|
44819
|
+
var DATA_ATTRIBUTES$1 = {
|
|
44815
44820
|
group: "data-panel-group",
|
|
44816
44821
|
groupDirection: "data-panel-group-direction",
|
|
44817
44822
|
groupId: "data-panel-group-id",
|
|
@@ -44821,20 +44826,20 @@ var DATA_ATTRIBUTES = {
|
|
|
44821
44826
|
panelSize: "data-panel-size",
|
|
44822
44827
|
resizeHandleId: "data-panel-resize-handle-id"
|
|
44823
44828
|
};
|
|
44824
|
-
var PRECISION = 10;
|
|
44825
|
-
var useIsomorphicLayoutEffect = useLayoutEffect;
|
|
44826
|
-
var useId = React2["useId".toString()];
|
|
44827
|
-
var wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
44828
|
-
var counter = 0;
|
|
44829
|
-
function useUniqueId(idFromParams = null) {
|
|
44830
|
-
const idFromUseId = wrappedUseId();
|
|
44829
|
+
var PRECISION$1 = 10;
|
|
44830
|
+
var useIsomorphicLayoutEffect$1 = useLayoutEffect;
|
|
44831
|
+
var useId$1 = React2["useId".toString()];
|
|
44832
|
+
var wrappedUseId$1 = typeof useId$1 === "function" ? useId$1 : () => null;
|
|
44833
|
+
var counter$1 = 0;
|
|
44834
|
+
function useUniqueId$1(idFromParams = null) {
|
|
44835
|
+
const idFromUseId = wrappedUseId$1();
|
|
44831
44836
|
const idRef = useRef(idFromParams || idFromUseId || null);
|
|
44832
44837
|
if (idRef.current === null) {
|
|
44833
|
-
idRef.current = "" + counter++;
|
|
44838
|
+
idRef.current = "" + counter$1++;
|
|
44834
44839
|
}
|
|
44835
44840
|
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
44836
44841
|
}
|
|
44837
|
-
function PanelWithForwardedRef({
|
|
44842
|
+
function PanelWithForwardedRef$1({
|
|
44838
44843
|
children: children2,
|
|
44839
44844
|
className: classNameFromProps = "",
|
|
44840
44845
|
collapsedSize,
|
|
@@ -44852,7 +44857,7 @@ function PanelWithForwardedRef({
|
|
|
44852
44857
|
tagName: Type = "div",
|
|
44853
44858
|
...rest
|
|
44854
44859
|
}) {
|
|
44855
|
-
const context = useContext(PanelGroupContext);
|
|
44860
|
+
const context = useContext(PanelGroupContext$1);
|
|
44856
44861
|
if (context === null) {
|
|
44857
44862
|
throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
44858
44863
|
}
|
|
@@ -44868,7 +44873,7 @@ function PanelWithForwardedRef({
|
|
|
44868
44873
|
resizePanel: resizePanel2,
|
|
44869
44874
|
unregisterPanel
|
|
44870
44875
|
} = context;
|
|
44871
|
-
const panelId = useUniqueId(idFromProps);
|
|
44876
|
+
const panelId = useUniqueId$1(idFromProps);
|
|
44872
44877
|
const panelDataRef = useRef({
|
|
44873
44878
|
callbacks: {
|
|
44874
44879
|
onCollapse,
|
|
@@ -44893,7 +44898,7 @@ function PanelWithForwardedRef({
|
|
|
44893
44898
|
if (!devWarningsRef.current.didLogMissingDefaultSizeWarning)
|
|
44894
44899
|
;
|
|
44895
44900
|
}
|
|
44896
|
-
useIsomorphicLayoutEffect(() => {
|
|
44901
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
44897
44902
|
const {
|
|
44898
44903
|
callbacks,
|
|
44899
44904
|
constraints
|
|
@@ -44916,7 +44921,7 @@ function PanelWithForwardedRef({
|
|
|
44916
44921
|
reevaluatePanelConstraints(panelDataRef.current, prevConstraints);
|
|
44917
44922
|
}
|
|
44918
44923
|
});
|
|
44919
|
-
useIsomorphicLayoutEffect(() => {
|
|
44924
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
44920
44925
|
const panelData = panelDataRef.current;
|
|
44921
44926
|
registerPanel(panelData);
|
|
44922
44927
|
return () => {
|
|
@@ -44956,37 +44961,37 @@ function PanelWithForwardedRef({
|
|
|
44956
44961
|
...style2,
|
|
44957
44962
|
...styleFromProps
|
|
44958
44963
|
},
|
|
44959
|
-
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
44960
|
-
[DATA_ATTRIBUTES.panel]: "",
|
|
44961
|
-
[DATA_ATTRIBUTES.panelCollapsible]: collapsible || void 0,
|
|
44962
|
-
[DATA_ATTRIBUTES.panelId]: panelId,
|
|
44963
|
-
[DATA_ATTRIBUTES.panelSize]: parseFloat("" + style2.flexGrow).toFixed(1)
|
|
44964
|
+
[DATA_ATTRIBUTES$1.groupId]: groupId,
|
|
44965
|
+
[DATA_ATTRIBUTES$1.panel]: "",
|
|
44966
|
+
[DATA_ATTRIBUTES$1.panelCollapsible]: collapsible || void 0,
|
|
44967
|
+
[DATA_ATTRIBUTES$1.panelId]: panelId,
|
|
44968
|
+
[DATA_ATTRIBUTES$1.panelSize]: parseFloat("" + style2.flexGrow).toFixed(1)
|
|
44964
44969
|
});
|
|
44965
44970
|
}
|
|
44966
|
-
var Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
|
|
44971
|
+
var Panel$1 = forwardRef((props, ref) => createElement(PanelWithForwardedRef$1, {
|
|
44967
44972
|
...props,
|
|
44968
44973
|
forwardedRef: ref
|
|
44969
44974
|
}));
|
|
44970
|
-
PanelWithForwardedRef.displayName = "Panel";
|
|
44971
|
-
Panel.displayName = "forwardRef(Panel)";
|
|
44972
|
-
function isKeyDown(event) {
|
|
44975
|
+
PanelWithForwardedRef$1.displayName = "Panel";
|
|
44976
|
+
Panel$1.displayName = "forwardRef(Panel)";
|
|
44977
|
+
function isKeyDown$1(event) {
|
|
44973
44978
|
return event.type === "keydown";
|
|
44974
44979
|
}
|
|
44975
|
-
function isPointerEvent(event) {
|
|
44980
|
+
function isPointerEvent$1(event) {
|
|
44976
44981
|
return event.type.startsWith("pointer");
|
|
44977
44982
|
}
|
|
44978
|
-
function isMouseEvent(event) {
|
|
44983
|
+
function isMouseEvent$1(event) {
|
|
44979
44984
|
return event.type.startsWith("mouse");
|
|
44980
44985
|
}
|
|
44981
|
-
function getResizeEventCoordinates(event) {
|
|
44982
|
-
if (isPointerEvent(event)) {
|
|
44986
|
+
function getResizeEventCoordinates$1(event) {
|
|
44987
|
+
if (isPointerEvent$1(event)) {
|
|
44983
44988
|
if (event.isPrimary) {
|
|
44984
44989
|
return {
|
|
44985
44990
|
x: event.clientX,
|
|
44986
44991
|
y: event.clientY
|
|
44987
44992
|
};
|
|
44988
44993
|
}
|
|
44989
|
-
} else if (isMouseEvent(event)) {
|
|
44994
|
+
} else if (isMouseEvent$1(event)) {
|
|
44990
44995
|
return {
|
|
44991
44996
|
x: event.clientX,
|
|
44992
44997
|
y: event.clientY
|
|
@@ -44997,74 +45002,74 @@ function getResizeEventCoordinates(event) {
|
|
|
44997
45002
|
y: Infinity
|
|
44998
45003
|
};
|
|
44999
45004
|
}
|
|
45000
|
-
function getInputType() {
|
|
45005
|
+
function getInputType$1() {
|
|
45001
45006
|
if (typeof matchMedia === "function") {
|
|
45002
45007
|
return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
|
|
45003
45008
|
}
|
|
45004
45009
|
}
|
|
45005
|
-
var EXCEEDED_HORIZONTAL_MIN = 1;
|
|
45006
|
-
var EXCEEDED_HORIZONTAL_MAX = 2;
|
|
45007
|
-
var EXCEEDED_VERTICAL_MIN = 4;
|
|
45008
|
-
var EXCEEDED_VERTICAL_MAX = 8;
|
|
45009
|
-
getInputType() === "coarse";
|
|
45010
|
-
var panelConstraintFlags = /* @__PURE__ */ new Map();
|
|
45011
|
-
function reportConstraintsViolation(resizeHandleId, flag) {
|
|
45012
|
-
panelConstraintFlags.set(resizeHandleId, flag);
|
|
45010
|
+
var EXCEEDED_HORIZONTAL_MIN$1 = 1;
|
|
45011
|
+
var EXCEEDED_HORIZONTAL_MAX$1 = 2;
|
|
45012
|
+
var EXCEEDED_VERTICAL_MIN$1 = 4;
|
|
45013
|
+
var EXCEEDED_VERTICAL_MAX$1 = 8;
|
|
45014
|
+
getInputType$1() === "coarse";
|
|
45015
|
+
var panelConstraintFlags$1 = /* @__PURE__ */ new Map();
|
|
45016
|
+
function reportConstraintsViolation$1(resizeHandleId, flag) {
|
|
45017
|
+
panelConstraintFlags$1.set(resizeHandleId, flag);
|
|
45013
45018
|
}
|
|
45014
45019
|
new AbortController();
|
|
45015
|
-
function useForceUpdate() {
|
|
45020
|
+
function useForceUpdate$1() {
|
|
45016
45021
|
const [_, setCount] = useState(0);
|
|
45017
45022
|
return useCallback(() => setCount((prevCount) => prevCount + 1), []);
|
|
45018
45023
|
}
|
|
45019
|
-
function assert(expectedCondition, message) {
|
|
45024
|
+
function assert$1(expectedCondition, message) {
|
|
45020
45025
|
if (!expectedCondition) {
|
|
45021
45026
|
console.error(message);
|
|
45022
45027
|
throw Error(message);
|
|
45023
45028
|
}
|
|
45024
45029
|
}
|
|
45025
|
-
function fuzzyCompareNumbers(actual, expected, fractionDigits = PRECISION) {
|
|
45030
|
+
function fuzzyCompareNumbers$1(actual, expected, fractionDigits = PRECISION$1) {
|
|
45026
45031
|
if (actual.toFixed(fractionDigits) === expected.toFixed(fractionDigits)) {
|
|
45027
45032
|
return 0;
|
|
45028
45033
|
} else {
|
|
45029
45034
|
return actual > expected ? 1 : -1;
|
|
45030
45035
|
}
|
|
45031
45036
|
}
|
|
45032
|
-
function fuzzyNumbersEqual$1(actual, expected, fractionDigits = PRECISION) {
|
|
45033
|
-
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
45037
|
+
function fuzzyNumbersEqual$1$1(actual, expected, fractionDigits = PRECISION$1) {
|
|
45038
|
+
return fuzzyCompareNumbers$1(actual, expected, fractionDigits) === 0;
|
|
45034
45039
|
}
|
|
45035
|
-
function fuzzyNumbersEqual(actual, expected, fractionDigits) {
|
|
45036
|
-
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
45040
|
+
function fuzzyNumbersEqual$2(actual, expected, fractionDigits) {
|
|
45041
|
+
return fuzzyCompareNumbers$1(actual, expected, fractionDigits) === 0;
|
|
45037
45042
|
}
|
|
45038
|
-
function fuzzyLayoutsEqual(actual, expected, fractionDigits) {
|
|
45043
|
+
function fuzzyLayoutsEqual$1(actual, expected, fractionDigits) {
|
|
45039
45044
|
if (actual.length !== expected.length) {
|
|
45040
45045
|
return false;
|
|
45041
45046
|
}
|
|
45042
45047
|
for (let index2 = 0; index2 < actual.length; index2++) {
|
|
45043
45048
|
const actualSize = actual[index2];
|
|
45044
45049
|
const expectedSize = expected[index2];
|
|
45045
|
-
if (!fuzzyNumbersEqual(actualSize, expectedSize, fractionDigits)) {
|
|
45050
|
+
if (!fuzzyNumbersEqual$2(actualSize, expectedSize, fractionDigits)) {
|
|
45046
45051
|
return false;
|
|
45047
45052
|
}
|
|
45048
45053
|
}
|
|
45049
45054
|
return true;
|
|
45050
45055
|
}
|
|
45051
|
-
function resizePanel({
|
|
45056
|
+
function resizePanel$1({
|
|
45052
45057
|
panelConstraints: panelConstraintsArray,
|
|
45053
45058
|
panelIndex,
|
|
45054
45059
|
size
|
|
45055
45060
|
}) {
|
|
45056
45061
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
45057
|
-
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
45062
|
+
assert$1(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
45058
45063
|
let {
|
|
45059
45064
|
collapsedSize = 0,
|
|
45060
45065
|
collapsible,
|
|
45061
45066
|
maxSize = 100,
|
|
45062
45067
|
minSize = 0
|
|
45063
45068
|
} = panelConstraints;
|
|
45064
|
-
if (fuzzyCompareNumbers(size, minSize) < 0) {
|
|
45069
|
+
if (fuzzyCompareNumbers$1(size, minSize) < 0) {
|
|
45065
45070
|
if (collapsible) {
|
|
45066
45071
|
const halfwayPoint = (collapsedSize + minSize) / 2;
|
|
45067
|
-
if (fuzzyCompareNumbers(size, halfwayPoint) < 0) {
|
|
45072
|
+
if (fuzzyCompareNumbers$1(size, halfwayPoint) < 0) {
|
|
45068
45073
|
size = collapsedSize;
|
|
45069
45074
|
} else {
|
|
45070
45075
|
size = minSize;
|
|
@@ -45074,10 +45079,10 @@ function resizePanel({
|
|
|
45074
45079
|
}
|
|
45075
45080
|
}
|
|
45076
45081
|
size = Math.min(maxSize, size);
|
|
45077
|
-
size = parseFloat(size.toFixed(PRECISION));
|
|
45082
|
+
size = parseFloat(size.toFixed(PRECISION$1));
|
|
45078
45083
|
return size;
|
|
45079
45084
|
}
|
|
45080
|
-
function adjustLayoutByDelta({
|
|
45085
|
+
function adjustLayoutByDelta$1({
|
|
45081
45086
|
delta,
|
|
45082
45087
|
initialLayout,
|
|
45083
45088
|
panelConstraints: panelConstraintsArray,
|
|
@@ -45085,20 +45090,20 @@ function adjustLayoutByDelta({
|
|
|
45085
45090
|
prevLayout,
|
|
45086
45091
|
trigger
|
|
45087
45092
|
}) {
|
|
45088
|
-
if (fuzzyNumbersEqual(delta, 0)) {
|
|
45093
|
+
if (fuzzyNumbersEqual$2(delta, 0)) {
|
|
45089
45094
|
return initialLayout;
|
|
45090
45095
|
}
|
|
45091
45096
|
const nextLayout = [...initialLayout];
|
|
45092
45097
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
45093
|
-
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
45094
|
-
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
45098
|
+
assert$1(firstPivotIndex != null, "Invalid first pivot index");
|
|
45099
|
+
assert$1(secondPivotIndex != null, "Invalid second pivot index");
|
|
45095
45100
|
let deltaApplied = 0;
|
|
45096
45101
|
{
|
|
45097
45102
|
if (trigger === "keyboard") {
|
|
45098
45103
|
{
|
|
45099
45104
|
const index2 = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
45100
45105
|
const panelConstraints = panelConstraintsArray[index2];
|
|
45101
|
-
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45106
|
+
assert$1(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45102
45107
|
const {
|
|
45103
45108
|
collapsedSize = 0,
|
|
45104
45109
|
collapsible,
|
|
@@ -45106,10 +45111,10 @@ function adjustLayoutByDelta({
|
|
|
45106
45111
|
} = panelConstraints;
|
|
45107
45112
|
if (collapsible) {
|
|
45108
45113
|
const prevSize = initialLayout[index2];
|
|
45109
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45110
|
-
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
45114
|
+
assert$1(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45115
|
+
if (fuzzyNumbersEqual$2(prevSize, collapsedSize)) {
|
|
45111
45116
|
const localDelta = minSize - prevSize;
|
|
45112
|
-
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
45117
|
+
if (fuzzyCompareNumbers$1(localDelta, Math.abs(delta)) > 0) {
|
|
45113
45118
|
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
45114
45119
|
}
|
|
45115
45120
|
}
|
|
@@ -45118,7 +45123,7 @@ function adjustLayoutByDelta({
|
|
|
45118
45123
|
{
|
|
45119
45124
|
const index2 = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
45120
45125
|
const panelConstraints = panelConstraintsArray[index2];
|
|
45121
|
-
assert(panelConstraints, `No panel constraints found for index ${index2}`);
|
|
45126
|
+
assert$1(panelConstraints, `No panel constraints found for index ${index2}`);
|
|
45122
45127
|
const {
|
|
45123
45128
|
collapsedSize = 0,
|
|
45124
45129
|
collapsible,
|
|
@@ -45126,10 +45131,10 @@ function adjustLayoutByDelta({
|
|
|
45126
45131
|
} = panelConstraints;
|
|
45127
45132
|
if (collapsible) {
|
|
45128
45133
|
const prevSize = initialLayout[index2];
|
|
45129
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45130
|
-
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
45134
|
+
assert$1(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45135
|
+
if (fuzzyNumbersEqual$2(prevSize, minSize)) {
|
|
45131
45136
|
const localDelta = prevSize - collapsedSize;
|
|
45132
|
-
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
45137
|
+
if (fuzzyCompareNumbers$1(localDelta, Math.abs(delta)) > 0) {
|
|
45133
45138
|
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
45134
45139
|
}
|
|
45135
45140
|
}
|
|
@@ -45143,8 +45148,8 @@ function adjustLayoutByDelta({
|
|
|
45143
45148
|
let maxAvailableDelta = 0;
|
|
45144
45149
|
while (true) {
|
|
45145
45150
|
const prevSize = initialLayout[index2];
|
|
45146
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45147
|
-
const maxSafeSize = resizePanel({
|
|
45151
|
+
assert$1(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45152
|
+
const maxSafeSize = resizePanel$1({
|
|
45148
45153
|
panelConstraints: panelConstraintsArray,
|
|
45149
45154
|
panelIndex: index2,
|
|
45150
45155
|
size: 100
|
|
@@ -45165,14 +45170,14 @@ function adjustLayoutByDelta({
|
|
|
45165
45170
|
while (index2 >= 0 && index2 < panelConstraintsArray.length) {
|
|
45166
45171
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
45167
45172
|
const prevSize = initialLayout[index2];
|
|
45168
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45173
|
+
assert$1(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
45169
45174
|
const unsafeSize = prevSize - deltaRemaining;
|
|
45170
|
-
const safeSize = resizePanel({
|
|
45175
|
+
const safeSize = resizePanel$1({
|
|
45171
45176
|
panelConstraints: panelConstraintsArray,
|
|
45172
45177
|
panelIndex: index2,
|
|
45173
45178
|
size: unsafeSize
|
|
45174
45179
|
});
|
|
45175
|
-
if (!fuzzyNumbersEqual(prevSize, safeSize)) {
|
|
45180
|
+
if (!fuzzyNumbersEqual$2(prevSize, safeSize)) {
|
|
45176
45181
|
deltaApplied += prevSize - safeSize;
|
|
45177
45182
|
nextLayout[index2] = safeSize;
|
|
45178
45183
|
if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), void 0, {
|
|
@@ -45188,38 +45193,38 @@ function adjustLayoutByDelta({
|
|
|
45188
45193
|
}
|
|
45189
45194
|
}
|
|
45190
45195
|
}
|
|
45191
|
-
if (fuzzyLayoutsEqual(prevLayout, nextLayout)) {
|
|
45196
|
+
if (fuzzyLayoutsEqual$1(prevLayout, nextLayout)) {
|
|
45192
45197
|
return prevLayout;
|
|
45193
45198
|
}
|
|
45194
45199
|
{
|
|
45195
45200
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
45196
45201
|
const prevSize = initialLayout[pivotIndex];
|
|
45197
|
-
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
45202
|
+
assert$1(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
45198
45203
|
const unsafeSize = prevSize + deltaApplied;
|
|
45199
|
-
const safeSize = resizePanel({
|
|
45204
|
+
const safeSize = resizePanel$1({
|
|
45200
45205
|
panelConstraints: panelConstraintsArray,
|
|
45201
45206
|
panelIndex: pivotIndex,
|
|
45202
45207
|
size: unsafeSize
|
|
45203
45208
|
});
|
|
45204
45209
|
nextLayout[pivotIndex] = safeSize;
|
|
45205
|
-
if (!fuzzyNumbersEqual(safeSize, unsafeSize)) {
|
|
45210
|
+
if (!fuzzyNumbersEqual$2(safeSize, unsafeSize)) {
|
|
45206
45211
|
let deltaRemaining = unsafeSize - safeSize;
|
|
45207
45212
|
const pivotIndex2 = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
45208
45213
|
let index2 = pivotIndex2;
|
|
45209
45214
|
while (index2 >= 0 && index2 < panelConstraintsArray.length) {
|
|
45210
45215
|
const prevSize2 = nextLayout[index2];
|
|
45211
|
-
assert(prevSize2 != null, `Previous layout not found for panel index ${index2}`);
|
|
45216
|
+
assert$1(prevSize2 != null, `Previous layout not found for panel index ${index2}`);
|
|
45212
45217
|
const unsafeSize2 = prevSize2 + deltaRemaining;
|
|
45213
|
-
const safeSize2 = resizePanel({
|
|
45218
|
+
const safeSize2 = resizePanel$1({
|
|
45214
45219
|
panelConstraints: panelConstraintsArray,
|
|
45215
45220
|
panelIndex: index2,
|
|
45216
45221
|
size: unsafeSize2
|
|
45217
45222
|
});
|
|
45218
|
-
if (!fuzzyNumbersEqual(prevSize2, safeSize2)) {
|
|
45223
|
+
if (!fuzzyNumbersEqual$2(prevSize2, safeSize2)) {
|
|
45219
45224
|
deltaRemaining -= safeSize2 - prevSize2;
|
|
45220
45225
|
nextLayout[index2] = safeSize2;
|
|
45221
45226
|
}
|
|
45222
|
-
if (fuzzyNumbersEqual(deltaRemaining, 0)) {
|
|
45227
|
+
if (fuzzyNumbersEqual$2(deltaRemaining, 0)) {
|
|
45223
45228
|
break;
|
|
45224
45229
|
}
|
|
45225
45230
|
if (delta > 0) {
|
|
@@ -45231,12 +45236,12 @@ function adjustLayoutByDelta({
|
|
|
45231
45236
|
}
|
|
45232
45237
|
}
|
|
45233
45238
|
const totalSize = nextLayout.reduce((total, size) => size + total, 0);
|
|
45234
|
-
if (!fuzzyNumbersEqual(totalSize, 100)) {
|
|
45239
|
+
if (!fuzzyNumbersEqual$2(totalSize, 100)) {
|
|
45235
45240
|
return prevLayout;
|
|
45236
45241
|
}
|
|
45237
45242
|
return nextLayout;
|
|
45238
45243
|
}
|
|
45239
|
-
function calculateAriaValues({
|
|
45244
|
+
function calculateAriaValues$1({
|
|
45240
45245
|
layout,
|
|
45241
45246
|
panelsArray,
|
|
45242
45247
|
pivotIndices
|
|
@@ -45246,7 +45251,7 @@ function calculateAriaValues({
|
|
|
45246
45251
|
let totalMinSize = 0;
|
|
45247
45252
|
let totalMaxSize = 0;
|
|
45248
45253
|
const firstIndex = pivotIndices[0];
|
|
45249
|
-
assert(firstIndex != null, "No pivot index found");
|
|
45254
|
+
assert$1(firstIndex != null, "No pivot index found");
|
|
45250
45255
|
panelsArray.forEach((panelData, index2) => {
|
|
45251
45256
|
const {
|
|
45252
45257
|
constraints
|
|
@@ -45272,19 +45277,19 @@ function calculateAriaValues({
|
|
|
45272
45277
|
valueNow
|
|
45273
45278
|
};
|
|
45274
45279
|
}
|
|
45275
|
-
function getResizeHandleElementsForGroup(groupId, scope = document) {
|
|
45276
|
-
return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES.resizeHandleId}][data-panel-group-id="${groupId}"]`));
|
|
45280
|
+
function getResizeHandleElementsForGroup$1(groupId, scope = document) {
|
|
45281
|
+
return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES$1.resizeHandleId}][data-panel-group-id="${groupId}"]`));
|
|
45277
45282
|
}
|
|
45278
|
-
function getResizeHandleElementIndex(groupId, id, scope = document) {
|
|
45279
|
-
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
45280
|
-
const index2 = handles.findIndex((handle2) => handle2.getAttribute(DATA_ATTRIBUTES.resizeHandleId) === id);
|
|
45283
|
+
function getResizeHandleElementIndex$1(groupId, id, scope = document) {
|
|
45284
|
+
const handles = getResizeHandleElementsForGroup$1(groupId, scope);
|
|
45285
|
+
const index2 = handles.findIndex((handle2) => handle2.getAttribute(DATA_ATTRIBUTES$1.resizeHandleId) === id);
|
|
45281
45286
|
return index2 !== null && index2 !== void 0 ? index2 : null;
|
|
45282
45287
|
}
|
|
45283
|
-
function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
|
|
45284
|
-
const index2 = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
|
|
45288
|
+
function determinePivotIndices$1(groupId, dragHandleId, panelGroupElement) {
|
|
45289
|
+
const index2 = getResizeHandleElementIndex$1(groupId, dragHandleId, panelGroupElement);
|
|
45285
45290
|
return index2 != null ? [index2, index2 + 1] : [-1, -1];
|
|
45286
45291
|
}
|
|
45287
|
-
function getPanelGroupElement(id, rootElement = document) {
|
|
45292
|
+
function getPanelGroupElement$1(id, rootElement = document) {
|
|
45288
45293
|
var _dataset;
|
|
45289
45294
|
if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
|
|
45290
45295
|
return rootElement;
|
|
@@ -45295,23 +45300,23 @@ function getPanelGroupElement(id, rootElement = document) {
|
|
|
45295
45300
|
}
|
|
45296
45301
|
return null;
|
|
45297
45302
|
}
|
|
45298
|
-
function getResizeHandleElement(id, scope = document) {
|
|
45299
|
-
const element2 = scope.querySelector(`[${DATA_ATTRIBUTES.resizeHandleId}="${id}"]`);
|
|
45303
|
+
function getResizeHandleElement$1(id, scope = document) {
|
|
45304
|
+
const element2 = scope.querySelector(`[${DATA_ATTRIBUTES$1.resizeHandleId}="${id}"]`);
|
|
45300
45305
|
if (element2) {
|
|
45301
45306
|
return element2;
|
|
45302
45307
|
}
|
|
45303
45308
|
return null;
|
|
45304
45309
|
}
|
|
45305
|
-
function getResizeHandlePanelIds(groupId, handleId, panelsArray, scope = document) {
|
|
45310
|
+
function getResizeHandlePanelIds$1(groupId, handleId, panelsArray, scope = document) {
|
|
45306
45311
|
var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
|
|
45307
|
-
const handle2 = getResizeHandleElement(handleId, scope);
|
|
45308
|
-
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
45312
|
+
const handle2 = getResizeHandleElement$1(handleId, scope);
|
|
45313
|
+
const handles = getResizeHandleElementsForGroup$1(groupId, scope);
|
|
45309
45314
|
const index2 = handle2 ? handles.indexOf(handle2) : -1;
|
|
45310
45315
|
const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index2]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
|
|
45311
45316
|
const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index2 + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
|
|
45312
45317
|
return [idBefore, idAfter];
|
|
45313
45318
|
}
|
|
45314
|
-
function useWindowSplitterPanelGroupBehavior({
|
|
45319
|
+
function useWindowSplitterPanelGroupBehavior$1({
|
|
45315
45320
|
committedValuesRef,
|
|
45316
45321
|
eagerValuesRef,
|
|
45317
45322
|
groupId,
|
|
@@ -45323,17 +45328,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45323
45328
|
const devWarningsRef = useRef({
|
|
45324
45329
|
didWarnAboutMissingResizeHandle: false
|
|
45325
45330
|
});
|
|
45326
|
-
useIsomorphicLayoutEffect(() => {
|
|
45331
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
45327
45332
|
if (!panelGroupElement) {
|
|
45328
45333
|
return;
|
|
45329
45334
|
}
|
|
45330
|
-
const resizeHandleElements = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
45335
|
+
const resizeHandleElements = getResizeHandleElementsForGroup$1(groupId, panelGroupElement);
|
|
45331
45336
|
for (let index2 = 0; index2 < panelDataArray.length - 1; index2++) {
|
|
45332
45337
|
const {
|
|
45333
45338
|
valueMax,
|
|
45334
45339
|
valueMin,
|
|
45335
45340
|
valueNow
|
|
45336
|
-
} = calculateAriaValues({
|
|
45341
|
+
} = calculateAriaValues$1({
|
|
45337
45342
|
layout,
|
|
45338
45343
|
panelsArray: panelDataArray,
|
|
45339
45344
|
pivotIndices: [index2, index2 + 1]
|
|
@@ -45351,7 +45356,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45351
45356
|
}
|
|
45352
45357
|
} else {
|
|
45353
45358
|
const panelData = panelDataArray[index2];
|
|
45354
|
-
assert(panelData, `No panel data found for index "${index2}"`);
|
|
45359
|
+
assert$1(panelData, `No panel data found for index "${index2}"`);
|
|
45355
45360
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
45356
45361
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
45357
45362
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -45372,18 +45377,18 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45372
45377
|
return;
|
|
45373
45378
|
}
|
|
45374
45379
|
const eagerValues = eagerValuesRef.current;
|
|
45375
|
-
assert(eagerValues, `Eager values not found`);
|
|
45380
|
+
assert$1(eagerValues, `Eager values not found`);
|
|
45376
45381
|
const {
|
|
45377
45382
|
panelDataArray: panelDataArray2
|
|
45378
45383
|
} = eagerValues;
|
|
45379
|
-
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
45380
|
-
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
45381
|
-
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
45382
|
-
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
45384
|
+
const groupElement = getPanelGroupElement$1(groupId, panelGroupElement);
|
|
45385
|
+
assert$1(groupElement != null, `No group found for id "${groupId}"`);
|
|
45386
|
+
const handles = getResizeHandleElementsForGroup$1(groupId, panelGroupElement);
|
|
45387
|
+
assert$1(handles, `No resize handles found for group id "${groupId}"`);
|
|
45383
45388
|
const cleanupFunctions = handles.map((handle2) => {
|
|
45384
|
-
const handleId = handle2.getAttribute(DATA_ATTRIBUTES.resizeHandleId);
|
|
45385
|
-
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
45386
|
-
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray2, panelGroupElement);
|
|
45389
|
+
const handleId = handle2.getAttribute(DATA_ATTRIBUTES$1.resizeHandleId);
|
|
45390
|
+
assert$1(handleId, `Resize handle element has no handle id attribute`);
|
|
45391
|
+
const [idBefore, idAfter] = getResizeHandlePanelIds$1(groupId, handleId, panelDataArray2, panelGroupElement);
|
|
45387
45392
|
if (idBefore == null || idAfter == null) {
|
|
45388
45393
|
return () => {
|
|
45389
45394
|
};
|
|
@@ -45398,7 +45403,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45398
45403
|
const index2 = panelDataArray2.findIndex((panelData) => panelData.id === idBefore);
|
|
45399
45404
|
if (index2 >= 0) {
|
|
45400
45405
|
const panelData = panelDataArray2[index2];
|
|
45401
|
-
assert(panelData, `No panel data found for index ${index2}`);
|
|
45406
|
+
assert$1(panelData, `No panel data found for index ${index2}`);
|
|
45402
45407
|
const size = layout[index2];
|
|
45403
45408
|
const {
|
|
45404
45409
|
collapsedSize = 0,
|
|
@@ -45406,11 +45411,11 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45406
45411
|
minSize = 0
|
|
45407
45412
|
} = panelData.constraints;
|
|
45408
45413
|
if (size != null && collapsible) {
|
|
45409
|
-
const nextLayout = adjustLayoutByDelta({
|
|
45410
|
-
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
45414
|
+
const nextLayout = adjustLayoutByDelta$1({
|
|
45415
|
+
delta: fuzzyNumbersEqual$2(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
45411
45416
|
initialLayout: layout,
|
|
45412
45417
|
panelConstraints: panelDataArray2.map((panelData2) => panelData2.constraints),
|
|
45413
|
-
pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
|
|
45418
|
+
pivotIndices: determinePivotIndices$1(groupId, handleId, panelGroupElement),
|
|
45414
45419
|
prevLayout: layout,
|
|
45415
45420
|
trigger: "keyboard"
|
|
45416
45421
|
});
|
|
@@ -45433,7 +45438,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
45433
45438
|
};
|
|
45434
45439
|
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
45435
45440
|
}
|
|
45436
|
-
function areEqual(arrayA, arrayB) {
|
|
45441
|
+
function areEqual$1(arrayA, arrayB) {
|
|
45437
45442
|
if (arrayA.length !== arrayB.length) {
|
|
45438
45443
|
return false;
|
|
45439
45444
|
}
|
|
@@ -45444,34 +45449,34 @@ function areEqual(arrayA, arrayB) {
|
|
|
45444
45449
|
}
|
|
45445
45450
|
return true;
|
|
45446
45451
|
}
|
|
45447
|
-
function getResizeEventCursorPosition(direction, event) {
|
|
45452
|
+
function getResizeEventCursorPosition$1(direction, event) {
|
|
45448
45453
|
const isHorizontal = direction === "horizontal";
|
|
45449
45454
|
const {
|
|
45450
45455
|
x,
|
|
45451
45456
|
y
|
|
45452
|
-
} = getResizeEventCoordinates(event);
|
|
45457
|
+
} = getResizeEventCoordinates$1(event);
|
|
45453
45458
|
return isHorizontal ? x : y;
|
|
45454
45459
|
}
|
|
45455
|
-
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
45460
|
+
function calculateDragOffsetPercentage$1(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
45456
45461
|
const isHorizontal = direction === "horizontal";
|
|
45457
|
-
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
45458
|
-
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
45459
|
-
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
45460
|
-
assert(groupId, `Resize handle element has no group id attribute`);
|
|
45462
|
+
const handleElement = getResizeHandleElement$1(dragHandleId, panelGroupElement);
|
|
45463
|
+
assert$1(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
45464
|
+
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES$1.groupId);
|
|
45465
|
+
assert$1(groupId, `Resize handle element has no group id attribute`);
|
|
45461
45466
|
let {
|
|
45462
45467
|
initialCursorPosition
|
|
45463
45468
|
} = initialDragState;
|
|
45464
|
-
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
45465
|
-
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
45466
|
-
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
45469
|
+
const cursorPosition = getResizeEventCursorPosition$1(direction, event);
|
|
45470
|
+
const groupElement = getPanelGroupElement$1(groupId, panelGroupElement);
|
|
45471
|
+
assert$1(groupElement, `No group element found for id "${groupId}"`);
|
|
45467
45472
|
const groupRect = groupElement.getBoundingClientRect();
|
|
45468
45473
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
45469
45474
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
45470
45475
|
const offsetPercentage = offsetPixels / groupSizeInPixels * 100;
|
|
45471
45476
|
return offsetPercentage;
|
|
45472
45477
|
}
|
|
45473
|
-
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
45474
|
-
if (isKeyDown(event)) {
|
|
45478
|
+
function calculateDeltaPercentage$1(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
45479
|
+
if (isKeyDown$1(event)) {
|
|
45475
45480
|
const isHorizontal = direction === "horizontal";
|
|
45476
45481
|
let delta = 0;
|
|
45477
45482
|
if (event.shiftKey) {
|
|
@@ -45507,10 +45512,10 @@ function calculateDeltaPercentage(event, dragHandleId, direction, initialDragSta
|
|
|
45507
45512
|
if (initialDragState == null) {
|
|
45508
45513
|
return 0;
|
|
45509
45514
|
}
|
|
45510
|
-
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
45515
|
+
return calculateDragOffsetPercentage$1(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
45511
45516
|
}
|
|
45512
45517
|
}
|
|
45513
|
-
function calculateUnsafeDefaultLayout({
|
|
45518
|
+
function calculateUnsafeDefaultLayout$1({
|
|
45514
45519
|
panelDataArray
|
|
45515
45520
|
}) {
|
|
45516
45521
|
const layout = Array(panelDataArray.length);
|
|
@@ -45519,7 +45524,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
45519
45524
|
let remainingSize = 100;
|
|
45520
45525
|
for (let index2 = 0; index2 < panelDataArray.length; index2++) {
|
|
45521
45526
|
const panelConstraints = panelConstraintsArray[index2];
|
|
45522
|
-
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45527
|
+
assert$1(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45523
45528
|
const {
|
|
45524
45529
|
defaultSize
|
|
45525
45530
|
} = panelConstraints;
|
|
@@ -45531,7 +45536,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
45531
45536
|
}
|
|
45532
45537
|
for (let index2 = 0; index2 < panelDataArray.length; index2++) {
|
|
45533
45538
|
const panelConstraints = panelConstraintsArray[index2];
|
|
45534
|
-
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45539
|
+
assert$1(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
45535
45540
|
const {
|
|
45536
45541
|
defaultSize
|
|
45537
45542
|
} = panelConstraints;
|
|
@@ -45546,10 +45551,10 @@ function calculateUnsafeDefaultLayout({
|
|
|
45546
45551
|
}
|
|
45547
45552
|
return layout;
|
|
45548
45553
|
}
|
|
45549
|
-
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
45554
|
+
function callPanelCallbacks$1(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
45550
45555
|
layout.forEach((size, index2) => {
|
|
45551
45556
|
const panelData = panelsArray[index2];
|
|
45552
|
-
assert(panelData, `Panel data not found for index ${index2}`);
|
|
45557
|
+
assert$1(panelData, `Panel data not found for index ${index2}`);
|
|
45553
45558
|
const {
|
|
45554
45559
|
callbacks,
|
|
45555
45560
|
constraints,
|
|
@@ -45571,17 +45576,17 @@ function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
|
45571
45576
|
onResize(size, lastNotifiedSize);
|
|
45572
45577
|
}
|
|
45573
45578
|
if (collapsible && (onCollapse || onExpand)) {
|
|
45574
|
-
if (onExpand && (lastNotifiedSize == null || fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
45579
|
+
if (onExpand && (lastNotifiedSize == null || fuzzyNumbersEqual$1$1(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual$1$1(size, collapsedSize)) {
|
|
45575
45580
|
onExpand();
|
|
45576
45581
|
}
|
|
45577
|
-
if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
45582
|
+
if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual$1$1(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual$1$1(size, collapsedSize)) {
|
|
45578
45583
|
onCollapse();
|
|
45579
45584
|
}
|
|
45580
45585
|
}
|
|
45581
45586
|
}
|
|
45582
45587
|
});
|
|
45583
45588
|
}
|
|
45584
|
-
function compareLayouts(a, b) {
|
|
45589
|
+
function compareLayouts$1(a, b) {
|
|
45585
45590
|
if (a.length !== b.length) {
|
|
45586
45591
|
return false;
|
|
45587
45592
|
} else {
|
|
@@ -45593,7 +45598,7 @@ function compareLayouts(a, b) {
|
|
|
45593
45598
|
}
|
|
45594
45599
|
return true;
|
|
45595
45600
|
}
|
|
45596
|
-
function computePanelFlexBoxStyle({
|
|
45601
|
+
function computePanelFlexBoxStyle$1({
|
|
45597
45602
|
defaultSize,
|
|
45598
45603
|
dragState,
|
|
45599
45604
|
layout,
|
|
@@ -45618,7 +45623,7 @@ function computePanelFlexBoxStyle({
|
|
|
45618
45623
|
pointerEvents: dragState !== null ? "none" : void 0
|
|
45619
45624
|
};
|
|
45620
45625
|
}
|
|
45621
|
-
function debounce(callback, durationMs = 10) {
|
|
45626
|
+
function debounce$1(callback, durationMs = 10) {
|
|
45622
45627
|
let timeoutId = null;
|
|
45623
45628
|
let callable = (...args) => {
|
|
45624
45629
|
if (timeoutId !== null) {
|
|
@@ -45630,7 +45635,7 @@ function debounce(callback, durationMs = 10) {
|
|
|
45630
45635
|
};
|
|
45631
45636
|
return callable;
|
|
45632
45637
|
}
|
|
45633
|
-
function initializeDefaultStorage(storageObject) {
|
|
45638
|
+
function initializeDefaultStorage$1(storageObject) {
|
|
45634
45639
|
try {
|
|
45635
45640
|
if (typeof localStorage !== "undefined") {
|
|
45636
45641
|
storageObject.getItem = (name2) => {
|
|
@@ -45649,10 +45654,10 @@ function initializeDefaultStorage(storageObject) {
|
|
|
45649
45654
|
};
|
|
45650
45655
|
}
|
|
45651
45656
|
}
|
|
45652
|
-
function getPanelGroupKey(autoSaveId) {
|
|
45657
|
+
function getPanelGroupKey$1(autoSaveId) {
|
|
45653
45658
|
return `react-resizable-panels:${autoSaveId}`;
|
|
45654
45659
|
}
|
|
45655
|
-
function getPanelKey(panels2) {
|
|
45660
|
+
function getPanelKey$1(panels2) {
|
|
45656
45661
|
return panels2.map((panel) => {
|
|
45657
45662
|
const {
|
|
45658
45663
|
constraints,
|
|
@@ -45667,9 +45672,9 @@ function getPanelKey(panels2) {
|
|
|
45667
45672
|
}
|
|
45668
45673
|
}).sort((a, b) => a.localeCompare(b)).join(",");
|
|
45669
45674
|
}
|
|
45670
|
-
function loadSerializedPanelGroupState(autoSaveId, storage) {
|
|
45675
|
+
function loadSerializedPanelGroupState$1(autoSaveId, storage) {
|
|
45671
45676
|
try {
|
|
45672
|
-
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
45677
|
+
const panelGroupKey = getPanelGroupKey$1(autoSaveId);
|
|
45673
45678
|
const serialized = storage.getItem(panelGroupKey);
|
|
45674
45679
|
if (serialized) {
|
|
45675
45680
|
const parsed = JSON.parse(serialized);
|
|
@@ -45681,17 +45686,17 @@ function loadSerializedPanelGroupState(autoSaveId, storage) {
|
|
|
45681
45686
|
}
|
|
45682
45687
|
return null;
|
|
45683
45688
|
}
|
|
45684
|
-
function loadPanelGroupState(autoSaveId, panels2, storage) {
|
|
45689
|
+
function loadPanelGroupState$1(autoSaveId, panels2, storage) {
|
|
45685
45690
|
var _loadSerializedPanelG, _state$panelKey;
|
|
45686
|
-
const state = (_loadSerializedPanelG = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG !== void 0 ? _loadSerializedPanelG : {};
|
|
45687
|
-
const panelKey = getPanelKey(panels2);
|
|
45691
|
+
const state = (_loadSerializedPanelG = loadSerializedPanelGroupState$1(autoSaveId, storage)) !== null && _loadSerializedPanelG !== void 0 ? _loadSerializedPanelG : {};
|
|
45692
|
+
const panelKey = getPanelKey$1(panels2);
|
|
45688
45693
|
return (_state$panelKey = state[panelKey]) !== null && _state$panelKey !== void 0 ? _state$panelKey : null;
|
|
45689
45694
|
}
|
|
45690
|
-
function savePanelGroupState(autoSaveId, panels2, panelSizesBeforeCollapse, sizes, storage) {
|
|
45695
|
+
function savePanelGroupState$1(autoSaveId, panels2, panelSizesBeforeCollapse, sizes, storage) {
|
|
45691
45696
|
var _loadSerializedPanelG2;
|
|
45692
|
-
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
45693
|
-
const panelKey = getPanelKey(panels2);
|
|
45694
|
-
const state = (_loadSerializedPanelG2 = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG2 !== void 0 ? _loadSerializedPanelG2 : {};
|
|
45697
|
+
const panelGroupKey = getPanelGroupKey$1(autoSaveId);
|
|
45698
|
+
const panelKey = getPanelKey$1(panels2);
|
|
45699
|
+
const state = (_loadSerializedPanelG2 = loadSerializedPanelGroupState$1(autoSaveId, storage)) !== null && _loadSerializedPanelG2 !== void 0 ? _loadSerializedPanelG2 : {};
|
|
45695
45700
|
state[panelKey] = {
|
|
45696
45701
|
expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
|
|
45697
45702
|
layout: sizes
|
|
@@ -45710,7 +45715,7 @@ function validatePanelConstraints({
|
|
|
45710
45715
|
{
|
|
45711
45716
|
const warnings = [];
|
|
45712
45717
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
45713
|
-
assert(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
45718
|
+
assert$1(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
45714
45719
|
const {
|
|
45715
45720
|
collapsedSize = 0,
|
|
45716
45721
|
collapsible = false,
|
|
@@ -45747,7 +45752,7 @@ ${warnings.join(`
|
|
|
45747
45752
|
}
|
|
45748
45753
|
return true;
|
|
45749
45754
|
}
|
|
45750
|
-
function validatePanelGroupLayout({
|
|
45755
|
+
function validatePanelGroupLayout$1({
|
|
45751
45756
|
layout: prevLayout,
|
|
45752
45757
|
panelConstraints
|
|
45753
45758
|
}) {
|
|
@@ -45755,13 +45760,13 @@ function validatePanelGroupLayout({
|
|
|
45755
45760
|
const nextLayoutTotalSize = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
|
|
45756
45761
|
if (nextLayout.length !== panelConstraints.length) {
|
|
45757
45762
|
throw Error(`Invalid ${panelConstraints.length} panel layout: ${nextLayout.map((size) => `${size}%`).join(", ")}`);
|
|
45758
|
-
} else if (!fuzzyNumbersEqual(nextLayoutTotalSize, 100) && nextLayout.length > 0) {
|
|
45763
|
+
} else if (!fuzzyNumbersEqual$2(nextLayoutTotalSize, 100) && nextLayout.length > 0) {
|
|
45759
45764
|
{
|
|
45760
45765
|
console.warn(`WARNING: Invalid layout total size: ${nextLayout.map((size) => `${size}%`).join(", ")}. Layout normalization will be applied.`);
|
|
45761
45766
|
}
|
|
45762
45767
|
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
45763
45768
|
const unsafeSize = nextLayout[index2];
|
|
45764
|
-
assert(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
45769
|
+
assert$1(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
45765
45770
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
45766
45771
|
nextLayout[index2] = safeSize;
|
|
45767
45772
|
}
|
|
@@ -45769,8 +45774,8 @@ function validatePanelGroupLayout({
|
|
|
45769
45774
|
let remainingSize = 0;
|
|
45770
45775
|
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
45771
45776
|
const unsafeSize = nextLayout[index2];
|
|
45772
|
-
assert(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
45773
|
-
const safeSize = resizePanel({
|
|
45777
|
+
assert$1(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
45778
|
+
const safeSize = resizePanel$1({
|
|
45774
45779
|
panelConstraints,
|
|
45775
45780
|
panelIndex: index2,
|
|
45776
45781
|
size: unsafeSize
|
|
@@ -45780,12 +45785,12 @@ function validatePanelGroupLayout({
|
|
|
45780
45785
|
nextLayout[index2] = safeSize;
|
|
45781
45786
|
}
|
|
45782
45787
|
}
|
|
45783
|
-
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
45788
|
+
if (!fuzzyNumbersEqual$2(remainingSize, 0)) {
|
|
45784
45789
|
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
45785
45790
|
const prevSize = nextLayout[index2];
|
|
45786
|
-
assert(prevSize != null, `No layout data found for index ${index2}`);
|
|
45791
|
+
assert$1(prevSize != null, `No layout data found for index ${index2}`);
|
|
45787
45792
|
const unsafeSize = prevSize + remainingSize;
|
|
45788
|
-
const safeSize = resizePanel({
|
|
45793
|
+
const safeSize = resizePanel$1({
|
|
45789
45794
|
panelConstraints,
|
|
45790
45795
|
panelIndex: index2,
|
|
45791
45796
|
size: unsafeSize
|
|
@@ -45793,7 +45798,7 @@ function validatePanelGroupLayout({
|
|
|
45793
45798
|
if (prevSize !== safeSize) {
|
|
45794
45799
|
remainingSize -= safeSize - prevSize;
|
|
45795
45800
|
nextLayout[index2] = safeSize;
|
|
45796
|
-
if (fuzzyNumbersEqual(remainingSize, 0)) {
|
|
45801
|
+
if (fuzzyNumbersEqual$2(remainingSize, 0)) {
|
|
45797
45802
|
break;
|
|
45798
45803
|
}
|
|
45799
45804
|
}
|
|
@@ -45801,19 +45806,19 @@ function validatePanelGroupLayout({
|
|
|
45801
45806
|
}
|
|
45802
45807
|
return nextLayout;
|
|
45803
45808
|
}
|
|
45804
|
-
var LOCAL_STORAGE_DEBOUNCE_INTERVAL = 100;
|
|
45805
|
-
var defaultStorage = {
|
|
45809
|
+
var LOCAL_STORAGE_DEBOUNCE_INTERVAL$1 = 100;
|
|
45810
|
+
var defaultStorage$1 = {
|
|
45806
45811
|
getItem: (name2) => {
|
|
45807
|
-
initializeDefaultStorage(defaultStorage);
|
|
45808
|
-
return defaultStorage.getItem(name2);
|
|
45812
|
+
initializeDefaultStorage$1(defaultStorage$1);
|
|
45813
|
+
return defaultStorage$1.getItem(name2);
|
|
45809
45814
|
},
|
|
45810
45815
|
setItem: (name2, value) => {
|
|
45811
|
-
initializeDefaultStorage(defaultStorage);
|
|
45812
|
-
defaultStorage.setItem(name2, value);
|
|
45816
|
+
initializeDefaultStorage$1(defaultStorage$1);
|
|
45817
|
+
defaultStorage$1.setItem(name2, value);
|
|
45813
45818
|
}
|
|
45814
45819
|
};
|
|
45815
|
-
var debounceMap = {};
|
|
45816
|
-
function PanelGroupWithForwardedRef({
|
|
45820
|
+
var debounceMap$1 = {};
|
|
45821
|
+
function PanelGroupWithForwardedRef$1({
|
|
45817
45822
|
autoSaveId = null,
|
|
45818
45823
|
children: children2,
|
|
45819
45824
|
className: classNameFromProps = "",
|
|
@@ -45822,16 +45827,16 @@ function PanelGroupWithForwardedRef({
|
|
|
45822
45827
|
id: idFromProps = null,
|
|
45823
45828
|
onLayout = null,
|
|
45824
45829
|
keyboardResizeBy = null,
|
|
45825
|
-
storage = defaultStorage,
|
|
45830
|
+
storage = defaultStorage$1,
|
|
45826
45831
|
style: styleFromProps,
|
|
45827
45832
|
tagName: Type = "div",
|
|
45828
45833
|
...rest
|
|
45829
45834
|
}) {
|
|
45830
|
-
const groupId = useUniqueId(idFromProps);
|
|
45835
|
+
const groupId = useUniqueId$1(idFromProps);
|
|
45831
45836
|
const panelGroupElementRef = useRef(null);
|
|
45832
45837
|
const [dragState, setDragState] = useState(null);
|
|
45833
45838
|
const [layout, setLayout] = useState([]);
|
|
45834
|
-
const forceUpdate = useForceUpdate();
|
|
45839
|
+
const forceUpdate = useForceUpdate$1();
|
|
45835
45840
|
const panelIdToLastNotifiedSizeMapRef = useRef({});
|
|
45836
45841
|
const panelSizeBeforeCollapseRef = useRef(/* @__PURE__ */ new Map());
|
|
45837
45842
|
const prevDeltaRef = useRef(0);
|
|
@@ -45870,21 +45875,21 @@ function PanelGroupWithForwardedRef({
|
|
|
45870
45875
|
layout: prevLayout,
|
|
45871
45876
|
panelDataArray
|
|
45872
45877
|
} = eagerValuesRef.current;
|
|
45873
|
-
const safeLayout = validatePanelGroupLayout({
|
|
45878
|
+
const safeLayout = validatePanelGroupLayout$1({
|
|
45874
45879
|
layout: unsafeLayout,
|
|
45875
45880
|
panelConstraints: panelDataArray.map((panelData) => panelData.constraints)
|
|
45876
45881
|
});
|
|
45877
|
-
if (!areEqual(prevLayout, safeLayout)) {
|
|
45882
|
+
if (!areEqual$1(prevLayout, safeLayout)) {
|
|
45878
45883
|
setLayout(safeLayout);
|
|
45879
45884
|
eagerValuesRef.current.layout = safeLayout;
|
|
45880
45885
|
if (onLayout2) {
|
|
45881
45886
|
onLayout2(safeLayout);
|
|
45882
45887
|
}
|
|
45883
|
-
callPanelCallbacks(panelDataArray, safeLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
45888
|
+
callPanelCallbacks$1(panelDataArray, safeLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
45884
45889
|
}
|
|
45885
45890
|
}
|
|
45886
45891
|
}), []);
|
|
45887
|
-
useIsomorphicLayoutEffect(() => {
|
|
45892
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
45888
45893
|
committedValuesRef.current.autoSaveId = autoSaveId;
|
|
45889
45894
|
committedValuesRef.current.direction = direction;
|
|
45890
45895
|
committedValuesRef.current.dragState = dragState;
|
|
@@ -45892,7 +45897,7 @@ function PanelGroupWithForwardedRef({
|
|
|
45892
45897
|
committedValuesRef.current.onLayout = onLayout;
|
|
45893
45898
|
committedValuesRef.current.storage = storage;
|
|
45894
45899
|
});
|
|
45895
|
-
useWindowSplitterPanelGroupBehavior({
|
|
45900
|
+
useWindowSplitterPanelGroupBehavior$1({
|
|
45896
45901
|
committedValuesRef,
|
|
45897
45902
|
eagerValuesRef,
|
|
45898
45903
|
groupId,
|
|
@@ -45909,10 +45914,10 @@ function PanelGroupWithForwardedRef({
|
|
|
45909
45914
|
if (layout.length === 0 || layout.length !== panelDataArray.length) {
|
|
45910
45915
|
return;
|
|
45911
45916
|
}
|
|
45912
|
-
let debouncedSave = debounceMap[autoSaveId];
|
|
45917
|
+
let debouncedSave = debounceMap$1[autoSaveId];
|
|
45913
45918
|
if (debouncedSave == null) {
|
|
45914
|
-
debouncedSave = debounce(savePanelGroupState, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
|
|
45915
|
-
debounceMap[autoSaveId] = debouncedSave;
|
|
45919
|
+
debouncedSave = debounce$1(savePanelGroupState$1, LOCAL_STORAGE_DEBOUNCE_INTERVAL$1);
|
|
45920
|
+
debounceMap$1[autoSaveId] = debouncedSave;
|
|
45916
45921
|
}
|
|
45917
45922
|
const clonedPanelDataArray = [...panelDataArray];
|
|
45918
45923
|
const clonedPanelSizesBeforeCollapse = new Map(panelSizeBeforeCollapseRef.current);
|
|
@@ -45934,7 +45939,7 @@ function PanelGroupWithForwardedRef({
|
|
|
45934
45939
|
id
|
|
45935
45940
|
}) => id);
|
|
45936
45941
|
devWarningsRef.current.prevPanelIds = panelIds;
|
|
45937
|
-
const panelsHaveChanged = prevPanelIds.length > 0 && !areEqual(prevPanelIds, panelIds);
|
|
45942
|
+
const panelsHaveChanged = prevPanelIds.length > 0 && !areEqual$1(prevPanelIds, panelIds);
|
|
45938
45943
|
if (panelsHaveChanged) {
|
|
45939
45944
|
if (panelDataArray.find(({
|
|
45940
45945
|
idIsFromProps,
|
|
@@ -45949,7 +45954,7 @@ function PanelGroupWithForwardedRef({
|
|
|
45949
45954
|
const panelConstraints = panelDataArray.map((panelData) => panelData.constraints);
|
|
45950
45955
|
for (let panelIndex = 0; panelIndex < panelConstraints.length; panelIndex++) {
|
|
45951
45956
|
const panelData = panelDataArray[panelIndex];
|
|
45952
|
-
assert(panelData, `Panel data not found for index ${panelIndex}`);
|
|
45957
|
+
assert$1(panelData, `Panel data not found for index ${panelIndex}`);
|
|
45953
45958
|
const isValid = validatePanelConstraints({
|
|
45954
45959
|
panelConstraints,
|
|
45955
45960
|
panelId: panelData.id,
|
|
@@ -45977,13 +45982,13 @@ function PanelGroupWithForwardedRef({
|
|
|
45977
45982
|
collapsedSize = 0,
|
|
45978
45983
|
panelSize,
|
|
45979
45984
|
pivotIndices
|
|
45980
|
-
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
45981
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
45982
|
-
if (!fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
45985
|
+
} = panelDataHelper$1(panelDataArray, panelData, prevLayout);
|
|
45986
|
+
assert$1(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
45987
|
+
if (!fuzzyNumbersEqual$1$1(panelSize, collapsedSize)) {
|
|
45983
45988
|
panelSizeBeforeCollapseRef.current.set(panelData.id, panelSize);
|
|
45984
|
-
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
45989
|
+
const isLastPanel = findPanelDataIndex$1(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
45985
45990
|
const delta = isLastPanel ? panelSize - collapsedSize : collapsedSize - panelSize;
|
|
45986
|
-
const nextLayout = adjustLayoutByDelta({
|
|
45991
|
+
const nextLayout = adjustLayoutByDelta$1({
|
|
45987
45992
|
delta,
|
|
45988
45993
|
initialLayout: prevLayout,
|
|
45989
45994
|
panelConstraints: panelConstraintsArray,
|
|
@@ -45991,13 +45996,13 @@ function PanelGroupWithForwardedRef({
|
|
|
45991
45996
|
prevLayout,
|
|
45992
45997
|
trigger: "imperative-api"
|
|
45993
45998
|
});
|
|
45994
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
45999
|
+
if (!compareLayouts$1(prevLayout, nextLayout)) {
|
|
45995
46000
|
setLayout(nextLayout);
|
|
45996
46001
|
eagerValuesRef.current.layout = nextLayout;
|
|
45997
46002
|
if (onLayout2) {
|
|
45998
46003
|
onLayout2(nextLayout);
|
|
45999
46004
|
}
|
|
46000
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46005
|
+
callPanelCallbacks$1(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46001
46006
|
}
|
|
46002
46007
|
}
|
|
46003
46008
|
}
|
|
@@ -46017,14 +46022,14 @@ function PanelGroupWithForwardedRef({
|
|
|
46017
46022
|
panelSize = 0,
|
|
46018
46023
|
minSize: minSizeFromProps = 0,
|
|
46019
46024
|
pivotIndices
|
|
46020
|
-
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
46025
|
+
} = panelDataHelper$1(panelDataArray, panelData, prevLayout);
|
|
46021
46026
|
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
46022
|
-
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
46027
|
+
if (fuzzyNumbersEqual$1$1(panelSize, collapsedSize)) {
|
|
46023
46028
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
46024
46029
|
const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
|
|
46025
|
-
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
46030
|
+
const isLastPanel = findPanelDataIndex$1(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
46026
46031
|
const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
|
|
46027
|
-
const nextLayout = adjustLayoutByDelta({
|
|
46032
|
+
const nextLayout = adjustLayoutByDelta$1({
|
|
46028
46033
|
delta,
|
|
46029
46034
|
initialLayout: prevLayout,
|
|
46030
46035
|
panelConstraints: panelConstraintsArray,
|
|
@@ -46032,13 +46037,13 @@ function PanelGroupWithForwardedRef({
|
|
|
46032
46037
|
prevLayout,
|
|
46033
46038
|
trigger: "imperative-api"
|
|
46034
46039
|
});
|
|
46035
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
46040
|
+
if (!compareLayouts$1(prevLayout, nextLayout)) {
|
|
46036
46041
|
setLayout(nextLayout);
|
|
46037
46042
|
eagerValuesRef.current.layout = nextLayout;
|
|
46038
46043
|
if (onLayout2) {
|
|
46039
46044
|
onLayout2(nextLayout);
|
|
46040
46045
|
}
|
|
46041
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46046
|
+
callPanelCallbacks$1(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46042
46047
|
}
|
|
46043
46048
|
}
|
|
46044
46049
|
}
|
|
@@ -46050,16 +46055,16 @@ function PanelGroupWithForwardedRef({
|
|
|
46050
46055
|
} = eagerValuesRef.current;
|
|
46051
46056
|
const {
|
|
46052
46057
|
panelSize
|
|
46053
|
-
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
46054
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46058
|
+
} = panelDataHelper$1(panelDataArray, panelData, layout2);
|
|
46059
|
+
assert$1(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46055
46060
|
return panelSize;
|
|
46056
46061
|
}, []);
|
|
46057
46062
|
const getPanelStyle = useCallback((panelData, defaultSize) => {
|
|
46058
46063
|
const {
|
|
46059
46064
|
panelDataArray
|
|
46060
46065
|
} = eagerValuesRef.current;
|
|
46061
|
-
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
46062
|
-
return computePanelFlexBoxStyle({
|
|
46066
|
+
const panelIndex = findPanelDataIndex$1(panelDataArray, panelData);
|
|
46067
|
+
return computePanelFlexBoxStyle$1({
|
|
46063
46068
|
defaultSize,
|
|
46064
46069
|
dragState,
|
|
46065
46070
|
layout,
|
|
@@ -46076,9 +46081,9 @@ function PanelGroupWithForwardedRef({
|
|
|
46076
46081
|
collapsedSize = 0,
|
|
46077
46082
|
collapsible,
|
|
46078
46083
|
panelSize
|
|
46079
|
-
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
46080
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46081
|
-
return collapsible === true && fuzzyNumbersEqual$1(panelSize, collapsedSize);
|
|
46084
|
+
} = panelDataHelper$1(panelDataArray, panelData, layout2);
|
|
46085
|
+
assert$1(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46086
|
+
return collapsible === true && fuzzyNumbersEqual$1$1(panelSize, collapsedSize);
|
|
46082
46087
|
}, []);
|
|
46083
46088
|
const isPanelExpanded = useCallback((panelData) => {
|
|
46084
46089
|
const {
|
|
@@ -46089,9 +46094,9 @@ function PanelGroupWithForwardedRef({
|
|
|
46089
46094
|
collapsedSize = 0,
|
|
46090
46095
|
collapsible,
|
|
46091
46096
|
panelSize
|
|
46092
|
-
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
46093
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46094
|
-
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
46097
|
+
} = panelDataHelper$1(panelDataArray, panelData, layout2);
|
|
46098
|
+
assert$1(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46099
|
+
return !collapsible || fuzzyCompareNumbers$1(panelSize, collapsedSize) > 0;
|
|
46095
46100
|
}, []);
|
|
46096
46101
|
const registerPanel = useCallback((panelData) => {
|
|
46097
46102
|
const {
|
|
@@ -46114,7 +46119,7 @@ function PanelGroupWithForwardedRef({
|
|
|
46114
46119
|
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
46115
46120
|
forceUpdate();
|
|
46116
46121
|
}, [forceUpdate]);
|
|
46117
|
-
useIsomorphicLayoutEffect(() => {
|
|
46122
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
46118
46123
|
if (eagerValuesRef.current.panelDataArrayChanged) {
|
|
46119
46124
|
eagerValuesRef.current.panelDataArrayChanged = false;
|
|
46120
46125
|
const {
|
|
@@ -46128,32 +46133,32 @@ function PanelGroupWithForwardedRef({
|
|
|
46128
46133
|
} = eagerValuesRef.current;
|
|
46129
46134
|
let unsafeLayout = null;
|
|
46130
46135
|
if (autoSaveId2) {
|
|
46131
|
-
const state = loadPanelGroupState(autoSaveId2, panelDataArray, storage2);
|
|
46136
|
+
const state = loadPanelGroupState$1(autoSaveId2, panelDataArray, storage2);
|
|
46132
46137
|
if (state) {
|
|
46133
46138
|
panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
|
|
46134
46139
|
unsafeLayout = state.layout;
|
|
46135
46140
|
}
|
|
46136
46141
|
}
|
|
46137
46142
|
if (unsafeLayout == null) {
|
|
46138
|
-
unsafeLayout = calculateUnsafeDefaultLayout({
|
|
46143
|
+
unsafeLayout = calculateUnsafeDefaultLayout$1({
|
|
46139
46144
|
panelDataArray
|
|
46140
46145
|
});
|
|
46141
46146
|
}
|
|
46142
|
-
const nextLayout = validatePanelGroupLayout({
|
|
46147
|
+
const nextLayout = validatePanelGroupLayout$1({
|
|
46143
46148
|
layout: unsafeLayout,
|
|
46144
46149
|
panelConstraints: panelDataArray.map((panelData) => panelData.constraints)
|
|
46145
46150
|
});
|
|
46146
|
-
if (!areEqual(prevLayout, nextLayout)) {
|
|
46151
|
+
if (!areEqual$1(prevLayout, nextLayout)) {
|
|
46147
46152
|
setLayout(nextLayout);
|
|
46148
46153
|
eagerValuesRef.current.layout = nextLayout;
|
|
46149
46154
|
if (onLayout2) {
|
|
46150
46155
|
onLayout2(nextLayout);
|
|
46151
46156
|
}
|
|
46152
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46157
|
+
callPanelCallbacks$1(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46153
46158
|
}
|
|
46154
46159
|
}
|
|
46155
46160
|
});
|
|
46156
|
-
useIsomorphicLayoutEffect(() => {
|
|
46161
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
46157
46162
|
const eagerValues = eagerValuesRef.current;
|
|
46158
46163
|
return () => {
|
|
46159
46164
|
eagerValues.layout = [];
|
|
@@ -46188,33 +46193,33 @@ function PanelGroupWithForwardedRef({
|
|
|
46188
46193
|
const {
|
|
46189
46194
|
initialLayout
|
|
46190
46195
|
} = dragState2 !== null && dragState2 !== void 0 ? dragState2 : {};
|
|
46191
|
-
const pivotIndices = determinePivotIndices(groupId2, dragHandleId, panelGroupElement2);
|
|
46192
|
-
let delta = calculateDeltaPercentage(event, dragHandleId, direction2, dragState2, keyboardResizeBy2, panelGroupElement2);
|
|
46196
|
+
const pivotIndices = determinePivotIndices$1(groupId2, dragHandleId, panelGroupElement2);
|
|
46197
|
+
let delta = calculateDeltaPercentage$1(event, dragHandleId, direction2, dragState2, keyboardResizeBy2, panelGroupElement2);
|
|
46193
46198
|
const isHorizontal = direction2 === "horizontal";
|
|
46194
46199
|
if (isHorizontal && isRTL) {
|
|
46195
46200
|
delta = -delta;
|
|
46196
46201
|
}
|
|
46197
46202
|
const panelConstraints = panelDataArray.map((panelData) => panelData.constraints);
|
|
46198
|
-
const nextLayout = adjustLayoutByDelta({
|
|
46203
|
+
const nextLayout = adjustLayoutByDelta$1({
|
|
46199
46204
|
delta,
|
|
46200
46205
|
initialLayout: initialLayout !== null && initialLayout !== void 0 ? initialLayout : prevLayout,
|
|
46201
46206
|
panelConstraints,
|
|
46202
46207
|
pivotIndices,
|
|
46203
46208
|
prevLayout,
|
|
46204
|
-
trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch"
|
|
46209
|
+
trigger: isKeyDown$1(event) ? "keyboard" : "mouse-or-touch"
|
|
46205
46210
|
});
|
|
46206
|
-
const layoutChanged = !compareLayouts(prevLayout, nextLayout);
|
|
46207
|
-
if (isPointerEvent(event) || isMouseEvent(event)) {
|
|
46211
|
+
const layoutChanged = !compareLayouts$1(prevLayout, nextLayout);
|
|
46212
|
+
if (isPointerEvent$1(event) || isMouseEvent$1(event)) {
|
|
46208
46213
|
if (prevDeltaRef.current != delta) {
|
|
46209
46214
|
prevDeltaRef.current = delta;
|
|
46210
46215
|
if (!layoutChanged && delta !== 0) {
|
|
46211
46216
|
if (isHorizontal) {
|
|
46212
|
-
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN : EXCEEDED_HORIZONTAL_MAX);
|
|
46217
|
+
reportConstraintsViolation$1(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN$1 : EXCEEDED_HORIZONTAL_MAX$1);
|
|
46213
46218
|
} else {
|
|
46214
|
-
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
|
|
46219
|
+
reportConstraintsViolation$1(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN$1 : EXCEEDED_VERTICAL_MAX$1);
|
|
46215
46220
|
}
|
|
46216
46221
|
} else {
|
|
46217
|
-
reportConstraintsViolation(dragHandleId, 0);
|
|
46222
|
+
reportConstraintsViolation$1(dragHandleId, 0);
|
|
46218
46223
|
}
|
|
46219
46224
|
}
|
|
46220
46225
|
}
|
|
@@ -46224,7 +46229,7 @@ function PanelGroupWithForwardedRef({
|
|
|
46224
46229
|
if (onLayout2) {
|
|
46225
46230
|
onLayout2(nextLayout);
|
|
46226
46231
|
}
|
|
46227
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46232
|
+
callPanelCallbacks$1(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46228
46233
|
}
|
|
46229
46234
|
};
|
|
46230
46235
|
}, []);
|
|
@@ -46240,11 +46245,11 @@ function PanelGroupWithForwardedRef({
|
|
|
46240
46245
|
const {
|
|
46241
46246
|
panelSize,
|
|
46242
46247
|
pivotIndices
|
|
46243
|
-
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
46244
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46245
|
-
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
46248
|
+
} = panelDataHelper$1(panelDataArray, panelData, prevLayout);
|
|
46249
|
+
assert$1(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
46250
|
+
const isLastPanel = findPanelDataIndex$1(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
46246
46251
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
46247
|
-
const nextLayout = adjustLayoutByDelta({
|
|
46252
|
+
const nextLayout = adjustLayoutByDelta$1({
|
|
46248
46253
|
delta,
|
|
46249
46254
|
initialLayout: prevLayout,
|
|
46250
46255
|
panelConstraints: panelConstraintsArray,
|
|
@@ -46252,13 +46257,13 @@ function PanelGroupWithForwardedRef({
|
|
|
46252
46257
|
prevLayout,
|
|
46253
46258
|
trigger: "imperative-api"
|
|
46254
46259
|
});
|
|
46255
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
46260
|
+
if (!compareLayouts$1(prevLayout, nextLayout)) {
|
|
46256
46261
|
setLayout(nextLayout);
|
|
46257
46262
|
eagerValuesRef.current.layout = nextLayout;
|
|
46258
46263
|
if (onLayout2) {
|
|
46259
46264
|
onLayout2(nextLayout);
|
|
46260
46265
|
}
|
|
46261
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46266
|
+
callPanelCallbacks$1(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
46262
46267
|
}
|
|
46263
46268
|
}, []);
|
|
46264
46269
|
const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
|
|
@@ -46278,12 +46283,12 @@ function PanelGroupWithForwardedRef({
|
|
|
46278
46283
|
} = panelData.constraints;
|
|
46279
46284
|
const {
|
|
46280
46285
|
panelSize: prevPanelSize
|
|
46281
|
-
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
46286
|
+
} = panelDataHelper$1(panelDataArray, panelData, layout2);
|
|
46282
46287
|
if (prevPanelSize == null) {
|
|
46283
46288
|
return;
|
|
46284
46289
|
}
|
|
46285
|
-
if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1(prevPanelSize, prevCollapsedSize)) {
|
|
46286
|
-
if (!fuzzyNumbersEqual$1(prevCollapsedSize, nextCollapsedSize)) {
|
|
46290
|
+
if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1$1(prevPanelSize, prevCollapsedSize)) {
|
|
46291
|
+
if (!fuzzyNumbersEqual$1$1(prevCollapsedSize, nextCollapsedSize)) {
|
|
46287
46292
|
resizePanel2(panelData, nextCollapsedSize);
|
|
46288
46293
|
}
|
|
46289
46294
|
} else if (prevPanelSize < nextMinSize) {
|
|
@@ -46302,9 +46307,9 @@ function PanelGroupWithForwardedRef({
|
|
|
46302
46307
|
if (!panelGroupElementRef.current) {
|
|
46303
46308
|
return;
|
|
46304
46309
|
}
|
|
46305
|
-
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
46306
|
-
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
46307
|
-
const initialCursorPosition = getResizeEventCursorPosition(direction2, event);
|
|
46310
|
+
const handleElement = getResizeHandleElement$1(dragHandleId, panelGroupElementRef.current);
|
|
46311
|
+
assert$1(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
46312
|
+
const initialCursorPosition = getResizeEventCursorPosition$1(direction2, event);
|
|
46308
46313
|
setDragState({
|
|
46309
46314
|
dragHandleId,
|
|
46310
46315
|
dragHandleRect: handleElement.getBoundingClientRect(),
|
|
@@ -46319,7 +46324,7 @@ function PanelGroupWithForwardedRef({
|
|
|
46319
46324
|
const {
|
|
46320
46325
|
panelDataArray
|
|
46321
46326
|
} = eagerValuesRef.current;
|
|
46322
|
-
const index2 = findPanelDataIndex(panelDataArray, panelData);
|
|
46327
|
+
const index2 = findPanelDataIndex$1(panelDataArray, panelData);
|
|
46323
46328
|
if (index2 >= 0) {
|
|
46324
46329
|
panelDataArray.splice(index2, 1);
|
|
46325
46330
|
delete panelIdToLastNotifiedSizeMapRef.current[panelData.id];
|
|
@@ -46353,7 +46358,7 @@ function PanelGroupWithForwardedRef({
|
|
|
46353
46358
|
overflow: "hidden",
|
|
46354
46359
|
width: "100%"
|
|
46355
46360
|
};
|
|
46356
|
-
return createElement(PanelGroupContext.Provider, {
|
|
46361
|
+
return createElement(PanelGroupContext$1.Provider, {
|
|
46357
46362
|
value: context
|
|
46358
46363
|
}, createElement(Type, {
|
|
46359
46364
|
...rest,
|
|
@@ -46365,22 +46370,22 @@ function PanelGroupWithForwardedRef({
|
|
|
46365
46370
|
...style2,
|
|
46366
46371
|
...styleFromProps
|
|
46367
46372
|
},
|
|
46368
|
-
[DATA_ATTRIBUTES.group]: "",
|
|
46369
|
-
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
46370
|
-
[DATA_ATTRIBUTES.groupId]: groupId
|
|
46373
|
+
[DATA_ATTRIBUTES$1.group]: "",
|
|
46374
|
+
[DATA_ATTRIBUTES$1.groupDirection]: direction,
|
|
46375
|
+
[DATA_ATTRIBUTES$1.groupId]: groupId
|
|
46371
46376
|
}));
|
|
46372
46377
|
}
|
|
46373
|
-
var PanelGroup = forwardRef((props2, ref) => createElement(PanelGroupWithForwardedRef, {
|
|
46378
|
+
var PanelGroup$1 = forwardRef((props2, ref) => createElement(PanelGroupWithForwardedRef$1, {
|
|
46374
46379
|
...props2,
|
|
46375
46380
|
forwardedRef: ref
|
|
46376
46381
|
}));
|
|
46377
|
-
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
46378
|
-
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
46379
|
-
function findPanelDataIndex(panelDataArray, panelData) {
|
|
46382
|
+
PanelGroupWithForwardedRef$1.displayName = "PanelGroup";
|
|
46383
|
+
PanelGroup$1.displayName = "forwardRef(PanelGroup)";
|
|
46384
|
+
function findPanelDataIndex$1(panelDataArray, panelData) {
|
|
46380
46385
|
return panelDataArray.findIndex((prevPanelData) => prevPanelData === panelData || prevPanelData.id === panelData.id);
|
|
46381
46386
|
}
|
|
46382
|
-
function panelDataHelper(panelDataArray, panelData, layout) {
|
|
46383
|
-
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
46387
|
+
function panelDataHelper$1(panelDataArray, panelData, layout) {
|
|
46388
|
+
const panelIndex = findPanelDataIndex$1(panelDataArray, panelData);
|
|
46384
46389
|
const isLastPanel = panelIndex === panelDataArray.length - 1;
|
|
46385
46390
|
const pivotIndices = isLastPanel ? [panelIndex - 1, panelIndex] : [panelIndex, panelIndex + 1];
|
|
46386
46391
|
const panelSize = layout[panelIndex];
|
|
@@ -46430,14 +46435,14 @@ var M = forwardRef(({ panels: o2, className: a2 = "", style: s2, theme: d2, minP
|
|
|
46430
46435
|
const y2 = o2.length, w2 = 2 * u2;
|
|
46431
46436
|
let x2;
|
|
46432
46437
|
x2 = y2 === 1 || y2 === 2 ? "100%" : `max(${u2}px, ${100 * p2}%)`;
|
|
46433
|
-
const
|
|
46438
|
+
const C2 = React2__default.useId().replace(/:/g, "_");
|
|
46434
46439
|
return jsxs(Fragment, { children: [
|
|
46435
46440
|
y2 === 2 && /* @__PURE__ */ jsx("style", { children: `
|
|
46436
|
-
.snap-carousel-container[data-carousel-id="${
|
|
46441
|
+
.snap-carousel-container[data-carousel-id="${C2}"][data-panel-count="2"] .snap-carousel-panel {
|
|
46437
46442
|
width: 100%;
|
|
46438
46443
|
}
|
|
46439
46444
|
@container (min-width: ${w2}px) {
|
|
46440
|
-
.snap-carousel-container[data-carousel-id="${
|
|
46445
|
+
.snap-carousel-container[data-carousel-id="${C2}"][data-panel-count="2"] .snap-carousel-panel {
|
|
46441
46446
|
width: 50%;
|
|
46442
46447
|
}
|
|
46443
46448
|
}
|
|
@@ -46452,41 +46457,41 @@ var M = forwardRef(({ panels: o2, className: a2 = "", style: s2, theme: d2, minP
|
|
|
46452
46457
|
a3 < o3 && (o3 = a3, r2 = i2);
|
|
46453
46458
|
}
|
|
46454
46459
|
m2(r2);
|
|
46455
|
-
}, "data-panel-count": y2, "data-carousel-id":
|
|
46460
|
+
}, "data-panel-count": y2, "data-carousel-id": C2, children: o2.map((t2, n2) => /* @__PURE__ */ jsx("div", { className: "snap-carousel-panel", children: t2 }, n2)) })
|
|
46456
46461
|
] });
|
|
46457
46462
|
});
|
|
46458
46463
|
M.displayName = "SnapCarousel";
|
|
46459
|
-
var se;
|
|
46464
|
+
var se$1;
|
|
46460
46465
|
var ce;
|
|
46461
|
-
(ce = se || (se = {})).DragStart = "dragStart", ce.DragMove = "dragMove", ce.DragEnd = "dragEnd", ce.DragCancel = "dragCancel", ce.DragOver = "dragOver", ce.RegisterDroppable = "registerDroppable", ce.SetDroppableDisabled = "setDroppableDisabled", ce.UnregisterDroppable = "unregisterDroppable";
|
|
46466
|
+
(ce = se$1 || (se$1 = {})).DragStart = "dragStart", ce.DragMove = "dragMove", ce.DragEnd = "dragEnd", ce.DragCancel = "dragCancel", ce.DragOver = "dragOver", ce.RegisterDroppable = "registerDroppable", ce.SetDroppableDisabled = "setDroppableDisabled", ce.UnregisterDroppable = "unregisterDroppable";
|
|
46462
46467
|
var ue = /* @__PURE__ */ Object.freeze({ x: 0, y: 0 });
|
|
46463
|
-
var Te;
|
|
46468
|
+
var Te$1;
|
|
46464
46469
|
var ke;
|
|
46465
|
-
(ke = Te || (Te = {}))[ke.Forward = 1] = "Forward", ke[ke.Backward = -1] = "Backward";
|
|
46466
|
-
var je;
|
|
46467
|
-
var He;
|
|
46468
|
-
var Ke;
|
|
46470
|
+
(ke = Te$1 || (Te$1 = {}))[ke.Forward = 1] = "Forward", ke[ke.Backward = -1] = "Backward";
|
|
46471
|
+
var je$1;
|
|
46472
|
+
var He$1;
|
|
46473
|
+
var Ke$1;
|
|
46469
46474
|
var Ue;
|
|
46470
|
-
(He = je || (je = {})).Click = "click", He.DragStart = "dragstart", He.Keydown = "keydown", He.ContextMenu = "contextmenu", He.Resize = "resize", He.SelectionChange = "selectionchange", He.VisibilityChange = "visibilitychange", (Ue = Ke || (Ke = {})).Space = "Space", Ue.Down = "ArrowDown", Ue.Right = "ArrowRight", Ue.Left = "ArrowLeft", Ue.Up = "ArrowUp", Ue.Esc = "Escape", Ue.Enter = "Enter", Ue.Tab = "Tab";
|
|
46471
|
-
({ start: [Ke.Space, Ke.Enter], cancel: [Ke.Esc], end: [Ke.Space, Ke.Enter, Ke.Tab] });
|
|
46472
|
-
var ot;
|
|
46475
|
+
(He$1 = je$1 || (je$1 = {})).Click = "click", He$1.DragStart = "dragstart", He$1.Keydown = "keydown", He$1.ContextMenu = "contextmenu", He$1.Resize = "resize", He$1.SelectionChange = "selectionchange", He$1.VisibilityChange = "visibilitychange", (Ue = Ke$1 || (Ke$1 = {})).Space = "Space", Ue.Down = "ArrowDown", Ue.Right = "ArrowRight", Ue.Left = "ArrowLeft", Ue.Up = "ArrowUp", Ue.Esc = "Escape", Ue.Enter = "Enter", Ue.Tab = "Tab";
|
|
46476
|
+
({ start: [Ke$1.Space, Ke$1.Enter], cancel: [Ke$1.Esc], end: [Ke$1.Space, Ke$1.Enter, Ke$1.Tab] });
|
|
46477
|
+
var ot$1;
|
|
46473
46478
|
var it;
|
|
46474
|
-
(it = ot || (ot = {}))[it.RightClick = 2] = "RightClick";
|
|
46475
|
-
var lt;
|
|
46476
|
-
var st;
|
|
46477
|
-
var ct;
|
|
46479
|
+
(it = ot$1 || (ot$1 = {}))[it.RightClick = 2] = "RightClick";
|
|
46480
|
+
var lt$1;
|
|
46481
|
+
var st$1;
|
|
46482
|
+
var ct$1;
|
|
46478
46483
|
var dt;
|
|
46479
|
-
(st = lt || (lt = {}))[st.Pointer = 0] = "Pointer", st[st.DraggableRect = 1] = "DraggableRect", (dt = ct || (ct = {}))[dt.TreeOrder = 0] = "TreeOrder", dt[dt.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
46480
|
-
({ x: { [Te.Backward]: false, [Te.Forward]: false }, y: { [Te.Backward]: false, [Te.Forward]: false } });
|
|
46481
|
-
var ht;
|
|
46482
|
-
var mt;
|
|
46484
|
+
(st$1 = lt$1 || (lt$1 = {}))[st$1.Pointer = 0] = "Pointer", st$1[st$1.DraggableRect = 1] = "DraggableRect", (dt = ct$1 || (ct$1 = {}))[dt.TreeOrder = 0] = "TreeOrder", dt[dt.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
46485
|
+
({ x: { [Te$1.Backward]: false, [Te$1.Forward]: false }, y: { [Te$1.Backward]: false, [Te$1.Forward]: false } });
|
|
46486
|
+
var ht$1;
|
|
46487
|
+
var mt$1;
|
|
46483
46488
|
var ft;
|
|
46484
|
-
(mt = ht || (ht = {}))[mt.Always = 0] = "Always", mt[mt.BeforeDragging = 1] = "BeforeDragging", mt[mt.WhileDragging = 2] = "WhileDragging", (ft || (ft = {})).Optimized = "optimized";
|
|
46485
|
-
({ droppable: { strategy: ht.WhileDragging, frequency: ft.Optimized } });
|
|
46489
|
+
(mt$1 = ht$1 || (ht$1 = {}))[mt$1.Always = 0] = "Always", mt$1[mt$1.BeforeDragging = 1] = "BeforeDragging", mt$1[mt$1.WhileDragging = 2] = "WhileDragging", (ft || (ft = {})).Optimized = "optimized";
|
|
46490
|
+
({ droppable: { strategy: ht$1.WhileDragging, frequency: ft.Optimized } });
|
|
46486
46491
|
/* @__PURE__ */ createContext({ ...ue, scaleX: 1, scaleY: 1 });
|
|
46487
|
-
var Bt;
|
|
46492
|
+
var Bt$1;
|
|
46488
46493
|
var Ot;
|
|
46489
|
-
(Ot = Bt || (Bt = {}))[Ot.Uninitialized = 0] = "Uninitialized", Ot[Ot.Initializing = 1] = "Initializing", Ot[Ot.Initialized = 2] = "Initialized";
|
|
46494
|
+
(Ot = Bt$1 || (Bt$1 = {}))[Ot.Uninitialized = 0] = "Uninitialized", Ot[Ot.Initializing = 1] = "Initializing", Ot[Ot.Initialized = 2] = "Initialized";
|
|
46490
46495
|
var Vt;
|
|
46491
46496
|
(() => {
|
|
46492
46497
|
if (typeof window != "undefined") {
|
|
@@ -46509,7 +46514,8 @@ var DocumentView = ({
|
|
|
46509
46514
|
repositoryInfo,
|
|
46510
46515
|
fontSizeScale,
|
|
46511
46516
|
theme: theme2,
|
|
46512
|
-
transparentBackground = false
|
|
46517
|
+
transparentBackground = false,
|
|
46518
|
+
editable = false
|
|
46513
46519
|
}) => {
|
|
46514
46520
|
const containerRef = useRef(null);
|
|
46515
46521
|
const backgroundColor = transparentBackground ? "transparent" : theme2.colors.background;
|
|
@@ -46541,7 +46547,8 @@ var DocumentView = ({
|
|
|
46541
46547
|
fontSizeScale,
|
|
46542
46548
|
handlePromptCopy,
|
|
46543
46549
|
repositoryInfo,
|
|
46544
|
-
transparentBackground
|
|
46550
|
+
transparentBackground,
|
|
46551
|
+
editable
|
|
46545
46552
|
})));
|
|
46546
46553
|
};
|
|
46547
46554
|
const formatDate$1 = (dateString) => {
|
|
@@ -46870,54 +46877,2116 @@ const GitHubIssueDetailPanelMetadata = {
|
|
|
46870
46877
|
slices: [],
|
|
46871
46878
|
surfaces: ["panel"]
|
|
46872
46879
|
};
|
|
46873
|
-
const
|
|
46874
|
-
|
|
46875
|
-
|
|
46876
|
-
|
|
46877
|
-
|
|
46878
|
-
|
|
46879
|
-
|
|
46880
|
-
|
|
46881
|
-
|
|
46882
|
-
|
|
46883
|
-
|
|
46880
|
+
const PanelGroupContext = createContext(null);
|
|
46881
|
+
PanelGroupContext.displayName = "PanelGroupContext";
|
|
46882
|
+
const DATA_ATTRIBUTES = {
|
|
46883
|
+
group: "data-panel-group",
|
|
46884
|
+
groupDirection: "data-panel-group-direction",
|
|
46885
|
+
groupId: "data-panel-group-id",
|
|
46886
|
+
panel: "data-panel",
|
|
46887
|
+
panelCollapsible: "data-panel-collapsible",
|
|
46888
|
+
panelId: "data-panel-id",
|
|
46889
|
+
panelSize: "data-panel-size",
|
|
46890
|
+
resizeHandleId: "data-panel-resize-handle-id"
|
|
46891
|
+
};
|
|
46892
|
+
const PRECISION = 10;
|
|
46893
|
+
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
46894
|
+
const useId = React2["useId".toString()];
|
|
46895
|
+
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
46896
|
+
let counter = 0;
|
|
46897
|
+
function useUniqueId(idFromParams = null) {
|
|
46898
|
+
const idFromUseId = wrappedUseId();
|
|
46899
|
+
const idRef = useRef(idFromParams || idFromUseId || null);
|
|
46900
|
+
if (idRef.current === null) {
|
|
46901
|
+
idRef.current = "" + counter++;
|
|
46902
|
+
}
|
|
46903
|
+
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
46904
|
+
}
|
|
46905
|
+
function PanelWithForwardedRef({
|
|
46906
|
+
children: children2,
|
|
46907
|
+
className: classNameFromProps = "",
|
|
46908
|
+
collapsedSize,
|
|
46909
|
+
collapsible,
|
|
46910
|
+
defaultSize,
|
|
46911
|
+
forwardedRef,
|
|
46912
|
+
id: idFromProps,
|
|
46913
|
+
maxSize,
|
|
46914
|
+
minSize,
|
|
46915
|
+
onCollapse,
|
|
46916
|
+
onExpand,
|
|
46917
|
+
onResize,
|
|
46918
|
+
order: order2,
|
|
46919
|
+
style: styleFromProps,
|
|
46920
|
+
tagName: Type = "div",
|
|
46921
|
+
...rest
|
|
46922
|
+
}) {
|
|
46923
|
+
const context = useContext(PanelGroupContext);
|
|
46924
|
+
if (context === null) {
|
|
46925
|
+
throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
46926
|
+
}
|
|
46927
|
+
const {
|
|
46928
|
+
collapsePanel,
|
|
46929
|
+
expandPanel,
|
|
46930
|
+
getPanelSize,
|
|
46931
|
+
getPanelStyle,
|
|
46932
|
+
groupId,
|
|
46933
|
+
isPanelCollapsed,
|
|
46934
|
+
reevaluatePanelConstraints,
|
|
46935
|
+
registerPanel,
|
|
46936
|
+
resizePanel: resizePanel2,
|
|
46937
|
+
unregisterPanel
|
|
46938
|
+
} = context;
|
|
46939
|
+
const panelId = useUniqueId(idFromProps);
|
|
46940
|
+
const panelDataRef = useRef({
|
|
46941
|
+
callbacks: {
|
|
46942
|
+
onCollapse,
|
|
46943
|
+
onExpand,
|
|
46944
|
+
onResize
|
|
46945
|
+
},
|
|
46946
|
+
constraints: {
|
|
46947
|
+
collapsedSize,
|
|
46948
|
+
collapsible,
|
|
46949
|
+
defaultSize,
|
|
46950
|
+
maxSize,
|
|
46951
|
+
minSize
|
|
46952
|
+
},
|
|
46953
|
+
id: panelId,
|
|
46954
|
+
idIsFromProps: idFromProps !== void 0,
|
|
46955
|
+
order: order2
|
|
46956
|
+
});
|
|
46957
|
+
useRef({
|
|
46958
|
+
didLogMissingDefaultSizeWarning: false
|
|
46959
|
+
});
|
|
46960
|
+
useIsomorphicLayoutEffect(() => {
|
|
46961
|
+
const {
|
|
46962
|
+
callbacks,
|
|
46963
|
+
constraints
|
|
46964
|
+
} = panelDataRef.current;
|
|
46965
|
+
const prevConstraints = {
|
|
46966
|
+
...constraints
|
|
46967
|
+
};
|
|
46968
|
+
panelDataRef.current.id = panelId;
|
|
46969
|
+
panelDataRef.current.idIsFromProps = idFromProps !== void 0;
|
|
46970
|
+
panelDataRef.current.order = order2;
|
|
46971
|
+
callbacks.onCollapse = onCollapse;
|
|
46972
|
+
callbacks.onExpand = onExpand;
|
|
46973
|
+
callbacks.onResize = onResize;
|
|
46974
|
+
constraints.collapsedSize = collapsedSize;
|
|
46975
|
+
constraints.collapsible = collapsible;
|
|
46976
|
+
constraints.defaultSize = defaultSize;
|
|
46977
|
+
constraints.maxSize = maxSize;
|
|
46978
|
+
constraints.minSize = minSize;
|
|
46979
|
+
if (prevConstraints.collapsedSize !== constraints.collapsedSize || prevConstraints.collapsible !== constraints.collapsible || prevConstraints.maxSize !== constraints.maxSize || prevConstraints.minSize !== constraints.minSize) {
|
|
46980
|
+
reevaluatePanelConstraints(panelDataRef.current, prevConstraints);
|
|
46884
46981
|
}
|
|
46885
|
-
|
|
46982
|
+
});
|
|
46983
|
+
useIsomorphicLayoutEffect(() => {
|
|
46984
|
+
const panelData = panelDataRef.current;
|
|
46985
|
+
registerPanel(panelData);
|
|
46986
|
+
return () => {
|
|
46987
|
+
unregisterPanel(panelData);
|
|
46988
|
+
};
|
|
46989
|
+
}, [order2, panelId, registerPanel, unregisterPanel]);
|
|
46990
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
46991
|
+
collapse: () => {
|
|
46992
|
+
collapsePanel(panelDataRef.current);
|
|
46993
|
+
},
|
|
46994
|
+
expand: (minSize2) => {
|
|
46995
|
+
expandPanel(panelDataRef.current, minSize2);
|
|
46996
|
+
},
|
|
46997
|
+
getId() {
|
|
46998
|
+
return panelId;
|
|
46999
|
+
},
|
|
47000
|
+
getSize() {
|
|
47001
|
+
return getPanelSize(panelDataRef.current);
|
|
47002
|
+
},
|
|
47003
|
+
isCollapsed() {
|
|
47004
|
+
return isPanelCollapsed(panelDataRef.current);
|
|
47005
|
+
},
|
|
47006
|
+
isExpanded() {
|
|
47007
|
+
return !isPanelCollapsed(panelDataRef.current);
|
|
47008
|
+
},
|
|
47009
|
+
resize: (size) => {
|
|
47010
|
+
resizePanel2(panelDataRef.current, size);
|
|
47011
|
+
}
|
|
47012
|
+
}), [collapsePanel, expandPanel, getPanelSize, isPanelCollapsed, panelId, resizePanel2]);
|
|
47013
|
+
const style2 = getPanelStyle(panelDataRef.current, defaultSize);
|
|
47014
|
+
return createElement(Type, {
|
|
47015
|
+
...rest,
|
|
47016
|
+
children: children2,
|
|
47017
|
+
className: classNameFromProps,
|
|
47018
|
+
id: panelId,
|
|
47019
|
+
style: {
|
|
47020
|
+
...style2,
|
|
47021
|
+
...styleFromProps
|
|
47022
|
+
},
|
|
47023
|
+
// CSS selectors
|
|
47024
|
+
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
47025
|
+
[DATA_ATTRIBUTES.panel]: "",
|
|
47026
|
+
[DATA_ATTRIBUTES.panelCollapsible]: collapsible || void 0,
|
|
47027
|
+
[DATA_ATTRIBUTES.panelId]: panelId,
|
|
47028
|
+
[DATA_ATTRIBUTES.panelSize]: parseFloat("" + style2.flexGrow).toFixed(1)
|
|
47029
|
+
});
|
|
47030
|
+
}
|
|
47031
|
+
const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
|
|
47032
|
+
...props,
|
|
47033
|
+
forwardedRef: ref
|
|
47034
|
+
}));
|
|
47035
|
+
PanelWithForwardedRef.displayName = "Panel";
|
|
47036
|
+
Panel.displayName = "forwardRef(Panel)";
|
|
47037
|
+
function isKeyDown(event) {
|
|
47038
|
+
return event.type === "keydown";
|
|
47039
|
+
}
|
|
47040
|
+
function isPointerEvent(event) {
|
|
47041
|
+
return event.type.startsWith("pointer");
|
|
47042
|
+
}
|
|
47043
|
+
function isMouseEvent(event) {
|
|
47044
|
+
return event.type.startsWith("mouse");
|
|
47045
|
+
}
|
|
47046
|
+
function getResizeEventCoordinates(event) {
|
|
47047
|
+
if (isPointerEvent(event)) {
|
|
47048
|
+
if (event.isPrimary) {
|
|
47049
|
+
return {
|
|
47050
|
+
x: event.clientX,
|
|
47051
|
+
y: event.clientY
|
|
47052
|
+
};
|
|
47053
|
+
}
|
|
47054
|
+
} else if (isMouseEvent(event)) {
|
|
47055
|
+
return {
|
|
47056
|
+
x: event.clientX,
|
|
47057
|
+
y: event.clientY
|
|
47058
|
+
};
|
|
46886
47059
|
}
|
|
46887
|
-
|
|
46888
|
-
|
|
46889
|
-
|
|
46890
|
-
|
|
46891
|
-
|
|
46892
|
-
|
|
46893
|
-
|
|
46894
|
-
|
|
46895
|
-
}
|
|
46896
|
-
|
|
46897
|
-
const
|
|
46898
|
-
|
|
46899
|
-
|
|
46900
|
-
|
|
46901
|
-
|
|
46902
|
-
|
|
46903
|
-
|
|
46904
|
-
|
|
46905
|
-
|
|
46906
|
-
|
|
46907
|
-
|
|
46908
|
-
|
|
47060
|
+
return {
|
|
47061
|
+
x: Infinity,
|
|
47062
|
+
y: Infinity
|
|
47063
|
+
};
|
|
47064
|
+
}
|
|
47065
|
+
function getInputType() {
|
|
47066
|
+
if (typeof matchMedia === "function") {
|
|
47067
|
+
return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
|
|
47068
|
+
}
|
|
47069
|
+
}
|
|
47070
|
+
const EXCEEDED_HORIZONTAL_MIN = 1;
|
|
47071
|
+
const EXCEEDED_HORIZONTAL_MAX = 2;
|
|
47072
|
+
const EXCEEDED_VERTICAL_MIN = 4;
|
|
47073
|
+
const EXCEEDED_VERTICAL_MAX = 8;
|
|
47074
|
+
getInputType() === "coarse";
|
|
47075
|
+
let panelConstraintFlags = /* @__PURE__ */ new Map();
|
|
47076
|
+
function reportConstraintsViolation(resizeHandleId, flag) {
|
|
47077
|
+
panelConstraintFlags.set(resizeHandleId, flag);
|
|
47078
|
+
}
|
|
47079
|
+
function useForceUpdate() {
|
|
47080
|
+
const [_, setCount] = useState(0);
|
|
47081
|
+
return useCallback(() => setCount((prevCount) => prevCount + 1), []);
|
|
47082
|
+
}
|
|
47083
|
+
function assert(expectedCondition, message) {
|
|
47084
|
+
if (!expectedCondition) {
|
|
47085
|
+
console.error(message);
|
|
47086
|
+
throw Error(message);
|
|
47087
|
+
}
|
|
47088
|
+
}
|
|
47089
|
+
function fuzzyCompareNumbers(actual, expected, fractionDigits = PRECISION) {
|
|
47090
|
+
if (actual.toFixed(fractionDigits) === expected.toFixed(fractionDigits)) {
|
|
47091
|
+
return 0;
|
|
47092
|
+
} else {
|
|
47093
|
+
return actual > expected ? 1 : -1;
|
|
47094
|
+
}
|
|
47095
|
+
}
|
|
47096
|
+
function fuzzyNumbersEqual$1(actual, expected, fractionDigits = PRECISION) {
|
|
47097
|
+
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
47098
|
+
}
|
|
47099
|
+
function fuzzyNumbersEqual(actual, expected, fractionDigits) {
|
|
47100
|
+
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
47101
|
+
}
|
|
47102
|
+
function fuzzyLayoutsEqual(actual, expected, fractionDigits) {
|
|
47103
|
+
if (actual.length !== expected.length) {
|
|
47104
|
+
return false;
|
|
47105
|
+
}
|
|
47106
|
+
for (let index2 = 0; index2 < actual.length; index2++) {
|
|
47107
|
+
const actualSize = actual[index2];
|
|
47108
|
+
const expectedSize = expected[index2];
|
|
47109
|
+
if (!fuzzyNumbersEqual(actualSize, expectedSize, fractionDigits)) {
|
|
47110
|
+
return false;
|
|
47111
|
+
}
|
|
47112
|
+
}
|
|
47113
|
+
return true;
|
|
47114
|
+
}
|
|
47115
|
+
function resizePanel({
|
|
47116
|
+
panelConstraints: panelConstraintsArray,
|
|
47117
|
+
panelIndex,
|
|
47118
|
+
size
|
|
47119
|
+
}) {
|
|
47120
|
+
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
47121
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
47122
|
+
let {
|
|
47123
|
+
collapsedSize = 0,
|
|
47124
|
+
collapsible,
|
|
47125
|
+
maxSize = 100,
|
|
47126
|
+
minSize = 0
|
|
47127
|
+
} = panelConstraints;
|
|
47128
|
+
if (fuzzyCompareNumbers(size, minSize) < 0) {
|
|
47129
|
+
if (collapsible) {
|
|
47130
|
+
const halfwayPoint = (collapsedSize + minSize) / 2;
|
|
47131
|
+
if (fuzzyCompareNumbers(size, halfwayPoint) < 0) {
|
|
47132
|
+
size = collapsedSize;
|
|
47133
|
+
} else {
|
|
47134
|
+
size = minSize;
|
|
46909
47135
|
}
|
|
47136
|
+
} else {
|
|
47137
|
+
size = minSize;
|
|
46910
47138
|
}
|
|
46911
|
-
|
|
46912
|
-
|
|
46913
|
-
|
|
46914
|
-
|
|
46915
|
-
|
|
46916
|
-
|
|
46917
|
-
|
|
46918
|
-
|
|
46919
|
-
|
|
46920
|
-
|
|
47139
|
+
}
|
|
47140
|
+
size = Math.min(maxSize, size);
|
|
47141
|
+
size = parseFloat(size.toFixed(PRECISION));
|
|
47142
|
+
return size;
|
|
47143
|
+
}
|
|
47144
|
+
function adjustLayoutByDelta({
|
|
47145
|
+
delta,
|
|
47146
|
+
initialLayout,
|
|
47147
|
+
panelConstraints: panelConstraintsArray,
|
|
47148
|
+
pivotIndices,
|
|
47149
|
+
prevLayout,
|
|
47150
|
+
trigger
|
|
47151
|
+
}) {
|
|
47152
|
+
if (fuzzyNumbersEqual(delta, 0)) {
|
|
47153
|
+
return initialLayout;
|
|
47154
|
+
}
|
|
47155
|
+
const nextLayout = [...initialLayout];
|
|
47156
|
+
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
47157
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
47158
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
47159
|
+
let deltaApplied = 0;
|
|
47160
|
+
{
|
|
47161
|
+
if (trigger === "keyboard") {
|
|
47162
|
+
{
|
|
47163
|
+
const index2 = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
47164
|
+
const panelConstraints = panelConstraintsArray[index2];
|
|
47165
|
+
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
47166
|
+
const {
|
|
47167
|
+
collapsedSize = 0,
|
|
47168
|
+
collapsible,
|
|
47169
|
+
minSize = 0
|
|
47170
|
+
} = panelConstraints;
|
|
47171
|
+
if (collapsible) {
|
|
47172
|
+
const prevSize = initialLayout[index2];
|
|
47173
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
47174
|
+
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
47175
|
+
const localDelta = minSize - prevSize;
|
|
47176
|
+
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
47177
|
+
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
47178
|
+
}
|
|
47179
|
+
}
|
|
47180
|
+
}
|
|
47181
|
+
}
|
|
47182
|
+
{
|
|
47183
|
+
const index2 = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
47184
|
+
const panelConstraints = panelConstraintsArray[index2];
|
|
47185
|
+
assert(panelConstraints, `No panel constraints found for index ${index2}`);
|
|
47186
|
+
const {
|
|
47187
|
+
collapsedSize = 0,
|
|
47188
|
+
collapsible,
|
|
47189
|
+
minSize = 0
|
|
47190
|
+
} = panelConstraints;
|
|
47191
|
+
if (collapsible) {
|
|
47192
|
+
const prevSize = initialLayout[index2];
|
|
47193
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
47194
|
+
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
47195
|
+
const localDelta = prevSize - collapsedSize;
|
|
47196
|
+
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
47197
|
+
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
47198
|
+
}
|
|
47199
|
+
}
|
|
47200
|
+
}
|
|
47201
|
+
}
|
|
47202
|
+
}
|
|
47203
|
+
}
|
|
47204
|
+
{
|
|
47205
|
+
const increment2 = delta < 0 ? 1 : -1;
|
|
47206
|
+
let index2 = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
47207
|
+
let maxAvailableDelta = 0;
|
|
47208
|
+
while (true) {
|
|
47209
|
+
const prevSize = initialLayout[index2];
|
|
47210
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
47211
|
+
const maxSafeSize = resizePanel({
|
|
47212
|
+
panelConstraints: panelConstraintsArray,
|
|
47213
|
+
panelIndex: index2,
|
|
47214
|
+
size: 100
|
|
47215
|
+
});
|
|
47216
|
+
const delta2 = maxSafeSize - prevSize;
|
|
47217
|
+
maxAvailableDelta += delta2;
|
|
47218
|
+
index2 += increment2;
|
|
47219
|
+
if (index2 < 0 || index2 >= panelConstraintsArray.length) {
|
|
47220
|
+
break;
|
|
47221
|
+
}
|
|
47222
|
+
}
|
|
47223
|
+
const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));
|
|
47224
|
+
delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;
|
|
47225
|
+
}
|
|
47226
|
+
{
|
|
47227
|
+
const pivotIndex = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
47228
|
+
let index2 = pivotIndex;
|
|
47229
|
+
while (index2 >= 0 && index2 < panelConstraintsArray.length) {
|
|
47230
|
+
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
47231
|
+
const prevSize = initialLayout[index2];
|
|
47232
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index2}`);
|
|
47233
|
+
const unsafeSize = prevSize - deltaRemaining;
|
|
47234
|
+
const safeSize = resizePanel({
|
|
47235
|
+
panelConstraints: panelConstraintsArray,
|
|
47236
|
+
panelIndex: index2,
|
|
47237
|
+
size: unsafeSize
|
|
47238
|
+
});
|
|
47239
|
+
if (!fuzzyNumbersEqual(prevSize, safeSize)) {
|
|
47240
|
+
deltaApplied += prevSize - safeSize;
|
|
47241
|
+
nextLayout[index2] = safeSize;
|
|
47242
|
+
if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), void 0, {
|
|
47243
|
+
numeric: true
|
|
47244
|
+
}) >= 0) {
|
|
47245
|
+
break;
|
|
47246
|
+
}
|
|
47247
|
+
}
|
|
47248
|
+
if (delta < 0) {
|
|
47249
|
+
index2--;
|
|
47250
|
+
} else {
|
|
47251
|
+
index2++;
|
|
47252
|
+
}
|
|
47253
|
+
}
|
|
47254
|
+
}
|
|
47255
|
+
if (fuzzyLayoutsEqual(prevLayout, nextLayout)) {
|
|
47256
|
+
return prevLayout;
|
|
47257
|
+
}
|
|
47258
|
+
{
|
|
47259
|
+
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
47260
|
+
const prevSize = initialLayout[pivotIndex];
|
|
47261
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
47262
|
+
const unsafeSize = prevSize + deltaApplied;
|
|
47263
|
+
const safeSize = resizePanel({
|
|
47264
|
+
panelConstraints: panelConstraintsArray,
|
|
47265
|
+
panelIndex: pivotIndex,
|
|
47266
|
+
size: unsafeSize
|
|
47267
|
+
});
|
|
47268
|
+
nextLayout[pivotIndex] = safeSize;
|
|
47269
|
+
if (!fuzzyNumbersEqual(safeSize, unsafeSize)) {
|
|
47270
|
+
let deltaRemaining = unsafeSize - safeSize;
|
|
47271
|
+
const pivotIndex2 = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
47272
|
+
let index2 = pivotIndex2;
|
|
47273
|
+
while (index2 >= 0 && index2 < panelConstraintsArray.length) {
|
|
47274
|
+
const prevSize2 = nextLayout[index2];
|
|
47275
|
+
assert(prevSize2 != null, `Previous layout not found for panel index ${index2}`);
|
|
47276
|
+
const unsafeSize2 = prevSize2 + deltaRemaining;
|
|
47277
|
+
const safeSize2 = resizePanel({
|
|
47278
|
+
panelConstraints: panelConstraintsArray,
|
|
47279
|
+
panelIndex: index2,
|
|
47280
|
+
size: unsafeSize2
|
|
47281
|
+
});
|
|
47282
|
+
if (!fuzzyNumbersEqual(prevSize2, safeSize2)) {
|
|
47283
|
+
deltaRemaining -= safeSize2 - prevSize2;
|
|
47284
|
+
nextLayout[index2] = safeSize2;
|
|
47285
|
+
}
|
|
47286
|
+
if (fuzzyNumbersEqual(deltaRemaining, 0)) {
|
|
47287
|
+
break;
|
|
47288
|
+
}
|
|
47289
|
+
if (delta > 0) {
|
|
47290
|
+
index2--;
|
|
47291
|
+
} else {
|
|
47292
|
+
index2++;
|
|
47293
|
+
}
|
|
47294
|
+
}
|
|
47295
|
+
}
|
|
47296
|
+
}
|
|
47297
|
+
const totalSize = nextLayout.reduce((total, size) => size + total, 0);
|
|
47298
|
+
if (!fuzzyNumbersEqual(totalSize, 100)) {
|
|
47299
|
+
return prevLayout;
|
|
47300
|
+
}
|
|
47301
|
+
return nextLayout;
|
|
47302
|
+
}
|
|
47303
|
+
function calculateAriaValues({
|
|
47304
|
+
layout,
|
|
47305
|
+
panelsArray,
|
|
47306
|
+
pivotIndices
|
|
47307
|
+
}) {
|
|
47308
|
+
let currentMinSize = 0;
|
|
47309
|
+
let currentMaxSize = 100;
|
|
47310
|
+
let totalMinSize = 0;
|
|
47311
|
+
let totalMaxSize = 0;
|
|
47312
|
+
const firstIndex = pivotIndices[0];
|
|
47313
|
+
assert(firstIndex != null, "No pivot index found");
|
|
47314
|
+
panelsArray.forEach((panelData, index2) => {
|
|
47315
|
+
const {
|
|
47316
|
+
constraints
|
|
47317
|
+
} = panelData;
|
|
47318
|
+
const {
|
|
47319
|
+
maxSize = 100,
|
|
47320
|
+
minSize = 0
|
|
47321
|
+
} = constraints;
|
|
47322
|
+
if (index2 === firstIndex) {
|
|
47323
|
+
currentMinSize = minSize;
|
|
47324
|
+
currentMaxSize = maxSize;
|
|
47325
|
+
} else {
|
|
47326
|
+
totalMinSize += minSize;
|
|
47327
|
+
totalMaxSize += maxSize;
|
|
47328
|
+
}
|
|
47329
|
+
});
|
|
47330
|
+
const valueMax = Math.min(currentMaxSize, 100 - totalMinSize);
|
|
47331
|
+
const valueMin = Math.max(currentMinSize, 100 - totalMaxSize);
|
|
47332
|
+
const valueNow = layout[firstIndex];
|
|
47333
|
+
return {
|
|
47334
|
+
valueMax,
|
|
47335
|
+
valueMin,
|
|
47336
|
+
valueNow
|
|
47337
|
+
};
|
|
47338
|
+
}
|
|
47339
|
+
function getResizeHandleElementsForGroup(groupId, scope = document) {
|
|
47340
|
+
return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES.resizeHandleId}][data-panel-group-id="${groupId}"]`));
|
|
47341
|
+
}
|
|
47342
|
+
function getResizeHandleElementIndex(groupId, id, scope = document) {
|
|
47343
|
+
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
47344
|
+
const index2 = handles.findIndex((handle2) => handle2.getAttribute(DATA_ATTRIBUTES.resizeHandleId) === id);
|
|
47345
|
+
return index2 !== null && index2 !== void 0 ? index2 : null;
|
|
47346
|
+
}
|
|
47347
|
+
function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
|
|
47348
|
+
const index2 = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
|
|
47349
|
+
return index2 != null ? [index2, index2 + 1] : [-1, -1];
|
|
47350
|
+
}
|
|
47351
|
+
function isHTMLElement(target) {
|
|
47352
|
+
if (target instanceof HTMLElement) {
|
|
47353
|
+
return true;
|
|
47354
|
+
}
|
|
47355
|
+
return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
|
|
47356
|
+
}
|
|
47357
|
+
function getPanelGroupElement(id, rootElement = document) {
|
|
47358
|
+
if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
|
|
47359
|
+
return rootElement;
|
|
47360
|
+
}
|
|
47361
|
+
const element2 = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
|
|
47362
|
+
if (element2) {
|
|
47363
|
+
return element2;
|
|
47364
|
+
}
|
|
47365
|
+
return null;
|
|
47366
|
+
}
|
|
47367
|
+
function getResizeHandleElement(id, scope = document) {
|
|
47368
|
+
const element2 = scope.querySelector(`[${DATA_ATTRIBUTES.resizeHandleId}="${id}"]`);
|
|
47369
|
+
if (element2) {
|
|
47370
|
+
return element2;
|
|
47371
|
+
}
|
|
47372
|
+
return null;
|
|
47373
|
+
}
|
|
47374
|
+
function getResizeHandlePanelIds(groupId, handleId, panelsArray, scope = document) {
|
|
47375
|
+
var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
|
|
47376
|
+
const handle2 = getResizeHandleElement(handleId, scope);
|
|
47377
|
+
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
47378
|
+
const index2 = handle2 ? handles.indexOf(handle2) : -1;
|
|
47379
|
+
const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index2]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
|
|
47380
|
+
const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index2 + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
|
|
47381
|
+
return [idBefore, idAfter];
|
|
47382
|
+
}
|
|
47383
|
+
function useWindowSplitterPanelGroupBehavior({
|
|
47384
|
+
committedValuesRef,
|
|
47385
|
+
eagerValuesRef,
|
|
47386
|
+
groupId,
|
|
47387
|
+
layout,
|
|
47388
|
+
panelDataArray,
|
|
47389
|
+
panelGroupElement,
|
|
47390
|
+
setLayout
|
|
47391
|
+
}) {
|
|
47392
|
+
useRef({
|
|
47393
|
+
didWarnAboutMissingResizeHandle: false
|
|
47394
|
+
});
|
|
47395
|
+
useIsomorphicLayoutEffect(() => {
|
|
47396
|
+
if (!panelGroupElement) {
|
|
47397
|
+
return;
|
|
47398
|
+
}
|
|
47399
|
+
const resizeHandleElements = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
47400
|
+
for (let index2 = 0; index2 < panelDataArray.length - 1; index2++) {
|
|
47401
|
+
const {
|
|
47402
|
+
valueMax,
|
|
47403
|
+
valueMin,
|
|
47404
|
+
valueNow
|
|
47405
|
+
} = calculateAriaValues({
|
|
47406
|
+
layout,
|
|
47407
|
+
panelsArray: panelDataArray,
|
|
47408
|
+
pivotIndices: [index2, index2 + 1]
|
|
47409
|
+
});
|
|
47410
|
+
const resizeHandleElement = resizeHandleElements[index2];
|
|
47411
|
+
if (resizeHandleElement == null) ;
|
|
47412
|
+
else {
|
|
47413
|
+
const panelData = panelDataArray[index2];
|
|
47414
|
+
assert(panelData, `No panel data found for index "${index2}"`);
|
|
47415
|
+
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
47416
|
+
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
47417
|
+
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
47418
|
+
resizeHandleElement.setAttribute("aria-valuenow", valueNow != null ? "" + Math.round(valueNow) : "");
|
|
47419
|
+
}
|
|
47420
|
+
}
|
|
47421
|
+
return () => {
|
|
47422
|
+
resizeHandleElements.forEach((resizeHandleElement, index2) => {
|
|
47423
|
+
resizeHandleElement.removeAttribute("aria-controls");
|
|
47424
|
+
resizeHandleElement.removeAttribute("aria-valuemax");
|
|
47425
|
+
resizeHandleElement.removeAttribute("aria-valuemin");
|
|
47426
|
+
resizeHandleElement.removeAttribute("aria-valuenow");
|
|
47427
|
+
});
|
|
47428
|
+
};
|
|
47429
|
+
}, [groupId, layout, panelDataArray, panelGroupElement]);
|
|
47430
|
+
useEffect(() => {
|
|
47431
|
+
if (!panelGroupElement) {
|
|
47432
|
+
return;
|
|
47433
|
+
}
|
|
47434
|
+
const eagerValues = eagerValuesRef.current;
|
|
47435
|
+
assert(eagerValues, `Eager values not found`);
|
|
47436
|
+
const {
|
|
47437
|
+
panelDataArray: panelDataArray2
|
|
47438
|
+
} = eagerValues;
|
|
47439
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
47440
|
+
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
47441
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
47442
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
47443
|
+
const cleanupFunctions = handles.map((handle2) => {
|
|
47444
|
+
const handleId = handle2.getAttribute(DATA_ATTRIBUTES.resizeHandleId);
|
|
47445
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
47446
|
+
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray2, panelGroupElement);
|
|
47447
|
+
if (idBefore == null || idAfter == null) {
|
|
47448
|
+
return () => {
|
|
47449
|
+
};
|
|
47450
|
+
}
|
|
47451
|
+
const onKeyDown = (event) => {
|
|
47452
|
+
if (event.defaultPrevented) {
|
|
47453
|
+
return;
|
|
47454
|
+
}
|
|
47455
|
+
switch (event.key) {
|
|
47456
|
+
case "Enter": {
|
|
47457
|
+
event.preventDefault();
|
|
47458
|
+
const index2 = panelDataArray2.findIndex((panelData) => panelData.id === idBefore);
|
|
47459
|
+
if (index2 >= 0) {
|
|
47460
|
+
const panelData = panelDataArray2[index2];
|
|
47461
|
+
assert(panelData, `No panel data found for index ${index2}`);
|
|
47462
|
+
const size = layout[index2];
|
|
47463
|
+
const {
|
|
47464
|
+
collapsedSize = 0,
|
|
47465
|
+
collapsible,
|
|
47466
|
+
minSize = 0
|
|
47467
|
+
} = panelData.constraints;
|
|
47468
|
+
if (size != null && collapsible) {
|
|
47469
|
+
const nextLayout = adjustLayoutByDelta({
|
|
47470
|
+
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
47471
|
+
initialLayout: layout,
|
|
47472
|
+
panelConstraints: panelDataArray2.map((panelData2) => panelData2.constraints),
|
|
47473
|
+
pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
|
|
47474
|
+
prevLayout: layout,
|
|
47475
|
+
trigger: "keyboard"
|
|
47476
|
+
});
|
|
47477
|
+
if (layout !== nextLayout) {
|
|
47478
|
+
setLayout(nextLayout);
|
|
47479
|
+
}
|
|
47480
|
+
}
|
|
47481
|
+
}
|
|
47482
|
+
break;
|
|
47483
|
+
}
|
|
47484
|
+
}
|
|
47485
|
+
};
|
|
47486
|
+
handle2.addEventListener("keydown", onKeyDown);
|
|
47487
|
+
return () => {
|
|
47488
|
+
handle2.removeEventListener("keydown", onKeyDown);
|
|
47489
|
+
};
|
|
47490
|
+
});
|
|
47491
|
+
return () => {
|
|
47492
|
+
cleanupFunctions.forEach((cleanupFunction) => cleanupFunction());
|
|
47493
|
+
};
|
|
47494
|
+
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
47495
|
+
}
|
|
47496
|
+
function areEqual(arrayA, arrayB) {
|
|
47497
|
+
if (arrayA.length !== arrayB.length) {
|
|
47498
|
+
return false;
|
|
47499
|
+
}
|
|
47500
|
+
for (let index2 = 0; index2 < arrayA.length; index2++) {
|
|
47501
|
+
if (arrayA[index2] !== arrayB[index2]) {
|
|
47502
|
+
return false;
|
|
47503
|
+
}
|
|
47504
|
+
}
|
|
47505
|
+
return true;
|
|
47506
|
+
}
|
|
47507
|
+
function getResizeEventCursorPosition(direction, event) {
|
|
47508
|
+
const isHorizontal = direction === "horizontal";
|
|
47509
|
+
const {
|
|
47510
|
+
x,
|
|
47511
|
+
y
|
|
47512
|
+
} = getResizeEventCoordinates(event);
|
|
47513
|
+
return isHorizontal ? x : y;
|
|
47514
|
+
}
|
|
47515
|
+
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
47516
|
+
const isHorizontal = direction === "horizontal";
|
|
47517
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
47518
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
47519
|
+
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
47520
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
47521
|
+
let {
|
|
47522
|
+
initialCursorPosition
|
|
47523
|
+
} = initialDragState;
|
|
47524
|
+
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
47525
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
47526
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
47527
|
+
const groupRect = groupElement.getBoundingClientRect();
|
|
47528
|
+
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
47529
|
+
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
47530
|
+
const offsetPercentage = offsetPixels / groupSizeInPixels * 100;
|
|
47531
|
+
return offsetPercentage;
|
|
47532
|
+
}
|
|
47533
|
+
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
47534
|
+
if (isKeyDown(event)) {
|
|
47535
|
+
const isHorizontal = direction === "horizontal";
|
|
47536
|
+
let delta = 0;
|
|
47537
|
+
if (event.shiftKey) {
|
|
47538
|
+
delta = 100;
|
|
47539
|
+
} else if (keyboardResizeBy != null) {
|
|
47540
|
+
delta = keyboardResizeBy;
|
|
47541
|
+
} else {
|
|
47542
|
+
delta = 10;
|
|
47543
|
+
}
|
|
47544
|
+
let movement = 0;
|
|
47545
|
+
switch (event.key) {
|
|
47546
|
+
case "ArrowDown":
|
|
47547
|
+
movement = isHorizontal ? 0 : delta;
|
|
47548
|
+
break;
|
|
47549
|
+
case "ArrowLeft":
|
|
47550
|
+
movement = isHorizontal ? -delta : 0;
|
|
47551
|
+
break;
|
|
47552
|
+
case "ArrowRight":
|
|
47553
|
+
movement = isHorizontal ? delta : 0;
|
|
47554
|
+
break;
|
|
47555
|
+
case "ArrowUp":
|
|
47556
|
+
movement = isHorizontal ? 0 : -delta;
|
|
47557
|
+
break;
|
|
47558
|
+
case "End":
|
|
47559
|
+
movement = 100;
|
|
47560
|
+
break;
|
|
47561
|
+
case "Home":
|
|
47562
|
+
movement = -100;
|
|
47563
|
+
break;
|
|
47564
|
+
}
|
|
47565
|
+
return movement;
|
|
47566
|
+
} else {
|
|
47567
|
+
if (initialDragState == null) {
|
|
47568
|
+
return 0;
|
|
47569
|
+
}
|
|
47570
|
+
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
47571
|
+
}
|
|
47572
|
+
}
|
|
47573
|
+
function calculateUnsafeDefaultLayout({
|
|
47574
|
+
panelDataArray
|
|
47575
|
+
}) {
|
|
47576
|
+
const layout = Array(panelDataArray.length);
|
|
47577
|
+
const panelConstraintsArray = panelDataArray.map((panelData) => panelData.constraints);
|
|
47578
|
+
let numPanelsWithSizes = 0;
|
|
47579
|
+
let remainingSize = 100;
|
|
47580
|
+
for (let index2 = 0; index2 < panelDataArray.length; index2++) {
|
|
47581
|
+
const panelConstraints = panelConstraintsArray[index2];
|
|
47582
|
+
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
47583
|
+
const {
|
|
47584
|
+
defaultSize
|
|
47585
|
+
} = panelConstraints;
|
|
47586
|
+
if (defaultSize != null) {
|
|
47587
|
+
numPanelsWithSizes++;
|
|
47588
|
+
layout[index2] = defaultSize;
|
|
47589
|
+
remainingSize -= defaultSize;
|
|
47590
|
+
}
|
|
47591
|
+
}
|
|
47592
|
+
for (let index2 = 0; index2 < panelDataArray.length; index2++) {
|
|
47593
|
+
const panelConstraints = panelConstraintsArray[index2];
|
|
47594
|
+
assert(panelConstraints, `Panel constraints not found for index ${index2}`);
|
|
47595
|
+
const {
|
|
47596
|
+
defaultSize
|
|
47597
|
+
} = panelConstraints;
|
|
47598
|
+
if (defaultSize != null) {
|
|
47599
|
+
continue;
|
|
47600
|
+
}
|
|
47601
|
+
const numRemainingPanels = panelDataArray.length - numPanelsWithSizes;
|
|
47602
|
+
const size = remainingSize / numRemainingPanels;
|
|
47603
|
+
numPanelsWithSizes++;
|
|
47604
|
+
layout[index2] = size;
|
|
47605
|
+
remainingSize -= size;
|
|
47606
|
+
}
|
|
47607
|
+
return layout;
|
|
47608
|
+
}
|
|
47609
|
+
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
47610
|
+
layout.forEach((size, index2) => {
|
|
47611
|
+
const panelData = panelsArray[index2];
|
|
47612
|
+
assert(panelData, `Panel data not found for index ${index2}`);
|
|
47613
|
+
const {
|
|
47614
|
+
callbacks,
|
|
47615
|
+
constraints,
|
|
47616
|
+
id: panelId
|
|
47617
|
+
} = panelData;
|
|
47618
|
+
const {
|
|
47619
|
+
collapsedSize = 0,
|
|
47620
|
+
collapsible
|
|
47621
|
+
} = constraints;
|
|
47622
|
+
const lastNotifiedSize = panelIdToLastNotifiedSizeMap[panelId];
|
|
47623
|
+
if (lastNotifiedSize == null || size !== lastNotifiedSize) {
|
|
47624
|
+
panelIdToLastNotifiedSizeMap[panelId] = size;
|
|
47625
|
+
const {
|
|
47626
|
+
onCollapse,
|
|
47627
|
+
onExpand,
|
|
47628
|
+
onResize
|
|
47629
|
+
} = callbacks;
|
|
47630
|
+
if (onResize) {
|
|
47631
|
+
onResize(size, lastNotifiedSize);
|
|
47632
|
+
}
|
|
47633
|
+
if (collapsible && (onCollapse || onExpand)) {
|
|
47634
|
+
if (onExpand && (lastNotifiedSize == null || fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
47635
|
+
onExpand();
|
|
47636
|
+
}
|
|
47637
|
+
if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
47638
|
+
onCollapse();
|
|
47639
|
+
}
|
|
47640
|
+
}
|
|
47641
|
+
}
|
|
47642
|
+
});
|
|
47643
|
+
}
|
|
47644
|
+
function compareLayouts(a, b) {
|
|
47645
|
+
if (a.length !== b.length) {
|
|
47646
|
+
return false;
|
|
47647
|
+
} else {
|
|
47648
|
+
for (let index2 = 0; index2 < a.length; index2++) {
|
|
47649
|
+
if (a[index2] != b[index2]) {
|
|
47650
|
+
return false;
|
|
47651
|
+
}
|
|
47652
|
+
}
|
|
47653
|
+
}
|
|
47654
|
+
return true;
|
|
47655
|
+
}
|
|
47656
|
+
function computePanelFlexBoxStyle({
|
|
47657
|
+
defaultSize,
|
|
47658
|
+
dragState,
|
|
47659
|
+
layout,
|
|
47660
|
+
panelData,
|
|
47661
|
+
panelIndex,
|
|
47662
|
+
precision = 3
|
|
47663
|
+
}) {
|
|
47664
|
+
const size = layout[panelIndex];
|
|
47665
|
+
let flexGrow;
|
|
47666
|
+
if (size == null) {
|
|
47667
|
+
flexGrow = defaultSize != void 0 ? defaultSize.toFixed(precision) : "1";
|
|
47668
|
+
} else if (panelData.length === 1) {
|
|
47669
|
+
flexGrow = "1";
|
|
47670
|
+
} else {
|
|
47671
|
+
flexGrow = size.toFixed(precision);
|
|
47672
|
+
}
|
|
47673
|
+
return {
|
|
47674
|
+
flexBasis: 0,
|
|
47675
|
+
flexGrow,
|
|
47676
|
+
flexShrink: 1,
|
|
47677
|
+
// Without this, Panel sizes may be unintentionally overridden by their content
|
|
47678
|
+
overflow: "hidden",
|
|
47679
|
+
// Disable pointer events inside of a panel during resize
|
|
47680
|
+
// This avoid edge cases like nested iframes
|
|
47681
|
+
pointerEvents: dragState !== null ? "none" : void 0
|
|
47682
|
+
};
|
|
47683
|
+
}
|
|
47684
|
+
function debounce(callback, durationMs = 10) {
|
|
47685
|
+
let timeoutId = null;
|
|
47686
|
+
let callable = (...args) => {
|
|
47687
|
+
if (timeoutId !== null) {
|
|
47688
|
+
clearTimeout(timeoutId);
|
|
47689
|
+
}
|
|
47690
|
+
timeoutId = setTimeout(() => {
|
|
47691
|
+
callback(...args);
|
|
47692
|
+
}, durationMs);
|
|
47693
|
+
};
|
|
47694
|
+
return callable;
|
|
47695
|
+
}
|
|
47696
|
+
function initializeDefaultStorage(storageObject) {
|
|
47697
|
+
try {
|
|
47698
|
+
if (typeof localStorage !== "undefined") {
|
|
47699
|
+
storageObject.getItem = (name2) => {
|
|
47700
|
+
return localStorage.getItem(name2);
|
|
47701
|
+
};
|
|
47702
|
+
storageObject.setItem = (name2, value) => {
|
|
47703
|
+
localStorage.setItem(name2, value);
|
|
47704
|
+
};
|
|
47705
|
+
} else {
|
|
47706
|
+
throw new Error("localStorage not supported in this environment");
|
|
47707
|
+
}
|
|
47708
|
+
} catch (error) {
|
|
47709
|
+
console.error(error);
|
|
47710
|
+
storageObject.getItem = () => null;
|
|
47711
|
+
storageObject.setItem = () => {
|
|
47712
|
+
};
|
|
47713
|
+
}
|
|
47714
|
+
}
|
|
47715
|
+
function getPanelGroupKey(autoSaveId) {
|
|
47716
|
+
return `react-resizable-panels:${autoSaveId}`;
|
|
47717
|
+
}
|
|
47718
|
+
function getPanelKey(panels2) {
|
|
47719
|
+
return panels2.map((panel) => {
|
|
47720
|
+
const {
|
|
47721
|
+
constraints,
|
|
47722
|
+
id,
|
|
47723
|
+
idIsFromProps,
|
|
47724
|
+
order: order2
|
|
47725
|
+
} = panel;
|
|
47726
|
+
if (idIsFromProps) {
|
|
47727
|
+
return id;
|
|
47728
|
+
} else {
|
|
47729
|
+
return order2 ? `${order2}:${JSON.stringify(constraints)}` : JSON.stringify(constraints);
|
|
47730
|
+
}
|
|
47731
|
+
}).sort((a, b) => a.localeCompare(b)).join(",");
|
|
47732
|
+
}
|
|
47733
|
+
function loadSerializedPanelGroupState(autoSaveId, storage) {
|
|
47734
|
+
try {
|
|
47735
|
+
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
47736
|
+
const serialized = storage.getItem(panelGroupKey);
|
|
47737
|
+
if (serialized) {
|
|
47738
|
+
const parsed = JSON.parse(serialized);
|
|
47739
|
+
if (typeof parsed === "object" && parsed != null) {
|
|
47740
|
+
return parsed;
|
|
47741
|
+
}
|
|
47742
|
+
}
|
|
47743
|
+
} catch (error) {
|
|
47744
|
+
}
|
|
47745
|
+
return null;
|
|
47746
|
+
}
|
|
47747
|
+
function loadPanelGroupState(autoSaveId, panels2, storage) {
|
|
47748
|
+
var _loadSerializedPanelG, _state$panelKey;
|
|
47749
|
+
const state = (_loadSerializedPanelG = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG !== void 0 ? _loadSerializedPanelG : {};
|
|
47750
|
+
const panelKey = getPanelKey(panels2);
|
|
47751
|
+
return (_state$panelKey = state[panelKey]) !== null && _state$panelKey !== void 0 ? _state$panelKey : null;
|
|
47752
|
+
}
|
|
47753
|
+
function savePanelGroupState(autoSaveId, panels2, panelSizesBeforeCollapse, sizes, storage) {
|
|
47754
|
+
var _loadSerializedPanelG2;
|
|
47755
|
+
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
47756
|
+
const panelKey = getPanelKey(panels2);
|
|
47757
|
+
const state = (_loadSerializedPanelG2 = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG2 !== void 0 ? _loadSerializedPanelG2 : {};
|
|
47758
|
+
state[panelKey] = {
|
|
47759
|
+
expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
|
|
47760
|
+
layout: sizes
|
|
47761
|
+
};
|
|
47762
|
+
try {
|
|
47763
|
+
storage.setItem(panelGroupKey, JSON.stringify(state));
|
|
47764
|
+
} catch (error) {
|
|
47765
|
+
console.error(error);
|
|
47766
|
+
}
|
|
47767
|
+
}
|
|
47768
|
+
function validatePanelGroupLayout({
|
|
47769
|
+
layout: prevLayout,
|
|
47770
|
+
panelConstraints
|
|
47771
|
+
}) {
|
|
47772
|
+
const nextLayout = [...prevLayout];
|
|
47773
|
+
const nextLayoutTotalSize = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
|
|
47774
|
+
if (nextLayout.length !== panelConstraints.length) {
|
|
47775
|
+
throw Error(`Invalid ${panelConstraints.length} panel layout: ${nextLayout.map((size) => `${size}%`).join(", ")}`);
|
|
47776
|
+
} else if (!fuzzyNumbersEqual(nextLayoutTotalSize, 100) && nextLayout.length > 0) {
|
|
47777
|
+
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
47778
|
+
const unsafeSize = nextLayout[index2];
|
|
47779
|
+
assert(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
47780
|
+
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
47781
|
+
nextLayout[index2] = safeSize;
|
|
47782
|
+
}
|
|
47783
|
+
}
|
|
47784
|
+
let remainingSize = 0;
|
|
47785
|
+
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
47786
|
+
const unsafeSize = nextLayout[index2];
|
|
47787
|
+
assert(unsafeSize != null, `No layout data found for index ${index2}`);
|
|
47788
|
+
const safeSize = resizePanel({
|
|
47789
|
+
panelConstraints,
|
|
47790
|
+
panelIndex: index2,
|
|
47791
|
+
size: unsafeSize
|
|
47792
|
+
});
|
|
47793
|
+
if (unsafeSize != safeSize) {
|
|
47794
|
+
remainingSize += unsafeSize - safeSize;
|
|
47795
|
+
nextLayout[index2] = safeSize;
|
|
47796
|
+
}
|
|
47797
|
+
}
|
|
47798
|
+
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
47799
|
+
for (let index2 = 0; index2 < panelConstraints.length; index2++) {
|
|
47800
|
+
const prevSize = nextLayout[index2];
|
|
47801
|
+
assert(prevSize != null, `No layout data found for index ${index2}`);
|
|
47802
|
+
const unsafeSize = prevSize + remainingSize;
|
|
47803
|
+
const safeSize = resizePanel({
|
|
47804
|
+
panelConstraints,
|
|
47805
|
+
panelIndex: index2,
|
|
47806
|
+
size: unsafeSize
|
|
47807
|
+
});
|
|
47808
|
+
if (prevSize !== safeSize) {
|
|
47809
|
+
remainingSize -= safeSize - prevSize;
|
|
47810
|
+
nextLayout[index2] = safeSize;
|
|
47811
|
+
if (fuzzyNumbersEqual(remainingSize, 0)) {
|
|
47812
|
+
break;
|
|
47813
|
+
}
|
|
47814
|
+
}
|
|
47815
|
+
}
|
|
47816
|
+
}
|
|
47817
|
+
return nextLayout;
|
|
47818
|
+
}
|
|
47819
|
+
const LOCAL_STORAGE_DEBOUNCE_INTERVAL = 100;
|
|
47820
|
+
const defaultStorage = {
|
|
47821
|
+
getItem: (name2) => {
|
|
47822
|
+
initializeDefaultStorage(defaultStorage);
|
|
47823
|
+
return defaultStorage.getItem(name2);
|
|
47824
|
+
},
|
|
47825
|
+
setItem: (name2, value) => {
|
|
47826
|
+
initializeDefaultStorage(defaultStorage);
|
|
47827
|
+
defaultStorage.setItem(name2, value);
|
|
47828
|
+
}
|
|
47829
|
+
};
|
|
47830
|
+
const debounceMap = {};
|
|
47831
|
+
function PanelGroupWithForwardedRef({
|
|
47832
|
+
autoSaveId = null,
|
|
47833
|
+
children: children2,
|
|
47834
|
+
className: classNameFromProps = "",
|
|
47835
|
+
direction,
|
|
47836
|
+
forwardedRef,
|
|
47837
|
+
id: idFromProps = null,
|
|
47838
|
+
onLayout = null,
|
|
47839
|
+
keyboardResizeBy = null,
|
|
47840
|
+
storage = defaultStorage,
|
|
47841
|
+
style: styleFromProps,
|
|
47842
|
+
tagName: Type = "div",
|
|
47843
|
+
...rest
|
|
47844
|
+
}) {
|
|
47845
|
+
const groupId = useUniqueId(idFromProps);
|
|
47846
|
+
const panelGroupElementRef = useRef(null);
|
|
47847
|
+
const [dragState, setDragState] = useState(null);
|
|
47848
|
+
const [layout, setLayout] = useState([]);
|
|
47849
|
+
const forceUpdate = useForceUpdate();
|
|
47850
|
+
const panelIdToLastNotifiedSizeMapRef = useRef({});
|
|
47851
|
+
const panelSizeBeforeCollapseRef = useRef(/* @__PURE__ */ new Map());
|
|
47852
|
+
const prevDeltaRef = useRef(0);
|
|
47853
|
+
const committedValuesRef = useRef({
|
|
47854
|
+
autoSaveId,
|
|
47855
|
+
direction,
|
|
47856
|
+
dragState,
|
|
47857
|
+
id: groupId,
|
|
47858
|
+
keyboardResizeBy,
|
|
47859
|
+
onLayout,
|
|
47860
|
+
storage
|
|
47861
|
+
});
|
|
47862
|
+
const eagerValuesRef = useRef({
|
|
47863
|
+
layout,
|
|
47864
|
+
panelDataArray: [],
|
|
47865
|
+
panelDataArrayChanged: false
|
|
47866
|
+
});
|
|
47867
|
+
useRef({
|
|
47868
|
+
didLogIdAndOrderWarning: false,
|
|
47869
|
+
didLogPanelConstraintsWarning: false,
|
|
47870
|
+
prevPanelIds: []
|
|
47871
|
+
});
|
|
47872
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
47873
|
+
getId: () => committedValuesRef.current.id,
|
|
47874
|
+
getLayout: () => {
|
|
47875
|
+
const {
|
|
47876
|
+
layout: layout2
|
|
47877
|
+
} = eagerValuesRef.current;
|
|
47878
|
+
return layout2;
|
|
47879
|
+
},
|
|
47880
|
+
setLayout: (unsafeLayout) => {
|
|
47881
|
+
const {
|
|
47882
|
+
onLayout: onLayout2
|
|
47883
|
+
} = committedValuesRef.current;
|
|
47884
|
+
const {
|
|
47885
|
+
layout: prevLayout,
|
|
47886
|
+
panelDataArray
|
|
47887
|
+
} = eagerValuesRef.current;
|
|
47888
|
+
const safeLayout = validatePanelGroupLayout({
|
|
47889
|
+
layout: unsafeLayout,
|
|
47890
|
+
panelConstraints: panelDataArray.map((panelData) => panelData.constraints)
|
|
47891
|
+
});
|
|
47892
|
+
if (!areEqual(prevLayout, safeLayout)) {
|
|
47893
|
+
setLayout(safeLayout);
|
|
47894
|
+
eagerValuesRef.current.layout = safeLayout;
|
|
47895
|
+
if (onLayout2) {
|
|
47896
|
+
onLayout2(safeLayout);
|
|
47897
|
+
}
|
|
47898
|
+
callPanelCallbacks(panelDataArray, safeLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
47899
|
+
}
|
|
47900
|
+
}
|
|
47901
|
+
}), []);
|
|
47902
|
+
useIsomorphicLayoutEffect(() => {
|
|
47903
|
+
committedValuesRef.current.autoSaveId = autoSaveId;
|
|
47904
|
+
committedValuesRef.current.direction = direction;
|
|
47905
|
+
committedValuesRef.current.dragState = dragState;
|
|
47906
|
+
committedValuesRef.current.id = groupId;
|
|
47907
|
+
committedValuesRef.current.onLayout = onLayout;
|
|
47908
|
+
committedValuesRef.current.storage = storage;
|
|
47909
|
+
});
|
|
47910
|
+
useWindowSplitterPanelGroupBehavior({
|
|
47911
|
+
committedValuesRef,
|
|
47912
|
+
eagerValuesRef,
|
|
47913
|
+
groupId,
|
|
47914
|
+
layout,
|
|
47915
|
+
panelDataArray: eagerValuesRef.current.panelDataArray,
|
|
47916
|
+
setLayout,
|
|
47917
|
+
panelGroupElement: panelGroupElementRef.current
|
|
47918
|
+
});
|
|
47919
|
+
useEffect(() => {
|
|
47920
|
+
const {
|
|
47921
|
+
panelDataArray
|
|
47922
|
+
} = eagerValuesRef.current;
|
|
47923
|
+
if (autoSaveId) {
|
|
47924
|
+
if (layout.length === 0 || layout.length !== panelDataArray.length) {
|
|
47925
|
+
return;
|
|
47926
|
+
}
|
|
47927
|
+
let debouncedSave = debounceMap[autoSaveId];
|
|
47928
|
+
if (debouncedSave == null) {
|
|
47929
|
+
debouncedSave = debounce(savePanelGroupState, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
|
|
47930
|
+
debounceMap[autoSaveId] = debouncedSave;
|
|
47931
|
+
}
|
|
47932
|
+
const clonedPanelDataArray = [...panelDataArray];
|
|
47933
|
+
const clonedPanelSizesBeforeCollapse = new Map(panelSizeBeforeCollapseRef.current);
|
|
47934
|
+
debouncedSave(autoSaveId, clonedPanelDataArray, clonedPanelSizesBeforeCollapse, layout, storage);
|
|
47935
|
+
}
|
|
47936
|
+
}, [autoSaveId, layout, storage]);
|
|
47937
|
+
useEffect(() => {
|
|
47938
|
+
});
|
|
47939
|
+
const collapsePanel = useCallback((panelData) => {
|
|
47940
|
+
const {
|
|
47941
|
+
onLayout: onLayout2
|
|
47942
|
+
} = committedValuesRef.current;
|
|
47943
|
+
const {
|
|
47944
|
+
layout: prevLayout,
|
|
47945
|
+
panelDataArray
|
|
47946
|
+
} = eagerValuesRef.current;
|
|
47947
|
+
if (panelData.constraints.collapsible) {
|
|
47948
|
+
const panelConstraintsArray = panelDataArray.map((panelData2) => panelData2.constraints);
|
|
47949
|
+
const {
|
|
47950
|
+
collapsedSize = 0,
|
|
47951
|
+
panelSize,
|
|
47952
|
+
pivotIndices
|
|
47953
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
47954
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
47955
|
+
if (!fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
47956
|
+
panelSizeBeforeCollapseRef.current.set(panelData.id, panelSize);
|
|
47957
|
+
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
47958
|
+
const delta = isLastPanel ? panelSize - collapsedSize : collapsedSize - panelSize;
|
|
47959
|
+
const nextLayout = adjustLayoutByDelta({
|
|
47960
|
+
delta,
|
|
47961
|
+
initialLayout: prevLayout,
|
|
47962
|
+
panelConstraints: panelConstraintsArray,
|
|
47963
|
+
pivotIndices,
|
|
47964
|
+
prevLayout,
|
|
47965
|
+
trigger: "imperative-api"
|
|
47966
|
+
});
|
|
47967
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
47968
|
+
setLayout(nextLayout);
|
|
47969
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
47970
|
+
if (onLayout2) {
|
|
47971
|
+
onLayout2(nextLayout);
|
|
47972
|
+
}
|
|
47973
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
47974
|
+
}
|
|
47975
|
+
}
|
|
47976
|
+
}
|
|
47977
|
+
}, []);
|
|
47978
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
47979
|
+
const {
|
|
47980
|
+
onLayout: onLayout2
|
|
47981
|
+
} = committedValuesRef.current;
|
|
47982
|
+
const {
|
|
47983
|
+
layout: prevLayout,
|
|
47984
|
+
panelDataArray
|
|
47985
|
+
} = eagerValuesRef.current;
|
|
47986
|
+
if (panelData.constraints.collapsible) {
|
|
47987
|
+
const panelConstraintsArray = panelDataArray.map((panelData2) => panelData2.constraints);
|
|
47988
|
+
const {
|
|
47989
|
+
collapsedSize = 0,
|
|
47990
|
+
panelSize = 0,
|
|
47991
|
+
minSize: minSizeFromProps = 0,
|
|
47992
|
+
pivotIndices
|
|
47993
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
47994
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
47995
|
+
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
47996
|
+
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
47997
|
+
const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
|
|
47998
|
+
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
47999
|
+
const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
|
|
48000
|
+
const nextLayout = adjustLayoutByDelta({
|
|
48001
|
+
delta,
|
|
48002
|
+
initialLayout: prevLayout,
|
|
48003
|
+
panelConstraints: panelConstraintsArray,
|
|
48004
|
+
pivotIndices,
|
|
48005
|
+
prevLayout,
|
|
48006
|
+
trigger: "imperative-api"
|
|
48007
|
+
});
|
|
48008
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
48009
|
+
setLayout(nextLayout);
|
|
48010
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
48011
|
+
if (onLayout2) {
|
|
48012
|
+
onLayout2(nextLayout);
|
|
48013
|
+
}
|
|
48014
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
48015
|
+
}
|
|
48016
|
+
}
|
|
48017
|
+
}
|
|
48018
|
+
}, []);
|
|
48019
|
+
const getPanelSize = useCallback((panelData) => {
|
|
48020
|
+
const {
|
|
48021
|
+
layout: layout2,
|
|
48022
|
+
panelDataArray
|
|
48023
|
+
} = eagerValuesRef.current;
|
|
48024
|
+
const {
|
|
48025
|
+
panelSize
|
|
48026
|
+
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
48027
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
48028
|
+
return panelSize;
|
|
48029
|
+
}, []);
|
|
48030
|
+
const getPanelStyle = useCallback((panelData, defaultSize) => {
|
|
48031
|
+
const {
|
|
48032
|
+
panelDataArray
|
|
48033
|
+
} = eagerValuesRef.current;
|
|
48034
|
+
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
48035
|
+
return computePanelFlexBoxStyle({
|
|
48036
|
+
defaultSize,
|
|
48037
|
+
dragState,
|
|
48038
|
+
layout,
|
|
48039
|
+
panelData: panelDataArray,
|
|
48040
|
+
panelIndex
|
|
48041
|
+
});
|
|
48042
|
+
}, [dragState, layout]);
|
|
48043
|
+
const isPanelCollapsed = useCallback((panelData) => {
|
|
48044
|
+
const {
|
|
48045
|
+
layout: layout2,
|
|
48046
|
+
panelDataArray
|
|
48047
|
+
} = eagerValuesRef.current;
|
|
48048
|
+
const {
|
|
48049
|
+
collapsedSize = 0,
|
|
48050
|
+
collapsible,
|
|
48051
|
+
panelSize
|
|
48052
|
+
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
48053
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
48054
|
+
return collapsible === true && fuzzyNumbersEqual$1(panelSize, collapsedSize);
|
|
48055
|
+
}, []);
|
|
48056
|
+
const isPanelExpanded = useCallback((panelData) => {
|
|
48057
|
+
const {
|
|
48058
|
+
layout: layout2,
|
|
48059
|
+
panelDataArray
|
|
48060
|
+
} = eagerValuesRef.current;
|
|
48061
|
+
const {
|
|
48062
|
+
collapsedSize = 0,
|
|
48063
|
+
collapsible,
|
|
48064
|
+
panelSize
|
|
48065
|
+
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
48066
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
48067
|
+
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
48068
|
+
}, []);
|
|
48069
|
+
const registerPanel = useCallback((panelData) => {
|
|
48070
|
+
const {
|
|
48071
|
+
panelDataArray
|
|
48072
|
+
} = eagerValuesRef.current;
|
|
48073
|
+
panelDataArray.push(panelData);
|
|
48074
|
+
panelDataArray.sort((panelA, panelB) => {
|
|
48075
|
+
const orderA = panelA.order;
|
|
48076
|
+
const orderB = panelB.order;
|
|
48077
|
+
if (orderA == null && orderB == null) {
|
|
48078
|
+
return 0;
|
|
48079
|
+
} else if (orderA == null) {
|
|
48080
|
+
return -1;
|
|
48081
|
+
} else if (orderB == null) {
|
|
48082
|
+
return 1;
|
|
48083
|
+
} else {
|
|
48084
|
+
return orderA - orderB;
|
|
48085
|
+
}
|
|
48086
|
+
});
|
|
48087
|
+
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
48088
|
+
forceUpdate();
|
|
48089
|
+
}, [forceUpdate]);
|
|
48090
|
+
useIsomorphicLayoutEffect(() => {
|
|
48091
|
+
if (eagerValuesRef.current.panelDataArrayChanged) {
|
|
48092
|
+
eagerValuesRef.current.panelDataArrayChanged = false;
|
|
48093
|
+
const {
|
|
48094
|
+
autoSaveId: autoSaveId2,
|
|
48095
|
+
onLayout: onLayout2,
|
|
48096
|
+
storage: storage2
|
|
48097
|
+
} = committedValuesRef.current;
|
|
48098
|
+
const {
|
|
48099
|
+
layout: prevLayout,
|
|
48100
|
+
panelDataArray
|
|
48101
|
+
} = eagerValuesRef.current;
|
|
48102
|
+
let unsafeLayout = null;
|
|
48103
|
+
if (autoSaveId2) {
|
|
48104
|
+
const state = loadPanelGroupState(autoSaveId2, panelDataArray, storage2);
|
|
48105
|
+
if (state) {
|
|
48106
|
+
panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
|
|
48107
|
+
unsafeLayout = state.layout;
|
|
48108
|
+
}
|
|
48109
|
+
}
|
|
48110
|
+
if (unsafeLayout == null) {
|
|
48111
|
+
unsafeLayout = calculateUnsafeDefaultLayout({
|
|
48112
|
+
panelDataArray
|
|
48113
|
+
});
|
|
48114
|
+
}
|
|
48115
|
+
const nextLayout = validatePanelGroupLayout({
|
|
48116
|
+
layout: unsafeLayout,
|
|
48117
|
+
panelConstraints: panelDataArray.map((panelData) => panelData.constraints)
|
|
48118
|
+
});
|
|
48119
|
+
if (!areEqual(prevLayout, nextLayout)) {
|
|
48120
|
+
setLayout(nextLayout);
|
|
48121
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
48122
|
+
if (onLayout2) {
|
|
48123
|
+
onLayout2(nextLayout);
|
|
48124
|
+
}
|
|
48125
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
48126
|
+
}
|
|
48127
|
+
}
|
|
48128
|
+
});
|
|
48129
|
+
useIsomorphicLayoutEffect(() => {
|
|
48130
|
+
const eagerValues = eagerValuesRef.current;
|
|
48131
|
+
return () => {
|
|
48132
|
+
eagerValues.layout = [];
|
|
48133
|
+
};
|
|
48134
|
+
}, []);
|
|
48135
|
+
const registerResizeHandle = useCallback((dragHandleId) => {
|
|
48136
|
+
let isRTL = false;
|
|
48137
|
+
const panelGroupElement = panelGroupElementRef.current;
|
|
48138
|
+
if (panelGroupElement) {
|
|
48139
|
+
const style3 = window.getComputedStyle(panelGroupElement, null);
|
|
48140
|
+
if (style3.getPropertyValue("direction") === "rtl") {
|
|
48141
|
+
isRTL = true;
|
|
48142
|
+
}
|
|
48143
|
+
}
|
|
48144
|
+
return function resizeHandler(event) {
|
|
48145
|
+
event.preventDefault();
|
|
48146
|
+
const panelGroupElement2 = panelGroupElementRef.current;
|
|
48147
|
+
if (!panelGroupElement2) {
|
|
48148
|
+
return () => null;
|
|
48149
|
+
}
|
|
48150
|
+
const {
|
|
48151
|
+
direction: direction2,
|
|
48152
|
+
dragState: dragState2,
|
|
48153
|
+
id: groupId2,
|
|
48154
|
+
keyboardResizeBy: keyboardResizeBy2,
|
|
48155
|
+
onLayout: onLayout2
|
|
48156
|
+
} = committedValuesRef.current;
|
|
48157
|
+
const {
|
|
48158
|
+
layout: prevLayout,
|
|
48159
|
+
panelDataArray
|
|
48160
|
+
} = eagerValuesRef.current;
|
|
48161
|
+
const {
|
|
48162
|
+
initialLayout
|
|
48163
|
+
} = dragState2 !== null && dragState2 !== void 0 ? dragState2 : {};
|
|
48164
|
+
const pivotIndices = determinePivotIndices(groupId2, dragHandleId, panelGroupElement2);
|
|
48165
|
+
let delta = calculateDeltaPercentage(event, dragHandleId, direction2, dragState2, keyboardResizeBy2, panelGroupElement2);
|
|
48166
|
+
const isHorizontal = direction2 === "horizontal";
|
|
48167
|
+
if (isHorizontal && isRTL) {
|
|
48168
|
+
delta = -delta;
|
|
48169
|
+
}
|
|
48170
|
+
const panelConstraints = panelDataArray.map((panelData) => panelData.constraints);
|
|
48171
|
+
const nextLayout = adjustLayoutByDelta({
|
|
48172
|
+
delta,
|
|
48173
|
+
initialLayout: initialLayout !== null && initialLayout !== void 0 ? initialLayout : prevLayout,
|
|
48174
|
+
panelConstraints,
|
|
48175
|
+
pivotIndices,
|
|
48176
|
+
prevLayout,
|
|
48177
|
+
trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch"
|
|
48178
|
+
});
|
|
48179
|
+
const layoutChanged = !compareLayouts(prevLayout, nextLayout);
|
|
48180
|
+
if (isPointerEvent(event) || isMouseEvent(event)) {
|
|
48181
|
+
if (prevDeltaRef.current != delta) {
|
|
48182
|
+
prevDeltaRef.current = delta;
|
|
48183
|
+
if (!layoutChanged && delta !== 0) {
|
|
48184
|
+
if (isHorizontal) {
|
|
48185
|
+
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN : EXCEEDED_HORIZONTAL_MAX);
|
|
48186
|
+
} else {
|
|
48187
|
+
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
|
|
48188
|
+
}
|
|
48189
|
+
} else {
|
|
48190
|
+
reportConstraintsViolation(dragHandleId, 0);
|
|
48191
|
+
}
|
|
48192
|
+
}
|
|
48193
|
+
}
|
|
48194
|
+
if (layoutChanged) {
|
|
48195
|
+
setLayout(nextLayout);
|
|
48196
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
48197
|
+
if (onLayout2) {
|
|
48198
|
+
onLayout2(nextLayout);
|
|
48199
|
+
}
|
|
48200
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
48201
|
+
}
|
|
48202
|
+
};
|
|
48203
|
+
}, []);
|
|
48204
|
+
const resizePanel2 = useCallback((panelData, unsafePanelSize) => {
|
|
48205
|
+
const {
|
|
48206
|
+
onLayout: onLayout2
|
|
48207
|
+
} = committedValuesRef.current;
|
|
48208
|
+
const {
|
|
48209
|
+
layout: prevLayout,
|
|
48210
|
+
panelDataArray
|
|
48211
|
+
} = eagerValuesRef.current;
|
|
48212
|
+
const panelConstraintsArray = panelDataArray.map((panelData2) => panelData2.constraints);
|
|
48213
|
+
const {
|
|
48214
|
+
panelSize,
|
|
48215
|
+
pivotIndices
|
|
48216
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
48217
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
48218
|
+
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
48219
|
+
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
48220
|
+
const nextLayout = adjustLayoutByDelta({
|
|
48221
|
+
delta,
|
|
48222
|
+
initialLayout: prevLayout,
|
|
48223
|
+
panelConstraints: panelConstraintsArray,
|
|
48224
|
+
pivotIndices,
|
|
48225
|
+
prevLayout,
|
|
48226
|
+
trigger: "imperative-api"
|
|
48227
|
+
});
|
|
48228
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
48229
|
+
setLayout(nextLayout);
|
|
48230
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
48231
|
+
if (onLayout2) {
|
|
48232
|
+
onLayout2(nextLayout);
|
|
48233
|
+
}
|
|
48234
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
48235
|
+
}
|
|
48236
|
+
}, []);
|
|
48237
|
+
const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
|
|
48238
|
+
const {
|
|
48239
|
+
layout: layout2,
|
|
48240
|
+
panelDataArray
|
|
48241
|
+
} = eagerValuesRef.current;
|
|
48242
|
+
const {
|
|
48243
|
+
collapsedSize: prevCollapsedSize = 0,
|
|
48244
|
+
collapsible: prevCollapsible
|
|
48245
|
+
} = prevConstraints;
|
|
48246
|
+
const {
|
|
48247
|
+
collapsedSize: nextCollapsedSize = 0,
|
|
48248
|
+
collapsible: nextCollapsible,
|
|
48249
|
+
maxSize: nextMaxSize = 100,
|
|
48250
|
+
minSize: nextMinSize = 0
|
|
48251
|
+
} = panelData.constraints;
|
|
48252
|
+
const {
|
|
48253
|
+
panelSize: prevPanelSize
|
|
48254
|
+
} = panelDataHelper(panelDataArray, panelData, layout2);
|
|
48255
|
+
if (prevPanelSize == null) {
|
|
48256
|
+
return;
|
|
48257
|
+
}
|
|
48258
|
+
if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1(prevPanelSize, prevCollapsedSize)) {
|
|
48259
|
+
if (!fuzzyNumbersEqual$1(prevCollapsedSize, nextCollapsedSize)) {
|
|
48260
|
+
resizePanel2(panelData, nextCollapsedSize);
|
|
48261
|
+
}
|
|
48262
|
+
} else if (prevPanelSize < nextMinSize) {
|
|
48263
|
+
resizePanel2(panelData, nextMinSize);
|
|
48264
|
+
} else if (prevPanelSize > nextMaxSize) {
|
|
48265
|
+
resizePanel2(panelData, nextMaxSize);
|
|
48266
|
+
}
|
|
48267
|
+
}, [resizePanel2]);
|
|
48268
|
+
const startDragging = useCallback((dragHandleId, event) => {
|
|
48269
|
+
const {
|
|
48270
|
+
direction: direction2
|
|
48271
|
+
} = committedValuesRef.current;
|
|
48272
|
+
const {
|
|
48273
|
+
layout: layout2
|
|
48274
|
+
} = eagerValuesRef.current;
|
|
48275
|
+
if (!panelGroupElementRef.current) {
|
|
48276
|
+
return;
|
|
48277
|
+
}
|
|
48278
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
48279
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
48280
|
+
const initialCursorPosition = getResizeEventCursorPosition(direction2, event);
|
|
48281
|
+
setDragState({
|
|
48282
|
+
dragHandleId,
|
|
48283
|
+
dragHandleRect: handleElement.getBoundingClientRect(),
|
|
48284
|
+
initialCursorPosition,
|
|
48285
|
+
initialLayout: layout2
|
|
48286
|
+
});
|
|
48287
|
+
}, []);
|
|
48288
|
+
const stopDragging = useCallback(() => {
|
|
48289
|
+
setDragState(null);
|
|
48290
|
+
}, []);
|
|
48291
|
+
const unregisterPanel = useCallback((panelData) => {
|
|
48292
|
+
const {
|
|
48293
|
+
panelDataArray
|
|
48294
|
+
} = eagerValuesRef.current;
|
|
48295
|
+
const index2 = findPanelDataIndex(panelDataArray, panelData);
|
|
48296
|
+
if (index2 >= 0) {
|
|
48297
|
+
panelDataArray.splice(index2, 1);
|
|
48298
|
+
delete panelIdToLastNotifiedSizeMapRef.current[panelData.id];
|
|
48299
|
+
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
48300
|
+
forceUpdate();
|
|
48301
|
+
}
|
|
48302
|
+
}, [forceUpdate]);
|
|
48303
|
+
const context = useMemo(() => ({
|
|
48304
|
+
collapsePanel,
|
|
48305
|
+
direction,
|
|
48306
|
+
dragState,
|
|
48307
|
+
expandPanel,
|
|
48308
|
+
getPanelSize,
|
|
48309
|
+
getPanelStyle,
|
|
48310
|
+
groupId,
|
|
48311
|
+
isPanelCollapsed,
|
|
48312
|
+
isPanelExpanded,
|
|
48313
|
+
reevaluatePanelConstraints,
|
|
48314
|
+
registerPanel,
|
|
48315
|
+
registerResizeHandle,
|
|
48316
|
+
resizePanel: resizePanel2,
|
|
48317
|
+
startDragging,
|
|
48318
|
+
stopDragging,
|
|
48319
|
+
unregisterPanel,
|
|
48320
|
+
panelGroupElement: panelGroupElementRef.current
|
|
48321
|
+
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, reevaluatePanelConstraints, registerPanel, registerResizeHandle, resizePanel2, startDragging, stopDragging, unregisterPanel]);
|
|
48322
|
+
const style2 = {
|
|
48323
|
+
display: "flex",
|
|
48324
|
+
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
48325
|
+
height: "100%",
|
|
48326
|
+
overflow: "hidden",
|
|
48327
|
+
width: "100%"
|
|
48328
|
+
};
|
|
48329
|
+
return createElement(PanelGroupContext.Provider, {
|
|
48330
|
+
value: context
|
|
48331
|
+
}, createElement(Type, {
|
|
48332
|
+
...rest,
|
|
48333
|
+
children: children2,
|
|
48334
|
+
className: classNameFromProps,
|
|
48335
|
+
id: idFromProps,
|
|
48336
|
+
ref: panelGroupElementRef,
|
|
48337
|
+
style: {
|
|
48338
|
+
...style2,
|
|
48339
|
+
...styleFromProps
|
|
48340
|
+
},
|
|
48341
|
+
// CSS selectors
|
|
48342
|
+
[DATA_ATTRIBUTES.group]: "",
|
|
48343
|
+
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
48344
|
+
[DATA_ATTRIBUTES.groupId]: groupId
|
|
48345
|
+
}));
|
|
48346
|
+
}
|
|
48347
|
+
const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwardedRef, {
|
|
48348
|
+
...props,
|
|
48349
|
+
forwardedRef: ref
|
|
48350
|
+
}));
|
|
48351
|
+
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
48352
|
+
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
48353
|
+
function findPanelDataIndex(panelDataArray, panelData) {
|
|
48354
|
+
return panelDataArray.findIndex((prevPanelData) => prevPanelData === panelData || prevPanelData.id === panelData.id);
|
|
48355
|
+
}
|
|
48356
|
+
function panelDataHelper(panelDataArray, panelData, layout) {
|
|
48357
|
+
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
48358
|
+
const isLastPanel = panelIndex === panelDataArray.length - 1;
|
|
48359
|
+
const pivotIndices = isLastPanel ? [panelIndex - 1, panelIndex] : [panelIndex, panelIndex + 1];
|
|
48360
|
+
const panelSize = layout[panelIndex];
|
|
48361
|
+
return {
|
|
48362
|
+
...panelData.constraints,
|
|
48363
|
+
panelSize,
|
|
48364
|
+
pivotIndices
|
|
48365
|
+
};
|
|
48366
|
+
}
|
|
48367
|
+
function C(e) {
|
|
48368
|
+
return { "--panel-background": e.colors.background, "--panel-border": e.colors.border, "--panel-handle": e.colors.backgroundSecondary, "--panel-handle-hover": e.colors.backgroundHover, "--panel-handle-active": e.colors.primary, "--panel-button-bg": e.colors.surface, "--panel-button-hover": e.colors.backgroundHover, "--panel-button-border": e.colors.border, "--panel-button-icon": e.colors.textSecondary, "--panel-accent-bg": e.colors.primary + "15" };
|
|
48369
|
+
}
|
|
48370
|
+
const z = forwardRef(({ panels: o, className: a = "", style: s2, theme: d, minPanelWidth: u = 350, idealPanelWidth: p2 = 0.333, showSeparator: h2 = false, onPanelChange: m, preventKeyboardScroll: f = true, disableSwipe: g = false }, v) => {
|
|
48371
|
+
const b = useRef(null), y = C(d);
|
|
48372
|
+
useImperativeHandle(v, () => ({ scrollToPanel: (e) => {
|
|
48373
|
+
if (!b.current) return;
|
|
48374
|
+
const t = b.current, n = t.children[e];
|
|
48375
|
+
if (n) {
|
|
48376
|
+
const e2 = n.offsetLeft;
|
|
48377
|
+
t.scrollTo({ left: e2, behavior: "smooth" });
|
|
48378
|
+
}
|
|
48379
|
+
}, getCurrentPanel: () => {
|
|
48380
|
+
if (!b.current || 0 === b.current.children.length) return 0;
|
|
48381
|
+
const e = b.current, t = e.getBoundingClientRect().left;
|
|
48382
|
+
let n = 0, r2 = 1 / 0;
|
|
48383
|
+
for (let o2 = 0; o2 < e.children.length; o2++) {
|
|
48384
|
+
const i = e.children[o2].getBoundingClientRect(), a2 = Math.abs(i.left - t);
|
|
48385
|
+
a2 < r2 && (r2 = a2, n = o2);
|
|
48386
|
+
}
|
|
48387
|
+
return n;
|
|
48388
|
+
} }));
|
|
48389
|
+
useEffect(() => {
|
|
48390
|
+
if (!f || !b.current) return;
|
|
48391
|
+
const e = b.current, t = (e2) => {
|
|
48392
|
+
const t2 = e2.target;
|
|
48393
|
+
if ("INPUT" === t2.tagName || "TEXTAREA" === t2.tagName || "SELECT" === t2.tagName || t2.isContentEditable || null !== t2.closest(".xterm") || null !== t2.closest('[contenteditable="true"]')) return;
|
|
48394
|
+
[" ", "Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "PageUp", "PageDown"].includes(e2.key) && e2.preventDefault();
|
|
48395
|
+
};
|
|
48396
|
+
return e.addEventListener("keydown", t), () => {
|
|
48397
|
+
e.removeEventListener("keydown", t);
|
|
48398
|
+
};
|
|
48399
|
+
}, [f]);
|
|
48400
|
+
const w = o.length, x = 2 * u;
|
|
48401
|
+
let S2;
|
|
48402
|
+
S2 = 1 === w || 2 === w ? "100%" : `max(${u}px, ${100 * p2}%)`;
|
|
48403
|
+
const R = React2__default.useId().replace(/:/g, "_");
|
|
48404
|
+
return jsxs(Fragment, { children: [
|
|
48405
|
+
2 === w && /* @__PURE__ */ jsx("style", { children: `
|
|
48406
|
+
.snap-carousel-container[data-carousel-id="${R}"][data-panel-count="2"] .snap-carousel-panel {
|
|
48407
|
+
width: 100%;
|
|
48408
|
+
}
|
|
48409
|
+
@container (min-width: ${x}px) {
|
|
48410
|
+
.snap-carousel-container[data-carousel-id="${R}"][data-panel-count="2"] .snap-carousel-panel {
|
|
48411
|
+
width: 50%;
|
|
48412
|
+
}
|
|
48413
|
+
}
|
|
48414
|
+
` }),
|
|
48415
|
+
/* @__PURE__ */ jsx("div", { ref: b, className: `snap-carousel-container ${g ? "swipe-disabled" : ""} ${a}`, style: { ...y, ...s2, "--snap-carousel-min-width": `${u}px`, "--snap-carousel-ideal-width": 100 * p2 + "%", "--snap-carousel-gap": h2 ? "1px" : "0px", "--snap-carousel-panel-width": S2, "--snap-carousel-panel-count": w, "--snap-carousel-two-panel-threshold": `${x}px` }, onScroll: (e) => {
|
|
48416
|
+
if (!m || !b.current || 0 === b.current.children.length) return;
|
|
48417
|
+
const t = b.current, n = t.getBoundingClientRect().left;
|
|
48418
|
+
let r2 = 0, o2 = 1 / 0;
|
|
48419
|
+
for (let i = 0; i < t.children.length; i++) {
|
|
48420
|
+
const e2 = t.children[i].getBoundingClientRect(), a2 = Math.abs(e2.left - n);
|
|
48421
|
+
a2 < o2 && (o2 = a2, r2 = i);
|
|
48422
|
+
}
|
|
48423
|
+
m(r2);
|
|
48424
|
+
}, "data-panel-count": w, "data-carousel-id": R, children: o.map((t, n) => /* @__PURE__ */ jsx("div", { className: "snap-carousel-panel", children: t }, n)) })
|
|
48425
|
+
] });
|
|
48426
|
+
});
|
|
48427
|
+
z.displayName = "SnapCarousel";
|
|
48428
|
+
var le$1, se;
|
|
48429
|
+
(se = le$1 || (le$1 = {})).DragStart = "dragStart", se.DragMove = "dragMove", se.DragEnd = "dragEnd", se.DragCancel = "dragCancel", se.DragOver = "dragOver", se.RegisterDroppable = "registerDroppable", se.SetDroppableDisabled = "setDroppableDisabled", se.UnregisterDroppable = "unregisterDroppable";
|
|
48430
|
+
const de = /* @__PURE__ */ Object.freeze({ x: 0, y: 0 });
|
|
48431
|
+
var Te, Ae;
|
|
48432
|
+
(Ae = Te || (Te = {}))[Ae.Forward = 1] = "Forward", Ae[Ae.Backward = -1] = "Backward";
|
|
48433
|
+
var _e$1, je, He, Ke;
|
|
48434
|
+
(je = _e$1 || (_e$1 = {})).Click = "click", je.DragStart = "dragstart", je.Keydown = "keydown", je.ContextMenu = "contextmenu", je.Resize = "resize", je.SelectionChange = "selectionchange", je.VisibilityChange = "visibilitychange", (Ke = He || (He = {})).Space = "Space", Ke.Down = "ArrowDown", Ke.Right = "ArrowRight", Ke.Left = "ArrowLeft", Ke.Up = "ArrowUp", Ke.Esc = "Escape", Ke.Enter = "Enter", Ke.Tab = "Tab";
|
|
48435
|
+
({ start: [He.Space, He.Enter], cancel: [He.Esc], end: [He.Space, He.Enter, He.Tab] });
|
|
48436
|
+
var rt, ot;
|
|
48437
|
+
(ot = rt || (rt = {}))[ot.RightClick = 2] = "RightClick";
|
|
48438
|
+
var at, lt, st, ct;
|
|
48439
|
+
(lt = at || (at = {}))[lt.Pointer = 0] = "Pointer", lt[lt.DraggableRect = 1] = "DraggableRect", (ct = st || (st = {}))[ct.TreeOrder = 0] = "TreeOrder", ct[ct.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
48440
|
+
({ x: { [Te.Backward]: false, [Te.Forward]: false }, y: { [Te.Backward]: false, [Te.Forward]: false } });
|
|
48441
|
+
var pt, ht, mt;
|
|
48442
|
+
(ht = pt || (pt = {}))[ht.Always = 0] = "Always", ht[ht.BeforeDragging = 1] = "BeforeDragging", ht[ht.WhileDragging = 2] = "WhileDragging", (mt || (mt = {})).Optimized = "optimized";
|
|
48443
|
+
({ droppable: { strategy: pt.WhileDragging, frequency: mt.Optimized } });
|
|
48444
|
+
/* @__PURE__ */ createContext({ ...de, scaleX: 1, scaleY: 1 });
|
|
48445
|
+
var $t, Bt;
|
|
48446
|
+
(Bt = $t || ($t = {}))[Bt.Uninitialized = 0] = "Uninitialized", Bt[Bt.Initializing = 1] = "Initializing", Bt[Bt.Initialized = 2] = "Initialized";
|
|
48447
|
+
var Ut;
|
|
48448
|
+
(() => {
|
|
48449
|
+
if ("undefined" != typeof window) {
|
|
48450
|
+
const e = window;
|
|
48451
|
+
return e.__principlemd_theme_context__ || (e.__principlemd_theme_context__ = createContext(void 0)), e.__principlemd_theme_context__;
|
|
48452
|
+
}
|
|
48453
|
+
return Ut || (Ut = createContext(void 0)), Ut;
|
|
48454
|
+
})();
|
|
48455
|
+
var _e = Object.defineProperty;
|
|
48456
|
+
var Ee = (o, e, t) => e in o ? _e(o, e, { enumerable: true, configurable: true, writable: true, value: t }) : o[e] = t;
|
|
48457
|
+
var le = (o, e, t) => Ee(o, typeof e != "symbol" ? e + "" : e, t);
|
|
48458
|
+
class De {
|
|
48459
|
+
constructor() {
|
|
48460
|
+
le(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
|
|
48461
|
+
le(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
|
|
48462
|
+
}
|
|
48463
|
+
/**
|
|
48464
|
+
* Load all user-created workspace presets
|
|
48465
|
+
*/
|
|
48466
|
+
async loadWorkspacePresets() {
|
|
48467
|
+
try {
|
|
48468
|
+
const e = localStorage.getItem(this.PRESETS_KEY);
|
|
48469
|
+
return e ? JSON.parse(e) : {};
|
|
48470
|
+
} catch (e) {
|
|
48471
|
+
return console.error("Failed to load workspace presets:", e), {};
|
|
48472
|
+
}
|
|
48473
|
+
}
|
|
48474
|
+
/**
|
|
48475
|
+
* Save workspace presets
|
|
48476
|
+
*/
|
|
48477
|
+
async saveWorkspacePresets(e) {
|
|
48478
|
+
try {
|
|
48479
|
+
localStorage.setItem(this.PRESETS_KEY, JSON.stringify(e));
|
|
48480
|
+
} catch (t) {
|
|
48481
|
+
throw console.error("Failed to save workspace presets:", t), t;
|
|
48482
|
+
}
|
|
48483
|
+
}
|
|
48484
|
+
/**
|
|
48485
|
+
* Load repository-specific workspace state
|
|
48486
|
+
*/
|
|
48487
|
+
async loadRepositoryState(e) {
|
|
48488
|
+
try {
|
|
48489
|
+
const t = `${this.REPO_STATE_PREFIX}${e}`, r2 = localStorage.getItem(t);
|
|
48490
|
+
return r2 ? JSON.parse(r2) : null;
|
|
48491
|
+
} catch (t) {
|
|
48492
|
+
return console.error(
|
|
48493
|
+
`Failed to load repository state for ${e}:`,
|
|
48494
|
+
t
|
|
48495
|
+
), null;
|
|
48496
|
+
}
|
|
48497
|
+
}
|
|
48498
|
+
/**
|
|
48499
|
+
* Save repository-specific workspace state
|
|
48500
|
+
*/
|
|
48501
|
+
async saveRepositoryState(e, t) {
|
|
48502
|
+
try {
|
|
48503
|
+
const r2 = `${this.REPO_STATE_PREFIX}${e}`;
|
|
48504
|
+
localStorage.setItem(r2, JSON.stringify(t));
|
|
48505
|
+
} catch (r2) {
|
|
48506
|
+
throw console.error(
|
|
48507
|
+
`Failed to save repository state for ${e}:`,
|
|
48508
|
+
r2
|
|
48509
|
+
), r2;
|
|
48510
|
+
}
|
|
48511
|
+
}
|
|
48512
|
+
/**
|
|
48513
|
+
* Load all repository states
|
|
48514
|
+
*/
|
|
48515
|
+
async loadAllRepositoryStates() {
|
|
48516
|
+
try {
|
|
48517
|
+
const e = {};
|
|
48518
|
+
for (let t = 0; t < localStorage.length; t++) {
|
|
48519
|
+
const r2 = localStorage.key(t);
|
|
48520
|
+
if (r2 && r2.startsWith(this.REPO_STATE_PREFIX)) {
|
|
48521
|
+
const s2 = r2.substring(this.REPO_STATE_PREFIX.length), i = localStorage.getItem(r2);
|
|
48522
|
+
if (i)
|
|
48523
|
+
try {
|
|
48524
|
+
e[s2] = JSON.parse(i);
|
|
48525
|
+
} catch (l) {
|
|
48526
|
+
console.error(
|
|
48527
|
+
`Failed to parse repository state for ${s2}:`,
|
|
48528
|
+
l
|
|
48529
|
+
);
|
|
48530
|
+
}
|
|
48531
|
+
}
|
|
48532
|
+
}
|
|
48533
|
+
return e;
|
|
48534
|
+
} catch (e) {
|
|
48535
|
+
return console.error("Failed to load all repository states:", e), {};
|
|
48536
|
+
}
|
|
48537
|
+
}
|
|
48538
|
+
}
|
|
48539
|
+
class O {
|
|
48540
|
+
/**
|
|
48541
|
+
* Configure a custom storage adapter (for Electron IPC or remote storage)
|
|
48542
|
+
*/
|
|
48543
|
+
static setAdapter(e) {
|
|
48544
|
+
this.adapter = e;
|
|
48545
|
+
}
|
|
48546
|
+
/**
|
|
48547
|
+
* Get all workspace layouts (including built-in)
|
|
48548
|
+
*/
|
|
48549
|
+
static async getWorkspaceLayouts() {
|
|
48550
|
+
const e = this.getBuiltInWorkspaceLayouts();
|
|
48551
|
+
return {
|
|
48552
|
+
...await this.adapter.loadWorkspacePresets(),
|
|
48553
|
+
...e
|
|
48554
|
+
};
|
|
48555
|
+
}
|
|
48556
|
+
/**
|
|
48557
|
+
* Get a specific workspace layout by ID
|
|
48558
|
+
*/
|
|
48559
|
+
static async getWorkspaceLayout(e) {
|
|
48560
|
+
return (await this.getWorkspaceLayouts())[e] || null;
|
|
48561
|
+
}
|
|
48562
|
+
/**
|
|
48563
|
+
* Create a new workspace layout
|
|
48564
|
+
*/
|
|
48565
|
+
static async createWorkspaceLayout(e) {
|
|
48566
|
+
const t = await this.adapter.loadWorkspacePresets(), r2 = this.generateWorkspaceId(e.name), s2 = {
|
|
48567
|
+
id: r2,
|
|
48568
|
+
name: e.name,
|
|
48569
|
+
description: e.description,
|
|
48570
|
+
layout: e.layout,
|
|
48571
|
+
defaultSizes: e.defaultSizes,
|
|
48572
|
+
defaultCollapsed: e.defaultCollapsed,
|
|
48573
|
+
createdAt: Date.now(),
|
|
48574
|
+
updatedAt: Date.now(),
|
|
48575
|
+
isBuiltIn: false
|
|
48576
|
+
}, i = {
|
|
48577
|
+
...t,
|
|
48578
|
+
[r2]: s2
|
|
48579
|
+
};
|
|
48580
|
+
return await this.adapter.saveWorkspacePresets(i), s2;
|
|
48581
|
+
}
|
|
48582
|
+
/**
|
|
48583
|
+
* Update an existing workspace layout
|
|
48584
|
+
*/
|
|
48585
|
+
static async updateWorkspaceLayout(e, t) {
|
|
48586
|
+
const r2 = await this.adapter.loadWorkspacePresets(), s2 = r2[e];
|
|
48587
|
+
if (!s2)
|
|
48588
|
+
return console.error(`Workspace layout ${e} not found`), null;
|
|
48589
|
+
if (s2.isBuiltIn)
|
|
48590
|
+
return console.error(`Cannot update built-in workspace layout ${e}`), null;
|
|
48591
|
+
const i = {
|
|
48592
|
+
...s2,
|
|
48593
|
+
...t,
|
|
48594
|
+
id: e,
|
|
48595
|
+
// Preserve ID
|
|
48596
|
+
createdAt: s2.createdAt,
|
|
48597
|
+
// Preserve creation time
|
|
48598
|
+
updatedAt: Date.now()
|
|
48599
|
+
}, l = {
|
|
48600
|
+
...r2,
|
|
48601
|
+
[e]: i
|
|
48602
|
+
};
|
|
48603
|
+
return await this.adapter.saveWorkspacePresets(l), i;
|
|
48604
|
+
}
|
|
48605
|
+
/**
|
|
48606
|
+
* Delete a workspace layout
|
|
48607
|
+
*/
|
|
48608
|
+
static async deleteWorkspaceLayout(e) {
|
|
48609
|
+
const t = await this.adapter.loadWorkspacePresets(), r2 = t[e];
|
|
48610
|
+
if (!r2)
|
|
48611
|
+
return console.error(`Workspace layout ${e} not found`), false;
|
|
48612
|
+
if (r2.isBuiltIn)
|
|
48613
|
+
return console.error(`Cannot delete built-in workspace layout ${e}`), false;
|
|
48614
|
+
const s2 = { ...t };
|
|
48615
|
+
return delete s2[e], await this.adapter.saveWorkspacePresets(s2), true;
|
|
48616
|
+
}
|
|
48617
|
+
/**
|
|
48618
|
+
* Get repository state (which workspace + current sizes/collapsed)
|
|
48619
|
+
*/
|
|
48620
|
+
static async getRepositoryState(e) {
|
|
48621
|
+
return await this.adapter.loadRepositoryState(e);
|
|
48622
|
+
}
|
|
48623
|
+
/**
|
|
48624
|
+
* Set repository state (which workspace + current sizes/collapsed/layout)
|
|
48625
|
+
*/
|
|
48626
|
+
static async setRepositoryState(e, t) {
|
|
48627
|
+
await this.adapter.saveRepositoryState(e, t);
|
|
48628
|
+
}
|
|
48629
|
+
/**
|
|
48630
|
+
* Update only sizes in repository state
|
|
48631
|
+
*/
|
|
48632
|
+
static async updateRepositorySizes(e, t) {
|
|
48633
|
+
const r2 = await this.getRepositoryState(e);
|
|
48634
|
+
r2 && await this.setRepositoryState(e, {
|
|
48635
|
+
...r2,
|
|
48636
|
+
sizes: t
|
|
48637
|
+
});
|
|
48638
|
+
}
|
|
48639
|
+
/**
|
|
48640
|
+
* Update only collapsed state in repository state
|
|
48641
|
+
*/
|
|
48642
|
+
static async updateRepositoryCollapsed(e, t) {
|
|
48643
|
+
const r2 = await this.getRepositoryState(e);
|
|
48644
|
+
r2 && await this.setRepositoryState(e, {
|
|
48645
|
+
...r2,
|
|
48646
|
+
collapsed: t
|
|
48647
|
+
});
|
|
48648
|
+
}
|
|
48649
|
+
/**
|
|
48650
|
+
* Check if repository state differs from workspace defaults
|
|
48651
|
+
*/
|
|
48652
|
+
static hasStateDeviation(e, t) {
|
|
48653
|
+
const r2 = t.defaultSizes ? JSON.stringify(e.sizes) !== JSON.stringify(t.defaultSizes) : false, s2 = t.defaultCollapsed ? JSON.stringify(e.collapsed) !== JSON.stringify(t.defaultCollapsed) : false;
|
|
48654
|
+
return { hasSizeDeviation: r2, hasCollapsedDeviation: s2 };
|
|
48655
|
+
}
|
|
48656
|
+
/**
|
|
48657
|
+
* Update workspace defaults from repository state
|
|
48658
|
+
*/
|
|
48659
|
+
static async updateWorkspaceFromRepositoryState(e, t) {
|
|
48660
|
+
const r2 = await this.getWorkspaceLayout(e), s2 = await this.getRepositoryState(t);
|
|
48661
|
+
if (!r2 || !s2 || r2.isBuiltIn) {
|
|
48662
|
+
console.error(
|
|
48663
|
+
"Cannot update built-in workspace or workspace/state not found"
|
|
48664
|
+
);
|
|
48665
|
+
return;
|
|
48666
|
+
}
|
|
48667
|
+
await this.updateWorkspaceLayout(e, {
|
|
48668
|
+
defaultSizes: s2.sizes,
|
|
48669
|
+
defaultCollapsed: s2.collapsed
|
|
48670
|
+
});
|
|
48671
|
+
}
|
|
48672
|
+
/**
|
|
48673
|
+
* Reset repository state to workspace defaults
|
|
48674
|
+
*/
|
|
48675
|
+
static async resetRepositoryToWorkspaceDefaults(e, t) {
|
|
48676
|
+
const r2 = await this.getWorkspaceLayout(t);
|
|
48677
|
+
if (!r2) {
|
|
48678
|
+
console.error(`Workspace ${t} not found`);
|
|
48679
|
+
return;
|
|
48680
|
+
}
|
|
48681
|
+
const s2 = await this.getRepositoryState(e);
|
|
48682
|
+
s2 && await this.setRepositoryState(e, {
|
|
48683
|
+
...s2,
|
|
48684
|
+
sizes: r2.defaultSizes || { left: 20, middle: 45, right: 35 },
|
|
48685
|
+
collapsed: r2.defaultCollapsed || { left: false, right: false }
|
|
48686
|
+
});
|
|
48687
|
+
}
|
|
48688
|
+
/**
|
|
48689
|
+
* Check if a layout matches a workspace layout
|
|
48690
|
+
*/
|
|
48691
|
+
static isLayoutMatchingWorkspace(e, t) {
|
|
48692
|
+
return this.areLayoutsEqual(e, t.layout);
|
|
48693
|
+
}
|
|
48694
|
+
/**
|
|
48695
|
+
* Find workspace ID that matches the given layout
|
|
48696
|
+
*/
|
|
48697
|
+
static async findMatchingWorkspace(e) {
|
|
48698
|
+
const t = await this.getWorkspaceLayouts();
|
|
48699
|
+
for (const [r2, s2] of Object.entries(t))
|
|
48700
|
+
if (this.isLayoutMatchingWorkspace(e, s2))
|
|
48701
|
+
return r2;
|
|
48702
|
+
return null;
|
|
48703
|
+
}
|
|
48704
|
+
/**
|
|
48705
|
+
* Deep comparison of two panel layouts
|
|
48706
|
+
*/
|
|
48707
|
+
static areLayoutsEqual(e, t) {
|
|
48708
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
48709
|
+
}
|
|
48710
|
+
/**
|
|
48711
|
+
* Generate a unique ID from a workspace name
|
|
48712
|
+
*/
|
|
48713
|
+
static generateWorkspaceId(e) {
|
|
48714
|
+
return `${e.toLowerCase().replace(/[^a-z0-9]+/g, "-")}-${Date.now()}`;
|
|
48715
|
+
}
|
|
48716
|
+
/**
|
|
48717
|
+
* Get built-in workspace layouts
|
|
48718
|
+
*/
|
|
48719
|
+
static getBuiltInWorkspaceLayouts() {
|
|
48720
|
+
const e = Date.now();
|
|
48721
|
+
return {
|
|
48722
|
+
"project-management": {
|
|
48723
|
+
id: "project-management",
|
|
48724
|
+
name: "Project Management",
|
|
48725
|
+
description: "Tasks, dependencies, issues, file tree, docs, drawings, multi terminal, city visualization, code viewer, markdown slides, and excalidraw",
|
|
48726
|
+
layout: {
|
|
48727
|
+
left: {
|
|
48728
|
+
type: "tabs",
|
|
48729
|
+
panels: [
|
|
48730
|
+
"tasks",
|
|
48731
|
+
"dependencies",
|
|
48732
|
+
"gitIssues",
|
|
48733
|
+
"fileTree",
|
|
48734
|
+
"docs",
|
|
48735
|
+
"drawings"
|
|
48736
|
+
],
|
|
48737
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48738
|
+
},
|
|
48739
|
+
middle: "multiTerminal",
|
|
48740
|
+
right: {
|
|
48741
|
+
type: "tabs",
|
|
48742
|
+
panels: [
|
|
48743
|
+
"cityVisualization",
|
|
48744
|
+
"codeViewer",
|
|
48745
|
+
"markdownViewer",
|
|
48746
|
+
"excalidrawDiagram"
|
|
48747
|
+
],
|
|
48748
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48749
|
+
}
|
|
48750
|
+
},
|
|
48751
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
48752
|
+
defaultCollapsed: { left: false, right: false },
|
|
48753
|
+
createdAt: e,
|
|
48754
|
+
updatedAt: e,
|
|
48755
|
+
isBuiltIn: true
|
|
48756
|
+
},
|
|
48757
|
+
"code-review": {
|
|
48758
|
+
id: "code-review",
|
|
48759
|
+
name: "Code Review",
|
|
48760
|
+
description: "Git changes, pull requests, and file tree on left, git diff and code viewer in middle, city map on right",
|
|
48761
|
+
layout: {
|
|
48762
|
+
left: {
|
|
48763
|
+
type: "tabs",
|
|
48764
|
+
panels: ["gitChanges", "gitPullRequests", "fileTree"],
|
|
48765
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48766
|
+
},
|
|
48767
|
+
middle: {
|
|
48768
|
+
type: "tabs",
|
|
48769
|
+
panels: ["gitDiff", "codeViewer"],
|
|
48770
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48771
|
+
},
|
|
48772
|
+
right: "cityVisualization"
|
|
48773
|
+
},
|
|
48774
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
48775
|
+
defaultCollapsed: { left: false, right: false },
|
|
48776
|
+
createdAt: e,
|
|
48777
|
+
updatedAt: e,
|
|
48778
|
+
isBuiltIn: true
|
|
48779
|
+
},
|
|
48780
|
+
documentation: {
|
|
48781
|
+
id: "documentation",
|
|
48782
|
+
name: "Documentation",
|
|
48783
|
+
description: "Docs, markdown viewer, and code viewer",
|
|
48784
|
+
layout: {
|
|
48785
|
+
left: "docs",
|
|
48786
|
+
middle: "markdownViewer",
|
|
48787
|
+
right: "codeViewer"
|
|
48788
|
+
},
|
|
48789
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
48790
|
+
defaultCollapsed: { left: false, right: true },
|
|
48791
|
+
createdAt: e,
|
|
48792
|
+
updatedAt: e,
|
|
48793
|
+
isBuiltIn: true
|
|
48794
|
+
},
|
|
48795
|
+
"agent-work": {
|
|
48796
|
+
id: "agent-work",
|
|
48797
|
+
name: "Agent Work",
|
|
48798
|
+
description: "Tasks, agent sessions, file tree, agent context, git changes, docs, multi terminal, city map, agent events, code viewer, and markdown slides",
|
|
48799
|
+
layout: {
|
|
48800
|
+
left: {
|
|
48801
|
+
type: "tabs",
|
|
48802
|
+
panels: [
|
|
48803
|
+
"tasks",
|
|
48804
|
+
"agentSessions",
|
|
48805
|
+
"fileTree",
|
|
48806
|
+
"agentContext",
|
|
48807
|
+
"gitChanges",
|
|
48808
|
+
"docs"
|
|
48809
|
+
],
|
|
48810
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48811
|
+
},
|
|
48812
|
+
middle: "multiTerminal",
|
|
48813
|
+
right: {
|
|
48814
|
+
type: "tabs",
|
|
48815
|
+
panels: [
|
|
48816
|
+
"cityVisualization",
|
|
48817
|
+
"agentEvents",
|
|
48818
|
+
"codeViewer",
|
|
48819
|
+
"markdownViewer"
|
|
48820
|
+
],
|
|
48821
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48822
|
+
}
|
|
48823
|
+
},
|
|
48824
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
48825
|
+
defaultCollapsed: { left: false, right: false },
|
|
48826
|
+
createdAt: e,
|
|
48827
|
+
updatedAt: e,
|
|
48828
|
+
isBuiltIn: true
|
|
48829
|
+
},
|
|
48830
|
+
"quality-check": {
|
|
48831
|
+
id: "quality-check",
|
|
48832
|
+
name: "Quality Check",
|
|
48833
|
+
description: "Package information, tools, and dependencies on left; city visualization map in middle; multi terminal and code viewer on right (collapsed)",
|
|
48834
|
+
layout: {
|
|
48835
|
+
left: {
|
|
48836
|
+
type: "tabs",
|
|
48837
|
+
panels: ["packageInfo", "tools", "dependencies"],
|
|
48838
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48839
|
+
},
|
|
48840
|
+
middle: "cityVisualization",
|
|
48841
|
+
right: {
|
|
48842
|
+
type: "tabs",
|
|
48843
|
+
panels: ["multiTerminal", "codeViewer"],
|
|
48844
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48845
|
+
}
|
|
48846
|
+
},
|
|
48847
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
48848
|
+
defaultCollapsed: { left: false, right: true },
|
|
48849
|
+
createdAt: e,
|
|
48850
|
+
updatedAt: e,
|
|
48851
|
+
isBuiltIn: true
|
|
48852
|
+
},
|
|
48853
|
+
drawing: {
|
|
48854
|
+
id: "drawing",
|
|
48855
|
+
name: "Drawing",
|
|
48856
|
+
description: "Drawings and docs, excalidraw diagram, multi terminal and markdown viewer",
|
|
48857
|
+
layout: {
|
|
48858
|
+
left: {
|
|
48859
|
+
type: "tabs",
|
|
48860
|
+
panels: ["drawings", "docs"],
|
|
48861
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48862
|
+
},
|
|
48863
|
+
middle: "excalidrawDiagram",
|
|
48864
|
+
right: {
|
|
48865
|
+
type: "tabs",
|
|
48866
|
+
panels: ["multiTerminal", "markdownViewer"],
|
|
48867
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48868
|
+
}
|
|
48869
|
+
},
|
|
48870
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
48871
|
+
defaultCollapsed: { left: false, right: true },
|
|
48872
|
+
createdAt: e,
|
|
48873
|
+
updatedAt: e,
|
|
48874
|
+
isBuiltIn: true
|
|
48875
|
+
},
|
|
48876
|
+
"old-school": {
|
|
48877
|
+
id: "old-school",
|
|
48878
|
+
name: "Old School",
|
|
48879
|
+
description: "File tree, search, git changes, and docs on left; code viewer and markdown viewer in middle; multi terminal and city map on right (collapsed)",
|
|
48880
|
+
layout: {
|
|
48881
|
+
left: {
|
|
48882
|
+
type: "tabs",
|
|
48883
|
+
panels: ["fileTree", "search", "gitChanges", "docs"],
|
|
48884
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48885
|
+
},
|
|
48886
|
+
middle: {
|
|
48887
|
+
type: "tabs",
|
|
48888
|
+
panels: ["codeViewer", "markdownViewer"],
|
|
48889
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48890
|
+
},
|
|
48891
|
+
right: {
|
|
48892
|
+
type: "tabs",
|
|
48893
|
+
panels: ["multiTerminal", "cityVisualization"],
|
|
48894
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
48895
|
+
}
|
|
48896
|
+
},
|
|
48897
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
48898
|
+
defaultCollapsed: { left: false, right: true },
|
|
48899
|
+
createdAt: e,
|
|
48900
|
+
updatedAt: e,
|
|
48901
|
+
isBuiltIn: true
|
|
48902
|
+
},
|
|
48903
|
+
"principal-office": {
|
|
48904
|
+
id: "principal-office",
|
|
48905
|
+
name: "Principal Office",
|
|
48906
|
+
description: "Alexandria docs on left, MDX editor in middle, multi terminal on right",
|
|
48907
|
+
layout: {
|
|
48908
|
+
left: "docs",
|
|
48909
|
+
middle: "mdxEditor",
|
|
48910
|
+
right: "multiTerminal"
|
|
48911
|
+
},
|
|
48912
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
48913
|
+
defaultCollapsed: { left: false, right: false },
|
|
48914
|
+
createdAt: e,
|
|
48915
|
+
updatedAt: e,
|
|
48916
|
+
isBuiltIn: true
|
|
48917
|
+
}
|
|
48918
|
+
};
|
|
48919
|
+
}
|
|
48920
|
+
/**
|
|
48921
|
+
* Initialize workspace layouts with built-in defaults if none exist
|
|
48922
|
+
*/
|
|
48923
|
+
static async initializeWorkspaceLayouts() {
|
|
48924
|
+
const e = await this.adapter.loadWorkspacePresets();
|
|
48925
|
+
Object.keys(e).length;
|
|
48926
|
+
}
|
|
48927
|
+
}
|
|
48928
|
+
le(O, "adapter", new De());
|
|
48929
|
+
function gt(o, e, t, r2) {
|
|
48930
|
+
useEffect(() => {
|
|
48931
|
+
const s2 = e.on(
|
|
48932
|
+
"panel:focus",
|
|
48933
|
+
(l) => {
|
|
48934
|
+
l.payload.panelId === o && t();
|
|
48935
|
+
}
|
|
48936
|
+
);
|
|
48937
|
+
return () => {
|
|
48938
|
+
s2();
|
|
48939
|
+
};
|
|
48940
|
+
}, [o, e, t, r2]);
|
|
48941
|
+
}
|
|
48942
|
+
const formatDate = (dateString) => {
|
|
48943
|
+
const date = new Date(dateString);
|
|
48944
|
+
const now = /* @__PURE__ */ new Date();
|
|
48945
|
+
const diffMs = now.getTime() - date.getTime();
|
|
48946
|
+
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
48947
|
+
if (diffDays === 0) {
|
|
48948
|
+
const diffHours = Math.floor(diffMs / (1e3 * 60 * 60));
|
|
48949
|
+
if (diffHours === 0) {
|
|
48950
|
+
const diffMins = Math.floor(diffMs / (1e3 * 60));
|
|
48951
|
+
if (diffMins < 1) return "just now";
|
|
48952
|
+
return `${diffMins}m ago`;
|
|
48953
|
+
}
|
|
48954
|
+
return `${diffHours}h ago`;
|
|
48955
|
+
}
|
|
48956
|
+
if (diffDays === 1) return "yesterday";
|
|
48957
|
+
if (diffDays < 7) return `${diffDays}d ago`;
|
|
48958
|
+
const weeks = Math.floor(diffDays / 7);
|
|
48959
|
+
if (diffDays < 30) return `${weeks}w ago`;
|
|
48960
|
+
const months = Math.floor(diffDays / 30);
|
|
48961
|
+
if (diffDays < 365) return `${months}mo ago`;
|
|
48962
|
+
const years = Math.floor(diffDays / 365);
|
|
48963
|
+
return `${years}y ago`;
|
|
48964
|
+
};
|
|
48965
|
+
const formatSha = (sha) => sha.substring(0, 7);
|
|
48966
|
+
const Avatar = ({ user, size = 32 }) => {
|
|
48967
|
+
const { theme: theme2 } = useTheme();
|
|
48968
|
+
return /* @__PURE__ */ jsx(
|
|
48969
|
+
"img",
|
|
48970
|
+
{
|
|
48971
|
+
src: user.avatar_url,
|
|
48972
|
+
alt: user.login,
|
|
48973
|
+
style: {
|
|
48974
|
+
width: size,
|
|
48975
|
+
height: size,
|
|
48976
|
+
borderRadius: "50%",
|
|
48977
|
+
border: `1px solid ${theme2.colors.border}`
|
|
48978
|
+
}
|
|
48979
|
+
}
|
|
48980
|
+
);
|
|
48981
|
+
};
|
|
48982
|
+
const ReactionsDisplay = ({ reactions }) => {
|
|
48983
|
+
const { theme: theme2 } = useTheme();
|
|
48984
|
+
if (reactions.total_count === 0) return null;
|
|
48985
|
+
const reactionEmojis = {
|
|
48986
|
+
"+1": "👍",
|
|
48987
|
+
"-1": "👎",
|
|
48988
|
+
laugh: "😄",
|
|
48989
|
+
hooray: "🎉",
|
|
46921
48990
|
confused: "😕",
|
|
46922
48991
|
heart: "❤️",
|
|
46923
48992
|
rocket: "🚀",
|
|
@@ -47600,25 +49669,19 @@ const TimelineEventRenderer = ({ event }) => {
|
|
|
47600
49669
|
};
|
|
47601
49670
|
const GitHubMessagesPanelContent = ({ context, events }) => {
|
|
47602
49671
|
const { theme: theme2 } = useTheme();
|
|
47603
|
-
const
|
|
47604
|
-
|
|
47605
|
-
|
|
47606
|
-
|
|
47607
|
-
|
|
47608
|
-
|
|
47609
|
-
|
|
49672
|
+
const panelRef = useRef(null);
|
|
49673
|
+
gt(
|
|
49674
|
+
"github-messages",
|
|
49675
|
+
events,
|
|
49676
|
+
() => {
|
|
49677
|
+
var _a;
|
|
49678
|
+
return (_a = panelRef.current) == null ? void 0 : _a.focus();
|
|
47610
49679
|
}
|
|
47611
|
-
|
|
47612
|
-
|
|
47613
|
-
|
|
47614
|
-
|
|
47615
|
-
|
|
47616
|
-
};
|
|
47617
|
-
const unsubData = events.on("github-messages:data", handleMessagesData);
|
|
47618
|
-
return () => {
|
|
47619
|
-
if (typeof unsubData === "function") unsubData();
|
|
47620
|
-
};
|
|
47621
|
-
}, [events]);
|
|
49680
|
+
);
|
|
49681
|
+
const messagesSlice = context.getSlice("github-messages");
|
|
49682
|
+
const isLoading = context.isSliceLoading("github-messages");
|
|
49683
|
+
const hasData = context.hasSlice("github-messages");
|
|
49684
|
+
const messagesData = messagesSlice == null ? void 0 : messagesSlice.data;
|
|
47622
49685
|
useEffect(() => {
|
|
47623
49686
|
if (!events) return;
|
|
47624
49687
|
const handleIssueSelected = (event) => {
|
|
@@ -47659,10 +49722,26 @@ const GitHubMessagesPanelContent = ({ context, events }) => {
|
|
|
47659
49722
|
flexDirection: "column",
|
|
47660
49723
|
height: "100%",
|
|
47661
49724
|
backgroundColor: theme2.colors.background,
|
|
47662
|
-
overflow: "hidden"
|
|
49725
|
+
overflow: "hidden",
|
|
49726
|
+
outline: "none"
|
|
47663
49727
|
};
|
|
49728
|
+
if (isLoading && !hasData) {
|
|
49729
|
+
return /* @__PURE__ */ jsx("div", { ref: panelRef, tabIndex: -1, style: containerStyle, children: /* @__PURE__ */ jsx(
|
|
49730
|
+
"div",
|
|
49731
|
+
{
|
|
49732
|
+
style: {
|
|
49733
|
+
flex: 1,
|
|
49734
|
+
display: "flex",
|
|
49735
|
+
alignItems: "center",
|
|
49736
|
+
justifyContent: "center",
|
|
49737
|
+
color: theme2.colors.textSecondary
|
|
49738
|
+
},
|
|
49739
|
+
children: "Loading conversation..."
|
|
49740
|
+
}
|
|
49741
|
+
) });
|
|
49742
|
+
}
|
|
47664
49743
|
if (!messagesData || !messagesData.target) {
|
|
47665
|
-
return /* @__PURE__ */ jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxs(
|
|
49744
|
+
return /* @__PURE__ */ jsx("div", { ref: panelRef, tabIndex: -1, style: containerStyle, children: /* @__PURE__ */ jsxs(
|
|
47666
49745
|
"div",
|
|
47667
49746
|
{
|
|
47668
49747
|
style: {
|
|
@@ -47710,23 +49789,8 @@ const GitHubMessagesPanelContent = ({ context, events }) => {
|
|
|
47710
49789
|
}
|
|
47711
49790
|
) });
|
|
47712
49791
|
}
|
|
47713
|
-
if (messagesData.loading) {
|
|
47714
|
-
return /* @__PURE__ */ jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsx(
|
|
47715
|
-
"div",
|
|
47716
|
-
{
|
|
47717
|
-
style: {
|
|
47718
|
-
flex: 1,
|
|
47719
|
-
display: "flex",
|
|
47720
|
-
alignItems: "center",
|
|
47721
|
-
justifyContent: "center",
|
|
47722
|
-
color: theme2.colors.textSecondary
|
|
47723
|
-
},
|
|
47724
|
-
children: "Loading conversation..."
|
|
47725
|
-
}
|
|
47726
|
-
) });
|
|
47727
|
-
}
|
|
47728
49792
|
if (messagesData.error) {
|
|
47729
|
-
return /* @__PURE__ */ jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxs(
|
|
49793
|
+
return /* @__PURE__ */ jsx("div", { ref: panelRef, tabIndex: -1, style: containerStyle, children: /* @__PURE__ */ jsxs(
|
|
47730
49794
|
"div",
|
|
47731
49795
|
{
|
|
47732
49796
|
style: {
|
|
@@ -47770,7 +49834,7 @@ const GitHubMessagesPanelContent = ({ context, events }) => {
|
|
|
47770
49834
|
};
|
|
47771
49835
|
};
|
|
47772
49836
|
const statusConfig = getStatusConfig();
|
|
47773
|
-
return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
|
|
49837
|
+
return /* @__PURE__ */ jsxs("div", { ref: panelRef, tabIndex: -1, style: containerStyle, children: [
|
|
47774
49838
|
/* @__PURE__ */ jsxs(
|
|
47775
49839
|
"div",
|
|
47776
49840
|
{
|
|
@@ -47948,7 +50012,7 @@ const OwnerRepositoriesPanelContent = ({
|
|
|
47948
50012
|
selectedRepository,
|
|
47949
50013
|
defaultShowSearch = false
|
|
47950
50014
|
}) => {
|
|
47951
|
-
var _a, _b, _c, _d,
|
|
50015
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
47952
50016
|
const { theme: theme2 } = useTheme();
|
|
47953
50017
|
const [selectedRepoId, setSelectedRepoId] = useState(null);
|
|
47954
50018
|
const [sortField, setSortField] = useState("updated");
|
|
@@ -47971,7 +50035,7 @@ const OwnerRepositoriesPanelContent = ({
|
|
|
47971
50035
|
const isLoading = context.isSliceLoading("owner-repositories");
|
|
47972
50036
|
((_c = ownerSlice == null ? void 0 : ownerSlice.data) == null ? void 0 : _c.owner) ?? null;
|
|
47973
50037
|
const repositories = ((_d = ownerSlice == null ? void 0 : ownerSlice.data) == null ? void 0 : _d.repositories) ?? [];
|
|
47974
|
-
const error = ((
|
|
50038
|
+
const error = ((_e2 = ownerSlice == null ? void 0 : ownerSlice.data) == null ? void 0 : _e2.error) ?? null;
|
|
47975
50039
|
((_f = ownerSlice == null ? void 0 : ownerSlice.data) == null ? void 0 : _f.isAuthenticated) ?? false;
|
|
47976
50040
|
const handleRefresh = useCallback(() => {
|
|
47977
50041
|
events.emit({
|