@likec4/diagram 1.32.0 → 1.32.1
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/bundle/{chunk-BvTQaUYl.js → chunk-DlHyKoeo.js} +236 -210
- package/bundle/custom.js +50 -49
- package/bundle/index.js +144 -121
- package/dist/LikeC4Diagram.js +1 -1
- package/dist/LikeC4Diagram.props.d.ts +14 -3
- package/dist/bundle/LikeC4View.js +16 -15
- package/dist/bundle/ReactLikeC4.js +7 -6
- package/dist/bundle/index.js +1 -1
- package/dist/custom/customNodes.d.ts +5 -0
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/likec4diagram/DiagramXYFlow.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +5 -5
- package/dist/likec4model/index.d.ts +1 -1
- package/dist/likec4model/useLikeC4Model.d.ts +2 -1
- package/dist/likec4model/useLikeC4Model.js +13 -2
- package/dist/overlays/overlay/Overlay.js +24 -4
- package/dist/search/Search.d.ts +2 -3
- package/dist/search/Search.js +27 -46
- package/dist/search/components/ElementsColumn.js +12 -13
- package/dist/search/components/PickView.js +6 -6
- package/dist/search/components/SearchByTags.js +5 -2
- package/dist/search/components/SearchInput.js +16 -14
- package/dist/search/components/ViewsColum.js +16 -9
- package/dist/search/components/utils.d.ts +3 -2
- package/dist/search/components/utils.js +37 -5
- package/dist/search/hooks.d.ts +2 -8
- package/dist/search/hooks.js +4 -4
- package/dist/state/DiagramActorProvider.js +1 -1
- package/dist/state/diagram-machine.d.ts +216 -8
- package/dist/state/diagram-machine.js +8 -6
- package/package.json +9 -8
- package/src/LikeC4Diagram.props.ts +14 -3
- package/src/LikeC4Diagram.tsx +1 -1
- package/src/bundle/LikeC4View.tsx +12 -19
- package/src/bundle/ReactLikeC4.tsx +2 -10
- package/src/custom/customNodes.tsx +5 -0
- package/src/custom/hooks.ts +1 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +3 -3
- package/src/likec4model/index.ts +2 -0
- package/src/likec4model/useLikeC4Model.ts +16 -2
- package/src/overlays/overlay/Overlay.tsx +20 -5
- package/src/search/Search.tsx +34 -51
- package/src/search/components/ElementsColumn.tsx +12 -15
- package/src/search/components/PickView.tsx +41 -47
- package/src/search/components/SearchByTags.tsx +5 -2
- package/src/search/components/SearchInput.tsx +17 -14
- package/src/search/components/ViewsColum.tsx +18 -10
- package/src/search/components/utils.ts +41 -4
- package/src/search/hooks.ts +5 -8
- package/src/state/DiagramActorProvider.tsx +2 -1
- package/src/state/diagram-machine.ts +8 -6
package/bundle/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { useRef, useCallback, useEffect, useState, useMemo, forwardRef, Fragment, createElement, cloneElement, useId as useId$1, Children, useContext, useInsertionEffect, isValidElement, createContext, Component, useLayoutEffect, memo as memo$2, useDeferredValue } from "react";
|
|
4
|
-
import { u as useCallbackRef, a as useMediaQuery, b as useMantineTheme, c as useMantineStyleNonce, k as keys, e as em, g as getPrimaryShade, d as alpha, r as rem, f as getPrimaryContrastColor, h as deepMerge, D as DEFAULT_THEME, i as useMantineCssVariablesResolver, j as useIsomorphicEffect, M as MantineContext, l as MantineThemeProvider, m as createSafeContext, n as useProps, o as useMergedRef, B as Box, t as toInt, p as useDirection, q as factory, s as useStyles, v as useMergeRefs, w as createVarsResolver, x as polymorphicFactory, U as UnstyledButton, y as getRadius$1, z as getSize, A as createOptionalContext, C as useResolvedStylesApi, E as getFontSize, F as useId, G as extractStyleProps, T as Text, H as clsx, I as getThemeColor, P as Popover, J as isElement, K as getRefProp, L as useUncontrolled, N as Paper, O as getSpacing, Q as filterProps, R as InlineStyles, S as useRandomClassName, V as parseThemeColor, W as Loader, X as createScopedKeydownHandler, Y as getContrastColor, Z as findElementAncestor, _ as useClickOutside, $ as createReactComponent, a0 as C$1, a1 as s$3, a2 as u$6, a3 as MotionConfigContext, a4 as useConstant, a5 as PresenceContext, a6 as useIsomorphicLayoutEffect$1, a7 as LayoutGroupContext, a8 as createRenderBatcher, a9 as featureDefinitions, aa as LazyContext, ab as loadExternalIsValidProp, ac as resolveVariantFromProps, ad as MotionGlobalConfig, ae as isMotionValue, af as optimizedAppearDataAttribute, ag as transformProps, ah as number, ai as alpha$1, aj as clamp$1, ak as percent, al as isCSSVariableToken, am as px$1, an as transformPropOrder, ao as isVariantLabel, ap as variantProps, aq as isAnimationControls, ar as variantPriorityOrder, as as isRefObject, at as SwitchLayoutGroupContext, au as addScaleCorrector, av as microtask, aw as resolveMotionValue, ax as scaleCorrectors, ay as degrees, az as vw, aA as vh, aB as numberValueTypes, aC as isControllingVariants, aD as isVariantNode, aE as hasReducedMotionListener, aF as initPrefersReducedMotion, aG as prefersReducedMotion, aH as isCSSVariableName, aI as buildHTMLStyles, aJ as scrapeMotionValuesFromProps, aK as camelToDash, aL as scrapeMotionValuesFromProps$1, aM as buildSVGAttrs, aN as isSVGTag, aO as isSVGComponent, aP as useDebouncedCallback$1, aQ as isBrowser, aR as
|
|
5
|
-
import {
|
|
4
|
+
import { u as useCallbackRef, a as useMediaQuery, b as useMantineTheme, c as useMantineStyleNonce, k as keys, e as em, g as getPrimaryShade, d as alpha, r as rem, f as getPrimaryContrastColor, h as deepMerge, D as DEFAULT_THEME, i as useMantineCssVariablesResolver, j as useIsomorphicEffect, M as MantineContext, l as MantineThemeProvider, m as createSafeContext, n as useProps, o as useMergedRef, B as Box, t as toInt, p as useDirection, q as factory, s as useStyles, v as useMergeRefs, w as createVarsResolver, x as polymorphicFactory, U as UnstyledButton, y as getRadius$1, z as getSize, A as createOptionalContext, C as useResolvedStylesApi, E as getFontSize, F as useId, G as extractStyleProps, T as Text, H as clsx, I as getThemeColor, P as Popover, J as isElement, K as getRefProp, L as useUncontrolled, N as Paper, O as getSpacing, Q as filterProps, R as InlineStyles, S as useRandomClassName, V as parseThemeColor, W as Loader, X as createScopedKeydownHandler, Y as getContrastColor, Z as findElementAncestor, _ as useClickOutside, $ as createReactComponent, a0 as C$1, a1 as s$3, a2 as u$6, a3 as MotionConfigContext, a4 as useConstant, a5 as PresenceContext, a6 as useIsomorphicLayoutEffect$1, a7 as LayoutGroupContext, a8 as createRenderBatcher, a9 as featureDefinitions, aa as LazyContext, ab as loadExternalIsValidProp, ac as resolveVariantFromProps, ad as MotionGlobalConfig, ae as isMotionValue, af as optimizedAppearDataAttribute, ag as transformProps, ah as number, ai as alpha$1, aj as clamp$1, ak as percent, al as isCSSVariableToken, am as px$1, an as transformPropOrder, ao as isVariantLabel, ap as variantProps, aq as isAnimationControls, ar as variantPriorityOrder, as as isRefObject, at as SwitchLayoutGroupContext, au as addScaleCorrector, av as microtask, aw as resolveMotionValue, ax as scaleCorrectors, ay as degrees, az as vw, aA as vh, aB as numberValueTypes, aC as isControllingVariants, aD as isVariantNode, aE as hasReducedMotionListener, aF as initPrefersReducedMotion, aG as prefersReducedMotion, aH as isCSSVariableName, aI as buildHTMLStyles, aJ as scrapeMotionValuesFromProps, aK as camelToDash, aL as scrapeMotionValuesFromProps$1, aM as buildSVGAttrs, aN as isSVGTag, aO as isSVGComponent, aP as useDebouncedCallback$1, aQ as isBrowser, aR as getPatternStyles, aS as patternFns, aT as splitProps, aU as styled, aV as css, aW as useLikeC4Specification, aX as useUpdateEffect, aY as n$6, aZ as t$3, a_ as Background$1, a$ as BackgroundVariant, b0 as useIsZoomTooSmall, b1 as useXYStoreApi, b2 as index, b3 as stopPropagation$1, b4 as cx, b5 as useStore, b6 as XSTATE_STOP, b7 as cloneMachineSnapshot, b8 as evaluateGuard, b9 as createErrorActorEvent, ba as XSTATE_ERROR, bb as ProcessingStatus, bc as resolveReferencedActor, bd as createActor, be as cancel, bf as raise, bg as spawnChild, bh as stopChild, bi as resolveStateValue, bj as getAllStateNodes, bk as getStateNodes, bl as createMachineSnapshot, bm as isInFinalState, bn as macrostep, bo as transitionNode, bp as resolveActionsAndContext, bq as createInitEvent, br as microstep, bs as getInitialStateNodes, bt as toStatePath, bu as isStateId, bv as getStateNodeByPath, bw as getPersistedSnapshot, bx as $$ACTOR_TYPE, by as STATE_DELIMITER, bz as mapValues, bA as toArray, bB as formatTransitions, bC as toTransitionConfigArray, bD as formatTransition, bE as getCandidates, bF as NULL_EVENT, bG as createInvokeId, bH as getDelayedTransitions, bI as formatInitialTransition, bJ as deepEqual, bK as ActionIcon$1, bL as IconZoomScan, bM as sva, bN as Box$1, bO as n$7, bP as EdgeLabelRenderer, bQ as e$3, bR as useDiagramContext, bS as useDiagram, bT as useMantinePortalProps, bU as PopoverTarget, bV as PopoverDropdown, bW as Stack, bX as Group, bY as Button, bZ as IconCheck, b_ as cva, b$ as useLikeC4Model, c0 as findDiagramNode, c1 as findDiagramEdge, c2 as Menu, c3 as MenuTarget, c4 as MenuDropdown, c5 as MenuLabel, c6 as MenuDivider, c7 as MenuItem, c8 as useEnabledFeatures, c9 as useDiagramEventHandlers, ca as TooltipGroup, cb as Space, cc as Tooltip$4, cd as IfEnabled, ce as IconFileSymlink, cf as getNodeDimensions, cg as useIsPanning, ch as useXYFlow, ci as useDiagramActorSnapshot, cj as useXYInternalNode, ck as isSamePoint, cl as bezierControlPoints, cm as bezierPath, cn as ViewGroupNode, co as CompoundDeploymentNode, cp as CompoundElementNode, cq as DeploymentNode, cr as ElementNode$2, cs as shallowEqual, ct as useSelector, cu as getBezierPath, cv as useCurrentViewId, cw as ElementActionButtons, cx as IconTransform, cy as customNode, cz as CompoundNodeContainer, cA as CompoundTitle, cB as ElementNodeContainer, cC as ElementShape, cD as ElementTitle, cE as ElementTags, cF as ElementDetailsButton, cG as Handle, cH as Position, cI as getDefaultExportFromCjs, cJ as l$3, cK as IconSelector, cL as SegmentedControl, cM as ReactFlowProvider, cN as useStoreApi, cO as useReactFlow, cP as Panel, cQ as m$4, cR as u$7, cS as useSyncedRef, cT as IconRenderer, cU as useTimeoutEffect, cV as ReactRemoveScroll, cW as Flex, cX as ElementTag, cY as ActionIconGroup, cZ as DiagramFeatures, c_ as Divider$1, c$ as useXYStore, d0 as useReducedMotionConfig, d1 as Overlay, d2 as t$4, d3 as VisuallyHidden, d4 as MotionDiv, d5 as IconOrShapeRenderer, d6 as MotionButton, d7 as FocusTrap, d8 as HStack, d9 as t$5, da as isMacOs, db as FloatingIndicator, dc as clampUseMovePosition, dd as useMove, de as HoverCard, df as HoverCardTarget, dg as HoverCardDropdown, dh as useDiagramSyncLayoutState, di as ButtonGroup, dj as useIsReducedGraphics, dk as usePanningAtom, dl as useTimeout, dm as useCustomCompareMemo, dn as applyEdgeChanges, dp as applyNodeChanges, dq as getViewportForBounds, dr as typedSystem, ds as centerXYInternalNode, dt as t$6, du as getBoundsOfRects, dv as boxToRect, dw as and, dx as AllDisabled, dy as focusedBounds, dz as or, dA as nodeToRect, dB as useDiagramEventHandlersRef, dC as useActorRef, dD as DiagramActorContextProvider, dE as IconRendererProvider, dF as DiagramEventHandlers, dG as ReduceGraphicsContext, dH as RootContainer, dI as useMutationObserver, dJ as Portal, dK as shallowEqual$1, dL as LikeC4ModelContext } from "./chunk-DlHyKoeo.js";
|
|
5
|
+
import { dM, dN } from "./chunk-DlHyKoeo.js";
|
|
6
6
|
import { nonexhaustive, invariant as invariant$1, isStepEdgeId, extractStep, nameFromFqn, nonNullable, toArray as toArray$1, ifind, DefaultMap, ancestorsFqn, hasAtLeast, isAncestor, sortParentsFirst, ifilter, Queue, whereOperatorAsPredicate, GroupElementKind, delay as delay$1, BBox, getParallelStepsPrefix } from "@likec4/core";
|
|
7
7
|
import { computeRelationshipsView, treeFromElements } from "@likec4/core/compute-view/relationships";
|
|
8
8
|
import { compareNatural, ifind as ifind$1, DefaultMap as DefaultMap$1 } from "@likec4/core/utils";
|
|
@@ -8975,12 +8975,6 @@ function useDebouncedEffect(callback, deps, delay2, maxWait = 0) {
|
|
|
8975
8975
|
useEffect(useDebouncedCallback$1(callback, deps, delay2, maxWait), deps);
|
|
8976
8976
|
}
|
|
8977
8977
|
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
8978
|
-
function usePreviousDistinct(value, predicate = isStrictEqual) {
|
|
8979
|
-
const [previousState, setPreviousState] = useState(), currentRef = useRef(value);
|
|
8980
|
-
return useUpdateEffect(() => {
|
|
8981
|
-
predicate(currentRef.current, value) || (setPreviousState(currentRef.current), currentRef.current = value);
|
|
8982
|
-
}, [value]), previousState;
|
|
8983
|
-
}
|
|
8984
8978
|
function EnsureMantine({ children }) {
|
|
8985
8979
|
const mantineCtx = useContext(MantineContext);
|
|
8986
8980
|
return useEffect(() => {
|
|
@@ -9051,7 +9045,7 @@ function generateCustomColorStyles(customColors) {
|
|
|
9051
9045
|
}
|
|
9052
9046
|
const LikeC4CustomColors = memo$2(() => {
|
|
9053
9047
|
const customColors = useLikeC4Specification().customColors ?? {}, [styles, setStyles] = useState(() => generateCustomColorStyles(customColors));
|
|
9054
|
-
useUpdateEffect
|
|
9048
|
+
useUpdateEffect(() => {
|
|
9055
9049
|
setStyles(generateCustomColorStyles(customColors));
|
|
9056
9050
|
}, [customColors]);
|
|
9057
9051
|
const nonce = useMantineStyleNonce()?.();
|
|
@@ -9253,7 +9247,7 @@ const cssTransparentBg = css({
|
|
|
9253
9247
|
onViewportResize
|
|
9254
9248
|
}) => {
|
|
9255
9249
|
const square = useStore(selectDimensions);
|
|
9256
|
-
return useUpdateEffect
|
|
9250
|
+
return useUpdateEffect(onViewportResize, [square]), null;
|
|
9257
9251
|
}, instanceStates = /* @__PURE__ */ new WeakMap();
|
|
9258
9252
|
function fromCallback(callback) {
|
|
9259
9253
|
return {
|
|
@@ -15949,7 +15943,7 @@ function ElementDetailsCard({
|
|
|
15949
15943
|
min: 0.1,
|
|
15950
15944
|
max: 0.9
|
|
15951
15945
|
}), width = useMotionValue(_width), height = useMotionValue(_height);
|
|
15952
|
-
useUpdateEffect
|
|
15946
|
+
useUpdateEffect(() => {
|
|
15953
15947
|
width.set(_width), height.set(_height);
|
|
15954
15948
|
}, [_width, _height]);
|
|
15955
15949
|
const handleDrag = useCallback((_, info) => {
|
|
@@ -17230,7 +17224,7 @@ function Overlays({ overlaysActorRef }) {
|
|
|
17230
17224
|
}
|
|
17231
17225
|
const [SearchActorContext, useSearchActor] = createSafeContext("SearchActorContext"), selectSearchValue = (s2) => s2.context.searchValue;
|
|
17232
17226
|
function useSearch() {
|
|
17233
|
-
const
|
|
17227
|
+
const searchActorRef = useSearchActor(), searchValue = useSelector(searchActorRef, selectSearchValue), updateSearch = useCallback((search) => {
|
|
17234
17228
|
searchActorRef.send({ type: "change.search", search });
|
|
17235
17229
|
}, [searchActorRef]);
|
|
17236
17230
|
return [searchValue, updateSearch];
|
|
@@ -17240,18 +17234,18 @@ const selectNormalizedSearchValue = (s2) => {
|
|
|
17240
17234
|
return v2.length > 1 ? v2 : "";
|
|
17241
17235
|
};
|
|
17242
17236
|
function useNormalizedSearch() {
|
|
17243
|
-
const
|
|
17237
|
+
const searchActorRef = useSearchActor();
|
|
17244
17238
|
return useDeferredValue(useSelector(searchActorRef, selectNormalizedSearchValue));
|
|
17245
17239
|
}
|
|
17246
17240
|
function useUpdateSearch() {
|
|
17247
|
-
const
|
|
17241
|
+
const searchActorRef = useSearchActor();
|
|
17248
17242
|
return useCallback((search) => {
|
|
17249
17243
|
searchActorRef.send({ type: "change.search", search });
|
|
17250
17244
|
}, [searchActorRef]);
|
|
17251
17245
|
}
|
|
17252
17246
|
const selectPickViewFor = (s2) => s2.context.pickViewFor;
|
|
17253
17247
|
function usePickViewFor() {
|
|
17254
|
-
const
|
|
17248
|
+
const searchActorRef = useSearchActor();
|
|
17255
17249
|
return useSelector(searchActorRef, selectPickViewFor);
|
|
17256
17250
|
}
|
|
17257
17251
|
const buttonFocused = css.raw({
|
|
@@ -17463,15 +17457,39 @@ function centerY(element) {
|
|
|
17463
17457
|
const rect = element.getBoundingClientRect();
|
|
17464
17458
|
return rect.y + Math.floor(rect.height / 2);
|
|
17465
17459
|
}
|
|
17466
|
-
function moveFocusToSearchInput() {
|
|
17467
|
-
|
|
17460
|
+
function moveFocusToSearchInput(from) {
|
|
17461
|
+
if (!from) {
|
|
17462
|
+
console.error("moveFocusToSearchInput: from is null or undefined");
|
|
17463
|
+
return;
|
|
17464
|
+
}
|
|
17465
|
+
const root2 = from.getRootNode();
|
|
17466
|
+
if (!t$4(root2.querySelector)) {
|
|
17467
|
+
console.error("moveFocusToSearchInput: root.querySelector is not a function");
|
|
17468
|
+
return;
|
|
17469
|
+
}
|
|
17470
|
+
let input2 = root2.querySelector("[data-likec4-search-input]");
|
|
17468
17471
|
if (input2) {
|
|
17469
17472
|
const length = input2.value.length;
|
|
17470
17473
|
input2.focus(), input2.setSelectionRange(length, length);
|
|
17471
17474
|
}
|
|
17472
17475
|
}
|
|
17473
|
-
function focusToFirstFoundElement() {
|
|
17474
|
-
|
|
17476
|
+
function focusToFirstFoundElement(from) {
|
|
17477
|
+
if (!from) {
|
|
17478
|
+
console.error("focusToFirstFoundElement: from is null or undefined");
|
|
17479
|
+
return;
|
|
17480
|
+
}
|
|
17481
|
+
const root2 = from.getRootNode();
|
|
17482
|
+
if (!t$4(root2.querySelector)) {
|
|
17483
|
+
console.error("focusToFirstFoundElement: root.querySelector is not a function");
|
|
17484
|
+
return;
|
|
17485
|
+
}
|
|
17486
|
+
root2.querySelector(`[data-likec4-search] .${focusable}`)?.focus();
|
|
17487
|
+
}
|
|
17488
|
+
function queryAllFocusable(from, where, selector3 = `.${focusable}`) {
|
|
17489
|
+
if (!from)
|
|
17490
|
+
return console.error("queryAllFocusable: from is null or undefined"), [];
|
|
17491
|
+
const root2 = from.getRootNode();
|
|
17492
|
+
return t$4(root2.querySelectorAll) ? [...root2.querySelectorAll(`[data-likec4-search-${where}] ${selector3}`)] : (console.error("queryAllFocusable: root.querySelectorAll is not a function"), []);
|
|
17475
17493
|
}
|
|
17476
17494
|
const _viewBtn = "likec4-view-btn", viewButton = cx(
|
|
17477
17495
|
css({
|
|
@@ -17498,18 +17516,18 @@ css({
|
|
|
17498
17516
|
}
|
|
17499
17517
|
});
|
|
17500
17518
|
const NothingFound = () => /* @__PURE__ */ jsx(Box$1, { className: emptyBoX, children: "Nothing found" }), ViewsColumn = memo$2(() => {
|
|
17519
|
+
const ref = useRef(null);
|
|
17501
17520
|
let views = [...useLikeC4Model().views()], search = useNormalizedSearch();
|
|
17502
17521
|
return search && (search.startsWith("kind:") ? views = [] : views = views.filter((view) => search.startsWith("#") ? view.tags.some((tag) => tag.toLocaleLowerCase().includes(search.slice(1))) : (view.title ?? "" + view.$view.description ?? "").toLocaleLowerCase().includes(search))), /* @__PURE__ */ jsxs(
|
|
17503
17522
|
Stack,
|
|
17504
17523
|
{
|
|
17524
|
+
ref,
|
|
17505
17525
|
renderRoot: (props) => /* @__PURE__ */ jsx(MotionDiv, { layout: !0, ...props }),
|
|
17506
17526
|
gap: 8,
|
|
17507
17527
|
"data-likec4-search-views": !0,
|
|
17508
17528
|
onKeyDown: (e2) => {
|
|
17509
17529
|
if (e2.key === "ArrowLeft" || e2.key === "ArrowRight") {
|
|
17510
|
-
const maxY = e2.target.getBoundingClientRect().y, elementButtons =
|
|
17511
|
-
"[data-likec4-search-elements] .likec4-focusable"
|
|
17512
|
-
)];
|
|
17530
|
+
const maxY = e2.target.getBoundingClientRect().y, elementButtons = queryAllFocusable(ref.current, "elements", ".likec4-element-button");
|
|
17513
17531
|
let elementButton = elementButtons.length > 1 ? elementButtons.find((el, i2, all) => centerY(el) > maxY || i2 === all.length - 1) : null;
|
|
17514
17532
|
elementButton ??= d$1(elementButtons), elementButton && (e2.stopPropagation(), elementButton.focus());
|
|
17515
17533
|
return;
|
|
@@ -17523,7 +17541,7 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box$1, { className: emptyBoX, chi
|
|
|
17523
17541
|
"data-likec4-view": !0,
|
|
17524
17542
|
tabIndex: -1,
|
|
17525
17543
|
onFocus: (e2) => {
|
|
17526
|
-
e2.stopPropagation(), moveFocusToSearchInput();
|
|
17544
|
+
e2.stopPropagation(), moveFocusToSearchInput(ref.current);
|
|
17527
17545
|
}
|
|
17528
17546
|
}
|
|
17529
17547
|
) }),
|
|
@@ -17540,7 +17558,11 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box$1, { className: emptyBoX, chi
|
|
|
17540
17558
|
);
|
|
17541
17559
|
}), btn$2 = buttonsva();
|
|
17542
17560
|
function ViewButton({ className, view, loop = !1, search, ...props }) {
|
|
17543
|
-
const diagram = useDiagram(), currentViewId = useCurrentViewId(), isCurrentView = view.id === currentViewId
|
|
17561
|
+
const searchActorRef = useSearchActor(), diagram = useDiagram(), currentViewId = useCurrentViewId(), isCurrentView = view.id === currentViewId, navigate = () => {
|
|
17562
|
+
searchActorRef.send({ type: "close" }), setTimeout(() => {
|
|
17563
|
+
diagram.navigateTo(view.id);
|
|
17564
|
+
}, 100);
|
|
17565
|
+
};
|
|
17544
17566
|
return /* @__PURE__ */ jsxs(
|
|
17545
17567
|
UnstyledButton,
|
|
17546
17568
|
{
|
|
@@ -17549,7 +17571,7 @@ function ViewButton({ className, view, loop = !1, search, ...props }) {
|
|
|
17549
17571
|
"data-likec4-view": view.id,
|
|
17550
17572
|
...isCurrentView && { "data-disabled": !0 },
|
|
17551
17573
|
onClick: (e2) => {
|
|
17552
|
-
e2.stopPropagation(),
|
|
17574
|
+
e2.stopPropagation(), navigate();
|
|
17553
17575
|
},
|
|
17554
17576
|
onKeyDown: createScopedKeydownHandler({
|
|
17555
17577
|
siblingSelector: "[data-likec4-view]",
|
|
@@ -17558,7 +17580,7 @@ function ViewButton({ className, view, loop = !1, search, ...props }) {
|
|
|
17558
17580
|
loop,
|
|
17559
17581
|
orientation: "vertical",
|
|
17560
17582
|
onKeyDown: (e2) => {
|
|
17561
|
-
e2.nativeEvent.code === "Space" && (e2.stopPropagation(),
|
|
17583
|
+
e2.nativeEvent.code === "Space" && (e2.stopPropagation(), navigate());
|
|
17562
17584
|
}
|
|
17563
17585
|
}),
|
|
17564
17586
|
children: [
|
|
@@ -17636,15 +17658,13 @@ function ElementsTree({
|
|
|
17636
17658
|
const target = e2.target, id2 = target.getAttribute("data-value"), node2 = !!id2 && byid[id2];
|
|
17637
17659
|
if (node2) {
|
|
17638
17660
|
if (e2.key === "ArrowUp") {
|
|
17639
|
-
id2 === roots[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput());
|
|
17661
|
+
id2 === roots[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput(target));
|
|
17640
17662
|
return;
|
|
17641
17663
|
}
|
|
17642
17664
|
if (e2.key === "ArrowRight") {
|
|
17643
17665
|
if (node2.children.length > 0 && tree.expandedState[id2] === !1)
|
|
17644
17666
|
return;
|
|
17645
|
-
const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons =
|
|
17646
|
-
`[data-likec4-search-views] .${focusable}`
|
|
17647
|
-
)];
|
|
17667
|
+
const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons = queryAllFocusable(target, "views");
|
|
17648
17668
|
let view = viewButtons.length > 1 ? viewButtons.find((el, i2, all2) => centerY(el) > maxY || i2 === all2.length - 1) : null;
|
|
17649
17669
|
view ??= d$1(viewButtons), view && (stopAndPrevent(e2), view.focus());
|
|
17650
17670
|
return;
|
|
@@ -17751,18 +17771,20 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
|
|
|
17751
17771
|
] });
|
|
17752
17772
|
}
|
|
17753
17773
|
function useHandleElementSelection() {
|
|
17754
|
-
const diagram = useDiagram(),
|
|
17755
|
-
return
|
|
17774
|
+
const diagram = useDiagram(), searchActorRef = useSearchActor();
|
|
17775
|
+
return useCallbackRef((element) => {
|
|
17756
17776
|
const views = [...element.views()];
|
|
17757
17777
|
if (views.length === 0)
|
|
17758
17778
|
return;
|
|
17759
17779
|
const singleView = t(views);
|
|
17760
17780
|
if (singleView) {
|
|
17761
|
-
|
|
17781
|
+
searchActorRef.send({ type: "close" }), singleView.id !== diagram.currentView.id && setTimeout(() => {
|
|
17782
|
+
diagram.navigateTo(singleView.id);
|
|
17783
|
+
}, 100);
|
|
17762
17784
|
return;
|
|
17763
17785
|
}
|
|
17764
17786
|
searchActorRef.send({ type: "pickview.open", elementFqn: element.id });
|
|
17765
|
-
}
|
|
17787
|
+
});
|
|
17766
17788
|
}
|
|
17767
17789
|
const input = css({
|
|
17768
17790
|
border: "transparent",
|
|
@@ -17818,7 +17840,7 @@ css({
|
|
|
17818
17840
|
}
|
|
17819
17841
|
});
|
|
17820
17842
|
function PickView({ elementFqn }) {
|
|
17821
|
-
const
|
|
17843
|
+
const searchActorRef = useSearchActor(), element = useLikeC4Model().element(elementFqn), scoped = [], others = [];
|
|
17822
17844
|
for (const view of element.views())
|
|
17823
17845
|
view.viewOf === element ? scoped.push(view) : others.push(view);
|
|
17824
17846
|
const closePickView = () => {
|
|
@@ -17847,7 +17869,7 @@ function PickView({ elementFqn }) {
|
|
|
17847
17869
|
},
|
|
17848
17870
|
"pickview-backdrop"
|
|
17849
17871
|
),
|
|
17850
|
-
/* @__PURE__ */ jsxs(
|
|
17872
|
+
/* @__PURE__ */ jsx(FocusTrap, { children: /* @__PURE__ */ jsxs(
|
|
17851
17873
|
MotionDiv,
|
|
17852
17874
|
{
|
|
17853
17875
|
initial: {
|
|
@@ -17887,7 +17909,7 @@ function PickView({ elementFqn }) {
|
|
|
17887
17909
|
}
|
|
17888
17910
|
)
|
|
17889
17911
|
] }),
|
|
17890
|
-
/* @__PURE__ */
|
|
17912
|
+
/* @__PURE__ */ jsxs(ScrollAreaAutosize, { mah: "calc(100vh - 110px)", type: "never", children: [
|
|
17891
17913
|
scoped.length > 0 && /* @__PURE__ */ jsxs(Stack, { gap: "sm", px: "sm", className: pickviewGroup, children: [
|
|
17892
17914
|
/* @__PURE__ */ jsx(Title, { order: 6, c: "dimmed", children: "scoped views of the element" }),
|
|
17893
17915
|
scoped.map((view, i2) => /* @__PURE__ */ jsx(
|
|
@@ -17918,14 +17940,15 @@ function PickView({ elementFqn }) {
|
|
|
17918
17940
|
view.id
|
|
17919
17941
|
))
|
|
17920
17942
|
] })
|
|
17921
|
-
] })
|
|
17943
|
+
] })
|
|
17922
17944
|
]
|
|
17923
17945
|
},
|
|
17924
17946
|
"pickview"
|
|
17925
|
-
)
|
|
17947
|
+
) })
|
|
17926
17948
|
] });
|
|
17927
17949
|
}
|
|
17928
17950
|
function SearchByTags() {
|
|
17951
|
+
const ref = useRef(null);
|
|
17929
17952
|
let tags = useLikeC4Model().tagsSortedByUsage, setSearch = useUpdateSearch(), search = useNormalizedSearch(), countBefore = tags.length;
|
|
17930
17953
|
if (search.startsWith("#")) {
|
|
17931
17954
|
const searchTag = search.slice(1);
|
|
@@ -17937,6 +17960,7 @@ function SearchByTags() {
|
|
|
17937
17960
|
return /* @__PURE__ */ jsxs(
|
|
17938
17961
|
HStack,
|
|
17939
17962
|
{
|
|
17963
|
+
ref,
|
|
17940
17964
|
css: {
|
|
17941
17965
|
gap: "md",
|
|
17942
17966
|
paddingLeft: 48,
|
|
@@ -17996,7 +18020,7 @@ function SearchByTags() {
|
|
|
17996
18020
|
}),
|
|
17997
18021
|
onClick: (e2) => {
|
|
17998
18022
|
e2.stopPropagation(), setSearch(`#${tag}`), setTimeout(() => {
|
|
17999
|
-
focusToFirstFoundElement();
|
|
18023
|
+
focusToFirstFoundElement(ref.current);
|
|
18000
18024
|
}, 350);
|
|
18001
18025
|
}
|
|
18002
18026
|
},
|
|
@@ -18011,7 +18035,7 @@ function SearchByTags() {
|
|
|
18011
18035
|
size: "compact-xs",
|
|
18012
18036
|
variant: "light",
|
|
18013
18037
|
onClick: (e2) => {
|
|
18014
|
-
e2.stopPropagation(), setSearch(""), moveFocusToSearchInput();
|
|
18038
|
+
e2.stopPropagation(), setSearch(""), moveFocusToSearchInput(ref.current);
|
|
18015
18039
|
},
|
|
18016
18040
|
rightSection: /* @__PURE__ */ jsx(IconX, { size: 14 }),
|
|
18017
18041
|
children: "Clear"
|
|
@@ -18025,9 +18049,7 @@ function startingWithKind(search) {
|
|
|
18025
18049
|
return search.match(/^(k|ki|kin|kind|kind:)$/) != null;
|
|
18026
18050
|
}
|
|
18027
18051
|
const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
18028
|
-
const
|
|
18029
|
-
usePreviousDistinct(search);
|
|
18030
|
-
const combobox = useCombobox({
|
|
18052
|
+
const searchActorRef = useSearchActor(), likec4model = useLikeC4Model(), inputRef = useRef(null), { ref, focused } = useFocusWithin(), [search, setSearch] = useSearch(), combobox = useCombobox({
|
|
18031
18053
|
scrollBehavior: "smooth",
|
|
18032
18054
|
loop: !1
|
|
18033
18055
|
});
|
|
@@ -18035,7 +18057,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18035
18057
|
"keydown",
|
|
18036
18058
|
(event) => {
|
|
18037
18059
|
try {
|
|
18038
|
-
!focused && (event.key === "Backspace" || event.key.startsWith("Arrow") || event.key.match(/^\p{L}$/u)) && moveFocusToSearchInput();
|
|
18060
|
+
!focused && (event.key === "Backspace" || event.key.startsWith("Arrow") || event.key.match(/^\p{L}$/u)) && moveFocusToSearchInput(inputRef.current);
|
|
18039
18061
|
} catch (e2) {
|
|
18040
18062
|
console.warn(e2);
|
|
18041
18063
|
}
|
|
@@ -18054,24 +18076,24 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18054
18076
|
// }
|
|
18055
18077
|
case search.startsWith("#"): {
|
|
18056
18078
|
const searchTag = search.toLocaleLowerCase().slice(1), alloptions = likec4model.tags.filter((tag) => tag.toLocaleLowerCase().includes(searchTag));
|
|
18057
|
-
|
|
18079
|
+
alloptions.length === 0 ? (isExactMatch = !1, options = [
|
|
18058
18080
|
/* @__PURE__ */ jsx(ComboboxEmpty, { children: "No tags found" }, "empty-tags")
|
|
18059
|
-
] : options = alloptions.map((tag) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `#${tag}`, children: [
|
|
18081
|
+
]) : (isExactMatch = likec4model.tags.some((tag) => tag.toLocaleLowerCase() === searchTag), options = alloptions.map((tag) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `#${tag}`, children: [
|
|
18060
18082
|
/* @__PURE__ */ jsx(Text, { component: "span", opacity: 0.5, mr: 1, fz: "sm", children: "#" }),
|
|
18061
18083
|
tag
|
|
18062
|
-
] }, tag));
|
|
18084
|
+
] }, tag)));
|
|
18063
18085
|
break;
|
|
18064
18086
|
}
|
|
18065
18087
|
case search.startsWith("kind:"):
|
|
18066
18088
|
case startingWithKind(search): {
|
|
18067
18089
|
const term = search.length > 5 ? search.slice(5).toLocaleLowerCase() : "";
|
|
18068
|
-
let alloptions = t$
|
|
18069
|
-
term && (alloptions = alloptions.filter((kind) => kind.toLocaleLowerCase().includes(term))
|
|
18090
|
+
let alloptions = t$5(likec4model.specification.elements);
|
|
18091
|
+
term && (alloptions = alloptions.filter((kind) => kind.toLocaleLowerCase().includes(term))), alloptions.length === 0 ? (isExactMatch = !1, options = [
|
|
18070
18092
|
/* @__PURE__ */ jsx(ComboboxEmpty, { children: "No kinds found" }, "empty-kinds")
|
|
18071
|
-
] : options = alloptions.map((kind) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `kind:${kind}`, children: [
|
|
18093
|
+
]) : (isExactMatch = alloptions.some((kind) => kind.toLocaleLowerCase() === term), options = alloptions.map((kind) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `kind:${kind}`, children: [
|
|
18072
18094
|
/* @__PURE__ */ jsx(Text, { component: "span", opacity: 0.5, mr: 1, fz: "sm", children: "kind:" }),
|
|
18073
18095
|
kind
|
|
18074
|
-
] }, kind));
|
|
18096
|
+
] }, kind)));
|
|
18075
18097
|
break;
|
|
18076
18098
|
}
|
|
18077
18099
|
}
|
|
@@ -18080,7 +18102,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18080
18102
|
{
|
|
18081
18103
|
onOptionSubmit: (optionValue) => {
|
|
18082
18104
|
setSearch(optionValue), combobox.resetSelectedOption(), SEARCH_PREFIXES.includes(optionValue) || (combobox.closeDropdown(), setTimeout(() => {
|
|
18083
|
-
focusToFirstFoundElement();
|
|
18105
|
+
focusToFirstFoundElement(inputRef.current);
|
|
18084
18106
|
}, 350));
|
|
18085
18107
|
},
|
|
18086
18108
|
width: "max-content",
|
|
@@ -18096,10 +18118,11 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18096
18118
|
/* @__PURE__ */ jsx(ComboboxTarget, { children: /* @__PURE__ */ jsx(
|
|
18097
18119
|
Input,
|
|
18098
18120
|
{
|
|
18099
|
-
ref,
|
|
18100
|
-
id: "likec4searchinput",
|
|
18121
|
+
ref: useMergedRef(inputRef, ref),
|
|
18101
18122
|
placeholder: "Search by title, description or start with # or kind:",
|
|
18102
18123
|
autoFocus: !0,
|
|
18124
|
+
"data-autofocus": !0,
|
|
18125
|
+
"data-likec4-search-input": !0,
|
|
18103
18126
|
tabIndex: 0,
|
|
18104
18127
|
classNames: {
|
|
18105
18128
|
input
|
|
@@ -18113,7 +18136,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18113
18136
|
onClick: (e2) => {
|
|
18114
18137
|
e2.stopPropagation();
|
|
18115
18138
|
const openedWithSearch = searchActorRef.getSnapshot().context.openedWithSearch;
|
|
18116
|
-
search === "" || search === openedWithSearch ? close
|
|
18139
|
+
search === "" || search === openedWithSearch ? searchActorRef.send({ type: "close" }) : setSearch("");
|
|
18117
18140
|
}
|
|
18118
18141
|
}
|
|
18119
18142
|
),
|
|
@@ -18154,7 +18177,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18154
18177
|
}
|
|
18155
18178
|
if (e2.key === "ArrowDown" && (!combobox.dropdownOpened || options.length === 0 || isExactMatch || // reached the last option and the search is empty
|
|
18156
18179
|
search === "" && combobox.getSelectedOptionIndex() === options.length - 1)) {
|
|
18157
|
-
combobox.closeDropdown(), stopAndPrevent(e2), focusToFirstFoundElement();
|
|
18180
|
+
combobox.closeDropdown(), stopAndPrevent(e2), focusToFirstFoundElement(inputRef.current);
|
|
18158
18181
|
return;
|
|
18159
18182
|
}
|
|
18160
18183
|
}
|
|
@@ -18198,15 +18221,12 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18198
18221
|
// _dark: `[rgb(34 34 34 / 0.95)]`,
|
|
18199
18222
|
// _light: `[rgb(255 255 255/ 0.95)]`,
|
|
18200
18223
|
// },
|
|
18201
|
-
}), selectIsOpened = (s2) => !s2.matches("inactive")
|
|
18224
|
+
}), selectIsOpened = (s2) => !s2.matches("inactive");
|
|
18225
|
+
function Search({ searchActorRef }) {
|
|
18202
18226
|
const isOpened = useSelector(searchActorRef, selectIsOpened), openSearch = () => {
|
|
18203
18227
|
searchActorRef.send({ type: "open" });
|
|
18204
|
-
},
|
|
18228
|
+
}, close = useCallbackRef(() => {
|
|
18205
18229
|
searchActorRef.send({ type: "close" });
|
|
18206
|
-
}, afterCloseCbRef = useRef(null), close = useCallbackRef((cb) => {
|
|
18207
|
-
afterCloseCbRef.current = cb ?? null, sendClose();
|
|
18208
|
-
}), onExitComplete = useCallbackRef(() => {
|
|
18209
|
-
afterCloseCbRef.current && (afterCloseCbRef.current(), afterCloseCbRef.current = null);
|
|
18210
18230
|
});
|
|
18211
18231
|
return useHotkeys([
|
|
18212
18232
|
["mod+k", openSearch, {
|
|
@@ -18215,34 +18235,26 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18215
18235
|
["mod+f", openSearch, {
|
|
18216
18236
|
preventDefault: !0
|
|
18217
18237
|
}]
|
|
18218
|
-
]), /* @__PURE__ */ jsx(
|
|
18219
|
-
|
|
18238
|
+
]), /* @__PURE__ */ jsx(SearchActorContext, { value: searchActorRef, children: /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: close, children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpened && /* @__PURE__ */ jsx(
|
|
18239
|
+
Overlay,
|
|
18220
18240
|
{
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18241
|
+
fullscreen: !0,
|
|
18242
|
+
withBackdrop: !1,
|
|
18243
|
+
backdrop: {
|
|
18244
|
+
opacity: 0.9
|
|
18224
18245
|
},
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18233
|
-
classes: {
|
|
18234
|
-
dialog,
|
|
18235
|
-
body
|
|
18236
|
-
},
|
|
18237
|
-
openDelay: 0,
|
|
18238
|
-
onClose: close,
|
|
18239
|
-
"data-likec4-search": "true",
|
|
18240
|
-
children: /* @__PURE__ */ jsx(SearchOverlay, { close, searchActorRef })
|
|
18241
|
-
}
|
|
18242
|
-
) }) }) }) })
|
|
18246
|
+
classes: {
|
|
18247
|
+
dialog,
|
|
18248
|
+
body
|
|
18249
|
+
},
|
|
18250
|
+
openDelay: 0,
|
|
18251
|
+
onClose: close,
|
|
18252
|
+
"data-likec4-search": "true",
|
|
18253
|
+
children: /* @__PURE__ */ jsx(SearchOverlay, { searchActorRef })
|
|
18243
18254
|
}
|
|
18244
|
-
);
|
|
18245
|
-
}
|
|
18255
|
+
) }) }) }) });
|
|
18256
|
+
}
|
|
18257
|
+
const scrollArea = css({
|
|
18246
18258
|
height: [
|
|
18247
18259
|
"100%",
|
|
18248
18260
|
"100cqh"
|
|
@@ -18254,18 +18266,18 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
|
|
|
18254
18266
|
height: "100%"
|
|
18255
18267
|
}
|
|
18256
18268
|
}
|
|
18257
|
-
}), SearchOverlay = ({
|
|
18258
|
-
const pickViewFor = usePickViewFor();
|
|
18269
|
+
}), SearchOverlay = ({ searchActorRef }) => {
|
|
18270
|
+
const ref = useRef(null), pickViewFor = usePickViewFor();
|
|
18259
18271
|
return useTimeoutEffect(() => {
|
|
18260
|
-
n$7(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement();
|
|
18261
|
-
}, 150), /* @__PURE__ */ jsxs(
|
|
18272
|
+
n$7(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
|
|
18273
|
+
}, 150), /* @__PURE__ */ jsxs(Box$1, { ref, display: "contents", children: [
|
|
18262
18274
|
/* @__PURE__ */ jsx(
|
|
18263
18275
|
Group,
|
|
18264
18276
|
{
|
|
18265
18277
|
className: "group",
|
|
18266
18278
|
wrap: "nowrap",
|
|
18267
18279
|
onClick: (e2) => {
|
|
18268
|
-
e2.stopPropagation(), moveFocusToSearchInput();
|
|
18280
|
+
e2.stopPropagation(), moveFocusToSearchInput(ref.current);
|
|
18269
18281
|
},
|
|
18270
18282
|
children: /* @__PURE__ */ jsxs(VStack, { flex: 1, px: "sm", children: [
|
|
18271
18283
|
/* @__PURE__ */ jsx(LikeC4SearchInput, {}),
|
|
@@ -19791,12 +19803,12 @@ function LikeC4DiagramXYFlow({
|
|
|
19791
19803
|
onCanvasDblClick
|
|
19792
19804
|
} = useDiagramEventHandlers(), notReadOnly = !enableReadOnly, isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
|
|
19793
19805
|
$isPanning.set(!0);
|
|
19794
|
-
}, isReducedGraphics ?
|
|
19806
|
+
}, isReducedGraphics ? 120 : 200), notPanning = useDebouncedCallback(() => {
|
|
19795
19807
|
isPanning.clear(), $isPanning.get() && $isPanning.set(!1);
|
|
19796
|
-
}, 200), onMove = useCallbackRef((event) => {
|
|
19808
|
+
}, isReducedGraphics ? 350 : 200), onMove = useCallbackRef((event) => {
|
|
19797
19809
|
event && ($isPanning.get() || isPanning.start(), notPanning());
|
|
19798
19810
|
}), onMoveEnd = useCallbackRef((event, viewport) => {
|
|
19799
|
-
event && notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
|
|
19811
|
+
event && !isReducedGraphics && notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
|
|
19800
19812
|
}), onViewportResize = useCallbackRef(() => {
|
|
19801
19813
|
diagram.send({ type: "xyflow.resized" });
|
|
19802
19814
|
}), nodeTypes2 = useCustomCompareMemo(
|
|
@@ -19810,7 +19822,7 @@ function LikeC4DiagramXYFlow({
|
|
|
19810
19822
|
[renderNodes],
|
|
19811
19823
|
shallowEqual
|
|
19812
19824
|
);
|
|
19813
|
-
return useUpdateEffect
|
|
19825
|
+
return useUpdateEffect(() => {
|
|
19814
19826
|
console.warn("renderNodes changed - this might degrade performance");
|
|
19815
19827
|
}, [nodeTypes2]), /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
19816
19828
|
/* @__PURE__ */ jsx(
|
|
@@ -20785,7 +20797,7 @@ function layoutResultToXYFlow(layout2) {
|
|
|
20785
20797
|
};
|
|
20786
20798
|
}
|
|
20787
20799
|
function inputToSubject(input2) {
|
|
20788
|
-
return "edgeId" in input2 ? (invariant$1(t$
|
|
20800
|
+
return "edgeId" in input2 ? (invariant$1(t$6(input2.edgeId), "edgeId is required"), {
|
|
20789
20801
|
edgeId: input2.edgeId
|
|
20790
20802
|
}) : {
|
|
20791
20803
|
source: input2.source,
|
|
@@ -21130,7 +21142,7 @@ const relationshipDetailsLogic = setup({
|
|
|
21130
21142
|
},
|
|
21131
21143
|
guards: {
|
|
21132
21144
|
"has overlays?": ({ context }) => context.overlays.length > 0,
|
|
21133
|
-
"close specific overlay?": ({ context, event }) => (assertEvent(event, "close"), t$
|
|
21145
|
+
"close specific overlay?": ({ context, event }) => (assertEvent(event, "close"), t$6(event.actorId) && context.overlays.some((o2) => o2.id === event.actorId)),
|
|
21134
21146
|
"last: is relationshipDetails?": ({ context }) => a$4(context.overlays)?.type === "relationshipDetails",
|
|
21135
21147
|
"last: is relationshipsBrowser?": ({ context }) => a$4(context.overlays)?.type === "relationshipsBrowser"
|
|
21136
21148
|
}
|
|
@@ -22680,12 +22692,14 @@ const _diagramMachine = setup({
|
|
|
22680
22692
|
"closeAllOverlays",
|
|
22681
22693
|
"closeSearch",
|
|
22682
22694
|
"stopSyncLayout",
|
|
22683
|
-
{
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22695
|
+
enqueueActions(({ enqueue, context }) => {
|
|
22696
|
+
enqueue({
|
|
22697
|
+
type: "trigger:NavigateTo",
|
|
22698
|
+
params: {
|
|
22699
|
+
viewId: nonNullable(context.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
|
|
22700
|
+
}
|
|
22701
|
+
});
|
|
22702
|
+
})
|
|
22689
22703
|
],
|
|
22690
22704
|
on: {
|
|
22691
22705
|
"update.view": {
|
|
@@ -22827,7 +22841,7 @@ function DiagramActorProvider({
|
|
|
22827
22841
|
"trigger:NavigateTo": (_, { viewId }) => {
|
|
22828
22842
|
setTimeout(() => {
|
|
22829
22843
|
handlersRef.current.onNavigateTo?.(viewId);
|
|
22830
|
-
},
|
|
22844
|
+
}, 40);
|
|
22831
22845
|
},
|
|
22832
22846
|
"trigger:OnChange": (_, params) => {
|
|
22833
22847
|
handlersRef.current.onChange?.(params);
|
|
@@ -22898,7 +22912,7 @@ function LikeC4Diagram({
|
|
|
22898
22912
|
pannable = !0,
|
|
22899
22913
|
zoomable = !0,
|
|
22900
22914
|
background = "dots",
|
|
22901
|
-
enableElementTags = !
|
|
22915
|
+
enableElementTags = !1,
|
|
22902
22916
|
enableFocusMode = !1,
|
|
22903
22917
|
enableElementDetails = !1,
|
|
22904
22918
|
enableRelationshipDetails = enableElementDetails,
|
|
@@ -23273,7 +23287,7 @@ function useBundledStyleSheet(injectFontCss, styleNonce) {
|
|
|
23273
23287
|
return useIsomorphicLayoutEffect(() => {
|
|
23274
23288
|
if (injectFontCss && !document.querySelector("style[data-likec4-font]")) {
|
|
23275
23289
|
const style = document.createElement("style");
|
|
23276
|
-
style.setAttribute("type", "text/css"), style.setAttribute("data-likec4-font", ""), t$
|
|
23290
|
+
style.setAttribute("type", "text/css"), style.setAttribute("data-likec4-font", ""), t$6(styleNonce) && style.setAttribute("nonce", styleNonce), t$4(styleNonce) && style.setAttribute("nonce", styleNonce()), style.appendChild(document.createTextNode(fontsCss)), document.head.appendChild(style);
|
|
23277
23291
|
}
|
|
23278
23292
|
}, [injectFontCss]), useIsomorphicLayoutEffect(() => {
|
|
23279
23293
|
const css2 = new CSSStyleSheet();
|
|
@@ -23416,8 +23430,12 @@ function LikeC4View({
|
|
|
23416
23430
|
viewId,
|
|
23417
23431
|
...props
|
|
23418
23432
|
}) {
|
|
23419
|
-
const
|
|
23420
|
-
return
|
|
23433
|
+
const view = useLikeC4Model().findView(viewId);
|
|
23434
|
+
return view ? view.isDiagram() ? /* @__PURE__ */ jsx(LikeC4ViewInner, { view: view.$view, ...props }) : /* @__PURE__ */ jsxs(ErrorMessage, { children: [
|
|
23435
|
+
'LikeC4 View "$',
|
|
23436
|
+
viewId,
|
|
23437
|
+
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
23438
|
+
] }) : /* @__PURE__ */ jsx(ViewNotFound, { viewId });
|
|
23421
23439
|
}
|
|
23422
23440
|
const LikeC4ViewInner = memo$2(({
|
|
23423
23441
|
view,
|
|
@@ -23429,7 +23447,7 @@ const LikeC4ViewInner = memo$2(({
|
|
|
23429
23447
|
injectFontCss = !0,
|
|
23430
23448
|
controls = !1,
|
|
23431
23449
|
fitView = !0,
|
|
23432
|
-
fitViewPadding = "
|
|
23450
|
+
fitViewPadding = "16px",
|
|
23433
23451
|
background = "transparent",
|
|
23434
23452
|
browser = !0,
|
|
23435
23453
|
showDiagramTitle = !1,
|
|
@@ -23512,13 +23530,13 @@ const LikeC4ViewInner = memo$2(({
|
|
|
23512
23530
|
...props
|
|
23513
23531
|
}
|
|
23514
23532
|
),
|
|
23515
|
-
browserView && /* @__PURE__ */ jsxs(Overlay, { onClose: () => onNavigateTo(null), children: [
|
|
23533
|
+
browserView && /* @__PURE__ */ jsxs(Overlay, { openDelay: 0, onClose: () => onNavigateTo(null), children: [
|
|
23516
23534
|
/* @__PURE__ */ jsx(
|
|
23517
23535
|
LikeC4Diagram,
|
|
23518
23536
|
{
|
|
23519
23537
|
view: browserView,
|
|
23520
23538
|
background: "dots",
|
|
23521
|
-
onNavigateTo
|
|
23539
|
+
onNavigateTo,
|
|
23522
23540
|
enableDynamicViewWalkthrough: !0,
|
|
23523
23541
|
enableFocusMode: !0,
|
|
23524
23542
|
enableRelationshipBrowser: !0,
|
|
@@ -23529,11 +23547,11 @@ const LikeC4ViewInner = memo$2(({
|
|
|
23529
23547
|
controls: !0,
|
|
23530
23548
|
readonly: !0,
|
|
23531
23549
|
fitView: !0,
|
|
23532
|
-
fitViewPadding: "
|
|
23533
|
-
renderNodes,
|
|
23550
|
+
fitViewPadding: "32px",
|
|
23534
23551
|
...props,
|
|
23535
23552
|
...browserProps,
|
|
23536
|
-
showNotations: (browserProps.showNotations ?? !0) && (browserView.notation?.nodes.length ?? 0) > 0
|
|
23553
|
+
showNotations: (browserProps.showNotations ?? !0) && (browserView.notation?.nodes.length ?? 0) > 0,
|
|
23554
|
+
renderNodes
|
|
23537
23555
|
}
|
|
23538
23556
|
),
|
|
23539
23557
|
/* @__PURE__ */ jsx(Box, { pos: "absolute", top: "1rem", right: "1rem", children: /* @__PURE__ */ jsx(
|
|
@@ -23558,8 +23576,12 @@ function ReactLikeC4({
|
|
|
23558
23576
|
viewId,
|
|
23559
23577
|
...props
|
|
23560
23578
|
}) {
|
|
23561
|
-
const
|
|
23562
|
-
return
|
|
23579
|
+
const view = useLikeC4Model().findView(viewId);
|
|
23580
|
+
return view ? view.isDiagram() ? /* @__PURE__ */ jsx(ReactLikeC4Inner, { view: view.$view, ...props }) : /* @__PURE__ */ jsxs(ErrorMessage, { children: [
|
|
23581
|
+
'LikeC4 View "$',
|
|
23582
|
+
viewId,
|
|
23583
|
+
'" is not layouted. Make sure you have LikeC4ModelProvider with layouted model.'
|
|
23584
|
+
] }) : /* @__PURE__ */ jsx(ViewNotFound, { viewId });
|
|
23563
23585
|
}
|
|
23564
23586
|
function ReactLikeC4Inner({
|
|
23565
23587
|
className,
|
|
@@ -23577,7 +23599,7 @@ function ReactLikeC4Inner({
|
|
|
23577
23599
|
}) {
|
|
23578
23600
|
const colorScheme = useColorScheme(explicitColorScheme), [shadowRootProps, cssstyle] = useShadowRootStyle(keepAspectRatio, view), hasNotations = (view.notation?.nodes ?? []).length > 0;
|
|
23579
23601
|
let nonce;
|
|
23580
|
-
return t$
|
|
23602
|
+
return t$6(styleNonce) ? nonce = styleNonce : t$4(styleNonce) && (nonce = styleNonce()), /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
23581
23603
|
/* @__PURE__ */ jsx(
|
|
23582
23604
|
"style",
|
|
23583
23605
|
{
|
|
@@ -23634,9 +23656,10 @@ export {
|
|
|
23634
23656
|
useEnabledFeatures,
|
|
23635
23657
|
useLikeC4Model,
|
|
23636
23658
|
useLikeC4Specification,
|
|
23659
|
+
dM as useLikeC4ViewModel,
|
|
23637
23660
|
useMantinePortalProps,
|
|
23638
|
-
|
|
23639
|
-
useUpdateEffect
|
|
23661
|
+
dN as useSetState,
|
|
23662
|
+
useUpdateEffect,
|
|
23640
23663
|
useXYFlow,
|
|
23641
23664
|
useXYInternalNode,
|
|
23642
23665
|
useXYStore,
|