@cjlapao/ui-kit 0.2.33 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +539 -432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +311 -204
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -51727,7 +51727,7 @@ function useResizable({
|
|
|
51727
51727
|
const getMaxWidth = (0, import_react261.useCallback)(() => {
|
|
51728
51728
|
return typeof maxWidthOpt === "function" ? maxWidthOpt() : maxWidthOpt;
|
|
51729
51729
|
}, [maxWidthOpt]);
|
|
51730
|
-
const
|
|
51730
|
+
const clamp5 = (0, import_react261.useCallback)(
|
|
51731
51731
|
(value) => Math.max(minWidth, Math.min(getMaxWidth(), value)),
|
|
51732
51732
|
[minWidth, getMaxWidth]
|
|
51733
51733
|
);
|
|
@@ -51735,7 +51735,7 @@ function useResizable({
|
|
|
51735
51735
|
if (!isDragging) return;
|
|
51736
51736
|
const handlePointerMove = (e) => {
|
|
51737
51737
|
const delta = e.clientX - startXRef.current;
|
|
51738
|
-
const newWidth =
|
|
51738
|
+
const newWidth = clamp5(startWidthRef.current + delta);
|
|
51739
51739
|
setWidth(newWidth);
|
|
51740
51740
|
onResize?.(newWidth);
|
|
51741
51741
|
};
|
|
@@ -51758,7 +51758,7 @@ function useResizable({
|
|
|
51758
51758
|
document.body.style.cursor = "";
|
|
51759
51759
|
document.body.style.userSelect = "";
|
|
51760
51760
|
};
|
|
51761
|
-
}, [isDragging,
|
|
51761
|
+
}, [isDragging, clamp5, onResize, onResizeEnd]);
|
|
51762
51762
|
const onPointerDown = (0, import_react261.useCallback)(
|
|
51763
51763
|
(e) => {
|
|
51764
51764
|
if (!enabled) return;
|
|
@@ -51775,9 +51775,9 @@ function useResizable({
|
|
|
51775
51775
|
const step = 20;
|
|
51776
51776
|
let newWidth = width;
|
|
51777
51777
|
if (e.key === "ArrowRight") {
|
|
51778
|
-
newWidth =
|
|
51778
|
+
newWidth = clamp5(width + step);
|
|
51779
51779
|
} else if (e.key === "ArrowLeft") {
|
|
51780
|
-
newWidth =
|
|
51780
|
+
newWidth = clamp5(width - step);
|
|
51781
51781
|
} else {
|
|
51782
51782
|
return;
|
|
51783
51783
|
}
|
|
@@ -51786,7 +51786,7 @@ function useResizable({
|
|
|
51786
51786
|
onResize?.(newWidth);
|
|
51787
51787
|
onResizeEnd?.(newWidth);
|
|
51788
51788
|
},
|
|
51789
|
-
[enabled, width,
|
|
51789
|
+
[enabled, width, clamp5, onResize, onResizeEnd]
|
|
51790
51790
|
);
|
|
51791
51791
|
const resolvedMax = getMaxWidth();
|
|
51792
51792
|
return {
|
|
@@ -68074,15 +68074,79 @@ var TreeView = ({
|
|
|
68074
68074
|
var TreeView_default = TreeView;
|
|
68075
68075
|
|
|
68076
68076
|
// src/components/WorkflowTracker/WorkflowTracker.tsx
|
|
68077
|
-
var
|
|
68077
|
+
var import_react298 = require("react");
|
|
68078
68078
|
var import_classnames124 = __toESM(require("classnames"), 1);
|
|
68079
68079
|
|
|
68080
68080
|
// src/components/WorkflowTracker/WorkflowTrackerRail.tsx
|
|
68081
|
-
var
|
|
68081
|
+
var import_react294 = require("react");
|
|
68082
68082
|
var import_classnames117 = __toESM(require("classnames"), 1);
|
|
68083
68083
|
|
|
68084
|
+
// src/components/WorkflowTracker/useWorkflowFooterResize.ts
|
|
68085
|
+
var import_react291 = require("react");
|
|
68086
|
+
var clamp4 = (value) => Number.isFinite(value) ? Math.max(10, Math.min(80, value)) : 30;
|
|
68087
|
+
function useWorkflowFooterResize({ height, defaultHeight, onChange, enabled }) {
|
|
68088
|
+
const [internal, setInternal] = (0, import_react291.useState)(() => clamp4(defaultHeight));
|
|
68089
|
+
const percentage = clamp4(height ?? internal);
|
|
68090
|
+
const bodyRef = (0, import_react291.useRef)(null);
|
|
68091
|
+
const drag = (0, import_react291.useRef)(null);
|
|
68092
|
+
const [dragging, setDragging] = (0, import_react291.useState)(false);
|
|
68093
|
+
const footerId = (0, import_react291.useId)();
|
|
68094
|
+
const update = (next) => {
|
|
68095
|
+
const value = clamp4(next);
|
|
68096
|
+
if (height === void 0) setInternal(value);
|
|
68097
|
+
onChange?.(value);
|
|
68098
|
+
};
|
|
68099
|
+
const finish = () => {
|
|
68100
|
+
drag.current = null;
|
|
68101
|
+
setDragging(false);
|
|
68102
|
+
};
|
|
68103
|
+
return {
|
|
68104
|
+
percentage,
|
|
68105
|
+
bodyRef,
|
|
68106
|
+
footerId,
|
|
68107
|
+
dragging: enabled && dragging,
|
|
68108
|
+
handleProps: {
|
|
68109
|
+
role: "separator",
|
|
68110
|
+
tabIndex: 0,
|
|
68111
|
+
"aria-orientation": "horizontal",
|
|
68112
|
+
"aria-valuemin": 10,
|
|
68113
|
+
"aria-valuemax": 80,
|
|
68114
|
+
"aria-valuenow": Math.round(percentage),
|
|
68115
|
+
"aria-valuetext": `${Math.round(percentage)}%`,
|
|
68116
|
+
"aria-controls": footerId,
|
|
68117
|
+
onPointerDown: (event) => {
|
|
68118
|
+
if (!enabled || event.button !== 0 || event.isPrimary === false) return;
|
|
68119
|
+
const bounds = bodyRef.current?.getBoundingClientRect();
|
|
68120
|
+
const available = (bounds?.height ?? 0) - event.currentTarget.getBoundingClientRect().height;
|
|
68121
|
+
if (available <= 0) return;
|
|
68122
|
+
event.preventDefault();
|
|
68123
|
+
event.currentTarget.focus();
|
|
68124
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
68125
|
+
drag.current = { y: event.clientY, height: available, percentage, pointerId: event.pointerId };
|
|
68126
|
+
setDragging(true);
|
|
68127
|
+
},
|
|
68128
|
+
onPointerMove: (event) => {
|
|
68129
|
+
const start = drag.current;
|
|
68130
|
+
if (!enabled || !start || start.pointerId !== event.pointerId) return;
|
|
68131
|
+
update(start.percentage + (start.y - event.clientY) / start.height * 100);
|
|
68132
|
+
},
|
|
68133
|
+
onPointerUp: finish,
|
|
68134
|
+
onPointerCancel: finish,
|
|
68135
|
+
onLostPointerCapture: finish,
|
|
68136
|
+
onKeyDown: (event) => {
|
|
68137
|
+
if (!enabled) return;
|
|
68138
|
+
const step = event.shiftKey ? 10 : 5;
|
|
68139
|
+
const next = event.key === "ArrowUp" ? percentage + step : event.key === "ArrowDown" ? percentage - step : event.key === "Home" ? 10 : event.key === "End" ? 80 : void 0;
|
|
68140
|
+
if (next === void 0) return;
|
|
68141
|
+
event.preventDefault();
|
|
68142
|
+
update(next);
|
|
68143
|
+
}
|
|
68144
|
+
}
|
|
68145
|
+
};
|
|
68146
|
+
}
|
|
68147
|
+
|
|
68084
68148
|
// src/components/WorkflowTracker/WorkflowTimeline.tsx
|
|
68085
|
-
var
|
|
68149
|
+
var import_react292 = __toESM(require("react"), 1);
|
|
68086
68150
|
var import_classnames116 = __toESM(require("classnames"), 1);
|
|
68087
68151
|
|
|
68088
68152
|
// src/components/WorkflowTracker/WorkflowSkeleton.tsx
|
|
@@ -68611,6 +68675,12 @@ var NestedSubSteps = ({
|
|
|
68611
68675
|
var WorkflowTimeline = ({
|
|
68612
68676
|
disableFutureSteps = false,
|
|
68613
68677
|
controls,
|
|
68678
|
+
footerResizable = false,
|
|
68679
|
+
defaultFooterHeight = 30,
|
|
68680
|
+
footerHeight,
|
|
68681
|
+
onFooterHeightChange,
|
|
68682
|
+
footerLabel = "Workflow footer",
|
|
68683
|
+
footerResizeLabel = "Resize workflow footer",
|
|
68614
68684
|
hasCollapseToggle = false,
|
|
68615
68685
|
renderStepPopover,
|
|
68616
68686
|
stepPopoverProps,
|
|
@@ -68634,6 +68704,14 @@ var WorkflowTimeline = ({
|
|
|
68634
68704
|
onStepAction
|
|
68635
68705
|
}) => {
|
|
68636
68706
|
const isEmpty2 = steps.length === 0;
|
|
68707
|
+
const hasFooter = controls != null && controls !== false;
|
|
68708
|
+
const resizableFooter = footerResizable && fillHeight && hasFooter;
|
|
68709
|
+
const footer = useWorkflowFooterResize({
|
|
68710
|
+
height: footerHeight,
|
|
68711
|
+
defaultHeight: defaultFooterHeight,
|
|
68712
|
+
onChange: onFooterHeightChange,
|
|
68713
|
+
enabled: resizableFooter
|
|
68714
|
+
});
|
|
68637
68715
|
const tallyEntries = [
|
|
68638
68716
|
{ count: tallies.done, label: labels.done },
|
|
68639
68717
|
{ count: tallies.skipped, label: labels.skipped },
|
|
@@ -68699,7 +68777,7 @@ var WorkflowTimeline = ({
|
|
|
68699
68777
|
motion: "none"
|
|
68700
68778
|
}
|
|
68701
68779
|
),
|
|
68702
|
-
tallyEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)("div", { className: "mt-3 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs", children: tallyEntries.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(
|
|
68780
|
+
tallyEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)("div", { className: "mt-3 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs", children: tallyEntries.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(import_react292.default.Fragment, { children: [
|
|
68703
68781
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
68704
68782
|
"span",
|
|
68705
68783
|
{
|
|
@@ -68720,16 +68798,18 @@ var WorkflowTimeline = ({
|
|
|
68720
68798
|
]
|
|
68721
68799
|
}
|
|
68722
68800
|
),
|
|
68723
|
-
/* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(
|
|
68724
|
-
|
|
68725
|
-
|
|
68726
|
-
|
|
68727
|
-
|
|
68728
|
-
|
|
68729
|
-
|
|
68730
|
-
|
|
68731
|
-
|
|
68732
|
-
|
|
68801
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsxs)("div", { ref: footer.bodyRef, className: (0, import_classnames116.default)("flex min-h-0 flex-col", fillHeight && "flex-1", footer.dragging && "select-none"), children: [
|
|
68802
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
68803
|
+
ScrollArea_default,
|
|
68804
|
+
{
|
|
68805
|
+
variant: "hover",
|
|
68806
|
+
className: fillHeight ? "min-h-0 flex-1" : void 0,
|
|
68807
|
+
style: fillHeight ? { flex: `${hasFooter ? 100 - footer.percentage : 100} 1 0%` } : void 0,
|
|
68808
|
+
viewportClassName: "overscroll-contain",
|
|
68809
|
+
contentClassName: (0, import_classnames116.default)(
|
|
68810
|
+
!loading && !isEmpty2 && (collapsed ? "px-2 py-4" : "px-5 py-5")
|
|
68811
|
+
),
|
|
68812
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(WorkflowRailSkeleton, { rows: loadingRows, collapsed }) : isEmpty2 ? collapsed ? /* @__PURE__ */ (0, import_jsx_runtime314.jsx)("span", { className: "sr-only", children: labels.empty }) : emptyState ?? /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
68733
68813
|
WorkflowPlaceholder,
|
|
68734
68814
|
{
|
|
68735
68815
|
title: labels.empty,
|
|
@@ -68924,21 +69004,36 @@ var WorkflowTimeline = ({
|
|
|
68924
69004
|
},
|
|
68925
69005
|
step.id
|
|
68926
69006
|
);
|
|
68927
|
-
}) })
|
|
68928
|
-
|
|
68929
|
-
|
|
68930
|
-
|
|
68931
|
-
|
|
68932
|
-
|
|
68933
|
-
|
|
68934
|
-
|
|
68935
|
-
|
|
68936
|
-
|
|
68937
|
-
}
|
|
68938
|
-
|
|
68939
|
-
|
|
68940
|
-
|
|
68941
|
-
|
|
69007
|
+
}) })
|
|
69008
|
+
}
|
|
69009
|
+
),
|
|
69010
|
+
resizableFooter && /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(
|
|
69011
|
+
"div",
|
|
69012
|
+
{
|
|
69013
|
+
...footer.handleProps,
|
|
69014
|
+
"aria-label": footerResizeLabel,
|
|
69015
|
+
className: (0, import_classnames116.default)("group relative flex h-3 shrink-0 touch-none cursor-row-resize items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-neutral-400", surfaces.border),
|
|
69016
|
+
children: [
|
|
69017
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)("span", { "aria-hidden": "true", className: (0, import_classnames116.default)("pointer-events-none absolute inset-x-0 top-1/2 border-t", surfaces.border) }),
|
|
69018
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)("span", { "aria-hidden": "true", className: (0, import_classnames116.default)("relative h-1 w-10 rounded-full bg-neutral-400 transition-opacity dark:bg-neutral-500", footer.dragging ? "opacity-100" : "opacity-40 group-hover:opacity-100 group-focus-visible:opacity-100") })
|
|
69019
|
+
]
|
|
69020
|
+
}
|
|
69021
|
+
),
|
|
69022
|
+
hasFooter && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
69023
|
+
ScrollArea_default,
|
|
69024
|
+
{
|
|
69025
|
+
id: footer.footerId,
|
|
69026
|
+
role: "region",
|
|
69027
|
+
"aria-label": footerLabel,
|
|
69028
|
+
variant: "hover",
|
|
69029
|
+
className: (0, import_classnames116.default)(!resizableFooter && "border-t", surfaces.border, fillHeight && "min-h-0"),
|
|
69030
|
+
style: fillHeight ? { flex: `${footer.percentage} 1 0%` } : void 0,
|
|
69031
|
+
viewportClassName: "overscroll-contain",
|
|
69032
|
+
contentClassName: collapsed ? "px-2 py-4" : "px-5 py-4",
|
|
69033
|
+
children: controls
|
|
69034
|
+
}
|
|
69035
|
+
)
|
|
69036
|
+
] }),
|
|
68942
69037
|
showLegend && !isEmpty2 && !collapsed && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
68943
69038
|
"div",
|
|
68944
69039
|
{
|
|
@@ -68967,7 +69062,7 @@ var WorkflowTimeline = ({
|
|
|
68967
69062
|
var WorkflowTimeline_default = WorkflowTimeline;
|
|
68968
69063
|
|
|
68969
69064
|
// src/components/WorkflowTracker/chrome.ts
|
|
68970
|
-
var
|
|
69065
|
+
var import_react293 = require("react");
|
|
68971
69066
|
var DEFAULT_LABELS = {
|
|
68972
69067
|
progress: "Progress",
|
|
68973
69068
|
done: "done",
|
|
@@ -69013,7 +69108,7 @@ var useWorkflowChrome = ({
|
|
|
69013
69108
|
translucentSurfaces
|
|
69014
69109
|
}) => {
|
|
69015
69110
|
const translucent = translucentSurfaces ?? isTranslucentVariant(variant);
|
|
69016
|
-
const palette = (0,
|
|
69111
|
+
const palette = (0, import_react293.useMemo)(
|
|
69017
69112
|
() => ({
|
|
69018
69113
|
accent: accentColor,
|
|
69019
69114
|
attention: attentionColor,
|
|
@@ -69024,7 +69119,7 @@ var useWorkflowChrome = ({
|
|
|
69024
69119
|
}),
|
|
69025
69120
|
[accentColor, attentionColor, blockedColor, failedColor, mutedColor, translucent]
|
|
69026
69121
|
);
|
|
69027
|
-
const surfaces = (0,
|
|
69122
|
+
const surfaces = (0, import_react293.useMemo)(() => getSurfaceTokens(translucent), [translucent]);
|
|
69028
69123
|
return { translucent, palette, surfaces, customStatuses };
|
|
69029
69124
|
};
|
|
69030
69125
|
var resolveLabels = (labelOverrides) => labelOverrides ? {
|
|
@@ -69331,6 +69426,12 @@ var WorkflowTrackerRail = ({
|
|
|
69331
69426
|
collapseLabel = "Collapse workflow rail",
|
|
69332
69427
|
renderStepPopover,
|
|
69333
69428
|
renderControls,
|
|
69429
|
+
footerResizable = false,
|
|
69430
|
+
defaultFooterHeight = 30,
|
|
69431
|
+
footerHeight,
|
|
69432
|
+
onFooterHeightChange,
|
|
69433
|
+
footerLabel = "Workflow footer",
|
|
69434
|
+
footerResizeLabel = "Resize workflow footer",
|
|
69334
69435
|
stepPopoverProps,
|
|
69335
69436
|
data = sampleWorkflow,
|
|
69336
69437
|
loading = false,
|
|
@@ -69348,20 +69449,20 @@ var WorkflowTrackerRail = ({
|
|
|
69348
69449
|
style,
|
|
69349
69450
|
...styleProps
|
|
69350
69451
|
}) => {
|
|
69351
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
69452
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react294.useState)(defaultCollapsed);
|
|
69352
69453
|
const isCollapsed = collapsible && (collapsed ?? internalCollapsed);
|
|
69353
|
-
const timelineId = (0,
|
|
69454
|
+
const timelineId = (0, import_react294.useId)();
|
|
69354
69455
|
const scrollBody = fillHeight || (cardScrollable ?? false);
|
|
69355
69456
|
const steps = data?.steps ?? [];
|
|
69356
69457
|
const { palette, surfaces, customStatuses } = useWorkflowChrome(styleProps);
|
|
69357
|
-
const labels = (0,
|
|
69458
|
+
const labels = (0, import_react294.useMemo)(() => resolveLabels(labelOverrides), [labelOverrides]);
|
|
69358
69459
|
const cardProps = buildCardProps(styleProps);
|
|
69359
|
-
const active = (0,
|
|
69460
|
+
const active = (0, import_react294.useMemo)(
|
|
69360
69461
|
() => resolveActiveStep(steps, data?.activeStepId),
|
|
69361
69462
|
[steps, data?.activeStepId]
|
|
69362
69463
|
);
|
|
69363
|
-
const progress = (0,
|
|
69364
|
-
const tallies = (0,
|
|
69464
|
+
const progress = (0, import_react294.useMemo)(() => computeProgress(steps), [steps]);
|
|
69465
|
+
const tallies = (0, import_react294.useMemo)(() => computeTallies(steps, customStatuses), [steps, customStatuses]);
|
|
69365
69466
|
return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)(
|
|
69366
69467
|
Panel_default,
|
|
69367
69468
|
{
|
|
@@ -69422,6 +69523,12 @@ var WorkflowTrackerRail = ({
|
|
|
69422
69523
|
WorkflowTimeline_default,
|
|
69423
69524
|
{
|
|
69424
69525
|
controls: renderControls?.({ collapsed: isCollapsed }),
|
|
69526
|
+
footerResizable,
|
|
69527
|
+
defaultFooterHeight,
|
|
69528
|
+
footerHeight,
|
|
69529
|
+
onFooterHeightChange,
|
|
69530
|
+
footerLabel,
|
|
69531
|
+
footerResizeLabel,
|
|
69425
69532
|
collapsed: isCollapsed,
|
|
69426
69533
|
side,
|
|
69427
69534
|
hasCollapseToggle: collapsible,
|
|
@@ -69464,7 +69571,7 @@ var WorkflowTrackerRail = ({
|
|
|
69464
69571
|
var WorkflowTrackerRail_default = WorkflowTrackerRail;
|
|
69465
69572
|
|
|
69466
69573
|
// src/components/WorkflowTracker/WorkflowTrackerStepDetails.tsx
|
|
69467
|
-
var
|
|
69574
|
+
var import_react295 = require("react");
|
|
69468
69575
|
var import_classnames119 = __toESM(require("classnames"), 1);
|
|
69469
69576
|
|
|
69470
69577
|
// src/components/WorkflowTracker/WorkflowDetailPanel.tsx
|
|
@@ -69678,12 +69785,12 @@ var WorkflowTrackerStepDetails = ({
|
|
|
69678
69785
|
}) => {
|
|
69679
69786
|
const steps = data?.steps ?? [];
|
|
69680
69787
|
const { palette, surfaces, customStatuses } = useWorkflowChrome(styleProps);
|
|
69681
|
-
const labels = (0,
|
|
69788
|
+
const labels = (0, import_react295.useMemo)(
|
|
69682
69789
|
() => resolveLabels(labelOverrides),
|
|
69683
69790
|
[labelOverrides]
|
|
69684
69791
|
);
|
|
69685
69792
|
const cardProps = buildCardProps(styleProps);
|
|
69686
|
-
const active = (0,
|
|
69793
|
+
const active = (0, import_react295.useMemo)(
|
|
69687
69794
|
() => resolveActiveStep(steps, data?.activeStepId),
|
|
69688
69795
|
[steps, data?.activeStepId]
|
|
69689
69796
|
);
|
|
@@ -69713,7 +69820,7 @@ var WorkflowTrackerStepDetails = ({
|
|
|
69713
69820
|
var WorkflowTrackerStepDetails_default = WorkflowTrackerStepDetails;
|
|
69714
69821
|
|
|
69715
69822
|
// src/components/WorkflowTracker/WorkflowTrackerDetails.tsx
|
|
69716
|
-
var
|
|
69823
|
+
var import_react296 = require("react");
|
|
69717
69824
|
var import_classnames121 = __toESM(require("classnames"), 1);
|
|
69718
69825
|
|
|
69719
69826
|
// src/components/WorkflowTracker/WorkflowDetailsCard.tsx
|
|
@@ -69759,9 +69866,9 @@ var WorkflowTrackerDetails = ({
|
|
|
69759
69866
|
...styleProps
|
|
69760
69867
|
}) => {
|
|
69761
69868
|
const steps = data?.steps ?? [];
|
|
69762
|
-
const labels = (0,
|
|
69869
|
+
const labels = (0, import_react296.useMemo)(() => resolveLabels(labelOverrides), [labelOverrides]);
|
|
69763
69870
|
const cardProps = buildCardProps(styleProps);
|
|
69764
|
-
const active = (0,
|
|
69871
|
+
const active = (0, import_react296.useMemo)(
|
|
69765
69872
|
() => resolveActiveStep(steps, data?.activeStepId),
|
|
69766
69873
|
[steps, data?.activeStepId]
|
|
69767
69874
|
);
|
|
@@ -69781,7 +69888,7 @@ var WorkflowTrackerDetails = ({
|
|
|
69781
69888
|
var WorkflowTrackerDetails_default = WorkflowTrackerDetails;
|
|
69782
69889
|
|
|
69783
69890
|
// src/components/WorkflowTracker/WorkflowTrackerRollups.tsx
|
|
69784
|
-
var
|
|
69891
|
+
var import_react297 = require("react");
|
|
69785
69892
|
var import_classnames123 = __toESM(require("classnames"), 1);
|
|
69786
69893
|
|
|
69787
69894
|
// src/components/WorkflowTracker/WorkflowSummaryCard.tsx
|
|
@@ -69834,10 +69941,10 @@ var WorkflowTrackerRollups = ({
|
|
|
69834
69941
|
}) => {
|
|
69835
69942
|
const steps = data?.steps ?? [];
|
|
69836
69943
|
const { palette, surfaces, customStatuses } = useWorkflowChrome(styleProps);
|
|
69837
|
-
const labels = (0,
|
|
69944
|
+
const labels = (0, import_react297.useMemo)(() => resolveLabels(labelOverrides), [labelOverrides]);
|
|
69838
69945
|
const cardProps = buildCardProps(styleProps);
|
|
69839
|
-
const attentionSteps = (0,
|
|
69840
|
-
const skippedSteps = (0,
|
|
69946
|
+
const attentionSteps = (0, import_react297.useMemo)(() => getAttentionSteps(steps, customStatuses), [steps, customStatuses]);
|
|
69947
|
+
const skippedSteps = (0, import_react297.useMemo)(() => getSkippedSteps(steps), [steps]);
|
|
69841
69948
|
if (loading || attentionSteps.length === 0 && skippedSteps.length === 0) {
|
|
69842
69949
|
return null;
|
|
69843
69950
|
}
|
|
@@ -69928,7 +70035,7 @@ var WorkflowTracker = ({
|
|
|
69928
70035
|
translucentSurfaces
|
|
69929
70036
|
};
|
|
69930
70037
|
const { surfaces } = useWorkflowChrome(styleProps);
|
|
69931
|
-
const labels = (0,
|
|
70038
|
+
const labels = (0, import_react298.useMemo)(() => resolveLabels(labelOverrides), [labelOverrides]);
|
|
69932
70039
|
const railStyle = {
|
|
69933
70040
|
"--wt-rail-width": typeof railWidth === "number" ? `${railWidth}px` : railWidth,
|
|
69934
70041
|
"--wt-fill-offset": typeof fillHeightOffset === "number" ? `${fillHeightOffset}px` : fillHeightOffset
|
|
@@ -70079,7 +70186,7 @@ var WorkflowTracker = ({
|
|
|
70079
70186
|
var WorkflowTracker_default = WorkflowTracker;
|
|
70080
70187
|
|
|
70081
70188
|
// src/components/Gantt/Gantt.tsx
|
|
70082
|
-
var
|
|
70189
|
+
var import_react303 = require("react");
|
|
70083
70190
|
var import_react_dom16 = require("react-dom");
|
|
70084
70191
|
var import_classnames128 = __toESM(require("classnames"), 1);
|
|
70085
70192
|
|
|
@@ -71711,9 +71818,9 @@ var GanttScale = ({ levels, height }) => {
|
|
|
71711
71818
|
GanttScale.displayName = "GanttScale";
|
|
71712
71819
|
|
|
71713
71820
|
// src/components/Gantt/GanttLinkLayer.tsx
|
|
71714
|
-
var
|
|
71821
|
+
var import_react299 = require("react");
|
|
71715
71822
|
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
71716
|
-
var GanttLinkLayer = (0,
|
|
71823
|
+
var GanttLinkLayer = (0, import_react299.forwardRef)(
|
|
71717
71824
|
function GanttLinkLayer2({
|
|
71718
71825
|
width,
|
|
71719
71826
|
height,
|
|
@@ -71727,7 +71834,7 @@ var GanttLinkLayer = (0, import_react298.forwardRef)(
|
|
|
71727
71834
|
onDeleteLink
|
|
71728
71835
|
}, ref) {
|
|
71729
71836
|
const t = useKitT();
|
|
71730
|
-
const svgRef = (0,
|
|
71837
|
+
const svgRef = (0, import_react299.useRef)(null);
|
|
71731
71838
|
const selPath = selected ? paths.find((p) => p.link === selected) : void 0;
|
|
71732
71839
|
const selColor = selPath ? selPath.color ?? color2 : color2;
|
|
71733
71840
|
const selMid = selPath ? { x: (selPath.from.x + selPath.to.x) / 2, y: (selPath.from.y + selPath.to.y) / 2 } : null;
|
|
@@ -71868,7 +71975,7 @@ var GanttLinkLayer = (0, import_react298.forwardRef)(
|
|
|
71868
71975
|
GanttLinkLayer.displayName = "GanttLinkLayer";
|
|
71869
71976
|
|
|
71870
71977
|
// src/components/Gantt/GanttBodyRow.tsx
|
|
71871
|
-
var
|
|
71978
|
+
var import_react300 = require("react");
|
|
71872
71979
|
var import_classnames126 = __toESM(require("classnames"), 1);
|
|
71873
71980
|
var import_jsx_runtime326 = require("react/jsx-runtime");
|
|
71874
71981
|
var BAR_HEIGHT = 24;
|
|
@@ -72165,7 +72272,7 @@ var TaskBar = ({
|
|
|
72165
72272
|
const t = useKitT();
|
|
72166
72273
|
const milestone = task.type === "milestone";
|
|
72167
72274
|
const barColor = task.color ?? color2;
|
|
72168
|
-
const tokens = (0,
|
|
72275
|
+
const tokens = (0, import_react300.useMemo)(() => getGanttBarTokens(barColor), [barColor]);
|
|
72169
72276
|
const startMs = liveDates ? liveDates.start : toMs(task.start);
|
|
72170
72277
|
const endMs = liveDates ? liveDates.end : toMs(task.end);
|
|
72171
72278
|
const left = dateToX(startMs, rangeStart, zoom);
|
|
@@ -72324,7 +72431,7 @@ var TaskBar = ({
|
|
|
72324
72431
|
};
|
|
72325
72432
|
|
|
72326
72433
|
// src/components/Gantt/GanttToolbar.tsx
|
|
72327
|
-
var
|
|
72434
|
+
var import_react301 = require("react");
|
|
72328
72435
|
var import_classnames127 = __toESM(require("classnames"), 1);
|
|
72329
72436
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
72330
72437
|
function nearestPreset(zoom, presets) {
|
|
@@ -72354,8 +72461,8 @@ var GanttToolbar = ({
|
|
|
72354
72461
|
Month: t("kit.gantt.zoomMonth"),
|
|
72355
72462
|
Quarter: t("kit.gantt.zoomQuarter")
|
|
72356
72463
|
};
|
|
72357
|
-
const active = (0,
|
|
72358
|
-
const chrome = (0,
|
|
72464
|
+
const active = (0, import_react301.useMemo)(() => nearestPreset(zoom, presets), [zoom, presets]);
|
|
72465
|
+
const chrome = (0, import_react301.useMemo)(
|
|
72359
72466
|
() => getSurfaceVariantClasses(variant, tone),
|
|
72360
72467
|
[variant, tone]
|
|
72361
72468
|
);
|
|
@@ -72390,16 +72497,16 @@ var GanttToolbar = ({
|
|
|
72390
72497
|
GanttToolbar.displayName = "GanttToolbar";
|
|
72391
72498
|
|
|
72392
72499
|
// src/components/Gantt/useGanttDrag.ts
|
|
72393
|
-
var
|
|
72500
|
+
var import_react302 = require("react");
|
|
72394
72501
|
function useGanttDrag(opts) {
|
|
72395
|
-
const [drag, setDrag] = (0,
|
|
72396
|
-
const [linkSelected, setLinkSelected] = (0,
|
|
72397
|
-
const optsRef = (0,
|
|
72502
|
+
const [drag, setDrag] = (0, import_react302.useState)(null);
|
|
72503
|
+
const [linkSelected, setLinkSelected] = (0, import_react302.useState)(null);
|
|
72504
|
+
const optsRef = (0, import_react302.useRef)(opts);
|
|
72398
72505
|
optsRef.current = opts;
|
|
72399
|
-
const dragRef = (0,
|
|
72506
|
+
const dragRef = (0, import_react302.useRef)(null);
|
|
72400
72507
|
dragRef.current = drag;
|
|
72401
72508
|
const { rows, zoom, rangeStart, accentColor } = opts;
|
|
72402
|
-
const barGeom = (0,
|
|
72509
|
+
const barGeom = (0, import_react302.useCallback)(
|
|
72403
72510
|
(taskId) => {
|
|
72404
72511
|
const row = rows.find((r) => r.key === `task:${taskId}`);
|
|
72405
72512
|
if (!row?.task) return null;
|
|
@@ -72419,7 +72526,7 @@ function useGanttDrag(opts) {
|
|
|
72419
72526
|
},
|
|
72420
72527
|
[rows, zoom, rangeStart]
|
|
72421
72528
|
);
|
|
72422
|
-
const findTargetBar = (0,
|
|
72529
|
+
const findTargetBar = (0, import_react302.useCallback)(
|
|
72423
72530
|
(x, y, excludeId) => {
|
|
72424
72531
|
const row = rows.find((r) => r.task && y >= r.top && y < r.top + r.height);
|
|
72425
72532
|
if (!row?.task || row.task.id === excludeId) return null;
|
|
@@ -72430,7 +72537,7 @@ function useGanttDrag(opts) {
|
|
|
72430
72537
|
},
|
|
72431
72538
|
[rows, barGeom]
|
|
72432
72539
|
);
|
|
72433
|
-
const allBarGeoms = (0,
|
|
72540
|
+
const allBarGeoms = (0, import_react302.useCallback)(() => {
|
|
72434
72541
|
const out = [];
|
|
72435
72542
|
for (const row of rows) {
|
|
72436
72543
|
if (!row.task) continue;
|
|
@@ -72439,17 +72546,17 @@ function useGanttDrag(opts) {
|
|
|
72439
72546
|
}
|
|
72440
72547
|
return out;
|
|
72441
72548
|
}, [rows, barGeom]);
|
|
72442
|
-
const timelineX = (0,
|
|
72549
|
+
const timelineX = (0, import_react302.useCallback)((clientX) => {
|
|
72443
72550
|
const overlay = optsRef.current.overlayRef.current;
|
|
72444
72551
|
if (!overlay) return 0;
|
|
72445
72552
|
return clientX - overlay.getBoundingClientRect().left;
|
|
72446
72553
|
}, []);
|
|
72447
|
-
const rowY = (0,
|
|
72554
|
+
const rowY = (0, import_react302.useCallback)((clientY) => {
|
|
72448
72555
|
const overlay = optsRef.current.overlayRef.current;
|
|
72449
72556
|
if (!overlay) return 0;
|
|
72450
72557
|
return clientY - overlay.getBoundingClientRect().top;
|
|
72451
72558
|
}, []);
|
|
72452
|
-
(0,
|
|
72559
|
+
(0, import_react302.useEffect)(() => {
|
|
72453
72560
|
if (!drag) return;
|
|
72454
72561
|
const onMove = (e) => {
|
|
72455
72562
|
e.preventDefault();
|
|
@@ -72574,7 +72681,7 @@ function useGanttDrag(opts) {
|
|
|
72574
72681
|
window.removeEventListener("pointerup", onUp);
|
|
72575
72682
|
};
|
|
72576
72683
|
}, [drag != null, timelineX, rowY]);
|
|
72577
|
-
const beginDrag = (0,
|
|
72684
|
+
const beginDrag = (0, import_react302.useCallback)(
|
|
72578
72685
|
(partial, e, focusEl) => {
|
|
72579
72686
|
const o = optsRef.current;
|
|
72580
72687
|
if (!o.interactive) return;
|
|
@@ -72608,7 +72715,7 @@ function useGanttDrag(opts) {
|
|
|
72608
72715
|
},
|
|
72609
72716
|
[timelineX, rowY]
|
|
72610
72717
|
);
|
|
72611
|
-
const onBarPointerDown = (0,
|
|
72718
|
+
const onBarPointerDown = (0, import_react302.useCallback)(
|
|
72612
72719
|
(task, e) => {
|
|
72613
72720
|
if (e.button !== 0) return;
|
|
72614
72721
|
beginDrag(
|
|
@@ -72626,7 +72733,7 @@ function useGanttDrag(opts) {
|
|
|
72626
72733
|
},
|
|
72627
72734
|
[beginDrag, timelineX, rowY]
|
|
72628
72735
|
);
|
|
72629
|
-
const onResizePointerDown = (0,
|
|
72736
|
+
const onResizePointerDown = (0, import_react302.useCallback)(
|
|
72630
72737
|
(task, edge, e) => {
|
|
72631
72738
|
if (e.button !== 0) return;
|
|
72632
72739
|
e.stopPropagation();
|
|
@@ -72645,7 +72752,7 @@ function useGanttDrag(opts) {
|
|
|
72645
72752
|
},
|
|
72646
72753
|
[beginDrag, timelineX, rowY]
|
|
72647
72754
|
);
|
|
72648
|
-
const onGripPointerDown = (0,
|
|
72755
|
+
const onGripPointerDown = (0, import_react302.useCallback)(
|
|
72649
72756
|
(_rowKey, task, e) => {
|
|
72650
72757
|
if (e.button !== 0) return;
|
|
72651
72758
|
const rowEl = e.currentTarget.closest(
|
|
@@ -72670,7 +72777,7 @@ function useGanttDrag(opts) {
|
|
|
72670
72777
|
},
|
|
72671
72778
|
[beginDrag, timelineX, rowY]
|
|
72672
72779
|
);
|
|
72673
|
-
const onLinkHandlePointerDown = (0,
|
|
72780
|
+
const onLinkHandlePointerDown = (0, import_react302.useCallback)(
|
|
72674
72781
|
(task, side, e, fromOffset = 0) => {
|
|
72675
72782
|
if (e.button !== 0) return;
|
|
72676
72783
|
e.stopPropagation();
|
|
@@ -72690,7 +72797,7 @@ function useGanttDrag(opts) {
|
|
|
72690
72797
|
},
|
|
72691
72798
|
[beginDrag, timelineX, rowY]
|
|
72692
72799
|
);
|
|
72693
|
-
const onProgressPointerDown = (0,
|
|
72800
|
+
const onProgressPointerDown = (0, import_react302.useCallback)(
|
|
72694
72801
|
(task, e) => {
|
|
72695
72802
|
if (e.button !== 0) return;
|
|
72696
72803
|
e.stopPropagation();
|
|
@@ -72708,7 +72815,7 @@ function useGanttDrag(opts) {
|
|
|
72708
72815
|
},
|
|
72709
72816
|
[beginDrag, timelineX, rowY]
|
|
72710
72817
|
);
|
|
72711
|
-
const rubber = (0,
|
|
72818
|
+
const rubber = (0, import_react302.useMemo)(() => {
|
|
72712
72819
|
if (!drag || drag.kind !== "link") return null;
|
|
72713
72820
|
const source = barGeom(drag.taskId);
|
|
72714
72821
|
if (!source) return null;
|
|
@@ -72800,7 +72907,7 @@ var Gantt = ({
|
|
|
72800
72907
|
const t = useKitT();
|
|
72801
72908
|
const kitEngine = useKitEngine();
|
|
72802
72909
|
const dateLocale = locale ?? kitEngine.locale;
|
|
72803
|
-
const allLabels = (0,
|
|
72910
|
+
const allLabels = (0, import_react303.useMemo)(
|
|
72804
72911
|
() => ({
|
|
72805
72912
|
loading: t("kit.gantt.loading"),
|
|
72806
72913
|
empty: t("kit.gantt.empty"),
|
|
@@ -72823,10 +72930,10 @@ var Gantt = ({
|
|
|
72823
72930
|
title: c.key === "name" ? allLabels.task : c.key === "owner" ? t("kit.gantt.colOwner") : t("kit.gantt.colProgress")
|
|
72824
72931
|
}));
|
|
72825
72932
|
const interactive = editable ?? Boolean(onTasksChange || onLinksChange || onReorder);
|
|
72826
|
-
const surfaceText = (0,
|
|
72827
|
-
const [internalZoom, setInternalZoom] = (0,
|
|
72933
|
+
const surfaceText = (0, import_react303.useMemo)(() => getSurfaceTextTokens(variant), [variant]);
|
|
72934
|
+
const [internalZoom, setInternalZoom] = (0, import_react303.useState)(initialZoom);
|
|
72828
72935
|
const zoom = zoomProp ?? internalZoom;
|
|
72829
|
-
const setZoom = (0,
|
|
72936
|
+
const setZoom = (0, import_react303.useCallback)(
|
|
72830
72937
|
(z) => {
|
|
72831
72938
|
const clamped = Math.min(maxZoom, Math.max(minZoom, z));
|
|
72832
72939
|
if (onZoomChange) onZoomChange(clamped);
|
|
@@ -72834,33 +72941,33 @@ var Gantt = ({
|
|
|
72834
72941
|
},
|
|
72835
72942
|
[minZoom, maxZoom, onZoomChange]
|
|
72836
72943
|
);
|
|
72837
|
-
const [internalSelection, setInternalSelection] = (0,
|
|
72944
|
+
const [internalSelection, setInternalSelection] = (0, import_react303.useState)(null);
|
|
72838
72945
|
const selectedId = selectedIdProp !== void 0 ? selectedIdProp : internalSelection;
|
|
72839
|
-
const setSelected = (0,
|
|
72946
|
+
const setSelected = (0, import_react303.useCallback)(
|
|
72840
72947
|
(id) => {
|
|
72841
72948
|
onSelect?.(id);
|
|
72842
72949
|
if (selectedIdProp === void 0) setInternalSelection(id);
|
|
72843
72950
|
},
|
|
72844
72951
|
[onSelect, selectedIdProp]
|
|
72845
72952
|
);
|
|
72846
|
-
const [internalOrder, setInternalOrder] = (0,
|
|
72953
|
+
const [internalOrder, setInternalOrder] = (0, import_react303.useState)(void 0);
|
|
72847
72954
|
const rowOrder = rowOrderProp ?? internalOrder;
|
|
72848
|
-
const handleReorder = (0,
|
|
72955
|
+
const handleReorder = (0, import_react303.useCallback)(
|
|
72849
72956
|
(order) => {
|
|
72850
72957
|
onReorder?.(order);
|
|
72851
72958
|
if (rowOrderProp === void 0) setInternalOrder(order);
|
|
72852
72959
|
},
|
|
72853
72960
|
[onReorder, rowOrderProp]
|
|
72854
72961
|
);
|
|
72855
|
-
const [collapsed, setCollapsed] = (0,
|
|
72962
|
+
const [collapsed, setCollapsed] = (0, import_react303.useState)(
|
|
72856
72963
|
() => new Set(tasks.filter((t2) => t2.open === false).map((t2) => t2.id))
|
|
72857
72964
|
);
|
|
72858
|
-
const [closedLanes, setClosedLanes] = (0,
|
|
72965
|
+
const [closedLanes, setClosedLanes] = (0, import_react303.useState)(
|
|
72859
72966
|
() => new Set((lanes ?? []).filter((l) => l.open === false).map((l) => l.id))
|
|
72860
72967
|
);
|
|
72861
|
-
const tasksRef = (0,
|
|
72862
|
-
const lanesRef = (0,
|
|
72863
|
-
(0,
|
|
72968
|
+
const tasksRef = (0, import_react303.useRef)(tasks);
|
|
72969
|
+
const lanesRef = (0, import_react303.useRef)(lanes);
|
|
72970
|
+
(0, import_react303.useEffect)(() => {
|
|
72864
72971
|
if (tasksRef.current !== tasks) {
|
|
72865
72972
|
tasksRef.current = tasks;
|
|
72866
72973
|
setCollapsed(new Set(tasks.filter((t2) => t2.open === false).map((t2) => t2.id)));
|
|
@@ -72870,7 +72977,7 @@ var Gantt = ({
|
|
|
72870
72977
|
setClosedLanes(new Set((lanes ?? []).filter((l) => l.open === false).map((l) => l.id)));
|
|
72871
72978
|
}
|
|
72872
72979
|
}, [tasks, lanes]);
|
|
72873
|
-
const toggleCollapse = (0,
|
|
72980
|
+
const toggleCollapse = (0, import_react303.useCallback)((taskId, isOpen) => {
|
|
72874
72981
|
setCollapsed((prev) => {
|
|
72875
72982
|
const next = new Set(prev);
|
|
72876
72983
|
if (isOpen) next.add(taskId);
|
|
@@ -72878,7 +72985,7 @@ var Gantt = ({
|
|
|
72878
72985
|
return next;
|
|
72879
72986
|
});
|
|
72880
72987
|
}, []);
|
|
72881
|
-
const toggleLane = (0,
|
|
72988
|
+
const toggleLane = (0, import_react303.useCallback)((laneId, isOpen) => {
|
|
72882
72989
|
setClosedLanes((prev) => {
|
|
72883
72990
|
const next = new Set(prev);
|
|
72884
72991
|
if (isOpen) next.add(laneId);
|
|
@@ -72886,37 +72993,37 @@ var Gantt = ({
|
|
|
72886
72993
|
return next;
|
|
72887
72994
|
});
|
|
72888
72995
|
}, []);
|
|
72889
|
-
const effectiveTasks = (0,
|
|
72996
|
+
const effectiveTasks = (0, import_react303.useMemo)(() => {
|
|
72890
72997
|
let out = tasks;
|
|
72891
72998
|
if (collapsed.size > 0) {
|
|
72892
72999
|
out = out.map((t2) => collapsed.has(t2.id) ? { ...t2, open: false } : t2);
|
|
72893
73000
|
}
|
|
72894
73001
|
return out;
|
|
72895
73002
|
}, [tasks, collapsed]);
|
|
72896
|
-
const effectiveLanes = (0,
|
|
73003
|
+
const effectiveLanes = (0, import_react303.useMemo)(() => {
|
|
72897
73004
|
if (closedLanes.size === 0) return lanes;
|
|
72898
73005
|
return (lanes ?? []).map(
|
|
72899
73006
|
(l) => closedLanes.has(l.id) ? { ...l, open: false } : l
|
|
72900
73007
|
);
|
|
72901
73008
|
}, [lanes, closedLanes]);
|
|
72902
|
-
const committedModel = (0,
|
|
73009
|
+
const committedModel = (0, import_react303.useMemo)(
|
|
72903
73010
|
() => buildRows(effectiveTasks, effectiveLanes, rowOrder, rowHeight2),
|
|
72904
73011
|
[effectiveTasks, effectiveLanes, rowOrder, rowHeight2]
|
|
72905
73012
|
);
|
|
72906
|
-
const range = (0,
|
|
73013
|
+
const range = (0, import_react303.useMemo)(() => {
|
|
72907
73014
|
const starts = tasks.map((t2) => toMs(t2.start));
|
|
72908
73015
|
const ends = tasks.map((t2) => toMs(t2.end));
|
|
72909
73016
|
return computeViewRange(starts, ends);
|
|
72910
73017
|
}, [tasks]);
|
|
72911
73018
|
const timelineWidth = rangeWidth(range.start, range.end, zoom);
|
|
72912
|
-
const scaleLevels = (0,
|
|
73019
|
+
const scaleLevels = (0, import_react303.useMemo)(
|
|
72913
73020
|
() => buildTimeScale(range.start, range.end, zoom, dateLocale),
|
|
72914
73021
|
[range, zoom, dateLocale]
|
|
72915
73022
|
);
|
|
72916
|
-
const [colWidths, setColWidths] = (0,
|
|
73023
|
+
const [colWidths, setColWidths] = (0, import_react303.useState)(
|
|
72917
73024
|
() => columnWidths ? { ...columnWidths } : {}
|
|
72918
73025
|
);
|
|
72919
|
-
(0,
|
|
73026
|
+
(0, import_react303.useEffect)(() => {
|
|
72920
73027
|
if (!columnWidths) return;
|
|
72921
73028
|
setColWidths((prev) => ({ ...prev, ...columnWidths }));
|
|
72922
73029
|
}, [columnWidths]);
|
|
@@ -72926,21 +73033,21 @@ var Gantt = ({
|
|
|
72926
73033
|
const m = /^(\d+(?:\.\d+)?)px$/.exec(col.width ?? "");
|
|
72927
73034
|
return m ? Number(m[1]) : 160;
|
|
72928
73035
|
};
|
|
72929
|
-
const sizedColumns = (0,
|
|
73036
|
+
const sizedColumns = (0, import_react303.useMemo)(
|
|
72930
73037
|
() => resolvedColumns.map((c) => ({ ...c, width: `${effectiveColWidth(c)}px` })),
|
|
72931
73038
|
[resolvedColumns, colWidths]
|
|
72932
73039
|
);
|
|
72933
|
-
const effectiveWidthsRef = (0,
|
|
73040
|
+
const effectiveWidthsRef = (0, import_react303.useRef)({});
|
|
72934
73041
|
effectiveWidthsRef.current = Object.fromEntries(
|
|
72935
73042
|
sizedColumns.map((c) => [c.key, effectiveColWidth(c)])
|
|
72936
73043
|
);
|
|
72937
|
-
const leftWidth = (0,
|
|
73044
|
+
const leftWidth = (0, import_react303.useMemo)(
|
|
72938
73045
|
() => GRIP_WIDTH + resolvedColumns.reduce((sum, c) => sum + effectiveColWidth(c), 0),
|
|
72939
73046
|
[resolvedColumns, colWidths]
|
|
72940
73047
|
);
|
|
72941
|
-
const resizingRef = (0,
|
|
72942
|
-
const [resizingKey, setResizingKey] = (0,
|
|
72943
|
-
const startColumnResize = (0,
|
|
73048
|
+
const resizingRef = (0, import_react303.useRef)(null);
|
|
73049
|
+
const [resizingKey, setResizingKey] = (0, import_react303.useState)(null);
|
|
73050
|
+
const startColumnResize = (0, import_react303.useCallback)(
|
|
72944
73051
|
(e, key) => {
|
|
72945
73052
|
if (e.button !== 0) return;
|
|
72946
73053
|
e.preventDefault();
|
|
@@ -72971,23 +73078,23 @@ var Gantt = ({
|
|
|
72971
73078
|
},
|
|
72972
73079
|
[onColumnWidthChange]
|
|
72973
73080
|
);
|
|
72974
|
-
(0,
|
|
73081
|
+
(0, import_react303.useEffect)(
|
|
72975
73082
|
() => () => {
|
|
72976
73083
|
document.body.style.cursor = "";
|
|
72977
73084
|
document.body.style.userSelect = "";
|
|
72978
73085
|
},
|
|
72979
73086
|
[]
|
|
72980
73087
|
);
|
|
72981
|
-
const scrollRef = (0,
|
|
72982
|
-
const overlayRef = (0,
|
|
72983
|
-
const rootRef = (0,
|
|
72984
|
-
const headerScaleRef = (0,
|
|
72985
|
-
const syncHeaderScale = (0,
|
|
73088
|
+
const scrollRef = (0, import_react303.useRef)(null);
|
|
73089
|
+
const overlayRef = (0, import_react303.useRef)(null);
|
|
73090
|
+
const rootRef = (0, import_react303.useRef)(null);
|
|
73091
|
+
const headerScaleRef = (0, import_react303.useRef)(null);
|
|
73092
|
+
const syncHeaderScale = (0, import_react303.useCallback)(() => {
|
|
72986
73093
|
const s = scrollRef.current;
|
|
72987
73094
|
const h = headerScaleRef.current;
|
|
72988
73095
|
if (s && h) h.style.transform = `translateX(${-s.scrollLeft}px)`;
|
|
72989
73096
|
}, []);
|
|
72990
|
-
const zoomBy = (0,
|
|
73097
|
+
const zoomBy = (0, import_react303.useCallback)(
|
|
72991
73098
|
(factor, pointerClientX) => {
|
|
72992
73099
|
const el = scrollRef.current;
|
|
72993
73100
|
const next = Math.min(maxZoom, Math.max(minZoom, zoom * factor));
|
|
@@ -73006,7 +73113,7 @@ var Gantt = ({
|
|
|
73006
73113
|
},
|
|
73007
73114
|
[zoom, minZoom, maxZoom, leftWidth, setZoom]
|
|
73008
73115
|
);
|
|
73009
|
-
(0,
|
|
73116
|
+
(0, import_react303.useEffect)(() => {
|
|
73010
73117
|
const el = scrollRef.current;
|
|
73011
73118
|
if (!el) return;
|
|
73012
73119
|
const onWheel = (e) => {
|
|
@@ -73018,10 +73125,10 @@ var Gantt = ({
|
|
|
73018
73125
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
73019
73126
|
return () => el.removeEventListener("wheel", onWheel);
|
|
73020
73127
|
}, [zoomBy]);
|
|
73021
|
-
(0,
|
|
73128
|
+
(0, import_react303.useEffect)(() => {
|
|
73022
73129
|
syncHeaderScale();
|
|
73023
73130
|
}, [syncHeaderScale, timelineWidth, zoom, range.start, leftWidth]);
|
|
73024
|
-
const liveRowsRef = (0,
|
|
73131
|
+
const liveRowsRef = (0, import_react303.useRef)(null);
|
|
73025
73132
|
const dragApi = useGanttDrag({
|
|
73026
73133
|
scrollRef,
|
|
73027
73134
|
overlayRef,
|
|
@@ -73043,12 +73150,12 @@ var Gantt = ({
|
|
|
73043
73150
|
rowOrder,
|
|
73044
73151
|
setSelected
|
|
73045
73152
|
});
|
|
73046
|
-
const liveReorder = (0,
|
|
73153
|
+
const liveReorder = (0, import_react303.useMemo)(() => {
|
|
73047
73154
|
const d = dragApi.drag;
|
|
73048
73155
|
if (d?.kind !== "reorder" || d.beforeId === void 0) return null;
|
|
73049
73156
|
return applyRowReorder(effectiveTasks, d.taskId, d.beforeId, rowOrder);
|
|
73050
73157
|
}, [dragApi.drag, effectiveTasks, rowOrder]);
|
|
73051
|
-
const liveModel = (0,
|
|
73158
|
+
const liveModel = (0, import_react303.useMemo)(
|
|
73052
73159
|
() => liveReorder ? buildRows(
|
|
73053
73160
|
liveReorder.tasks,
|
|
73054
73161
|
effectiveLanes,
|
|
@@ -73058,7 +73165,7 @@ var Gantt = ({
|
|
|
73058
73165
|
[liveReorder, effectiveLanes, rowHeight2, committedModel]
|
|
73059
73166
|
);
|
|
73060
73167
|
liveRowsRef.current = liveModel.rows;
|
|
73061
|
-
const bars = (0,
|
|
73168
|
+
const bars = (0, import_react303.useMemo)(() => {
|
|
73062
73169
|
const map = /* @__PURE__ */ new Map();
|
|
73063
73170
|
for (const row of liveModel.rows) {
|
|
73064
73171
|
if (!row.task) continue;
|
|
@@ -73080,7 +73187,7 @@ var Gantt = ({
|
|
|
73080
73187
|
return map;
|
|
73081
73188
|
}, [liveModel.rows, range, zoom]);
|
|
73082
73189
|
const bodyHeight = liveModel.rows.length > 0 ? liveModel.rows[liveModel.rows.length - 1].top + liveModel.rows[liveModel.rows.length - 1].height : 0;
|
|
73083
|
-
const onBarKeyDown = (0,
|
|
73190
|
+
const onBarKeyDown = (0, import_react303.useCallback)(
|
|
73084
73191
|
(e, task) => {
|
|
73085
73192
|
if (!interactive || task.locked || !onTasksChange) return;
|
|
73086
73193
|
const stepMs = snap2 === "hour" ? 36e5 : snap2 === "week" ? 7 * MS_PER_DAY : MS_PER_DAY;
|
|
@@ -73125,7 +73232,7 @@ var Gantt = ({
|
|
|
73125
73232
|
},
|
|
73126
73233
|
[interactive, snap2, tasks, onTasksChange, setSelected]
|
|
73127
73234
|
);
|
|
73128
|
-
const deleteSelectedLink = (0,
|
|
73235
|
+
const deleteSelectedLink = (0, import_react303.useCallback)(() => {
|
|
73129
73236
|
const sel = dragApi.linkSelected;
|
|
73130
73237
|
if (!sel || !interactive || !onLinksChange) return;
|
|
73131
73238
|
const key = (l) => l.id ?? `${l.source}~${l.target}~${l.type ?? "fs"}`;
|
|
@@ -73133,7 +73240,7 @@ var Gantt = ({
|
|
|
73133
73240
|
onLinksChange(links.filter((l) => key(l) !== selKey));
|
|
73134
73241
|
dragApi.setLinkSelected(null);
|
|
73135
73242
|
}, [dragApi, links, interactive, onLinksChange]);
|
|
73136
|
-
const moveSelection = (0,
|
|
73243
|
+
const moveSelection = (0, import_react303.useCallback)(
|
|
73137
73244
|
(where) => {
|
|
73138
73245
|
const rows = liveModel.rows;
|
|
73139
73246
|
if (!rows.length) return;
|
|
@@ -73146,7 +73253,7 @@ var Gantt = ({
|
|
|
73146
73253
|
},
|
|
73147
73254
|
[liveModel.rows, selectedId, setSelected]
|
|
73148
73255
|
);
|
|
73149
|
-
const onRootKeyDown = (0,
|
|
73256
|
+
const onRootKeyDown = (0, import_react303.useCallback)(
|
|
73150
73257
|
(e) => {
|
|
73151
73258
|
if (dragApi.linkSelected) {
|
|
73152
73259
|
if (e.key === "Escape") {
|
|
@@ -73192,14 +73299,14 @@ var Gantt = ({
|
|
|
73192
73299
|
},
|
|
73193
73300
|
[dragApi, deleteSelectedLink, moveSelection, setZoom, zoom]
|
|
73194
73301
|
);
|
|
73195
|
-
const handleSelectLink = (0,
|
|
73302
|
+
const handleSelectLink = (0, import_react303.useCallback)(
|
|
73196
73303
|
(link) => {
|
|
73197
73304
|
dragApi.setLinkSelected(link);
|
|
73198
73305
|
if (link) rootRef.current?.focus();
|
|
73199
73306
|
},
|
|
73200
73307
|
[dragApi]
|
|
73201
73308
|
);
|
|
73202
|
-
const handleRootPointerDown = (0,
|
|
73309
|
+
const handleRootPointerDown = (0, import_react303.useCallback)(
|
|
73203
73310
|
(e) => {
|
|
73204
73311
|
if (e.target.closest?.("[data-gantt-keep-link-selection]")) return;
|
|
73205
73312
|
if (dragApi.linkSelected) dragApi.setLinkSelected(null);
|
|
@@ -73214,22 +73321,22 @@ var Gantt = ({
|
|
|
73214
73321
|
const drag = dragApi.drag;
|
|
73215
73322
|
const dragTask = drag?.taskId ? committedModel.tasksById.get(drag.taskId) : void 0;
|
|
73216
73323
|
const reorderLineY = drag?.kind === "reorder" && drag.beforeId !== void 0 ? reorderPreviewTop(liveModel.rows, `task:${drag.taskId}`, drag.beforeId) : null;
|
|
73217
|
-
const dragSubtree = (0,
|
|
73324
|
+
const dragSubtree = (0, import_react303.useMemo)(() => {
|
|
73218
73325
|
if (dragApi.drag?.kind !== "reorder") return null;
|
|
73219
73326
|
return reorderDragSubtree(
|
|
73220
73327
|
liveModel.rows,
|
|
73221
73328
|
`task:${dragApi.drag.taskId}`
|
|
73222
73329
|
);
|
|
73223
73330
|
}, [dragApi.drag, liveModel.rows]);
|
|
73224
|
-
const dragSubtreeKeys = (0,
|
|
73331
|
+
const dragSubtreeKeys = (0, import_react303.useMemo)(
|
|
73225
73332
|
() => new Set((dragSubtree ?? []).map((r) => r.key)),
|
|
73226
73333
|
[dragSubtree]
|
|
73227
73334
|
);
|
|
73228
|
-
const dragSubtreeHeight = (0,
|
|
73335
|
+
const dragSubtreeHeight = (0, import_react303.useMemo)(
|
|
73229
73336
|
() => (dragSubtree ?? []).reduce((sum, r) => sum + r.height, 0),
|
|
73230
73337
|
[dragSubtree]
|
|
73231
73338
|
);
|
|
73232
|
-
const liveDragDates = (0,
|
|
73339
|
+
const liveDragDates = (0, import_react303.useMemo)(() => {
|
|
73233
73340
|
if (!drag || !dragTask) return null;
|
|
73234
73341
|
if (drag.kind !== "move" && drag.kind !== "resize-start" && drag.kind !== "resize-end") return null;
|
|
73235
73342
|
return applyDragDates(
|
|
@@ -73240,7 +73347,7 @@ var Gantt = ({
|
|
|
73240
73347
|
);
|
|
73241
73348
|
}, [drag, dragTask, zoom, snap2]);
|
|
73242
73349
|
const liveDragProgress = drag?.kind === "progress" && drag.liveProgress != null ? drag.liveProgress : null;
|
|
73243
|
-
const dragOverride = (0,
|
|
73350
|
+
const dragOverride = (0, import_react303.useMemo)(() => {
|
|
73244
73351
|
if (!drag || !dragTask) return null;
|
|
73245
73352
|
if (drag.kind === "progress" && drag.liveProgress != null) {
|
|
73246
73353
|
return { ...dragTask, progress: drag.liveProgress };
|
|
@@ -73250,11 +73357,11 @@ var Gantt = ({
|
|
|
73250
73357
|
}
|
|
73251
73358
|
return null;
|
|
73252
73359
|
}, [drag, dragTask, liveDragDates]);
|
|
73253
|
-
const liveLaneProgress = (0,
|
|
73360
|
+
const liveLaneProgress = (0, import_react303.useMemo)(
|
|
73254
73361
|
() => dragOverride && dragTask ? laneRollupProgress(effectiveTasks, dragTask.id, dragOverride) : null,
|
|
73255
73362
|
[dragOverride, dragTask, effectiveTasks]
|
|
73256
73363
|
);
|
|
73257
|
-
const liveGroupProgress = (0,
|
|
73364
|
+
const liveGroupProgress = (0, import_react303.useMemo)(() => {
|
|
73258
73365
|
if (!dragOverride || !dragTask) return null;
|
|
73259
73366
|
const byId = new Map(effectiveTasks.map((t2) => [t2.id, t2]));
|
|
73260
73367
|
const m = /* @__PURE__ */ new Map();
|
|
@@ -73266,7 +73373,7 @@ var Gantt = ({
|
|
|
73266
73373
|
}
|
|
73267
73374
|
return m.size > 0 ? m : null;
|
|
73268
73375
|
}, [dragOverride, dragTask, effectiveTasks]);
|
|
73269
|
-
const liveLinkBars = (0,
|
|
73376
|
+
const liveLinkBars = (0, import_react303.useMemo)(() => {
|
|
73270
73377
|
if (!liveDragDates || !dragTask) return bars;
|
|
73271
73378
|
const g = bars.get(dragTask.id);
|
|
73272
73379
|
if (!g) return bars;
|
|
@@ -73275,18 +73382,18 @@ var Gantt = ({
|
|
|
73275
73382
|
if (left === g.left && width === g.width) return bars;
|
|
73276
73383
|
return new Map(bars).set(dragTask.id, { ...g, left, width });
|
|
73277
73384
|
}, [bars, liveDragDates, dragTask, range, zoom]);
|
|
73278
|
-
const linkPaths = (0,
|
|
73385
|
+
const linkPaths = (0, import_react303.useMemo)(
|
|
73279
73386
|
() => computeLinkPaths(links, liveLinkBars, color2),
|
|
73280
73387
|
[links, liveLinkBars, color2]
|
|
73281
73388
|
);
|
|
73282
|
-
const linkLayerWidth = (0,
|
|
73389
|
+
const linkLayerWidth = (0, import_react303.useMemo)(
|
|
73283
73390
|
() => ganttLinkLayerWidth(linkPaths, timelineWidth),
|
|
73284
73391
|
[linkPaths, timelineWidth]
|
|
73285
73392
|
);
|
|
73286
|
-
(0,
|
|
73393
|
+
(0, import_react303.useEffect)(() => {
|
|
73287
73394
|
syncHeaderScale();
|
|
73288
73395
|
}, [linkLayerWidth, syncHeaderScale]);
|
|
73289
|
-
const linkFan = (0,
|
|
73396
|
+
const linkFan = (0, import_react303.useMemo)(() => computeLinkFanOffsets(links, bars), [links, bars]);
|
|
73290
73397
|
return /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
73291
73398
|
Panel_default,
|
|
73292
73399
|
{
|
|
@@ -73697,7 +73804,7 @@ var GanttSkeleton = ({
|
|
|
73697
73804
|
] }, i)) });
|
|
73698
73805
|
|
|
73699
73806
|
// src/components/TaskBoard/TaskBoard.tsx
|
|
73700
|
-
var
|
|
73807
|
+
var import_react316 = require("react");
|
|
73701
73808
|
var import_classnames139 = __toESM(require("classnames"), 1);
|
|
73702
73809
|
|
|
73703
73810
|
// ../common/taskboard/types.ts
|
|
@@ -74253,11 +74360,11 @@ var import_classnames133 = __toESM(require("classnames"), 1);
|
|
|
74253
74360
|
var import_classnames130 = __toESM(require("classnames"), 1);
|
|
74254
74361
|
|
|
74255
74362
|
// src/components/TaskBoard/TaskBoardCard.tsx
|
|
74256
|
-
var
|
|
74363
|
+
var import_react305 = __toESM(require("react"), 1);
|
|
74257
74364
|
var import_classnames129 = __toESM(require("classnames"), 1);
|
|
74258
74365
|
|
|
74259
74366
|
// src/components/TaskBoard/context.ts
|
|
74260
|
-
var
|
|
74367
|
+
var import_react304 = require("react");
|
|
74261
74368
|
var TASKBOARD_SIZES = {
|
|
74262
74369
|
xs: { columnWidth: 232, cardPad: "p-2", title: "text-xs", meta: "text-[10px]", gap: "gap-1.5" },
|
|
74263
74370
|
sm: { columnWidth: 248, cardPad: "p-2.5", title: "text-[13px]", meta: "text-[11px]", gap: "gap-2" },
|
|
@@ -74266,9 +74373,9 @@ var TASKBOARD_SIZES = {
|
|
|
74266
74373
|
xl: { columnWidth: 352, cardPad: "p-4", title: "text-base", meta: "text-sm", gap: "gap-3" }
|
|
74267
74374
|
};
|
|
74268
74375
|
var REFUSED_DROP = "cursor-not-allowed bg-red-500/10 ring-2 ring-inset ring-red-500/40 dark:bg-red-500/15";
|
|
74269
|
-
var TaskBoardContext = (0,
|
|
74376
|
+
var TaskBoardContext = (0, import_react304.createContext)(null);
|
|
74270
74377
|
function useTaskBoard() {
|
|
74271
|
-
const ctx = (0,
|
|
74378
|
+
const ctx = (0, import_react304.useContext)(TaskBoardContext);
|
|
74272
74379
|
if (!ctx) throw new Error("TaskBoard parts must render inside <TaskBoard>");
|
|
74273
74380
|
return ctx;
|
|
74274
74381
|
}
|
|
@@ -74376,7 +74483,7 @@ var TaskBoardCardBody = ({ card }) => {
|
|
|
74376
74483
|
] })
|
|
74377
74484
|
] });
|
|
74378
74485
|
};
|
|
74379
|
-
var TaskBoardCard =
|
|
74486
|
+
var TaskBoardCard = import_react305.default.forwardRef(
|
|
74380
74487
|
({ card, column, lane, index, state, className, onClick, onContextMenu, onKeyDown, ...rest }, ref) => {
|
|
74381
74488
|
const ctx = useTaskBoard();
|
|
74382
74489
|
const { renderCard, onCardOpen, onCardContextMenu, cardSurface, size, color: color2 } = ctx;
|
|
@@ -74506,11 +74613,11 @@ var TaskBoardBucket = ({ column, lane, cards, className, label }) => {
|
|
|
74506
74613
|
};
|
|
74507
74614
|
|
|
74508
74615
|
// src/components/TaskBoard/usePresence.ts
|
|
74509
|
-
var
|
|
74616
|
+
var import_react306 = require("react");
|
|
74510
74617
|
var COLLAPSE_MS = 200;
|
|
74511
74618
|
function usePresence(open, ms = COLLAPSE_MS) {
|
|
74512
|
-
const [mounted, setMounted] = (0,
|
|
74513
|
-
(0,
|
|
74619
|
+
const [mounted, setMounted] = (0, import_react306.useState)(open);
|
|
74620
|
+
(0, import_react306.useEffect)(() => {
|
|
74514
74621
|
if (open) {
|
|
74515
74622
|
setMounted(true);
|
|
74516
74623
|
return;
|
|
@@ -74527,7 +74634,7 @@ function usePresence(open, ms = COLLAPSE_MS) {
|
|
|
74527
74634
|
}
|
|
74528
74635
|
|
|
74529
74636
|
// src/components/TaskBoard/TaskBoardColumnEdit.tsx
|
|
74530
|
-
var
|
|
74637
|
+
var import_react307 = require("react");
|
|
74531
74638
|
var import_react_dom17 = require("react-dom");
|
|
74532
74639
|
var import_classnames131 = __toESM(require("classnames"), 1);
|
|
74533
74640
|
var import_jsx_runtime331 = require("react/jsx-runtime");
|
|
@@ -74555,8 +74662,8 @@ var TaskBoardAddColumn = ({
|
|
|
74555
74662
|
variant
|
|
74556
74663
|
}) => {
|
|
74557
74664
|
const { text: text2, surface, color: color2, size, columnCornerClass } = useTaskBoard();
|
|
74558
|
-
const [editing, setEditing] = (0,
|
|
74559
|
-
const [title, setTitle] = (0,
|
|
74665
|
+
const [editing, setEditing] = (0, import_react307.useState)(false);
|
|
74666
|
+
const [title, setTitle] = (0, import_react307.useState)("");
|
|
74560
74667
|
const trigger = getSurfaceTriggerTokens(color2);
|
|
74561
74668
|
const close = () => {
|
|
74562
74669
|
setEditing(false);
|
|
@@ -74669,7 +74776,7 @@ var TaskBoardColumnClone = ({ drag, column, cards, count }) => {
|
|
|
74669
74776
|
};
|
|
74670
74777
|
|
|
74671
74778
|
// src/components/TaskBoard/TaskBoardColumnEditor.tsx
|
|
74672
|
-
var
|
|
74779
|
+
var import_react308 = require("react");
|
|
74673
74780
|
var import_classnames132 = __toESM(require("classnames"), 1);
|
|
74674
74781
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
74675
74782
|
var toDraft = (c) => ({
|
|
@@ -74693,9 +74800,9 @@ function fromDraft(column, d) {
|
|
|
74693
74800
|
var limitValid = (wip) => wip.trim() === "" || Number.isInteger(Number(wip)) && Number(wip) >= 1;
|
|
74694
74801
|
var TaskBoardColumnEditButton = ({ column }) => {
|
|
74695
74802
|
const { onEditColumn, allColumns, text: text2, surface, color: color2 } = useTaskBoard();
|
|
74696
|
-
const [open, setOpen] = (0,
|
|
74697
|
-
const [draft, setDraft] = (0,
|
|
74698
|
-
const id = (0,
|
|
74803
|
+
const [open, setOpen] = (0, import_react308.useState)(false);
|
|
74804
|
+
const [draft, setDraft] = (0, import_react308.useState)(() => toDraft(column));
|
|
74805
|
+
const id = (0, import_react308.useId)();
|
|
74699
74806
|
if (!onEditColumn) return null;
|
|
74700
74807
|
const trigger = getSurfaceTriggerTokens(color2);
|
|
74701
74808
|
const valid = draft.title.trim() !== "" && limitValid(draft.wip) && limitValid(draft.max);
|
|
@@ -75311,7 +75418,7 @@ var TaskBoardDragLayer = ({ drag, card }) => {
|
|
|
75311
75418
|
};
|
|
75312
75419
|
|
|
75313
75420
|
// src/components/TaskBoard/useTaskBoardDrag.ts
|
|
75314
|
-
var
|
|
75421
|
+
var import_react309 = require("react");
|
|
75315
75422
|
var DRAG_THRESHOLD_PX = 4;
|
|
75316
75423
|
var TOUCH_GRAB_DELAY_MS = 250;
|
|
75317
75424
|
var TOUCH_SLOP_PX = 8;
|
|
@@ -75326,18 +75433,18 @@ function bucketOf(el) {
|
|
|
75326
75433
|
return column === null ? null : { column, lane: lane || null, el: bucket };
|
|
75327
75434
|
}
|
|
75328
75435
|
function useTaskBoardDrag(opts) {
|
|
75329
|
-
const [drag, setDrag] = (0,
|
|
75330
|
-
const [pending, setPending] = (0,
|
|
75331
|
-
const optsRef = (0,
|
|
75436
|
+
const [drag, setDrag] = (0, import_react309.useState)(null);
|
|
75437
|
+
const [pending, setPending] = (0, import_react309.useState)(null);
|
|
75438
|
+
const optsRef = (0, import_react309.useRef)(opts);
|
|
75332
75439
|
optsRef.current = opts;
|
|
75333
|
-
const dragRef = (0,
|
|
75334
|
-
const pressRef = (0,
|
|
75335
|
-
const suppressClickRef = (0,
|
|
75336
|
-
const pointerRef = (0,
|
|
75337
|
-
const rafRef = (0,
|
|
75338
|
-
const cleanupRef = (0,
|
|
75339
|
-
const userSelectRef = (0,
|
|
75340
|
-
const setDragState = (0,
|
|
75440
|
+
const dragRef = (0, import_react309.useRef)(null);
|
|
75441
|
+
const pressRef = (0, import_react309.useRef)(null);
|
|
75442
|
+
const suppressClickRef = (0, import_react309.useRef)(false);
|
|
75443
|
+
const pointerRef = (0, import_react309.useRef)({ x: 0, y: 0 });
|
|
75444
|
+
const rafRef = (0, import_react309.useRef)(null);
|
|
75445
|
+
const cleanupRef = (0, import_react309.useRef)(null);
|
|
75446
|
+
const userSelectRef = (0, import_react309.useRef)(null);
|
|
75447
|
+
const setDragState = (0, import_react309.useCallback)((next) => {
|
|
75341
75448
|
dragRef.current = next;
|
|
75342
75449
|
setDrag(next);
|
|
75343
75450
|
}, []);
|
|
@@ -75345,7 +75452,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75345
75452
|
const o = optsRef.current;
|
|
75346
75453
|
return { cards: o.cards, columns: o.columns, lanes: o.lanes, heldBy: o.heldBy, selfId: o.selfId, maxItems: o.maxItems };
|
|
75347
75454
|
};
|
|
75348
|
-
const resolveTarget = (0,
|
|
75455
|
+
const resolveTarget = (0, import_react309.useCallback)((x, y) => {
|
|
75349
75456
|
const d = dragRef.current;
|
|
75350
75457
|
if (!d) return;
|
|
75351
75458
|
const hit = bucketOf(document.elementFromPoint?.(x, y) ?? null);
|
|
@@ -75365,7 +75472,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75365
75472
|
setDragState({ ...d, x, y, to, valid });
|
|
75366
75473
|
if (changed) optsRef.current.onDragTarget?.(d.cardId, valid ? to : null);
|
|
75367
75474
|
}, [setDragState]);
|
|
75368
|
-
const autoScroll = (0,
|
|
75475
|
+
const autoScroll = (0, import_react309.useCallback)(() => {
|
|
75369
75476
|
rafRef.current = null;
|
|
75370
75477
|
if (!dragRef.current) return;
|
|
75371
75478
|
const { x, y } = pointerRef.current;
|
|
@@ -75396,7 +75503,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75396
75503
|
rafRef.current = requestAnimationFrame(autoScroll);
|
|
75397
75504
|
}
|
|
75398
75505
|
}, [resolveTarget]);
|
|
75399
|
-
const endGesture = (0,
|
|
75506
|
+
const endGesture = (0, import_react309.useCallback)(() => {
|
|
75400
75507
|
const p = pressRef.current;
|
|
75401
75508
|
if (p?.timer) clearTimeout(p.timer);
|
|
75402
75509
|
pressRef.current = null;
|
|
@@ -75409,7 +75516,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75409
75516
|
userSelectRef.current = null;
|
|
75410
75517
|
}
|
|
75411
75518
|
}, []);
|
|
75412
|
-
const cancel = (0,
|
|
75519
|
+
const cancel = (0, import_react309.useCallback)(
|
|
75413
75520
|
(_reason) => {
|
|
75414
75521
|
const d = dragRef.current;
|
|
75415
75522
|
endGesture();
|
|
@@ -75420,7 +75527,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75420
75527
|
},
|
|
75421
75528
|
[endGesture, setDragState]
|
|
75422
75529
|
);
|
|
75423
|
-
const finish = (0,
|
|
75530
|
+
const finish = (0, import_react309.useCallback)(async () => {
|
|
75424
75531
|
const d = dragRef.current;
|
|
75425
75532
|
endGesture();
|
|
75426
75533
|
if (!d) return false;
|
|
@@ -75454,7 +75561,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75454
75561
|
optsRef.current.onDragEnd?.(d.cardId, ok);
|
|
75455
75562
|
return ok;
|
|
75456
75563
|
}, [endGesture, setDragState]);
|
|
75457
|
-
const keyboardGrab = (0,
|
|
75564
|
+
const keyboardGrab = (0, import_react309.useCallback)(
|
|
75458
75565
|
(card, from) => {
|
|
75459
75566
|
const o = optsRef.current;
|
|
75460
75567
|
if (!o.editable || card.locked || dragRef.current) return false;
|
|
@@ -75467,7 +75574,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75467
75574
|
},
|
|
75468
75575
|
[setDragState]
|
|
75469
75576
|
);
|
|
75470
|
-
const keyboardMove = (0,
|
|
75577
|
+
const keyboardMove = (0, import_react309.useCallback)(
|
|
75471
75578
|
(to) => {
|
|
75472
75579
|
const d = dragRef.current;
|
|
75473
75580
|
if (!d) return;
|
|
@@ -75476,7 +75583,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75476
75583
|
},
|
|
75477
75584
|
[setDragState]
|
|
75478
75585
|
);
|
|
75479
|
-
const lift = (0,
|
|
75586
|
+
const lift = (0, import_react309.useCallback)(
|
|
75480
75587
|
(p, x, y) => {
|
|
75481
75588
|
if (userSelectRef.current === null) {
|
|
75482
75589
|
userSelectRef.current = document.body.style.userSelect;
|
|
@@ -75498,7 +75605,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75498
75605
|
},
|
|
75499
75606
|
[resolveTarget, setDragState]
|
|
75500
75607
|
);
|
|
75501
|
-
const onWindowMove = (0,
|
|
75608
|
+
const onWindowMove = (0, import_react309.useCallback)(
|
|
75502
75609
|
(e) => {
|
|
75503
75610
|
const p = pressRef.current;
|
|
75504
75611
|
if (!p) return;
|
|
@@ -75525,7 +75632,7 @@ function useTaskBoardDrag(opts) {
|
|
|
75525
75632
|
},
|
|
75526
75633
|
[autoScroll, endGesture, lift, resolveTarget]
|
|
75527
75634
|
);
|
|
75528
|
-
const startPress = (0,
|
|
75635
|
+
const startPress = (0, import_react309.useCallback)(
|
|
75529
75636
|
(card, from, e) => {
|
|
75530
75637
|
const o = optsRef.current;
|
|
75531
75638
|
if (!o.editable || e.button !== 0 || card.locked) return;
|
|
@@ -75582,18 +75689,18 @@ function useTaskBoardDrag(opts) {
|
|
|
75582
75689
|
},
|
|
75583
75690
|
[cancel, endGesture, finish, onWindowMove]
|
|
75584
75691
|
);
|
|
75585
|
-
(0,
|
|
75692
|
+
(0, import_react309.useEffect)(() => {
|
|
75586
75693
|
const d = dragRef.current;
|
|
75587
75694
|
if (d && !opts.cards.some((c) => c.id === d.cardId)) cancel("removed");
|
|
75588
75695
|
}, [opts.cards, cancel]);
|
|
75589
|
-
(0,
|
|
75590
|
-
const previewCards = (0,
|
|
75696
|
+
(0, import_react309.useEffect)(() => () => endGesture(), [endGesture]);
|
|
75697
|
+
const previewCards = (0, import_react309.useMemo)(() => {
|
|
75591
75698
|
const { cards, columns, lanes } = opts;
|
|
75592
75699
|
if (pending) return applyMove(cards, pending, columns, lanes);
|
|
75593
75700
|
if (drag?.to && drag.valid) return applyMove(cards, { cardId: drag.cardId, from: drag.from, to: drag.to }, columns, lanes);
|
|
75594
75701
|
return cards;
|
|
75595
75702
|
}, [opts.cards, opts.columns, opts.lanes, drag, pending]);
|
|
75596
|
-
const cardHandlers = (0,
|
|
75703
|
+
const cardHandlers = (0, import_react309.useCallback)(
|
|
75597
75704
|
(card, from) => ({
|
|
75598
75705
|
onPointerDown: (e) => startPress(card, from, e),
|
|
75599
75706
|
onClickCapture: (e) => {
|
|
@@ -75610,31 +75717,31 @@ function useTaskBoardDrag(opts) {
|
|
|
75610
75717
|
}
|
|
75611
75718
|
|
|
75612
75719
|
// src/components/TaskBoard/useTaskBoardKeyboard.ts
|
|
75613
|
-
var
|
|
75720
|
+
var import_react310 = require("react");
|
|
75614
75721
|
var isRtl = (el) => el?.closest("[dir]")?.getAttribute("dir") === "rtl";
|
|
75615
75722
|
function useTaskBoardKeyboard(o) {
|
|
75616
75723
|
const { rootRef, cards, viewCards, columns, lanes, text: text2, drag } = o;
|
|
75617
|
-
const [message, setMessage] = (0,
|
|
75618
|
-
const [activeId, setActiveId] = (0,
|
|
75619
|
-
const [ownSelection, setOwnSelection] = (0,
|
|
75724
|
+
const [message, setMessage] = (0, import_react310.useState)("");
|
|
75725
|
+
const [activeId, setActiveId] = (0, import_react310.useState)(null);
|
|
75726
|
+
const [ownSelection, setOwnSelection] = (0, import_react310.useState)([]);
|
|
75620
75727
|
const selection = o.selectedIds ?? ownSelection;
|
|
75621
|
-
const anchorRef = (0,
|
|
75622
|
-
const refocusRef = (0,
|
|
75623
|
-
const viewBuckets = (0,
|
|
75624
|
-
const firstId = (0,
|
|
75728
|
+
const anchorRef = (0, import_react310.useRef)(null);
|
|
75729
|
+
const refocusRef = (0, import_react310.useRef)(null);
|
|
75730
|
+
const viewBuckets = (0, import_react310.useMemo)(() => bucketCards(viewCards, columns, lanes), [viewCards, columns, lanes]);
|
|
75731
|
+
const firstId = (0, import_react310.useMemo)(() => {
|
|
75625
75732
|
for (const cards2 of viewBuckets.values()) if (cards2.length) return cards2[0].id;
|
|
75626
75733
|
return null;
|
|
75627
75734
|
}, [viewBuckets]);
|
|
75628
75735
|
const tabStop = activeId && viewCards.some((c) => c.id === activeId) ? activeId : firstId;
|
|
75629
|
-
(0,
|
|
75736
|
+
(0, import_react310.useLayoutEffect)(() => {
|
|
75630
75737
|
const id = refocusRef.current;
|
|
75631
75738
|
if (!id) return;
|
|
75632
75739
|
refocusRef.current = null;
|
|
75633
75740
|
rootRef.current?.querySelector(`[data-card-id="${CSS.escape(id)}"]`)?.focus();
|
|
75634
75741
|
});
|
|
75635
|
-
const announce = (0,
|
|
75636
|
-
const columnTitle = (0,
|
|
75637
|
-
const announceSlot = (0,
|
|
75742
|
+
const announce = (0, import_react310.useCallback)((s) => setMessage(s), []);
|
|
75743
|
+
const columnTitle = (0, import_react310.useCallback)((id) => columns.find((c) => c.id === id)?.title ?? id, [columns]);
|
|
75744
|
+
const announceSlot = (0, import_react310.useCallback)(
|
|
75638
75745
|
(cardId, to) => {
|
|
75639
75746
|
const others = bucketCards(cards.filter((c) => c.id !== cardId), columns, lanes);
|
|
75640
75747
|
const total = (others.get(bucketKey(to.column, to.lane))?.length ?? 0) + 1;
|
|
@@ -75644,14 +75751,14 @@ function useTaskBoardKeyboard(o) {
|
|
|
75644
75751
|
},
|
|
75645
75752
|
[announce, cards, columns, lanes, columnTitle, text2]
|
|
75646
75753
|
);
|
|
75647
|
-
const setSelection = (0,
|
|
75754
|
+
const setSelection = (0, import_react310.useCallback)(
|
|
75648
75755
|
(ids) => {
|
|
75649
75756
|
if (o.selectedIds === void 0) setOwnSelection(ids);
|
|
75650
75757
|
o.onSelectionChange?.(ids);
|
|
75651
75758
|
},
|
|
75652
75759
|
[o]
|
|
75653
75760
|
);
|
|
75654
|
-
const focusStep = (0,
|
|
75761
|
+
const focusStep = (0, import_react310.useCallback)(
|
|
75655
75762
|
(from, dir) => {
|
|
75656
75763
|
const root = rootRef.current;
|
|
75657
75764
|
const bucket = from.closest("[data-bucket]");
|
|
@@ -75694,7 +75801,7 @@ function useTaskBoardKeyboard(o) {
|
|
|
75694
75801
|
return null;
|
|
75695
75802
|
}
|
|
75696
75803
|
};
|
|
75697
|
-
const cardProps = (0,
|
|
75804
|
+
const cardProps = (0, import_react310.useCallback)(
|
|
75698
75805
|
(card, slot) => ({
|
|
75699
75806
|
tabIndex: card.id === tabStop ? 0 : -1,
|
|
75700
75807
|
onFocus: () => setActiveId(card.id),
|
|
@@ -75797,22 +75904,22 @@ function useTaskBoardKeyboard(o) {
|
|
|
75797
75904
|
}
|
|
75798
75905
|
|
|
75799
75906
|
// src/components/TaskBoard/useTaskBoardColumnDrag.ts
|
|
75800
|
-
var
|
|
75907
|
+
var import_react311 = require("react");
|
|
75801
75908
|
var DRAG_THRESHOLD_PX2 = 4;
|
|
75802
75909
|
var isRtl2 = (el) => el?.closest("[dir]")?.getAttribute("dir") === "rtl";
|
|
75803
75910
|
function useTaskBoardColumnDrag(opts) {
|
|
75804
|
-
const [drag, setDrag] = (0,
|
|
75805
|
-
const optsRef = (0,
|
|
75911
|
+
const [drag, setDrag] = (0, import_react311.useState)(null);
|
|
75912
|
+
const optsRef = (0, import_react311.useRef)(opts);
|
|
75806
75913
|
optsRef.current = opts;
|
|
75807
|
-
const dragRef = (0,
|
|
75808
|
-
const cleanupRef = (0,
|
|
75809
|
-
const userSelectRef = (0,
|
|
75810
|
-
const refocusRef = (0,
|
|
75811
|
-
const set = (0,
|
|
75914
|
+
const dragRef = (0, import_react311.useRef)(null);
|
|
75915
|
+
const cleanupRef = (0, import_react311.useRef)(null);
|
|
75916
|
+
const userSelectRef = (0, import_react311.useRef)(null);
|
|
75917
|
+
const refocusRef = (0, import_react311.useRef)(null);
|
|
75918
|
+
const set = (0, import_react311.useCallback)((next) => {
|
|
75812
75919
|
dragRef.current = next;
|
|
75813
75920
|
setDrag(next);
|
|
75814
75921
|
}, []);
|
|
75815
|
-
const end = (0,
|
|
75922
|
+
const end = (0, import_react311.useCallback)(() => {
|
|
75816
75923
|
cleanupRef.current?.();
|
|
75817
75924
|
cleanupRef.current = null;
|
|
75818
75925
|
if (userSelectRef.current !== null) {
|
|
@@ -75820,11 +75927,11 @@ function useTaskBoardColumnDrag(opts) {
|
|
|
75820
75927
|
userSelectRef.current = null;
|
|
75821
75928
|
}
|
|
75822
75929
|
}, []);
|
|
75823
|
-
const cancel = (0,
|
|
75930
|
+
const cancel = (0, import_react311.useCallback)(() => {
|
|
75824
75931
|
end();
|
|
75825
75932
|
set(null);
|
|
75826
75933
|
}, [end, set]);
|
|
75827
|
-
const commit = (0,
|
|
75934
|
+
const commit = (0, import_react311.useCallback)(() => {
|
|
75828
75935
|
const d = dragRef.current;
|
|
75829
75936
|
end();
|
|
75830
75937
|
set(null);
|
|
@@ -75832,14 +75939,14 @@ function useTaskBoardColumnDrag(opts) {
|
|
|
75832
75939
|
optsRef.current.onCommit(moveColumn(optsRef.current.columns, d.id, d.to));
|
|
75833
75940
|
return true;
|
|
75834
75941
|
}, [end, set]);
|
|
75835
|
-
(0,
|
|
75942
|
+
(0, import_react311.useLayoutEffect)(() => {
|
|
75836
75943
|
const id = refocusRef.current;
|
|
75837
75944
|
if (!id) return;
|
|
75838
75945
|
refocusRef.current = null;
|
|
75839
75946
|
opts.rootRef.current?.querySelector(`[data-column-grip="${CSS.escape(id)}"]`)?.focus();
|
|
75840
75947
|
});
|
|
75841
|
-
(0,
|
|
75842
|
-
const startPointer = (0,
|
|
75948
|
+
(0, import_react311.useEffect)(() => () => end(), [end]);
|
|
75949
|
+
const startPointer = (0, import_react311.useCallback)(
|
|
75843
75950
|
(column, from, e) => {
|
|
75844
75951
|
if (!optsRef.current.enabled || e.button !== 0) return;
|
|
75845
75952
|
e.preventDefault();
|
|
@@ -75893,7 +76000,7 @@ function useTaskBoardColumnDrag(opts) {
|
|
|
75893
76000
|
},
|
|
75894
76001
|
[cancel, commit, end, set]
|
|
75895
76002
|
);
|
|
75896
|
-
const onGripKey = (0,
|
|
76003
|
+
const onGripKey = (0, import_react311.useCallback)(
|
|
75897
76004
|
(column, from, e) => {
|
|
75898
76005
|
const o = optsRef.current;
|
|
75899
76006
|
if (!o.enabled) return;
|
|
@@ -75929,11 +76036,11 @@ function useTaskBoardColumnDrag(opts) {
|
|
|
75929
76036
|
},
|
|
75930
76037
|
[cancel, commit, set]
|
|
75931
76038
|
);
|
|
75932
|
-
const previewColumns = (0,
|
|
76039
|
+
const previewColumns = (0, import_react311.useMemo)(
|
|
75933
76040
|
() => drag && drag.to !== drag.from ? moveColumn(opts.columns, drag.id, drag.to) : opts.columns,
|
|
75934
76041
|
[drag, opts.columns]
|
|
75935
76042
|
);
|
|
75936
|
-
const gripProps = (0,
|
|
76043
|
+
const gripProps = (0, import_react311.useCallback)(
|
|
75937
76044
|
(column, index) => ({
|
|
75938
76045
|
"data-column-grip": column.id,
|
|
75939
76046
|
"aria-label": opts.text("moveColumn", { name: column.title }),
|
|
@@ -75946,11 +76053,11 @@ function useTaskBoardColumnDrag(opts) {
|
|
|
75946
76053
|
}
|
|
75947
76054
|
|
|
75948
76055
|
// src/components/TaskBoard/useFlip.ts
|
|
75949
|
-
var
|
|
76056
|
+
var import_react312 = require("react");
|
|
75950
76057
|
function useFlip(rootRef, orderKey) {
|
|
75951
|
-
const positions = (0,
|
|
75952
|
-
const lastKey = (0,
|
|
75953
|
-
(0,
|
|
76058
|
+
const positions = (0, import_react312.useRef)(/* @__PURE__ */ new Map());
|
|
76059
|
+
const lastKey = (0, import_react312.useRef)(orderKey);
|
|
76060
|
+
(0, import_react312.useLayoutEffect)(() => {
|
|
75954
76061
|
const root = rootRef.current;
|
|
75955
76062
|
if (!root) return;
|
|
75956
76063
|
const reorder = lastKey.current !== orderKey;
|
|
@@ -75978,21 +76085,21 @@ function useFlip(rootRef, orderKey) {
|
|
|
75978
76085
|
}
|
|
75979
76086
|
|
|
75980
76087
|
// src/components/TaskBoard/useTaskBoardCollab.ts
|
|
75981
|
-
var
|
|
76088
|
+
var import_react313 = require("react");
|
|
75982
76089
|
var EXPIRE_TICK_MS = 1e3;
|
|
75983
76090
|
function useTaskBoardCollab(transport, currentUser) {
|
|
75984
|
-
const [presence, setPresence] = (0,
|
|
76091
|
+
const [presence, setPresence] = (0, import_react313.useState)(emptyPresence);
|
|
75985
76092
|
const active = Boolean(transport && currentUser);
|
|
75986
|
-
const mountedRef = (0,
|
|
75987
|
-
const userRef = (0,
|
|
76093
|
+
const mountedRef = (0, import_react313.useRef)(false);
|
|
76094
|
+
const userRef = (0, import_react313.useRef)(currentUser);
|
|
75988
76095
|
userRef.current = currentUser;
|
|
75989
|
-
const hoverRef = (0,
|
|
75990
|
-
const apply = (0,
|
|
76096
|
+
const hoverRef = (0, import_react313.useRef)({ last: 0, timer: null });
|
|
76097
|
+
const apply = (0, import_react313.useCallback)((event) => {
|
|
75991
76098
|
if (!mountedRef.current) return;
|
|
75992
76099
|
const now2 = Date.now();
|
|
75993
76100
|
setPresence((s) => presenceReducer(s, event, now2));
|
|
75994
76101
|
}, []);
|
|
75995
|
-
const send = (0,
|
|
76102
|
+
const send = (0, import_react313.useCallback)(
|
|
75996
76103
|
(event) => {
|
|
75997
76104
|
if (!transport) return;
|
|
75998
76105
|
safePublish(transport, event);
|
|
@@ -76001,7 +76108,7 @@ function useTaskBoardCollab(transport, currentUser) {
|
|
|
76001
76108
|
[transport, apply]
|
|
76002
76109
|
);
|
|
76003
76110
|
const userId = currentUser?.id;
|
|
76004
|
-
(0,
|
|
76111
|
+
(0, import_react313.useEffect)(() => {
|
|
76005
76112
|
if (!transport || !userId) return;
|
|
76006
76113
|
mountedRef.current = true;
|
|
76007
76114
|
const hello = () => {
|
|
@@ -76041,13 +76148,13 @@ function useTaskBoardCollab(transport, currentUser) {
|
|
|
76041
76148
|
setPresence(emptyPresence());
|
|
76042
76149
|
};
|
|
76043
76150
|
}, [transport, userId, apply, send]);
|
|
76044
|
-
const grab = (0,
|
|
76151
|
+
const grab = (0, import_react313.useCallback)(
|
|
76045
76152
|
(cardId) => {
|
|
76046
76153
|
if (userId) send({ type: "grab", userId, cardId, at: Date.now() });
|
|
76047
76154
|
},
|
|
76048
76155
|
[send, userId]
|
|
76049
76156
|
);
|
|
76050
|
-
const hover = (0,
|
|
76157
|
+
const hover = (0, import_react313.useCallback)(
|
|
76051
76158
|
(cardId, slot) => {
|
|
76052
76159
|
if (!userId) return;
|
|
76053
76160
|
const h = hoverRef.current;
|
|
@@ -76063,7 +76170,7 @@ function useTaskBoardCollab(transport, currentUser) {
|
|
|
76063
76170
|
},
|
|
76064
76171
|
[send, userId]
|
|
76065
76172
|
);
|
|
76066
|
-
const release = (0,
|
|
76173
|
+
const release = (0, import_react313.useCallback)(
|
|
76067
76174
|
(cardId, dropped) => {
|
|
76068
76175
|
if (!userId) return;
|
|
76069
76176
|
const h = hoverRef.current;
|
|
@@ -76073,16 +76180,16 @@ function useTaskBoardCollab(transport, currentUser) {
|
|
|
76073
76180
|
},
|
|
76074
76181
|
[send, userId]
|
|
76075
76182
|
);
|
|
76076
|
-
const peers = (0,
|
|
76183
|
+
const peers = (0, import_react313.useMemo)(
|
|
76077
76184
|
() => [...presence.peers.values()].map((p) => p.user).filter((u2) => u2.id !== userId),
|
|
76078
76185
|
[presence.peers, userId]
|
|
76079
76186
|
);
|
|
76080
|
-
const heldBy = (0,
|
|
76187
|
+
const heldBy = (0, import_react313.useMemo)(() => {
|
|
76081
76188
|
const m = /* @__PURE__ */ new Map();
|
|
76082
76189
|
for (const [cardId, h] of presence.holds) m.set(cardId, h.userId);
|
|
76083
76190
|
return m;
|
|
76084
76191
|
}, [presence.holds]);
|
|
76085
|
-
const userById = (0,
|
|
76192
|
+
const userById = (0, import_react313.useCallback)(
|
|
76086
76193
|
(id) => presence.peers.get(id)?.user ?? { id, name: id },
|
|
76087
76194
|
[presence.peers]
|
|
76088
76195
|
);
|
|
@@ -76098,15 +76205,15 @@ function safePublish(transport, event) {
|
|
|
76098
76205
|
}
|
|
76099
76206
|
|
|
76100
76207
|
// src/components/TaskBoard/TaskBoardRemoteGhosts.tsx
|
|
76101
|
-
var
|
|
76208
|
+
var import_react314 = require("react");
|
|
76102
76209
|
var import_react_dom19 = require("react-dom");
|
|
76103
76210
|
var import_classnames137 = __toESM(require("classnames"), 1);
|
|
76104
76211
|
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
76105
76212
|
var GHOST_HEIGHT = 40;
|
|
76106
76213
|
var TaskBoardRemoteGhosts = ({ rootRef, holds, selfId, cards, userById }) => {
|
|
76107
|
-
const [ghosts, setGhosts] = (0,
|
|
76108
|
-
const [tick, setTick] = (0,
|
|
76109
|
-
(0,
|
|
76214
|
+
const [ghosts, setGhosts] = (0, import_react314.useState)([]);
|
|
76215
|
+
const [tick, setTick] = (0, import_react314.useState)(0);
|
|
76216
|
+
(0, import_react314.useLayoutEffect)(() => {
|
|
76110
76217
|
const root = rootRef.current;
|
|
76111
76218
|
if (!root) return;
|
|
76112
76219
|
const bump = () => setTick((t) => t + 1);
|
|
@@ -76117,7 +76224,7 @@ var TaskBoardRemoteGhosts = ({ rootRef, holds, selfId, cards, userById }) => {
|
|
|
76117
76224
|
window.removeEventListener("resize", bump);
|
|
76118
76225
|
};
|
|
76119
76226
|
}, [rootRef]);
|
|
76120
|
-
(0,
|
|
76227
|
+
(0, import_react314.useLayoutEffect)(() => {
|
|
76121
76228
|
const root = rootRef.current;
|
|
76122
76229
|
if (!root) return;
|
|
76123
76230
|
const next = [];
|
|
@@ -76198,7 +76305,7 @@ var TaskBoardSkeleton = ({ columns, columnWidth, wellSurface, cornerClass }) =>
|
|
|
76198
76305
|
)) });
|
|
76199
76306
|
|
|
76200
76307
|
// src/components/TaskBoard/labels.ts
|
|
76201
|
-
var
|
|
76308
|
+
var import_react315 = require("react");
|
|
76202
76309
|
var KEYS = {
|
|
76203
76310
|
root: "kit.taskboard.root",
|
|
76204
76311
|
loading: "kit.taskboard.loading",
|
|
@@ -76244,7 +76351,7 @@ var KEYS = {
|
|
|
76244
76351
|
var interpolate = (s, values) => values ? s.replace(/\{(\w+)\}/g, (m, k) => k in values ? String(values[k]) : m) : s;
|
|
76245
76352
|
function useTaskBoardText(labels) {
|
|
76246
76353
|
const t = useKitT();
|
|
76247
|
-
return (0,
|
|
76354
|
+
return (0, import_react315.useCallback)(
|
|
76248
76355
|
(key, values) => {
|
|
76249
76356
|
const own = labels?.[key];
|
|
76250
76357
|
return own !== void 0 ? interpolate(own, values) : t(KEYS[key], values);
|
|
@@ -76310,7 +76417,7 @@ var TaskBoardBody = (props) => {
|
|
|
76310
76417
|
const resolvedColumnWidth = normalizedColumnWidth === "auto" || normalizedColumnWidth === "" || typeof normalizedColumnWidth === "number" && (!Number.isFinite(normalizedColumnWidth) || normalizedColumnWidth <= 0) ? sizeTokens12.columnWidth : normalizedColumnWidth;
|
|
76311
76418
|
const wellSurface = surface.translucent ? GLASS_WELL : SOLID_WELL;
|
|
76312
76419
|
const columnCornerClass = getSurfaceCornerClass(columnCorner);
|
|
76313
|
-
const rootRef = (0,
|
|
76420
|
+
const rootRef = (0, import_react316.useRef)(null);
|
|
76314
76421
|
const isEditable = editable ?? Boolean(onCardsChange);
|
|
76315
76422
|
const laneView = layout === "lanes" && Boolean(lanes?.length);
|
|
76316
76423
|
const viewLanes = laneView ? lanes : void 0;
|
|
@@ -76331,8 +76438,8 @@ var TaskBoardBody = (props) => {
|
|
|
76331
76438
|
onDragTarget: (cardId, slot) => slot && collab.hover(cardId, slot),
|
|
76332
76439
|
onDragEnd: collab.release
|
|
76333
76440
|
});
|
|
76334
|
-
const [notice, setNotice] = (0,
|
|
76335
|
-
(0,
|
|
76441
|
+
const [notice, setNotice] = (0, import_react316.useState)(null);
|
|
76442
|
+
(0, import_react316.useEffect)(() => {
|
|
76336
76443
|
if (!drag || !selfId) return;
|
|
76337
76444
|
const holder = collab.heldBy.get(drag.cardId);
|
|
76338
76445
|
if (!holder || holder === selfId) return;
|
|
@@ -76340,7 +76447,7 @@ var TaskBoardBody = (props) => {
|
|
|
76340
76447
|
cancel("held");
|
|
76341
76448
|
setNotice({ cardId: drag.cardId, text: text2("heldShort", { name: peer.name }), color: peer.color ?? peerColor(peer.id) });
|
|
76342
76449
|
}, [collab, drag, selfId, cancel, text2]);
|
|
76343
|
-
(0,
|
|
76450
|
+
(0, import_react316.useEffect)(() => {
|
|
76344
76451
|
if (!notice) return;
|
|
76345
76452
|
const t = setTimeout(() => setNotice(null), NOTICE_MS);
|
|
76346
76453
|
return () => clearTimeout(t);
|
|
@@ -76364,7 +76471,7 @@ var TaskBoardBody = (props) => {
|
|
|
76364
76471
|
selectedIds,
|
|
76365
76472
|
onSelectionChange
|
|
76366
76473
|
});
|
|
76367
|
-
const selected = (0,
|
|
76474
|
+
const selected = (0, import_react316.useMemo)(() => new Set(keyboard.selection), [keyboard.selection]);
|
|
76368
76475
|
const columnEditing = Boolean(editMode && onColumnsChange);
|
|
76369
76476
|
const columnDrag = useTaskBoardColumnDrag({
|
|
76370
76477
|
rootRef,
|
|
@@ -76376,20 +76483,20 @@ var TaskBoardBody = (props) => {
|
|
|
76376
76483
|
});
|
|
76377
76484
|
const viewColumns = columnDrag.previewColumns;
|
|
76378
76485
|
useFlip(rootRef, viewColumns.map((c) => c.id).join("|"));
|
|
76379
|
-
const editColumn = (0,
|
|
76486
|
+
const editColumn = (0, import_react316.useCallback)(
|
|
76380
76487
|
(next) => onColumnsChange?.(columns.map((c) => c.id === next.id ? next : c)),
|
|
76381
76488
|
[columns, onColumnsChange]
|
|
76382
76489
|
);
|
|
76383
76490
|
const addColumn = (title2) => onColumnsChange?.([...columns, { id: uniqueColumnId(title2, columns), title: title2 }]);
|
|
76384
76491
|
const keyboardProps = keyboard.cardProps;
|
|
76385
|
-
const heldPeer = (0,
|
|
76492
|
+
const heldPeer = (0, import_react316.useCallback)(
|
|
76386
76493
|
(cardId) => {
|
|
76387
76494
|
const holder = collab.heldBy.get(cardId);
|
|
76388
76495
|
return holder && holder !== selfId ? collab.userById(holder) : void 0;
|
|
76389
76496
|
},
|
|
76390
76497
|
[collab, selfId]
|
|
76391
76498
|
);
|
|
76392
|
-
const ctx = (0,
|
|
76499
|
+
const ctx = (0, import_react316.useMemo)(
|
|
76393
76500
|
() => ({
|
|
76394
76501
|
text: text2,
|
|
76395
76502
|
surface,
|
|
@@ -76427,7 +76534,7 @@ var TaskBoardBody = (props) => {
|
|
|
76427
76534
|
}),
|
|
76428
76535
|
[text2, surface, color2, sizeTokens12, resolvedColumnWidth, cardLayout, priorities, locale, isEditable, renderCard, onCardOpen, onCardContextMenu, onAddCard, wellSurface, columnCornerClass, columnEditing, columnDrag.gripProps, columnDrag.drag, editColumn, columns, maxItems, selected, drag, pending, cardHandlers, keyboardProps, heldPeer, notice]
|
|
76429
76536
|
);
|
|
76430
|
-
const buckets = (0,
|
|
76537
|
+
const buckets = (0, import_react316.useMemo)(() => bucketCards(previewCards, columns, viewLanes), [previewCards, columns, viewLanes]);
|
|
76431
76538
|
const draggedCard = drag ? cards.find((c) => c.id === drag.cardId) : void 0;
|
|
76432
76539
|
const toggleColumn = onColumnsChange ? (id) => onColumnsChange(columns.map((c) => c.id === id ? { ...c, collapsed: !c.collapsed } : c)) : void 0;
|
|
76433
76540
|
const toggleLane = onLanesChange && lanes ? (id) => onLanesChange(lanes.map((l) => l.id === id ? { ...l, collapsed: !l.collapsed } : l)) : void 0;
|
|
@@ -76579,7 +76686,7 @@ var TaskBoard = (props) => {
|
|
|
76579
76686
|
};
|
|
76580
76687
|
|
|
76581
76688
|
// src/components/GradientBackdrop/GradientBackdrop.tsx
|
|
76582
|
-
var
|
|
76689
|
+
var import_react317 = __toESM(require("react"), 1);
|
|
76583
76690
|
var import_classnames140 = __toESM(require("classnames"), 1);
|
|
76584
76691
|
|
|
76585
76692
|
// ../common/backdrop/color.ts
|
|
@@ -76715,10 +76822,10 @@ function gradientBackdropCss(colors3, s) {
|
|
|
76715
76822
|
// src/components/GradientBackdrop/GradientBackdrop.tsx
|
|
76716
76823
|
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
76717
76824
|
var GRADIENT_BACKDROP_SCHEMES = ["auto", "light", "dark"];
|
|
76718
|
-
var GradientBackdrop =
|
|
76825
|
+
var GradientBackdrop = import_react317.default.forwardRef(
|
|
76719
76826
|
({ theme = "slate", scheme = "auto", noise = false, noiseScale, className, style, children, ...rest }, ref) => {
|
|
76720
76827
|
const themeKey = typeof theme === "string" ? theme : JSON.stringify(theme);
|
|
76721
|
-
const resolved = (0,
|
|
76828
|
+
const resolved = (0, import_react317.useMemo)(() => {
|
|
76722
76829
|
const t = resolveGradientBackdropTheme(theme);
|
|
76723
76830
|
return { light: gradientBackdropCss(t.light, t.shape), dark: gradientBackdropCss(t.dark, t.shape) };
|
|
76724
76831
|
}, [themeKey]);
|
|
@@ -76767,10 +76874,10 @@ GradientBackdrop.displayName = "GradientBackdrop";
|
|
|
76767
76874
|
|
|
76768
76875
|
// src/components/Terminal/Terminal.tsx
|
|
76769
76876
|
var import_classnames141 = __toESM(require("classnames"), 1);
|
|
76770
|
-
var
|
|
76877
|
+
var import_react319 = require("react");
|
|
76771
76878
|
|
|
76772
76879
|
// src/components/Terminal/TerminalViewport.tsx
|
|
76773
|
-
var
|
|
76880
|
+
var import_react318 = require("react");
|
|
76774
76881
|
|
|
76775
76882
|
// src/components/Terminal/engine.ts
|
|
76776
76883
|
async function loadTerminalEngine() {
|
|
@@ -76829,28 +76936,28 @@ var TERMINAL_DARK_THEME = {
|
|
|
76829
76936
|
|
|
76830
76937
|
// src/components/Terminal/TerminalViewport.tsx
|
|
76831
76938
|
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
76832
|
-
var TerminalViewport = (0,
|
|
76833
|
-
const host = (0,
|
|
76834
|
-
const engine = (0,
|
|
76835
|
-
const fitAddon = (0,
|
|
76836
|
-
const [scroll, setScroll] = (0,
|
|
76939
|
+
var TerminalViewport = (0, import_react318.forwardRef)(function TerminalViewport2(props, ref) {
|
|
76940
|
+
const host = (0, import_react318.useRef)(null);
|
|
76941
|
+
const engine = (0, import_react318.useRef)(null);
|
|
76942
|
+
const fitAddon = (0, import_react318.useRef)(null);
|
|
76943
|
+
const [scroll, setScroll] = (0, import_react318.useState)({
|
|
76837
76944
|
contentSize: 0,
|
|
76838
76945
|
viewportSize: 0,
|
|
76839
76946
|
offset: 0
|
|
76840
76947
|
});
|
|
76841
|
-
const scrollTo = (0,
|
|
76948
|
+
const scrollTo = (0, import_react318.useCallback)(
|
|
76842
76949
|
(offset) => engine.current?.scrollToLine(Math.round(offset)),
|
|
76843
76950
|
[]
|
|
76844
76951
|
);
|
|
76845
|
-
const virtualScroll = (0,
|
|
76952
|
+
const virtualScroll = (0, import_react318.useMemo)(
|
|
76846
76953
|
() => ({ ...scroll, onScroll: scrollTo }),
|
|
76847
76954
|
[scroll, scrollTo]
|
|
76848
76955
|
);
|
|
76849
|
-
const latest = (0,
|
|
76956
|
+
const latest = (0, import_react318.useRef)(props);
|
|
76850
76957
|
latest.current = props;
|
|
76851
|
-
const initialData = (0,
|
|
76852
|
-
const pending = (0,
|
|
76853
|
-
const handle = (0,
|
|
76958
|
+
const initialData = (0, import_react318.useRef)(props.initialData);
|
|
76959
|
+
const pending = (0, import_react318.useRef)([]);
|
|
76960
|
+
const handle = (0, import_react318.useMemo)(
|
|
76854
76961
|
() => ({
|
|
76855
76962
|
write(data) {
|
|
76856
76963
|
if (engine.current) engine.current.write(data);
|
|
@@ -76878,7 +76985,7 @@ var TerminalViewport = (0, import_react317.forwardRef)(function TerminalViewport
|
|
|
76878
76985
|
}),
|
|
76879
76986
|
[]
|
|
76880
76987
|
);
|
|
76881
|
-
(0,
|
|
76988
|
+
(0, import_react318.useImperativeHandle)(ref, () => handle, [handle]);
|
|
76882
76989
|
const applyOptions = () => {
|
|
76883
76990
|
const term = engine.current;
|
|
76884
76991
|
if (!term) return;
|
|
@@ -76898,9 +77005,9 @@ var TerminalViewport = (0, import_react317.forwardRef)(function TerminalViewport
|
|
|
76898
77005
|
}
|
|
76899
77006
|
};
|
|
76900
77007
|
};
|
|
76901
|
-
const updateOptions = (0,
|
|
77008
|
+
const updateOptions = (0, import_react318.useRef)(applyOptions);
|
|
76902
77009
|
updateOptions.current = applyOptions;
|
|
76903
|
-
(0,
|
|
77010
|
+
(0, import_react318.useEffect)(() => {
|
|
76904
77011
|
let cancelled = false;
|
|
76905
77012
|
let initialized = false;
|
|
76906
77013
|
let instance;
|
|
@@ -76991,7 +77098,7 @@ var TerminalViewport = (0, import_react317.forwardRef)(function TerminalViewport
|
|
|
76991
77098
|
fitAddon.current = null;
|
|
76992
77099
|
};
|
|
76993
77100
|
}, [handle]);
|
|
76994
|
-
(0,
|
|
77101
|
+
(0, import_react318.useEffect)(() => {
|
|
76995
77102
|
updateOptions.current();
|
|
76996
77103
|
if (props.active !== false) handle.fit();
|
|
76997
77104
|
}, [
|
|
@@ -77027,7 +77134,7 @@ var TerminalViewport = (0, import_react317.forwardRef)(function TerminalViewport
|
|
|
77027
77134
|
|
|
77028
77135
|
// src/components/Terminal/Terminal.tsx
|
|
77029
77136
|
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
77030
|
-
var Terminal = (0,
|
|
77137
|
+
var Terminal = (0, import_react319.forwardRef)(
|
|
77031
77138
|
function Terminal2({
|
|
77032
77139
|
initialData,
|
|
77033
77140
|
readOnly,
|
|
@@ -77089,9 +77196,9 @@ var Terminal = (0, import_react318.forwardRef)(
|
|
|
77089
77196
|
|
|
77090
77197
|
// src/components/Terminal/TerminalTabs.tsx
|
|
77091
77198
|
var import_classnames142 = __toESM(require("classnames"), 1);
|
|
77092
|
-
var
|
|
77199
|
+
var import_react320 = require("react");
|
|
77093
77200
|
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
77094
|
-
var TerminalTabs = (0,
|
|
77201
|
+
var TerminalTabs = (0, import_react320.forwardRef)(
|
|
77095
77202
|
function TerminalTabs2({
|
|
77096
77203
|
sessions,
|
|
77097
77204
|
value,
|
|
@@ -77120,18 +77227,18 @@ var TerminalTabs = (0, import_react319.forwardRef)(
|
|
|
77120
77227
|
...surface
|
|
77121
77228
|
}, ref) {
|
|
77122
77229
|
const tone = getSurfaceAccentColor(surfaceTone);
|
|
77123
|
-
const prefix = (0,
|
|
77124
|
-
const [selected, setSelected] = (0,
|
|
77230
|
+
const prefix = (0, import_react320.useId)();
|
|
77231
|
+
const [selected, setSelected] = (0, import_react320.useState)(defaultValue ?? sessions[0]?.id);
|
|
77125
77232
|
const requested = value ?? selected;
|
|
77126
77233
|
const active = sessions.find((session) => session.id === requested) ?? sessions[0];
|
|
77127
77234
|
const activeId = active?.id;
|
|
77128
|
-
const handles = (0,
|
|
77129
|
-
(0,
|
|
77235
|
+
const handles = (0, import_react320.useRef)(/* @__PURE__ */ new Map());
|
|
77236
|
+
(0, import_react320.useImperativeHandle)(
|
|
77130
77237
|
ref,
|
|
77131
77238
|
() => ({ getSession: (id) => handles.current.get(id) }),
|
|
77132
77239
|
[]
|
|
77133
77240
|
);
|
|
77134
|
-
(0,
|
|
77241
|
+
(0, import_react320.useEffect)(() => {
|
|
77135
77242
|
if (value === void 0 && selected !== activeId) setSelected(activeId);
|
|
77136
77243
|
}, [value, selected, activeId]);
|
|
77137
77244
|
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
@@ -77271,18 +77378,18 @@ function hasZone(node) {
|
|
|
77271
77378
|
}
|
|
77272
77379
|
|
|
77273
77380
|
// src/components/Menu/Menu.tsx
|
|
77274
|
-
var
|
|
77381
|
+
var import_react322 = __toESM(require("react"), 1);
|
|
77275
77382
|
var import_react_router_dom3 = require("react-router-dom");
|
|
77276
77383
|
var import_classnames144 = __toESM(require("classnames"), 1);
|
|
77277
77384
|
|
|
77278
77385
|
// src/components/Menu/MenuPopup.tsx
|
|
77279
|
-
var
|
|
77386
|
+
var import_react321 = require("react");
|
|
77280
77387
|
var import_react_dom20 = require("react-dom");
|
|
77281
77388
|
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
77282
77389
|
function MenuPopup({ anchor, placement, width, children }) {
|
|
77283
|
-
const ref = (0,
|
|
77284
|
-
const [style, setStyle] = (0,
|
|
77285
|
-
(0,
|
|
77390
|
+
const ref = (0, import_react321.useRef)(null);
|
|
77391
|
+
const [style, setStyle] = (0, import_react321.useState)({ visibility: "hidden" });
|
|
77392
|
+
(0, import_react321.useLayoutEffect)(() => {
|
|
77286
77393
|
const update = () => {
|
|
77287
77394
|
if (!anchor.current || !ref.current) return;
|
|
77288
77395
|
const trigger = anchor.current.getBoundingClientRect();
|
|
@@ -77326,11 +77433,11 @@ var menuPadding = {
|
|
|
77326
77433
|
var rowSizes = { xs: "px-2 py-1 text-xs", sm: "px-2.5 py-1.5 text-xs", md: "px-3 py-2 text-sm", lg: "px-4 py-2.5 text-base", xl: "px-5 py-3 text-lg" };
|
|
77327
77434
|
var text = (item) => item.textValue ?? (typeof item.label === "string" ? item.label : item.id);
|
|
77328
77435
|
function MenuList({ items, state, depth = 0, parentLabel, onBack, focusOnMount = false, grouped = false }) {
|
|
77329
|
-
const list = (0,
|
|
77330
|
-
const buffer = (0,
|
|
77331
|
-
const timer = (0,
|
|
77436
|
+
const list = (0, import_react322.useRef)(null);
|
|
77437
|
+
const buffer = (0, import_react322.useRef)("");
|
|
77438
|
+
const timer = (0, import_react322.useRef)(void 0);
|
|
77332
77439
|
const actions = () => Array.from(list.current?.querySelectorAll("[data-menu-action]") ?? []).filter((el) => el.closest('[role="menu"]') === list.current && el.getAttribute("aria-disabled") !== "true");
|
|
77333
|
-
(0,
|
|
77440
|
+
(0, import_react322.useLayoutEffect)(() => {
|
|
77334
77441
|
if (grouped) return;
|
|
77335
77442
|
const entries = actions();
|
|
77336
77443
|
const selected = entries.find((el) => el === document.activeElement) ?? entries[0];
|
|
@@ -77338,12 +77445,12 @@ function MenuList({ items, state, depth = 0, parentLabel, onBack, focusOnMount =
|
|
|
77338
77445
|
el.tabIndex = el === selected ? 0 : -1;
|
|
77339
77446
|
});
|
|
77340
77447
|
}, [items, grouped]);
|
|
77341
|
-
(0,
|
|
77448
|
+
(0, import_react322.useLayoutEffect)(() => {
|
|
77342
77449
|
if (!focusOnMount) return;
|
|
77343
77450
|
const frame = requestAnimationFrame(() => actions()[0]?.focus());
|
|
77344
77451
|
return () => cancelAnimationFrame(frame);
|
|
77345
77452
|
}, [focusOnMount]);
|
|
77346
|
-
(0,
|
|
77453
|
+
(0, import_react322.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
77347
77454
|
return /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
|
|
77348
77455
|
"ul",
|
|
77349
77456
|
{
|
|
@@ -77403,13 +77510,13 @@ function MenuList({ items, state, depth = 0, parentLabel, onBack, focusOnMount =
|
|
|
77403
77510
|
);
|
|
77404
77511
|
}
|
|
77405
77512
|
function MenuRow({ item, state, depth }) {
|
|
77406
|
-
const anchor = (0,
|
|
77513
|
+
const anchor = (0, import_react322.useRef)(null);
|
|
77407
77514
|
const { props } = state;
|
|
77408
77515
|
const tiered = (item.submenuMode ?? props.submenuMode) === "tiered";
|
|
77409
77516
|
const nested = Boolean(item.items?.some((child) => !child.hidden) || item.content != null);
|
|
77410
77517
|
const expanded = tiered ? state.path[depth] === item.id : state.expanded.includes(item.id);
|
|
77411
77518
|
const label = text(item);
|
|
77412
|
-
const id = (0,
|
|
77519
|
+
const id = (0, import_react322.useId)();
|
|
77413
77520
|
const open = (keyboard) => {
|
|
77414
77521
|
if (item.disabled || !nested) return;
|
|
77415
77522
|
state.keyboard.current = keyboard;
|
|
@@ -77448,7 +77555,7 @@ function MenuRow({ item, state, depth }) {
|
|
|
77448
77555
|
if (item.closeOnSelect ?? !checkable) state.close(true);
|
|
77449
77556
|
};
|
|
77450
77557
|
const content = props.renderItem?.(item, { expanded, checked: Boolean(item.checked) }) ?? /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(import_jsx_runtime346.Fragment, { children: [
|
|
77451
|
-
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { "aria-hidden": "true", className: "inline-flex h-5 w-5 shrink-0 items-center justify-center", children: checkable ? item.checked && (item.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current" }) : /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(CustomIcon_default, { icon: "Check", size: "sm" })) :
|
|
77558
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { "aria-hidden": "true", className: "inline-flex h-5 w-5 shrink-0 items-center justify-center", children: checkable ? item.checked && (item.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current" }) : /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(CustomIcon_default, { icon: "Check", size: "sm" })) : import_react322.default.isValidElement(item.icon) ? item.icon : typeof item.icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(CustomIcon_default, { icon: item.icon, size: "sm" }) : null }),
|
|
77452
77559
|
/* @__PURE__ */ (0, import_jsx_runtime346.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
77453
77560
|
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "block truncate", children: item.label }),
|
|
77454
77561
|
item.description && /* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "block text-xs font-normal opacity-70", children: item.description })
|
|
@@ -77541,18 +77648,18 @@ function MenuSurface({ state, children, root = false }) {
|
|
|
77541
77648
|
) });
|
|
77542
77649
|
}
|
|
77543
77650
|
function Menu(props) {
|
|
77544
|
-
const owner = (0,
|
|
77545
|
-
const triggerRef = (0,
|
|
77651
|
+
const owner = (0, import_react322.useId)();
|
|
77652
|
+
const triggerRef = (0, import_react322.useRef)(null);
|
|
77546
77653
|
const anchor = props.anchorRef ?? triggerRef;
|
|
77547
77654
|
const popup = props.popup ?? Boolean(props.trigger || props.anchorRef);
|
|
77548
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
77655
|
+
const [internalOpen, setInternalOpen] = (0, import_react322.useState)(props.defaultOpen ?? false);
|
|
77549
77656
|
const open = props.open ?? internalOpen;
|
|
77550
|
-
const [expanded, setExpanded] = (0,
|
|
77551
|
-
const [path, setPath] = (0,
|
|
77552
|
-
const keyboard = (0,
|
|
77553
|
-
const leave = (0,
|
|
77554
|
-
const cancelLeave = (0,
|
|
77555
|
-
const requestOpen = (0,
|
|
77657
|
+
const [expanded, setExpanded] = (0, import_react322.useState)(props.defaultExpandedKeys ?? []);
|
|
77658
|
+
const [path, setPath] = (0, import_react322.useState)([]);
|
|
77659
|
+
const keyboard = (0, import_react322.useRef)(false);
|
|
77660
|
+
const leave = (0, import_react322.useRef)(void 0);
|
|
77661
|
+
const cancelLeave = (0, import_react322.useCallback)(() => clearTimeout(leave.current), []);
|
|
77662
|
+
const requestOpen = (0, import_react322.useCallback)((value) => {
|
|
77556
77663
|
if (props.open === void 0) setInternalOpen(value);
|
|
77557
77664
|
props.onOpenChange?.(value);
|
|
77558
77665
|
if (!value) setPath([]);
|
|
@@ -77568,7 +77675,7 @@ function Menu(props) {
|
|
|
77568
77675
|
}
|
|
77569
77676
|
}
|
|
77570
77677
|
};
|
|
77571
|
-
(0,
|
|
77678
|
+
(0, import_react322.useEffect)(() => {
|
|
77572
77679
|
if (popup ? !open : path.length === 0) return;
|
|
77573
77680
|
const outside = (event) => {
|
|
77574
77681
|
const target = event.target;
|
|
@@ -77579,7 +77686,7 @@ function Menu(props) {
|
|
|
77579
77686
|
document.addEventListener("pointerdown", outside);
|
|
77580
77687
|
return () => document.removeEventListener("pointerdown", outside);
|
|
77581
77688
|
}, [popup, open, path.length, anchor, owner, requestOpen]);
|
|
77582
|
-
(0,
|
|
77689
|
+
(0, import_react322.useEffect)(() => () => clearTimeout(leave.current), []);
|
|
77583
77690
|
const state = {
|
|
77584
77691
|
owner,
|
|
77585
77692
|
props,
|
|
@@ -77604,8 +77711,8 @@ function Menu(props) {
|
|
|
77604
77711
|
let trigger = null;
|
|
77605
77712
|
if (props.trigger) {
|
|
77606
77713
|
const original = props.trigger.props;
|
|
77607
|
-
const originalRef = Number(
|
|
77608
|
-
trigger = (0,
|
|
77714
|
+
const originalRef = Number(import_react322.default.version.split(".")[0]) >= 19 ? original.ref : props.trigger.ref;
|
|
77715
|
+
trigger = (0, import_react322.cloneElement)(props.trigger, {
|
|
77609
77716
|
ref: (el) => {
|
|
77610
77717
|
triggerRef.current = el;
|
|
77611
77718
|
if (typeof originalRef === "function") originalRef(el);
|
|
@@ -77634,7 +77741,7 @@ function Menu(props) {
|
|
|
77634
77741
|
}
|
|
77635
77742
|
|
|
77636
77743
|
// src/components/FileUpload/FileUpload.tsx
|
|
77637
|
-
var
|
|
77744
|
+
var import_react324 = require("react");
|
|
77638
77745
|
var import_classnames145 = __toESM(require("classnames"), 1);
|
|
77639
77746
|
|
|
77640
77747
|
// src/components/FileUpload/fileSelection.ts
|
|
@@ -77677,12 +77784,12 @@ var uploadSizeTokens = {
|
|
|
77677
77784
|
};
|
|
77678
77785
|
|
|
77679
77786
|
// src/components/FileUpload/ImagePreview.tsx
|
|
77680
|
-
var
|
|
77787
|
+
var import_react323 = require("react");
|
|
77681
77788
|
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
77682
77789
|
function ImagePreview({ file, src, alt, className }) {
|
|
77683
|
-
const [preview, setPreview] = (0,
|
|
77684
|
-
const [failed, setFailed] = (0,
|
|
77685
|
-
(0,
|
|
77790
|
+
const [preview, setPreview] = (0, import_react323.useState)(null);
|
|
77791
|
+
const [failed, setFailed] = (0, import_react323.useState)(null);
|
|
77792
|
+
(0, import_react323.useEffect)(() => {
|
|
77686
77793
|
if (!file) return;
|
|
77687
77794
|
let active = true;
|
|
77688
77795
|
let url2;
|
|
@@ -77723,12 +77830,12 @@ var defaultLabels = {
|
|
|
77723
77830
|
};
|
|
77724
77831
|
function FileUpload({ embedded = false, compact: compact2 = false, value, defaultValue = [], onChange, onReject, accept, maxSize, multiple = false, maxFiles = 20, size = "md", disabled = false, loading = false, error, preview = true, labels: overrides, rejectionMessage, className, "aria-label": ariaLabel, ...surface }) {
|
|
77725
77832
|
const density = uploadSizeTokens[size];
|
|
77726
|
-
const [internal, setInternal] = (0,
|
|
77727
|
-
const [rejections, setRejections] = (0,
|
|
77728
|
-
const [dragging, setDragging] = (0,
|
|
77729
|
-
const depth = (0,
|
|
77730
|
-
const input = (0,
|
|
77731
|
-
const id = (0,
|
|
77833
|
+
const [internal, setInternal] = (0, import_react324.useState)(defaultValue);
|
|
77834
|
+
const [rejections, setRejections] = (0, import_react324.useState)([]);
|
|
77835
|
+
const [dragging, setDragging] = (0, import_react324.useState)(false);
|
|
77836
|
+
const depth = (0, import_react324.useRef)(0);
|
|
77837
|
+
const input = (0, import_react324.useRef)(null);
|
|
77838
|
+
const id = (0, import_react324.useId)();
|
|
77732
77839
|
const files = value ?? internal;
|
|
77733
77840
|
const locked = disabled || loading;
|
|
77734
77841
|
const labels = { ...defaultLabels, ...overrides };
|
|
@@ -77811,7 +77918,7 @@ function FileUpload({ embedded = false, compact: compact2 = false, value, defaul
|
|
|
77811
77918
|
}
|
|
77812
77919
|
|
|
77813
77920
|
// src/components/IdentityPicker/IdentityPicker.tsx
|
|
77814
|
-
var
|
|
77921
|
+
var import_react325 = require("react");
|
|
77815
77922
|
var import_classnames146 = __toESM(require("classnames"), 1);
|
|
77816
77923
|
|
|
77817
77924
|
// src/components/IdentityPicker/sizeTokens.ts
|
|
@@ -78006,10 +78113,10 @@ function IdentityPicker({
|
|
|
78006
78113
|
const spacing = compact2 ? compactIdentitySpacing[size] : density;
|
|
78007
78114
|
const monogramLayout = compact2 ? (0, import_classnames146.default)("flex flex-wrap items-end gap-2", spacing.panel.split(" ").filter((token) => !token.startsWith("space-y-"))) : spacing.panel;
|
|
78008
78115
|
const categoryLineHeight = size === "xs" || size === "sm" ? "1rem" : size === "md" ? "1.25rem" : "1.5rem";
|
|
78009
|
-
const tabsId = (0,
|
|
78010
|
-
const [internal, setInternal] = (0,
|
|
78011
|
-
const [query, setQuery] = (0,
|
|
78012
|
-
const [category, setCategory] = (0,
|
|
78116
|
+
const tabsId = (0, import_react325.useId)();
|
|
78117
|
+
const [internal, setInternal] = (0, import_react325.useState)(defaultValue);
|
|
78118
|
+
const [query, setQuery] = (0, import_react325.useState)("");
|
|
78119
|
+
const [category, setCategory] = (0, import_react325.useState)("recommended");
|
|
78013
78120
|
const selected = value === void 0 ? internal : value;
|
|
78014
78121
|
const labels = { ...defaults, ...overrides };
|
|
78015
78122
|
const locked = disabled || loading;
|
|
@@ -78143,7 +78250,7 @@ function IdentityPicker({
|
|
|
78143
78250
|
}
|
|
78144
78251
|
|
|
78145
78252
|
// src/components/DotStepper/DotStepper.tsx
|
|
78146
|
-
var
|
|
78253
|
+
var import_react326 = __toESM(require("react"), 1);
|
|
78147
78254
|
var import_classnames147 = __toESM(require("classnames"), 1);
|
|
78148
78255
|
|
|
78149
78256
|
// src/components/DotStepper/plan.ts
|
|
@@ -78177,13 +78284,13 @@ var sizes = {
|
|
|
78177
78284
|
lg: { target: "h-8 w-8", dot: "h-4 w-4", gap: "gap-1", stack: "w-5" },
|
|
78178
78285
|
xl: { target: "h-10 w-10", dot: "h-5 w-5", gap: "gap-1.5", stack: "w-6" }
|
|
78179
78286
|
};
|
|
78180
|
-
var DotTrigger = (0,
|
|
78287
|
+
var DotTrigger = (0, import_react326.forwardRef)(function DotTrigger2({ tooltip, ...props }, ref) {
|
|
78181
78288
|
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(TooltipWrapper_default, { text: tooltip, children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("button", { ...props, ref }) });
|
|
78182
78289
|
});
|
|
78183
78290
|
function ActivePopover({ trigger, content, options }) {
|
|
78184
|
-
const [open, setOpen] = (0,
|
|
78291
|
+
const [open, setOpen] = (0, import_react326.useState)(false);
|
|
78185
78292
|
const { onOpenChange, ...rest } = options ?? {};
|
|
78186
|
-
const anchor =
|
|
78293
|
+
const anchor = import_react326.default.cloneElement(trigger, { tooltip: open ? void 0 : trigger.props.tooltip });
|
|
78187
78294
|
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(Popover_default, { ...rest, trigger: anchor, visible: open, onOpenChange: (value) => {
|
|
78188
78295
|
setOpen(value);
|
|
78189
78296
|
onOpenChange?.(value);
|
|
@@ -78208,14 +78315,14 @@ function DotStepper({ steps, currentIndex, currentStepId, maxVisible = 5, size =
|
|
|
78208
78315
|
active && animated && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("span", { "data-dot-pulse": "", className: (0, import_classnames147.default)("pointer-events-none absolute inset-0 rounded-full motion-safe:animate-ping [animation-duration:1.6s] motion-reduce:hidden", getTrueColorDotClass(tone)) }),
|
|
78209
78316
|
/* @__PURE__ */ (0, import_jsx_runtime350.jsx)("span", { "data-dot-status": status, className: (0, import_classnames147.default)("absolute inset-0 rounded-full", fill(status)) })
|
|
78210
78317
|
] }) });
|
|
78211
|
-
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
78318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(import_react326.default.Fragment, { children: content !== void 0 && content !== null ? /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(ActivePopover, { trigger, content, options: popoverProps }) : trigger }, `${step.id ?? index}:${status}:${locked ? "disabled" : "enabled"}`);
|
|
78212
78319
|
}),
|
|
78213
78320
|
overflow("after", plan.after)
|
|
78214
78321
|
] }) });
|
|
78215
78322
|
}
|
|
78216
78323
|
|
|
78217
78324
|
// src/components/knowledge/shared.tsx
|
|
78218
|
-
var
|
|
78325
|
+
var import_react327 = require("react");
|
|
78219
78326
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
78220
78327
|
var MESSAGE_KEYS = {
|
|
78221
78328
|
"library": "kit.knowledge.library",
|
|
@@ -78274,7 +78381,7 @@ function useKnowledgeCopy(labels) {
|
|
|
78274
78381
|
return (key) => labels?.[key] ?? t(MESSAGE_KEYS[key]);
|
|
78275
78382
|
}
|
|
78276
78383
|
function useKnowledgeState(value, initial, onChange) {
|
|
78277
|
-
const [internal, setInternal] = (0,
|
|
78384
|
+
const [internal, setInternal] = (0, import_react327.useState)(initial);
|
|
78278
78385
|
return [value === void 0 ? internal : value, (next) => {
|
|
78279
78386
|
if (value === void 0) setInternal(next);
|
|
78280
78387
|
onChange?.(next);
|
|
@@ -78331,7 +78438,7 @@ function MemoryCard({
|
|
|
78331
78438
|
}
|
|
78332
78439
|
|
|
78333
78440
|
// src/components/knowledge/MemoryLibrary.tsx
|
|
78334
|
-
var
|
|
78441
|
+
var import_react328 = require("react");
|
|
78335
78442
|
|
|
78336
78443
|
// ../common/knowledge/model.ts
|
|
78337
78444
|
var MEMORY_KINDS = ["lesson", "decision", "convention", "pitfall", "code", "documentation"];
|
|
@@ -78445,10 +78552,10 @@ function MemoryLibrary({
|
|
|
78445
78552
|
const [filters, setFilters] = useKnowledgeState(filtersProp, defaultFilters, onFiltersChange);
|
|
78446
78553
|
const [selection, select] = useKnowledgeState(selectedId, defaultSelectedId, onSelectionChange);
|
|
78447
78554
|
const [view, setView] = useKnowledgeState(viewProp, defaultView, onViewChange);
|
|
78448
|
-
const visible = (0,
|
|
78449
|
-
const topics = (0,
|
|
78450
|
-
const highlighted = (0,
|
|
78451
|
-
const groups = (0,
|
|
78555
|
+
const visible = (0, import_react328.useMemo)(() => remote ? [...memories] : filterMemories(memories, query, filters), [memories, query, filters, remote]);
|
|
78556
|
+
const topics = (0, import_react328.useMemo)(() => [...new Set(memories.flatMap((memory) => memory.topic ? [memory.topic] : []))].sort(), [memories]);
|
|
78557
|
+
const highlighted = (0, import_react328.useMemo)(() => new Set(highlightedIds), [highlightedIds]);
|
|
78558
|
+
const groups = (0, import_react328.useMemo)(() => {
|
|
78452
78559
|
const result = /* @__PURE__ */ new Map();
|
|
78453
78560
|
for (const memory of visible) {
|
|
78454
78561
|
const key = groupByTopic ? memory.topic ?? "" : "";
|
|
@@ -78572,7 +78679,7 @@ function MemoryDetail({
|
|
|
78572
78679
|
}
|
|
78573
78680
|
|
|
78574
78681
|
// src/components/knowledge/KnowledgeMap.tsx
|
|
78575
|
-
var
|
|
78682
|
+
var import_react329 = require("react");
|
|
78576
78683
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
78577
78684
|
var COLORS = ["#0891b2", "#d97706", "#059669", "#e11d48", "#6366f1", "#8b5cf6"];
|
|
78578
78685
|
var PAGE_SIZE = 24;
|
|
@@ -78597,15 +78704,15 @@ function KnowledgeMap({
|
|
|
78597
78704
|
disabled = false,
|
|
78598
78705
|
...surface
|
|
78599
78706
|
}) {
|
|
78600
|
-
const copy = useKnowledgeCopy(labels), helpId = (0,
|
|
78601
|
-
const scene = (0,
|
|
78707
|
+
const copy = useKnowledgeCopy(labels), helpId = (0, import_react329.useId)();
|
|
78708
|
+
const scene = (0, import_react329.useMemo)(() => buildKnowledgeScene(memories, points), [memories, points]);
|
|
78602
78709
|
const [selection, select] = useKnowledgeState(selectedId, defaultSelectedId, onSelectionChange);
|
|
78603
|
-
const canvasRef = (0,
|
|
78604
|
-
const drag = (0,
|
|
78605
|
-
const [camera, setCamera] = (0,
|
|
78606
|
-
const [query, setQuery] = (0,
|
|
78607
|
-
const highlighted = (0,
|
|
78608
|
-
const clusters = (0,
|
|
78710
|
+
const canvasRef = (0, import_react329.useRef)(null), hostRef = (0, import_react329.useRef)(null);
|
|
78711
|
+
const drag = (0, import_react329.useRef)(null);
|
|
78712
|
+
const [camera, setCamera] = (0, import_react329.useState)(INITIAL_CAMERA), [size, setSize] = (0, import_react329.useState)({ width: 640, height });
|
|
78713
|
+
const [query, setQuery] = (0, import_react329.useState)(""), [page, setPage] = (0, import_react329.useState)(0);
|
|
78714
|
+
const highlighted = (0, import_react329.useMemo)(() => new Set(highlightedIds), [highlightedIds]);
|
|
78715
|
+
const clusters = (0, import_react329.useMemo)(() => {
|
|
78609
78716
|
const groups = /* @__PURE__ */ new Map();
|
|
78610
78717
|
const names = [...new Set(scene.points.map((point) => point.clusterId))].sort();
|
|
78611
78718
|
const colors3 = new Map(names.map((name, index) => [name, COLORS[index % COLORS.length]]));
|
|
@@ -78622,7 +78729,7 @@ function KnowledgeMap({
|
|
|
78622
78729
|
}
|
|
78623
78730
|
return groups;
|
|
78624
78731
|
}, [scene]);
|
|
78625
|
-
const geometry = (0,
|
|
78732
|
+
const geometry = (0, import_react329.useMemo)(() => {
|
|
78626
78733
|
const byId = new Map(scene.points.map((point) => [point.memoryId, point]));
|
|
78627
78734
|
const diagnostics = [...scene.diagnostics];
|
|
78628
78735
|
const edges = relationships.flatMap((edge) => {
|
|
@@ -78635,10 +78742,10 @@ function KnowledgeMap({
|
|
|
78635
78742
|
});
|
|
78636
78743
|
return { edges, diagnostics };
|
|
78637
78744
|
}, [scene, relationships]);
|
|
78638
|
-
(0,
|
|
78745
|
+
(0, import_react329.useEffect)(() => {
|
|
78639
78746
|
onDiagnostics?.(geometry.diagnostics);
|
|
78640
78747
|
}, [geometry.diagnostics, onDiagnostics]);
|
|
78641
|
-
(0,
|
|
78748
|
+
(0, import_react329.useEffect)(() => {
|
|
78642
78749
|
const host = hostRef.current;
|
|
78643
78750
|
if (!host) return;
|
|
78644
78751
|
const update = () => setSize({ width: Math.max(1, host.clientWidth), height: Math.max(120, height) });
|
|
@@ -78648,7 +78755,7 @@ function KnowledgeMap({
|
|
|
78648
78755
|
observer.observe(host);
|
|
78649
78756
|
return () => observer.disconnect();
|
|
78650
78757
|
}, [height]);
|
|
78651
|
-
const bounds = (0,
|
|
78758
|
+
const bounds = (0, import_react329.useMemo)(() => {
|
|
78652
78759
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
78653
78760
|
for (const point of scene.points) {
|
|
78654
78761
|
minX = Math.min(minX, point.x);
|
|
@@ -78659,11 +78766,11 @@ function KnowledgeMap({
|
|
|
78659
78766
|
return scene.points.length ? { x: (minX + maxX) / 2, y: (minY + maxY) / 2, width: Math.max(80, maxX - minX), height: Math.max(80, maxY - minY) } : { x: 0, y: 0, width: 640, height: 360 };
|
|
78660
78767
|
}, [scene]);
|
|
78661
78768
|
const fitZoom = Math.max(1e-6, Math.min((size.width - 100) / bounds.width, (size.height - 100) / bounds.height, 3));
|
|
78662
|
-
const transform = (0,
|
|
78769
|
+
const transform = (0, import_react329.useCallback)((point) => ({
|
|
78663
78770
|
x: (point.x - bounds.x) * fitZoom * camera.zoom + size.width / 2 + camera.x,
|
|
78664
78771
|
y: (point.y - bounds.y) * fitZoom * camera.zoom + size.height / 2 + camera.y
|
|
78665
78772
|
}), [bounds, fitZoom, camera, size]);
|
|
78666
|
-
(0,
|
|
78773
|
+
(0, import_react329.useEffect)(() => {
|
|
78667
78774
|
const canvas = canvasRef.current;
|
|
78668
78775
|
if (!canvas) return;
|
|
78669
78776
|
const ctx = canvas.getContext("2d");
|
|
@@ -78737,12 +78844,12 @@ function KnowledgeMap({
|
|
|
78737
78844
|
ctx.globalAlpha = 1;
|
|
78738
78845
|
}
|
|
78739
78846
|
});
|
|
78740
|
-
(0,
|
|
78847
|
+
(0, import_react329.useEffect)(() => {
|
|
78741
78848
|
const observer = new MutationObserver(() => setSize((value) => ({ ...value })));
|
|
78742
78849
|
for (let node = hostRef.current; node; node = node.parentElement) observer.observe(node, { attributes: true, attributeFilter: ["class", "data-color-scheme", "style"] });
|
|
78743
78850
|
return () => observer.disconnect();
|
|
78744
78851
|
}, []);
|
|
78745
|
-
const zoom = (0,
|
|
78852
|
+
const zoom = (0, import_react329.useCallback)((factor, anchor = { x: size.width / 2, y: size.height / 2 }) => setCamera((current) => {
|
|
78746
78853
|
const next = Math.max(0.25, Math.min(24, current.zoom * factor)), scale = next / current.zoom;
|
|
78747
78854
|
return {
|
|
78748
78855
|
zoom: next,
|
|
@@ -78750,7 +78857,7 @@ function KnowledgeMap({
|
|
|
78750
78857
|
y: anchor.y - size.height / 2 - (anchor.y - size.height / 2 - current.y) * scale
|
|
78751
78858
|
};
|
|
78752
78859
|
}), [size.width, size.height]);
|
|
78753
|
-
(0,
|
|
78860
|
+
(0, import_react329.useEffect)(() => {
|
|
78754
78861
|
const canvas = canvasRef.current;
|
|
78755
78862
|
if (!canvas) return;
|
|
78756
78863
|
const wheel = (event) => {
|
|
@@ -78773,7 +78880,7 @@ function KnowledgeMap({
|
|
|
78773
78880
|
}
|
|
78774
78881
|
return nearest;
|
|
78775
78882
|
}
|
|
78776
|
-
const matches = (0,
|
|
78883
|
+
const matches = (0, import_react329.useMemo)(() => scene.points.filter((point) => (!selectedTopic || point.memory.topic === selectedTopic) && `${point.memory.title} ${point.memory.topic ?? ""}`.toLocaleLowerCase().includes(query.toLocaleLowerCase())), [scene, query, selectedTopic]);
|
|
78777
78884
|
const lastPage = Math.max(0, Math.ceil(matches.length / PAGE_SIZE) - 1), currentPage = Math.min(page, lastPage);
|
|
78778
78885
|
const selectableRelationships = geometry.edges.filter((edge) => edge.source.memoryId === selection || edge.target.memoryId === selection);
|
|
78779
78886
|
return /* @__PURE__ */ (0, import_jsx_runtime355.jsxs)(Panel_default, { tone: "none", variant: "outlined", padding: "none", loading, disabled, ...surface, className: `kit-knowledge kit-knowledge-map ${className}`, "aria-busy": loading, children: [
|
|
@@ -78881,7 +78988,7 @@ function KnowledgeMap({
|
|
|
78881
78988
|
}
|
|
78882
78989
|
|
|
78883
78990
|
// src/components/knowledge/KnowledgeExplorer.tsx
|
|
78884
|
-
var
|
|
78991
|
+
var import_react330 = require("react");
|
|
78885
78992
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
78886
78993
|
function KnowledgeExplorer({
|
|
78887
78994
|
memories,
|
|
@@ -78917,14 +79024,14 @@ function KnowledgeExplorer({
|
|
|
78917
79024
|
const [query, setQuery] = useKnowledgeState(queryProp, defaultQuery, onQueryChange);
|
|
78918
79025
|
const [filters, setFilters] = useKnowledgeState(filtersProp, defaultFilters, onFiltersChange);
|
|
78919
79026
|
const [traceId, selectTrace] = useKnowledgeState(traceIdProp, defaultSelectedTraceId, onTraceSelectionChange);
|
|
78920
|
-
const [mobileView, setMobileView] = (0,
|
|
78921
|
-
const records = (0,
|
|
79027
|
+
const [mobileView, setMobileView] = (0, import_react330.useState)("library");
|
|
79028
|
+
const records = (0, import_react330.useMemo)(() => new Map(memories.map((memory) => [memory.id, memory])), [memories]);
|
|
78922
79029
|
const selectedMemory = selection ? records.get(selection) ?? null : null;
|
|
78923
|
-
const highlightedIds = (0,
|
|
78924
|
-
const linkedTraceIds = (0,
|
|
78925
|
-
const linkedNodes = (0,
|
|
78926
|
-
const traceNodes = (0,
|
|
78927
|
-
const matchingIds = (0,
|
|
79030
|
+
const highlightedIds = (0, import_react330.useMemo)(() => [...new Set(traceLinks.filter((link) => link.traceNodeId === traceId && records.has(link.memoryId)).map((link) => link.memoryId))], [traceLinks, traceId, records]);
|
|
79031
|
+
const linkedTraceIds = (0, import_react330.useMemo)(() => new Set(traceLinks.filter((link) => link.memoryId === selection).map((link) => link.traceNodeId)), [traceLinks, selection]);
|
|
79032
|
+
const linkedNodes = (0, import_react330.useMemo)(() => trace?.nodes.filter((node) => linkedTraceIds.has(node.id)) ?? [], [trace?.nodes, linkedTraceIds]);
|
|
79033
|
+
const traceNodes = (0, import_react330.useMemo)(() => trace?.nodes.map((node) => linkedTraceIds.has(node.id) ? { ...node, tone: "cyan" } : node) ?? [], [trace?.nodes, linkedTraceIds]);
|
|
79034
|
+
const matchingIds = (0, import_react330.useMemo)(() => filterMemories(memories, query, filters).map((memory) => memory.id), [memories, query, filters]);
|
|
78928
79035
|
const enabled = ["library", "map", "detail", "trace"].filter((region) => regions?.[region] !== false && (region !== "trace" || !!trace || !!renderRegion?.trace));
|
|
78929
79036
|
const view = enabled.includes(mobileView) ? mobileView : enabled[0];
|
|
78930
79037
|
const context = { selectedMemory, selectedId: selection, selectMemory: select, query, setQuery, filters, setFilters, highlightedIds, selectedTraceId: traceId, selectTrace };
|
|
@@ -79009,7 +79116,7 @@ function ContentActions({
|
|
|
79009
79116
|
var ContentActions_default = ContentActions;
|
|
79010
79117
|
|
|
79011
79118
|
// src/components/CodeBlock.tsx
|
|
79012
|
-
var
|
|
79119
|
+
var import_react331 = __toESM(require("react"), 1);
|
|
79013
79120
|
var import_refractor = require("refractor");
|
|
79014
79121
|
var import_tsx = __toESM(require("refractor/tsx"), 1);
|
|
79015
79122
|
var import_jsx_runtime358 = require("react/jsx-runtime");
|
|
@@ -79033,7 +79140,7 @@ function renderLines(runs, numbered, value) {
|
|
|
79033
79140
|
});
|
|
79034
79141
|
}
|
|
79035
79142
|
const digits = String(value.split("\n").length).length;
|
|
79036
|
-
return lines.map((line3, index) => /* @__PURE__ */ (0, import_jsx_runtime358.jsxs)(
|
|
79143
|
+
return lines.map((line3, index) => /* @__PURE__ */ (0, import_jsx_runtime358.jsxs)(import_react331.default.Fragment, { children: [
|
|
79037
79144
|
index > 0 ? "\n" : null,
|
|
79038
79145
|
/* @__PURE__ */ (0, import_jsx_runtime358.jsxs)("span", { className: "ui-code-block-line", children: [
|
|
79039
79146
|
numbered && /* @__PURE__ */ (0, import_jsx_runtime358.jsx)("span", { className: "ui-code-block-line-number", "aria-hidden": "true", "data-line": index + 1, style: { width: `${digits}ch` } }),
|
|
@@ -79061,10 +79168,10 @@ function CodeBlock({
|
|
|
79061
79168
|
...rest
|
|
79062
79169
|
}) {
|
|
79063
79170
|
const t = useKitT();
|
|
79064
|
-
const [copyState, setCopyState] = (0,
|
|
79065
|
-
const timer = (0,
|
|
79066
|
-
const generation = (0,
|
|
79067
|
-
(0,
|
|
79171
|
+
const [copyState, setCopyState] = (0, import_react331.useState)("idle");
|
|
79172
|
+
const timer = (0, import_react331.useRef)(void 0);
|
|
79173
|
+
const generation = (0, import_react331.useRef)(0);
|
|
79174
|
+
(0, import_react331.useEffect)(() => {
|
|
79068
79175
|
generation.current++;
|
|
79069
79176
|
setCopyState("idle");
|
|
79070
79177
|
clearTimeout(timer.current);
|
|
@@ -79073,7 +79180,7 @@ function CodeBlock({
|
|
|
79073
79180
|
clearTimeout(timer.current);
|
|
79074
79181
|
};
|
|
79075
79182
|
}, [value]);
|
|
79076
|
-
const highlighted = (0,
|
|
79183
|
+
const highlighted = (0, import_react331.useMemo)(() => {
|
|
79077
79184
|
if (!readOnly || !language) return [{ text: value, className: "" }];
|
|
79078
79185
|
try {
|
|
79079
79186
|
return tokenRuns(import_refractor.refractor.highlight(value, language.toLowerCase()).children);
|
|
@@ -79122,7 +79229,7 @@ function CodeBlock({
|
|
|
79122
79229
|
}
|
|
79123
79230
|
|
|
79124
79231
|
// src/components/FilterBar.tsx
|
|
79125
|
-
var
|
|
79232
|
+
var import_react332 = require("react");
|
|
79126
79233
|
var import_classnames149 = __toESM(require("classnames"), 1);
|
|
79127
79234
|
var import_jsx_runtime359 = require("react/jsx-runtime");
|
|
79128
79235
|
function normalize(filters, value) {
|
|
@@ -79182,15 +79289,15 @@ function FilterBar({
|
|
|
79182
79289
|
transparency,
|
|
79183
79290
|
liquidExtras: (0, import_classnames149.default)(getGlassVibrancyClass(vibrancy), getSurfaceGlassFillClass(tone, glassOpacity))
|
|
79184
79291
|
});
|
|
79185
|
-
const [internal, setInternal] = (0,
|
|
79292
|
+
const [internal, setInternal] = (0, import_react332.useState)(defaultValue);
|
|
79186
79293
|
const applied = normalize(filters, value ?? internal);
|
|
79187
|
-
const [open, setOpen] = (0,
|
|
79188
|
-
const [category, setCategory] = (0,
|
|
79189
|
-
const [draft, setDraft] = (0,
|
|
79190
|
-
const anchor = (0,
|
|
79191
|
-
const searchRegion = (0,
|
|
79192
|
-
const searchId = (0,
|
|
79193
|
-
const [expanded, setExpanded] = (0,
|
|
79294
|
+
const [open, setOpen] = (0, import_react332.useState)(false);
|
|
79295
|
+
const [category, setCategory] = (0, import_react332.useState)(null);
|
|
79296
|
+
const [draft, setDraft] = (0, import_react332.useState)([]);
|
|
79297
|
+
const anchor = (0, import_react332.useRef)(null);
|
|
79298
|
+
const searchRegion = (0, import_react332.useRef)(null);
|
|
79299
|
+
const searchId = (0, import_react332.useId)();
|
|
79300
|
+
const [expanded, setExpanded] = (0, import_react332.useState)(Boolean(searchProps.initialValue));
|
|
79194
79301
|
const searchDisabled = disabled || searchProps.disabled;
|
|
79195
79302
|
const active = filters.find((filter) => filter.id === category);
|
|
79196
79303
|
const motion = CONTROL_SPRING_TOKENS[spring];
|
|
@@ -79211,12 +79318,12 @@ function FilterBar({
|
|
|
79211
79318
|
setCategory(filter.id);
|
|
79212
79319
|
setOpen(true);
|
|
79213
79320
|
};
|
|
79214
|
-
const previouslyExpanded = (0,
|
|
79215
|
-
(0,
|
|
79321
|
+
const previouslyExpanded = (0, import_react332.useRef)(expanded);
|
|
79322
|
+
(0, import_react332.useLayoutEffect)(() => {
|
|
79216
79323
|
if (showSearch && expanded && !previouslyExpanded.current && !searchDisabled) searchRegion.current?.querySelector("input")?.focus();
|
|
79217
79324
|
previouslyExpanded.current = expanded;
|
|
79218
79325
|
}, [expanded, searchDisabled, showSearch]);
|
|
79219
|
-
(0,
|
|
79326
|
+
(0, import_react332.useEffect)(() => {
|
|
79220
79327
|
if (disabled || category !== null && (!active || active.disabled)) {
|
|
79221
79328
|
setOpen(false);
|
|
79222
79329
|
setCategory(null);
|
|
@@ -79395,18 +79502,18 @@ function FilterBar({
|
|
|
79395
79502
|
);
|
|
79396
79503
|
}
|
|
79397
79504
|
function FilterChips({ chips, color: color2, variant, size, buttonTone, buttonStyle, removeLabel }) {
|
|
79398
|
-
const [visible, setVisible] = (0,
|
|
79399
|
-
const region = (0,
|
|
79400
|
-
const positions = (0,
|
|
79505
|
+
const [visible, setVisible] = (0, import_react332.useState)(chips);
|
|
79506
|
+
const region = (0, import_react332.useRef)(null);
|
|
79507
|
+
const positions = (0, import_react332.useRef)(/* @__PURE__ */ new Map());
|
|
79401
79508
|
const signature = chips.map((chip) => chip.id).join("\0");
|
|
79402
|
-
(0,
|
|
79509
|
+
(0, import_react332.useEffect)(() => {
|
|
79403
79510
|
const timer = setTimeout(() => setVisible((current) => current.filter((chip) => signature.split("\0").includes(chip.id))), 900);
|
|
79404
79511
|
return () => clearTimeout(timer);
|
|
79405
79512
|
}, [signature]);
|
|
79406
|
-
(0,
|
|
79513
|
+
(0, import_react332.useLayoutEffect)(() => {
|
|
79407
79514
|
setVisible((current) => [...chips, ...current.filter((chip) => !chips.some((next) => next.id === chip.id))]);
|
|
79408
79515
|
}, [signature]);
|
|
79409
|
-
(0,
|
|
79516
|
+
(0, import_react332.useLayoutEffect)(() => {
|
|
79410
79517
|
if (typeof matchMedia === "undefined" || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
79411
79518
|
const next = /* @__PURE__ */ new Map();
|
|
79412
79519
|
region.current?.querySelectorAll("[data-chip]").forEach((element) => {
|
|
@@ -79429,11 +79536,11 @@ function FilterChips({ chips, color: color2, variant, size, buttonTone, buttonSt
|
|
|
79429
79536
|
}
|
|
79430
79537
|
|
|
79431
79538
|
// src/contexts/BottomSheetContext.tsx
|
|
79432
|
-
var
|
|
79539
|
+
var import_react333 = require("react");
|
|
79433
79540
|
var import_react_dom21 = require("react-dom");
|
|
79434
79541
|
var import_classnames150 = __toESM(require("classnames"), 1);
|
|
79435
79542
|
var import_jsx_runtime360 = require("react/jsx-runtime");
|
|
79436
|
-
var BottomSheetContext = (0,
|
|
79543
|
+
var BottomSheetContext = (0, import_react333.createContext)(null);
|
|
79437
79544
|
var TRANSITION_MS2 = 260;
|
|
79438
79545
|
var renderSlot = (slot, controls) => {
|
|
79439
79546
|
if (!slot) {
|
|
@@ -79444,13 +79551,13 @@ var renderSlot = (slot, controls) => {
|
|
|
79444
79551
|
var BottomSheetProvider = ({
|
|
79445
79552
|
children
|
|
79446
79553
|
}) => {
|
|
79447
|
-
const [sheet, setSheet] = (0,
|
|
79448
|
-
const [isVisible, setIsVisible] = (0,
|
|
79449
|
-
const pendingCloseRef = (0,
|
|
79450
|
-
const dismissSheet = (0,
|
|
79554
|
+
const [sheet, setSheet] = (0, import_react333.useState)(null);
|
|
79555
|
+
const [isVisible, setIsVisible] = (0, import_react333.useState)(false);
|
|
79556
|
+
const pendingCloseRef = (0, import_react333.useRef)(null);
|
|
79557
|
+
const dismissSheet = (0, import_react333.useCallback)(() => {
|
|
79451
79558
|
setIsVisible(false);
|
|
79452
79559
|
}, []);
|
|
79453
|
-
const presentSheet = (0,
|
|
79560
|
+
const presentSheet = (0, import_react333.useCallback)((options) => {
|
|
79454
79561
|
if (pendingCloseRef.current) {
|
|
79455
79562
|
clearTimeout(pendingCloseRef.current);
|
|
79456
79563
|
pendingCloseRef.current = null;
|
|
@@ -79463,7 +79570,7 @@ var BottomSheetProvider = ({
|
|
|
79463
79570
|
setTimeout(animateIn, 0);
|
|
79464
79571
|
}
|
|
79465
79572
|
}, []);
|
|
79466
|
-
(0,
|
|
79573
|
+
(0, import_react333.useEffect)(() => {
|
|
79467
79574
|
if (!isVisible && sheet) {
|
|
79468
79575
|
pendingCloseRef.current = setTimeout(() => {
|
|
79469
79576
|
sheet.onClose?.();
|
|
@@ -79478,7 +79585,7 @@ var BottomSheetProvider = ({
|
|
|
79478
79585
|
}
|
|
79479
79586
|
return void 0;
|
|
79480
79587
|
}, [isVisible, sheet]);
|
|
79481
|
-
(0,
|
|
79588
|
+
(0, import_react333.useEffect)(
|
|
79482
79589
|
() => () => {
|
|
79483
79590
|
if (pendingCloseRef.current) {
|
|
79484
79591
|
clearTimeout(pendingCloseRef.current);
|
|
@@ -79486,13 +79593,13 @@ var BottomSheetProvider = ({
|
|
|
79486
79593
|
},
|
|
79487
79594
|
[]
|
|
79488
79595
|
);
|
|
79489
|
-
const controls = (0,
|
|
79596
|
+
const controls = (0, import_react333.useMemo)(
|
|
79490
79597
|
() => ({
|
|
79491
79598
|
dismiss: dismissSheet
|
|
79492
79599
|
}),
|
|
79493
79600
|
[dismissSheet]
|
|
79494
79601
|
);
|
|
79495
|
-
const contextValue = (0,
|
|
79602
|
+
const contextValue = (0, import_react333.useMemo)(
|
|
79496
79603
|
() => ({
|
|
79497
79604
|
presentSheet,
|
|
79498
79605
|
dismissSheet,
|
|
@@ -79559,7 +79666,7 @@ var BottomSheetProvider = ({
|
|
|
79559
79666
|
] });
|
|
79560
79667
|
};
|
|
79561
79668
|
var useBottomSheet = () => {
|
|
79562
|
-
const context = (0,
|
|
79669
|
+
const context = (0, import_react333.useContext)(BottomSheetContext);
|
|
79563
79670
|
if (!context) {
|
|
79564
79671
|
throw new Error("useBottomSheet must be used within a BottomSheetProvider");
|
|
79565
79672
|
}
|
|
@@ -80220,7 +80327,7 @@ var MetricBar = ({
|
|
|
80220
80327
|
MetricBar.displayName = "MetricBar";
|
|
80221
80328
|
|
|
80222
80329
|
// src/components/NetworkGraph/NetworkGraph.tsx
|
|
80223
|
-
var
|
|
80330
|
+
var import_react335 = require("react");
|
|
80224
80331
|
|
|
80225
80332
|
// src/components/NetworkGraph/model.ts
|
|
80226
80333
|
var CELL = 64;
|
|
@@ -80364,17 +80471,17 @@ function findNetworkPath(edges, source, target) {
|
|
|
80364
80471
|
}
|
|
80365
80472
|
|
|
80366
80473
|
// src/components/NetworkGraph/useNetworkCanvas.ts
|
|
80367
|
-
var
|
|
80474
|
+
var import_react334 = require("react");
|
|
80368
80475
|
function useNetworkCanvas(options) {
|
|
80369
|
-
const canvasRef = (0,
|
|
80370
|
-
const view = (0,
|
|
80371
|
-
const size = (0,
|
|
80372
|
-
const latest = (0,
|
|
80373
|
-
const frame = (0,
|
|
80374
|
-
const [zoom, setZoom] = (0,
|
|
80375
|
-
const colors3 = (0,
|
|
80376
|
-
const textColor = (0,
|
|
80377
|
-
const draw = (0,
|
|
80476
|
+
const canvasRef = (0, import_react334.useRef)(null);
|
|
80477
|
+
const view = (0, import_react334.useRef)({ x: 0, y: 0, zoom: 1 });
|
|
80478
|
+
const size = (0, import_react334.useRef)({ width: 1, height: 1 });
|
|
80479
|
+
const latest = (0, import_react334.useRef)(options);
|
|
80480
|
+
const frame = (0, import_react334.useRef)(null);
|
|
80481
|
+
const [zoom, setZoom] = (0, import_react334.useState)(1);
|
|
80482
|
+
const colors3 = (0, import_react334.useRef)(/* @__PURE__ */ new Map());
|
|
80483
|
+
const textColor = (0, import_react334.useRef)("#737373");
|
|
80484
|
+
const draw = (0, import_react334.useCallback)(() => {
|
|
80378
80485
|
const canvas = canvasRef.current;
|
|
80379
80486
|
const ctx = canvas?.getContext("2d");
|
|
80380
80487
|
if (!canvas || !ctx) return;
|
|
@@ -80474,14 +80581,14 @@ function useNetworkCanvas(options) {
|
|
|
80474
80581
|
}
|
|
80475
80582
|
ctx.globalAlpha = 1;
|
|
80476
80583
|
}, []);
|
|
80477
|
-
const requestDraw = (0,
|
|
80584
|
+
const requestDraw = (0, import_react334.useCallback)(() => {
|
|
80478
80585
|
if (frame.current !== null) return;
|
|
80479
80586
|
frame.current = requestAnimationFrame(() => {
|
|
80480
80587
|
frame.current = null;
|
|
80481
80588
|
draw();
|
|
80482
80589
|
});
|
|
80483
80590
|
}, [draw]);
|
|
80484
|
-
const update = (0,
|
|
80591
|
+
const update = (0, import_react334.useCallback)(
|
|
80485
80592
|
(next) => {
|
|
80486
80593
|
view.current = next;
|
|
80487
80594
|
setZoom(next.zoom);
|
|
@@ -80490,7 +80597,7 @@ function useNetworkCanvas(options) {
|
|
|
80490
80597
|
},
|
|
80491
80598
|
[requestDraw]
|
|
80492
80599
|
);
|
|
80493
|
-
const fit = (0,
|
|
80600
|
+
const fit = (0, import_react334.useCallback)(
|
|
80494
80601
|
() => update(
|
|
80495
80602
|
fitNetwork(
|
|
80496
80603
|
latest.current.nodes,
|
|
@@ -80500,11 +80607,11 @@ function useNetworkCanvas(options) {
|
|
|
80500
80607
|
),
|
|
80501
80608
|
[update]
|
|
80502
80609
|
);
|
|
80503
|
-
const zoomBy = (0,
|
|
80610
|
+
const zoomBy = (0, import_react334.useCallback)(
|
|
80504
80611
|
(factor, x = size.current.width / 2, y = size.current.height / 2) => update(zoomAt(view.current, factor, x, y)),
|
|
80505
80612
|
[update]
|
|
80506
80613
|
);
|
|
80507
|
-
const focusNode = (0,
|
|
80614
|
+
const focusNode = (0, import_react334.useCallback)(
|
|
80508
80615
|
(node) => {
|
|
80509
80616
|
update({
|
|
80510
80617
|
...view.current,
|
|
@@ -80514,14 +80621,14 @@ function useNetworkCanvas(options) {
|
|
|
80514
80621
|
},
|
|
80515
80622
|
[update]
|
|
80516
80623
|
);
|
|
80517
|
-
(0,
|
|
80624
|
+
(0, import_react334.useEffect)(() => {
|
|
80518
80625
|
latest.current = options;
|
|
80519
80626
|
requestDraw();
|
|
80520
80627
|
}, [options, requestDraw]);
|
|
80521
|
-
(0,
|
|
80628
|
+
(0, import_react334.useEffect)(() => {
|
|
80522
80629
|
fit();
|
|
80523
80630
|
}, [options.model, fit]);
|
|
80524
|
-
(0,
|
|
80631
|
+
(0, import_react334.useEffect)(() => {
|
|
80525
80632
|
const canvas = canvasRef.current;
|
|
80526
80633
|
if (!canvas) return;
|
|
80527
80634
|
const measure = () => {
|
|
@@ -80606,11 +80713,11 @@ function NetworkGraph({
|
|
|
80606
80713
|
}) {
|
|
80607
80714
|
const tone = getSurfaceAccentColor(surfaceTone);
|
|
80608
80715
|
const t = useKitT();
|
|
80609
|
-
const helpId = (0,
|
|
80610
|
-
const layoutRef = (0,
|
|
80611
|
-
const [hasLegendSpace, setHasLegendSpace] = (0,
|
|
80716
|
+
const helpId = (0, import_react335.useId)();
|
|
80717
|
+
const layoutRef = (0, import_react335.useRef)(null);
|
|
80718
|
+
const [hasLegendSpace, setHasLegendSpace] = (0, import_react335.useState)(true);
|
|
80612
80719
|
const legendOnRight = legendPosition === "right" || legendPosition === "auto" && hasLegendSpace;
|
|
80613
|
-
(0,
|
|
80720
|
+
(0, import_react335.useEffect)(() => {
|
|
80614
80721
|
const element = layoutRef.current;
|
|
80615
80722
|
if (!element || legendPosition !== "auto") return;
|
|
80616
80723
|
const measure = () => setHasLegendSpace(element.getBoundingClientRect().width >= 600);
|
|
@@ -80619,38 +80726,38 @@ function NetworkGraph({
|
|
|
80619
80726
|
observer.observe(element);
|
|
80620
80727
|
return () => observer.disconnect();
|
|
80621
80728
|
}, [legendPosition, loading]);
|
|
80622
|
-
const model = (0,
|
|
80729
|
+
const model = (0, import_react335.useMemo)(
|
|
80623
80730
|
() => buildNetwork(nodes, edges, communities),
|
|
80624
80731
|
[nodes, edges, communities]
|
|
80625
80732
|
);
|
|
80626
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
80733
|
+
const [internalSelected, setInternalSelected] = (0, import_react335.useState)(
|
|
80627
80734
|
defaultSelectedNodeId
|
|
80628
80735
|
);
|
|
80629
|
-
const [hidden, setHidden] = (0,
|
|
80630
|
-
const [focused, setFocused] = (0,
|
|
80631
|
-
const [query, setQuery] = (0,
|
|
80632
|
-
const enabled = (0,
|
|
80736
|
+
const [hidden, setHidden] = (0, import_react335.useState)(() => /* @__PURE__ */ new Set());
|
|
80737
|
+
const [focused, setFocused] = (0, import_react335.useState)(null);
|
|
80738
|
+
const [query, setQuery] = (0, import_react335.useState)("");
|
|
80739
|
+
const enabled = (0, import_react335.useMemo)(
|
|
80633
80740
|
() => new Set(
|
|
80634
80741
|
visibleCommunityIds ?? model.groups.filter((g) => !hidden.has(g.id)).map((g) => g.id)
|
|
80635
80742
|
),
|
|
80636
80743
|
[visibleCommunityIds, model, hidden]
|
|
80637
80744
|
);
|
|
80638
|
-
const visibleNodes = (0,
|
|
80745
|
+
const visibleNodes = (0, import_react335.useMemo)(
|
|
80639
80746
|
() => model.nodes.filter((n) => !n.community || enabled.has(n.community)),
|
|
80640
80747
|
[model, enabled]
|
|
80641
80748
|
);
|
|
80642
|
-
const visible = (0,
|
|
80749
|
+
const visible = (0, import_react335.useMemo)(
|
|
80643
80750
|
() => new Set(visibleNodes.map((n) => n.id)),
|
|
80644
80751
|
[visibleNodes]
|
|
80645
80752
|
);
|
|
80646
80753
|
const selection = selectedNodeId === void 0 ? internalSelected : selectedNodeId;
|
|
80647
80754
|
const selected = selection !== null && visible.has(selection) ? selection : null;
|
|
80648
80755
|
const activeFocus = focused !== null && visible.has(focused) ? focused : null;
|
|
80649
|
-
const highlighted = (0,
|
|
80756
|
+
const highlighted = (0, import_react335.useMemo)(
|
|
80650
80757
|
() => new Set(highlightedEdgeIds),
|
|
80651
80758
|
[highlightedEdgeIds]
|
|
80652
80759
|
);
|
|
80653
|
-
const counts = (0,
|
|
80760
|
+
const counts = (0, import_react335.useMemo)(() => {
|
|
80654
80761
|
const result = /* @__PURE__ */ new Map();
|
|
80655
80762
|
for (const n of model.nodes)
|
|
80656
80763
|
if (n.community)
|
|
@@ -80670,7 +80777,7 @@ function NetworkGraph({
|
|
|
80670
80777
|
onViewportChange
|
|
80671
80778
|
});
|
|
80672
80779
|
const locked = disabled || loading;
|
|
80673
|
-
const drag = (0,
|
|
80780
|
+
const drag = (0, import_react335.useRef)(null);
|
|
80674
80781
|
const select = (id) => {
|
|
80675
80782
|
if (locked) return;
|
|
80676
80783
|
if (selectedNodeId === void 0) setInternalSelected(id);
|
|
@@ -80686,7 +80793,7 @@ function NetworkGraph({
|
|
|
80686
80793
|
);
|
|
80687
80794
|
onVisibleCommunitiesChange?.(ids);
|
|
80688
80795
|
};
|
|
80689
|
-
(0,
|
|
80796
|
+
(0, import_react335.useEffect)(() => {
|
|
80690
80797
|
const element = canvas.canvasRef.current;
|
|
80691
80798
|
if (!element || locked) return;
|
|
80692
80799
|
const wheel = (event) => {
|
|
@@ -80735,7 +80842,7 @@ function NetworkGraph({
|
|
|
80735
80842
|
}
|
|
80736
80843
|
};
|
|
80737
80844
|
const focusedNode = model.byId.get(activeFocus ?? selected ?? "");
|
|
80738
|
-
const matchingNodes = (0,
|
|
80845
|
+
const matchingNodes = (0, import_react335.useMemo)(() => {
|
|
80739
80846
|
const search = query.toLocaleLowerCase();
|
|
80740
80847
|
return visibleNodes.filter((n) => (n.label ?? n.id).toLocaleLowerCase().includes(search)).slice(0, 50).map((n) => ({ value: n.id, label: n.label ?? n.id }));
|
|
80741
80848
|
}, [visibleNodes, query]);
|