@upbound/monarch-blocks 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cel-filter-bar.js +1 -1
- package/dist/cel-filter-bar.js.map +1 -1
- package/dist/code-block.d.ts +20 -5
- package/dist/code-block.js +70 -12
- package/dist/code-block.js.map +1 -1
- package/dist/data-table.js +5 -5
- package/dist/data-table.js.map +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/filter-bar.js.map +1 -1
- package/dist/graph.js +44 -37
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +123 -58
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { CelFilterBar, RELATIVE_DURATION_PRESET_VALUES, allowsMultipleConditions
|
|
|
2
2
|
export { C as CelColumnDefinition, a as CelColumnOption, b as CelConditionValue, c as CelFilterBarProps, d as CelFilterCondition, e as CelFilterGroup, f as CelFilterSchema, g as CelFilterTree, h as CelOperator, i as CelRestrictedOptionSelectPayload, j as CheckboxCelValue, k as CompileResult, D as DateCelValue, M as MapKeyCelValue, l as MultiTextCelValue, P as PillActiveSurface, R as RadioCelValue, m as RelativeDurationPreset, V as ValidationIssue, n as isCelFilterCondition, o as isCelFilterGroup, p as isCheckboxCelValue, q as isDateCelValue, r as isMapKeyCelValue, s as isMultiTextCelValue } from './types-BULiU2qC.js';
|
|
3
3
|
export { ChartAction, ChartConfig, ChartContainer, ChartDescription, ChartFooter, ChartHeader, ChartLegend, ChartLegendContent, ChartStyle, ChartTitle, ChartTooltip, ChartTooltipContent } from './chart.js';
|
|
4
4
|
export { ChatInput, ChatInputProps, ChatInterface, ChatInterfaceProps, ChatMessage, ChatMessageBubble, ChatRoutine, ChatSession, ChatSessionList, ChatSessionListProps, ChatThread, ChatThreadProps, ChatToolCall } from './chat-interface.js';
|
|
5
|
-
export { CodeBlock, CodeBlockBody, CodeBlockCopyButton, CodeBlockDownloadButton, CodeBlockFooter, CodeBlockHeader } from './code-block.js';
|
|
5
|
+
export { CodeBlock, CodeBlockBody, CodeBlockCode, CodeBlockCopyButton, CodeBlockDownloadButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLanguage } from './code-block.js';
|
|
6
6
|
export { CellContextualFilter, CellContextualFilterProps, ColumnOptions, ColumnOptionsProps, ContextualMenuAction, DataTable, DataTableBody, DataTableCelFilterConfig, DataTableCell, DataTableExpandedRow, DataTableFilterVisibilityConfig, DataTableGroupRow, DataTableHeader, DataTablePagination, DataTablePaginationConfig, DataTablePaginationProps, DataTableProps, DataTableRow, DataTableRowProps, DataTableSkeletonBody, DataTableValueCell, DataTableValueCellProps, ExpandButton, RowActionItem, RowActions, RowCountRelation, StickyHeaderConfig, TableHookOptions, TableLayout, TimestampCell, ViewFilter, ViewFilterProps, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions } from './data-table.js';
|
|
7
7
|
export { D as DataTableEmptyConfig, a as DataTableEmptyView, d as defaultEmptyConfig, b as defaultErrorConfig, c as defaultNoFilterFoundConfig } from './empty-view-DO36LNvk.js';
|
|
8
8
|
export { ActiveFilter, CheckboxFilterDefinition, CheckboxFilterValue, DateFilterDefinition, DateFilterValue, FilterBar, FilterBarProps, FilterChip, FilterDefinition, FilterOption, FilterType, FilterValue, MultiTextFilterDefinition, MultiTextFilterValue, RadioFilterDefinition, RadioFilterValue, TextFilterDefinition, TextFilterValue } from './filter-bar.js';
|
package/dist/index.js
CHANGED
|
@@ -1296,7 +1296,7 @@ function CelAddFilterButton({
|
|
|
1296
1296
|
if (column) onSelect(column.id);
|
|
1297
1297
|
},
|
|
1298
1298
|
children: [
|
|
1299
|
-
/* @__PURE__ */ jsxs(ComboboxTrigger, { "aria-label": "Add filter", render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: [
|
|
1299
|
+
/* @__PURE__ */ jsxs(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: [
|
|
1300
1300
|
/* @__PURE__ */ jsx(Icon, { name: "plus", "data-icon": "inline-start" }),
|
|
1301
1301
|
"Add filter"
|
|
1302
1302
|
] }),
|
|
@@ -2892,7 +2892,7 @@ function ChatInterface(_a) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
|
|
2894
2894
|
// src/code-block.tsx
|
|
2895
|
-
import { useState as useState5 } from "react";
|
|
2895
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
2896
2896
|
import { Icon as Icon3 } from "@upbound/monarch-core";
|
|
2897
2897
|
import {
|
|
2898
2898
|
Card,
|
|
@@ -2903,6 +2903,36 @@ import {
|
|
|
2903
2903
|
TooltipContent as TooltipContent2,
|
|
2904
2904
|
TooltipTrigger as TooltipTrigger2
|
|
2905
2905
|
} from "@upbound/monarch-core";
|
|
2906
|
+
|
|
2907
|
+
// src/lib/highlight.ts
|
|
2908
|
+
import { createHighlighter } from "shiki";
|
|
2909
|
+
var CODE_BLOCK_LANGUAGES = ["tsx", "typescript", "bash", "shell", "json", "css", "yaml"];
|
|
2910
|
+
var HIGHLIGHTER_KEY = "__monarch_shiki_highlighter__";
|
|
2911
|
+
function getHighlighter() {
|
|
2912
|
+
const g = globalThis;
|
|
2913
|
+
if (!g[HIGHLIGHTER_KEY]) {
|
|
2914
|
+
g[HIGHLIGHTER_KEY] = createHighlighter({
|
|
2915
|
+
themes: ["github-light-high-contrast", "github-dark-dimmed"],
|
|
2916
|
+
langs: [...CODE_BLOCK_LANGUAGES]
|
|
2917
|
+
}).catch((error) => {
|
|
2918
|
+
delete g[HIGHLIGHTER_KEY];
|
|
2919
|
+
throw error;
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
return g[HIGHLIGHTER_KEY];
|
|
2923
|
+
}
|
|
2924
|
+
async function highlightCode(code, lang) {
|
|
2925
|
+
const hl = await getHighlighter();
|
|
2926
|
+
return hl.codeToHtml(code, {
|
|
2927
|
+
lang,
|
|
2928
|
+
themes: {
|
|
2929
|
+
light: "github-light-high-contrast",
|
|
2930
|
+
dark: "github-dark-dimmed"
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
// src/code-block.tsx
|
|
2906
2936
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2907
2937
|
function CodeBlock(_a) {
|
|
2908
2938
|
var _b = _a, {
|
|
@@ -2943,24 +2973,48 @@ function CodeBlockHeader(_a) {
|
|
|
2943
2973
|
}, props)
|
|
2944
2974
|
);
|
|
2945
2975
|
}
|
|
2976
|
+
var LINE_NUMBER_GUTTER = cn(
|
|
2977
|
+
"[&_code]:[counter-reset:line]",
|
|
2978
|
+
"[&_.line]:before:[counter-increment:line]",
|
|
2979
|
+
"[&_.line]:before:content-[counter(line)]",
|
|
2980
|
+
"[&_.line]:before:inline-block",
|
|
2981
|
+
"[&_.line]:before:w-6",
|
|
2982
|
+
"[&_.line]:before:mr-3",
|
|
2983
|
+
"[&_.line]:before:text-right",
|
|
2984
|
+
"[&_.line]:before:text-muted-foreground",
|
|
2985
|
+
"[&_.line]:before:text-[0.75rem]",
|
|
2986
|
+
"[&_.line]:before:select-none"
|
|
2987
|
+
);
|
|
2946
2988
|
function CodeBlockBody(_a) {
|
|
2947
2989
|
var _b = _a, {
|
|
2948
2990
|
className,
|
|
2949
2991
|
code,
|
|
2950
|
-
html,
|
|
2951
|
-
lineNumbers,
|
|
2952
2992
|
maxHeight,
|
|
2953
2993
|
copyButton,
|
|
2954
2994
|
downloadButton
|
|
2955
2995
|
} = _b, props = __objRest(_b, [
|
|
2956
2996
|
"className",
|
|
2957
2997
|
"code",
|
|
2958
|
-
"html",
|
|
2959
|
-
"lineNumbers",
|
|
2960
2998
|
"maxHeight",
|
|
2961
2999
|
"copyButton",
|
|
2962
3000
|
"downloadButton"
|
|
2963
3001
|
]);
|
|
3002
|
+
const { content, lineNumbers } = code;
|
|
3003
|
+
const [html, setHtml] = useState5(null);
|
|
3004
|
+
const language = code.type === "parsed" ? code.language : null;
|
|
3005
|
+
useEffect3(() => {
|
|
3006
|
+
if (!language) {
|
|
3007
|
+
setHtml(null);
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
let cancelled = false;
|
|
3011
|
+
highlightCode(content, language).then((result) => {
|
|
3012
|
+
if (!cancelled) setHtml(result);
|
|
3013
|
+
});
|
|
3014
|
+
return () => {
|
|
3015
|
+
cancelled = true;
|
|
3016
|
+
};
|
|
3017
|
+
}, [content, language]);
|
|
2964
3018
|
return /* @__PURE__ */ jsxs4(CardContent, __spreadProps(__spreadValues({ "data-line-numbers": lineNumbers || void 0, className: cn("relative p-0!", className) }, props), { children: [
|
|
2965
3019
|
(copyButton || downloadButton) && /* @__PURE__ */ jsxs4("div", { className: "absolute top-2 right-2 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover/code-block:opacity-100", children: [
|
|
2966
3020
|
copyButton,
|
|
@@ -2971,16 +3025,20 @@ function CodeBlockBody(_a) {
|
|
|
2971
3025
|
{
|
|
2972
3026
|
className: cn("overflow-x-auto", maxHeight && "overflow-y-auto"),
|
|
2973
3027
|
style: maxHeight ? { maxHeight } : void 0,
|
|
2974
|
-
children:
|
|
3028
|
+
children: /* @__PURE__ */ jsx6(
|
|
2975
3029
|
"div",
|
|
2976
3030
|
{
|
|
2977
|
-
className:
|
|
2978
|
-
|
|
3031
|
+
className: cn(
|
|
3032
|
+
"[&_code]:font-mono [&_pre]:m-0 [&_pre]:p-4 group-data-[size=sm]/code-block:[&_pre]:p-3",
|
|
3033
|
+
html && "[&_pre]:bg-transparent!",
|
|
3034
|
+
lineNumbers && LINE_NUMBER_GUTTER
|
|
3035
|
+
),
|
|
3036
|
+
children: html ? /* @__PURE__ */ jsx6("div", { dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx6("pre", { children: /* @__PURE__ */ jsx6("code", { className: lineNumbers ? void 0 : "whitespace-pre", children: lineNumbers ? content.split("\n").map((line, i) => /* @__PURE__ */ jsxs4("span", { className: "line", children: [
|
|
3037
|
+
line,
|
|
3038
|
+
"\n"
|
|
3039
|
+
] }, i)) : content }) })
|
|
2979
3040
|
}
|
|
2980
|
-
)
|
|
2981
|
-
line,
|
|
2982
|
-
"\n"
|
|
2983
|
-
] }, i)) }) }) : /* @__PURE__ */ jsx6("pre", { className: "p-4 group-data-[size=sm]/code-block:p-3", children: /* @__PURE__ */ jsx6("code", { className: "font-mono whitespace-pre", children: code }) })
|
|
3041
|
+
)
|
|
2984
3042
|
}
|
|
2985
3043
|
)
|
|
2986
3044
|
] }));
|
|
@@ -3713,7 +3771,7 @@ function getColumnFilterCount(filterValue, filter) {
|
|
|
3713
3771
|
}
|
|
3714
3772
|
|
|
3715
3773
|
// src/hooks/use-table-column-resizing.ts
|
|
3716
|
-
import { useCallback as useCallback4, useEffect as
|
|
3774
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState7 } from "react";
|
|
3717
3775
|
var RESIZE_MIN = 40;
|
|
3718
3776
|
var RESIZE_MAX = 500;
|
|
3719
3777
|
var RESIZE_MAX_UNBOUNDED = Number.MAX_SAFE_INTEGER;
|
|
@@ -3802,7 +3860,7 @@ function useTableColumnResizing({
|
|
|
3802
3860
|
} = {}) {
|
|
3803
3861
|
const [columnSizing, setColumnSizing] = useState7(() => clampSizing(initialSizing != null ? initialSizing : {}, maxSize));
|
|
3804
3862
|
const persistTimerRef = useRef3(null);
|
|
3805
|
-
|
|
3863
|
+
useEffect4(() => {
|
|
3806
3864
|
if (!initialSizing) return;
|
|
3807
3865
|
const next = clampSizing(initialSizing, maxSize);
|
|
3808
3866
|
setColumnSizing((prev) => {
|
|
@@ -3811,7 +3869,7 @@ function useTableColumnResizing({
|
|
|
3811
3869
|
return keys.every((k) => prev[k] === next[k]) ? prev : next;
|
|
3812
3870
|
});
|
|
3813
3871
|
}, [initialSizing, maxSize]);
|
|
3814
|
-
|
|
3872
|
+
useEffect4(() => {
|
|
3815
3873
|
return () => {
|
|
3816
3874
|
if (persistTimerRef.current) clearTimeout(persistTimerRef.current);
|
|
3817
3875
|
};
|
|
@@ -4523,9 +4581,9 @@ function DataTableSortIcon({ sortOrder }) {
|
|
|
4523
4581
|
return /* @__PURE__ */ jsx13(
|
|
4524
4582
|
Icon9,
|
|
4525
4583
|
{
|
|
4526
|
-
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
4527
4584
|
size: "xs",
|
|
4528
|
-
|
|
4585
|
+
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
4586
|
+
className: "text-foreground group-hover/col-actions:text-foreground group-data-[state=open]/col-actions:text-foreground mr-0.5 shrink-0"
|
|
4529
4587
|
}
|
|
4530
4588
|
);
|
|
4531
4589
|
}
|
|
@@ -4617,7 +4675,7 @@ function HeaderCellContent({
|
|
|
4617
4675
|
"aria-label": shouldShowActionsMenu ? headerTitle ? `${headerTitle} column actions` : "Column actions" : void 0,
|
|
4618
4676
|
className: cn(
|
|
4619
4677
|
"group/col-actions text-muted-foreground -mx-2 -my-1 flex min-w-0 items-center gap-1 truncate rounded-md px-2 py-1 text-left font-medium motion-safe:transition-colors",
|
|
4620
|
-
sorted && "text-
|
|
4678
|
+
sorted && "text-foreground",
|
|
4621
4679
|
shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
4622
4680
|
),
|
|
4623
4681
|
children: [
|
|
@@ -5105,7 +5163,7 @@ function FilterBar(_a) {
|
|
|
5105
5163
|
if (filter) handleAddFilter(filter.key);
|
|
5106
5164
|
},
|
|
5107
5165
|
children: [
|
|
5108
|
-
/* @__PURE__ */ jsxs12(ComboboxTrigger2, { "aria-label": "Add filter", render: /* @__PURE__ */ jsx14(Button7, { variant: "outline" }), children: [
|
|
5166
|
+
/* @__PURE__ */ jsxs12(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx14(Button7, { variant: "outline" }), children: [
|
|
5109
5167
|
/* @__PURE__ */ jsx14(Icon10, { name: "plus", "data-icon": "inline-start" }),
|
|
5110
5168
|
"Add filter"
|
|
5111
5169
|
] }),
|
|
@@ -6660,7 +6718,7 @@ var GraphActionsProvider = React14.forwardRef(
|
|
|
6660
6718
|
GraphActionsProvider.displayName = "GraphActionsProvider";
|
|
6661
6719
|
|
|
6662
6720
|
// src/graph/graph.tsx
|
|
6663
|
-
import * as
|
|
6721
|
+
import * as React17 from "react";
|
|
6664
6722
|
import {
|
|
6665
6723
|
getCoreRowModel as getCoreRowModel2,
|
|
6666
6724
|
getFacetedRowModel as getFacetedRowModel2,
|
|
@@ -6671,15 +6729,8 @@ import {
|
|
|
6671
6729
|
import { Icon as Icon14, InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
|
|
6672
6730
|
|
|
6673
6731
|
// src/graph/graph-view.tsx
|
|
6674
|
-
import * as
|
|
6675
|
-
import {
|
|
6676
|
-
Background,
|
|
6677
|
-
Controls,
|
|
6678
|
-
MiniMap,
|
|
6679
|
-
ReactFlow,
|
|
6680
|
-
ReactFlowProvider,
|
|
6681
|
-
useReactFlow
|
|
6682
|
-
} from "reactflow";
|
|
6732
|
+
import * as React16 from "react";
|
|
6733
|
+
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider } from "reactflow";
|
|
6683
6734
|
|
|
6684
6735
|
// src/graph/hooks/useAutoLayout.ts
|
|
6685
6736
|
import { useMemo as useMemo10 } from "react";
|
|
@@ -6885,25 +6936,50 @@ var useNodeVisibility = (nodes, edges) => {
|
|
|
6885
6936
|
return { nodes: visibleNodes, edges: visibleEdges };
|
|
6886
6937
|
};
|
|
6887
6938
|
|
|
6939
|
+
// src/graph/hooks/useViewportFocus.ts
|
|
6940
|
+
import * as React15 from "react";
|
|
6941
|
+
import { useReactFlow, useStore } from "reactflow";
|
|
6942
|
+
function getViewportFocusCenter(node) {
|
|
6943
|
+
var _a;
|
|
6944
|
+
const compact = node.type !== "loading" && Boolean((_a = node.data) == null ? void 0 : _a.compact);
|
|
6945
|
+
const height = compact ? GRAPH_NODE_COLLAPSED_HEIGHT : GRAPH_NODE_HEIGHT;
|
|
6946
|
+
return {
|
|
6947
|
+
x: node.position.x + GRAPH_NODE_WIDTH / 2,
|
|
6948
|
+
y: node.position.y + height / 2
|
|
6949
|
+
};
|
|
6950
|
+
}
|
|
6951
|
+
function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
6952
|
+
const { setCenter } = useReactFlow();
|
|
6953
|
+
const viewportReady = useStore((state) => state.width > 0 && state.height > 0);
|
|
6954
|
+
const node = viewportFocusNodeId ? nodeMap.get(viewportFocusNodeId) : void 0;
|
|
6955
|
+
React15.useEffect(() => {
|
|
6956
|
+
if (!node || !viewportReady) {
|
|
6957
|
+
return;
|
|
6958
|
+
}
|
|
6959
|
+
const { x, y } = getViewportFocusCenter(node);
|
|
6960
|
+
setCenter(x, y, { zoom: 1 });
|
|
6961
|
+
}, [node == null ? void 0 : node.id, viewportReady, setCenter]);
|
|
6962
|
+
}
|
|
6963
|
+
|
|
6888
6964
|
// src/graph/graph-view.tsx
|
|
6889
6965
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6890
6966
|
var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeTypes, children, viewportFocusNodeId }) => {
|
|
6891
6967
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
6892
|
-
const nodeTypes =
|
|
6968
|
+
const nodeTypes = React16.useMemo(
|
|
6893
6969
|
() => __spreadValues({
|
|
6894
6970
|
default: GraphNode,
|
|
6895
6971
|
loading: GraphNodeSkeleton
|
|
6896
6972
|
}, parentNodeTypes),
|
|
6897
6973
|
[parentNodeTypes]
|
|
6898
6974
|
);
|
|
6899
|
-
const edgeTypes =
|
|
6975
|
+
const edgeTypes = React16.useMemo(
|
|
6900
6976
|
() => __spreadValues({
|
|
6901
6977
|
default: GraphEdge
|
|
6902
6978
|
}, parentEdgeTypes),
|
|
6903
6979
|
[parentEdgeTypes]
|
|
6904
6980
|
);
|
|
6905
6981
|
const { nodes: visibleNodes, edges: visibleEdges } = useNodeVisibility(nodes, edges);
|
|
6906
|
-
const nodesWithExpansion =
|
|
6982
|
+
const nodesWithExpansion = React16.useMemo(() => {
|
|
6907
6983
|
return visibleNodes.map((node) => {
|
|
6908
6984
|
if (isDefaultNode(node) && !node.data.onExpandToggle) {
|
|
6909
6985
|
return __spreadProps(__spreadValues({}, node), {
|
|
@@ -6950,21 +7026,10 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
6950
7026
|
}
|
|
6951
7027
|
);
|
|
6952
7028
|
};
|
|
6953
|
-
var GraphView =
|
|
7029
|
+
var GraphView = React16.forwardRef(({ defaultNodes = [], defaultEdges = [], nodeTypes, edgeTypes, children, viewportFocusNodeId }, ref) => {
|
|
6954
7030
|
return /* @__PURE__ */ jsx22(ReactFlowProvider, { children: /* @__PURE__ */ jsx22(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx22(GraphViewInternal, { nodeTypes, edgeTypes, viewportFocusNodeId, children }) }) });
|
|
6955
7031
|
});
|
|
6956
7032
|
GraphView.displayName = "GraphView";
|
|
6957
|
-
function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
6958
|
-
const flow = useReactFlow();
|
|
6959
|
-
React15.useEffect(() => {
|
|
6960
|
-
if (viewportFocusNodeId) {
|
|
6961
|
-
const focusNode = nodeMap.get(viewportFocusNodeId);
|
|
6962
|
-
if (focusNode) {
|
|
6963
|
-
flow.setCenter(focusNode.position.x, focusNode.position.y, { zoom: 1 });
|
|
6964
|
-
}
|
|
6965
|
-
}
|
|
6966
|
-
}, [viewportFocusNodeId, flow, nodeMap]);
|
|
6967
|
-
}
|
|
6968
7033
|
|
|
6969
7034
|
// src/graph/graph.tsx
|
|
6970
7035
|
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -7003,12 +7068,12 @@ function Graph({
|
|
|
7003
7068
|
children
|
|
7004
7069
|
}) {
|
|
7005
7070
|
var _a, _b, _c;
|
|
7006
|
-
const graphRef =
|
|
7007
|
-
const [innerGlobalFilter, setInnerGlobalFilter] =
|
|
7008
|
-
const [innerColumnFilters, setInnerColumnFilters] =
|
|
7071
|
+
const graphRef = React17.useRef(null);
|
|
7072
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React17.useState("");
|
|
7073
|
+
const [innerColumnFilters, setInnerColumnFilters] = React17.useState([]);
|
|
7009
7074
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
7010
7075
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
7011
|
-
|
|
7076
|
+
React17.useEffect(() => {
|
|
7012
7077
|
if (parentGlobalFilter !== void 0) {
|
|
7013
7078
|
setInnerGlobalFilter(parentGlobalFilter);
|
|
7014
7079
|
}
|
|
@@ -7029,7 +7094,7 @@ function Graph({
|
|
|
7029
7094
|
});
|
|
7030
7095
|
const flatColumns = table.getAllFlatColumns();
|
|
7031
7096
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
7032
|
-
const filteredData =
|
|
7097
|
+
const filteredData = React17.useMemo(() => filteredRows.map((row) => row.original), [filteredRows]);
|
|
7033
7098
|
const filterCount = columnFilters.map(
|
|
7034
7099
|
({ id: columnFilterId, value }) => {
|
|
7035
7100
|
var _a2, _b2;
|
|
@@ -7043,10 +7108,10 @@ function Graph({
|
|
|
7043
7108
|
setColumnFilters([]);
|
|
7044
7109
|
setGlobalFilter("");
|
|
7045
7110
|
};
|
|
7046
|
-
const memoizedNodeTypes =
|
|
7047
|
-
const memoizedEdgeTypes =
|
|
7048
|
-
const memoizedConfig =
|
|
7049
|
-
|
|
7111
|
+
const memoizedNodeTypes = React17.useMemo(() => config.nodeTypes, [config.nodeTypes]);
|
|
7112
|
+
const memoizedEdgeTypes = React17.useMemo(() => config.edgeTypes, [config.edgeTypes]);
|
|
7113
|
+
const memoizedConfig = React17.useMemo(() => config, [config]);
|
|
7114
|
+
React17.useEffect(() => {
|
|
7050
7115
|
if (!graphRef.current) {
|
|
7051
7116
|
return;
|
|
7052
7117
|
}
|
|
@@ -7118,20 +7183,20 @@ function Graph({
|
|
|
7118
7183
|
}
|
|
7119
7184
|
|
|
7120
7185
|
// src/graph/hooks/useGetViewportNodeIds.ts
|
|
7121
|
-
import { useEffect as
|
|
7122
|
-
import { useStore, useViewport } from "reactflow";
|
|
7186
|
+
import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef9, useState as useState14 } from "react";
|
|
7187
|
+
import { useStore as useStore2, useViewport } from "reactflow";
|
|
7123
7188
|
var useGetDebouncedViewport = (debounceDelay = 1e3) => {
|
|
7124
7189
|
const timerRef = useRef9(null);
|
|
7125
7190
|
const [debouncedValues, setDebouncedValues] = useState14({ x: 0, y: 0, zoom: 1, width: 0, height: 0, nodes: [] });
|
|
7126
7191
|
const { x, y, zoom } = useViewport();
|
|
7127
|
-
const { width, height, nodes } =
|
|
7192
|
+
const { width, height, nodes } = useStore2((state) => ({
|
|
7128
7193
|
width: state.width,
|
|
7129
7194
|
height: state.height,
|
|
7130
7195
|
nodes: state.getNodes()
|
|
7131
7196
|
}));
|
|
7132
7197
|
const nodesHash = nodes.map((n) => n.id).sort().join(",");
|
|
7133
7198
|
const memoizedNodes = useMemo14(() => nodes, [nodesHash]);
|
|
7134
|
-
|
|
7199
|
+
useEffect10(() => {
|
|
7135
7200
|
if (timerRef.current) {
|
|
7136
7201
|
clearTimeout(timerRef.current);
|
|
7137
7202
|
}
|