likec4 1.32.0 → 1.32.2

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.
@@ -1300,8 +1300,8 @@ function useHover$1() {
1300
1300
  [handleMouseEnter, handleMouseLeave]
1301
1301
  ), hovered };
1302
1302
  }
1303
- function useDisclosure(initialState = !1, options = {}) {
1304
- const [opened, setOpened] = useState(initialState), open = useCallback(() => {
1303
+ function useDisclosure(initialState2 = !1, options = {}) {
1304
+ const [opened, setOpened] = useState(initialState2), open = useCallback(() => {
1305
1305
  setOpened((isOpened) => isOpened || (options.onOpen?.(), !0));
1306
1306
  }, [options.onOpen]), close = useCallback(() => {
1307
1307
  setOpened((isOpened) => isOpened && (options.onClose?.(), !1));
@@ -12646,7 +12646,7 @@ const defaultProps$8 = {
12646
12646
  styles,
12647
12647
  unstyled,
12648
12648
  vars,
12649
- initialState,
12649
+ initialState: initialState2,
12650
12650
  maxHeight,
12651
12651
  hideLabel,
12652
12652
  showLabel,
@@ -12670,7 +12670,7 @@ const defaultProps$8 = {
12670
12670
  varsResolver: varsResolver$5
12671
12671
  }), _id = useId$2(id2), regionId = `${_id}-region`, [show, setShowState] = useUncontrolled({
12672
12672
  value: expanded,
12673
- defaultValue: initialState,
12673
+ defaultValue: initialState2,
12674
12674
  finalValue: !1,
12675
12675
  onChange: onExpandedChange
12676
12676
  }), { ref: contentRef, height } = useElementSize(), spoilerMoreContent = show ? hideLabel : showLabel, spoiler = spoilerMoreContent !== null && maxHeight < height;
@@ -13255,14 +13255,14 @@ function isNodeIndeterminate(value, data, checkedState) {
13255
13255
  return checkedState.length === 0 ? !1 : getAllCheckedNodes(data, checkedState).result.some((node2) => node2.value === value && node2.indeterminate);
13256
13256
  }
13257
13257
  const memoizedIsNodeIndeterminate = memoize(isNodeIndeterminate);
13258
- function getInitialTreeExpandedState(initialState, data, value, acc = {}) {
13258
+ function getInitialTreeExpandedState(initialState2, data, value, acc = {}) {
13259
13259
  return data.forEach((node2) => {
13260
- acc[node2.value] = node2.value in initialState ? initialState[node2.value] : node2.value === value, Array.isArray(node2.children) && getInitialTreeExpandedState(initialState, node2.children, value, acc);
13260
+ acc[node2.value] = node2.value in initialState2 ? initialState2[node2.value] : node2.value === value, Array.isArray(node2.children) && getInitialTreeExpandedState(initialState2, node2.children, value, acc);
13261
13261
  }), acc;
13262
13262
  }
13263
- function getInitialCheckedState(initialState, data) {
13263
+ function getInitialCheckedState(initialState2, data) {
13264
13264
  const acc = [];
13265
- return initialState.forEach((node2) => acc.push(...getChildrenNodesValues(node2, data))), Array.from(new Set(acc));
13265
+ return initialState2.forEach((node2) => acc.push(...getChildrenNodesValues(node2, data))), Array.from(new Set(acc));
13266
13266
  }
13267
13267
  function useTree({
13268
13268
  initialSelectedState = [],
@@ -13542,7 +13542,7 @@ function batch(fn) {
13542
13542
  }
13543
13543
  }
13544
13544
  class Store {
13545
- constructor(initialState, options) {
13545
+ constructor(initialState2, options) {
13546
13546
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = (listener) => {
13547
13547
  var _a, _b;
13548
13548
  this.listeners.add(listener);
@@ -13553,7 +13553,7 @@ class Store {
13553
13553
  }, this.setState = (updater) => {
13554
13554
  var _a, _b, _c;
13555
13555
  this.prevState = this.state, this.state = (_a = this.options) != null && _a.updateFn ? this.options.updateFn(this.prevState)(updater) : updater(this.prevState), (_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null || _c.call(_b), __flush(this);
13556
- }, this.prevState = initialState, this.state = initialState, this.options = options;
13556
+ }, this.prevState = initialState2, this.state = initialState2, this.options = options;
13557
13557
  }
13558
13558
  }
13559
13559
  class Derived {
@@ -26595,11 +26595,11 @@ const __vite_import_meta_env__ = {}, createStoreImpl = (createState2) => {
26595
26595
  const previousState = state;
26596
26596
  state = replace ?? (typeof nextState != "object" || nextState === null) ? nextState : Object.assign({}, state, nextState), listeners.forEach((listener) => listener(state, previousState));
26597
26597
  }
26598
- }, getState = () => state, api = { setState, getState, getInitialState: () => initialState, subscribe: (listener) => (listeners.add(listener), () => listeners.delete(listener)), destroy: () => {
26598
+ }, getState = () => state, api = { setState, getState, getInitialState: () => initialState2, subscribe: (listener) => (listeners.add(listener), () => listeners.delete(listener)), destroy: () => {
26599
26599
  (__vite_import_meta_env__ ? "production" : void 0) !== "production" && console.warn(
26600
26600
  "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
26601
26601
  ), listeners.clear();
26602
- } }, initialState = state = createState2(setState, getState, api);
26602
+ } }, initialState2 = state = createState2(setState, getState, api);
26603
26603
  return api;
26604
26604
  }, createStore$1 = (createState2) => createState2 ? createStoreImpl(createState2) : createStoreImpl, { useDebugValue } = React__default, { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports, identity = (arg) => arg;
26605
26605
  function useStoreWithEqualityFn(api, selector3 = identity, equalityFn) {
@@ -28903,7 +28903,7 @@ function useDebouncedCallback(callback, deps, delay2, maxWait = 0) {
28903
28903
  }, [delay2, maxWait, ...deps]);
28904
28904
  }
28905
28905
  const noop$1 = () => {
28906
- }, isBrowser$1 = typeof globalThis < "u" && typeof navigator < "u" && typeof document < "u", isStrictEqual = (previous, next) => previous === next, basicDepsComparator = (d1, d2) => {
28906
+ }, isBrowser$1 = typeof globalThis < "u" && typeof navigator < "u" && typeof document < "u", basicDepsComparator = (d1, d2) => {
28907
28907
  if (d1 === d2)
28908
28908
  return !0;
28909
28909
  if (d1.length !== d2.length)
@@ -29011,12 +29011,6 @@ const useCustomCompareMemo = (factory2, deps, comparator) => {
29011
29011
  function useDeepCompareMemo(factory2, deps) {
29012
29012
  return useCustomCompareMemo(factory2, deps, isEqual);
29013
29013
  }
29014
- function usePreviousDistinct(value, predicate = isStrictEqual) {
29015
- const [previousState, setPreviousState] = useState(), currentRef = useRef(value);
29016
- return useUpdateEffect$1(() => {
29017
- predicate(currentRef.current, value) || (setPreviousState(currentRef.current), currentRef.current = value);
29018
- }, [value]), previousState;
29019
- }
29020
29014
  function useAsync(asyncFn, initialValue) {
29021
29015
  const [state, setState] = useState({
29022
29016
  status: "not-executed",
@@ -30014,7 +30008,7 @@ const LikeC4ModelContext$1 = createContext(null);
30014
30008
  function useLikeC4Model$1(type) {
30015
30009
  const model = useContext(LikeC4ModelContext$1);
30016
30010
  if (!model)
30017
- throw new Error("No LikeC4Model found in context");
30011
+ throw new Error("LikeC4Model not found. Make sure you have LikeC4ModelProvider.");
30018
30012
  if (t$3(type) && model.stage !== type)
30019
30013
  throw new Error(`Invalid LikeC4ModelContext, expected "${type}" but got "${model.stage}" in context`);
30020
30014
  return model;
@@ -32472,8 +32466,8 @@ ${err.message}`);
32472
32466
  }
32473
32467
  function getInitialStateNodesWithTheirAncestors(stateNode) {
32474
32468
  const states = getInitialStateNodes(stateNode);
32475
- for (const initialState of states)
32476
- for (const ancestor of getProperAncestors(initialState, stateNode))
32469
+ for (const initialState2 of states)
32470
+ for (const ancestor of getProperAncestors(initialState2, stateNode))
32477
32471
  states.add(ancestor);
32478
32472
  return states;
32479
32473
  }
@@ -32737,8 +32731,8 @@ ${err.message}`);
32737
32731
  addProperAncestorStatesToEnter(s2, stateNode.parent, statesToEnter, historyValue, statesForDefaultEntry);
32738
32732
  }
32739
32733
  else if (stateNode.type === "compound") {
32740
- const [initialState] = stateNode.initial.target;
32741
- isHistoryNode(initialState) || (statesToEnter.add(initialState), statesForDefaultEntry.add(initialState)), addDescendantStatesToEnter(initialState, historyValue, statesForDefaultEntry, statesToEnter), addProperAncestorStatesToEnter(initialState, stateNode, statesToEnter, historyValue, statesForDefaultEntry);
32734
+ const [initialState2] = stateNode.initial.target;
32735
+ isHistoryNode(initialState2) || (statesToEnter.add(initialState2), statesForDefaultEntry.add(initialState2)), addDescendantStatesToEnter(initialState2, historyValue, statesForDefaultEntry, statesToEnter), addProperAncestorStatesToEnter(initialState2, stateNode, statesToEnter, historyValue, statesForDefaultEntry);
32742
32736
  } else if (stateNode.type === "parallel")
32743
32737
  for (const child of getChildren2(stateNode).filter((sn) => !isHistoryNode(sn)))
32744
32738
  [...statesToEnter].some((s2) => isDescendant(s2, child)) || (isHistoryNode(child) || (statesToEnter.add(child), statesForDefaultEntry.add(child)), addDescendantStatesToEnter(child, historyValue, statesForDefaultEntry, statesToEnter));
@@ -38385,131 +38379,90 @@ const select = (s2) => s2.children.search ?? null;
38385
38379
  function useSearchActorRef() {
38386
38380
  return useDiagramActorSnapshot(select, Object.is);
38387
38381
  }
38388
- var reactErrorBoundary_cjs = {}, hasRequiredReactErrorBoundary_cjs;
38389
- function requireReactErrorBoundary_cjs() {
38390
- if (hasRequiredReactErrorBoundary_cjs) return reactErrorBoundary_cjs;
38391
- hasRequiredReactErrorBoundary_cjs = 1, Object.defineProperty(reactErrorBoundary_cjs, "__esModule", { value: !0 });
38392
- var react = React__default;
38393
- const ErrorBoundaryContext = react.createContext(null), initialState = {
38394
- didCatch: !1,
38395
- error: null
38396
- };
38397
- class ErrorBoundary extends react.Component {
38398
- constructor(props2) {
38399
- super(props2), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = initialState;
38382
+ const ErrorBoundaryContext = createContext(null), initialState = {
38383
+ didCatch: !1,
38384
+ error: null
38385
+ };
38386
+ class ErrorBoundary extends Component {
38387
+ constructor(props2) {
38388
+ super(props2), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = initialState;
38389
+ }
38390
+ static getDerivedStateFromError(error) {
38391
+ return {
38392
+ didCatch: !0,
38393
+ error
38394
+ };
38395
+ }
38396
+ resetErrorBoundary() {
38397
+ const {
38398
+ error
38399
+ } = this.state;
38400
+ if (error !== null) {
38401
+ for (var _this$props$onReset, _this$props, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
38402
+ args[_key] = arguments[_key];
38403
+ (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 || _this$props$onReset.call(_this$props, {
38404
+ args,
38405
+ reason: "imperative-api"
38406
+ }), this.setState(initialState);
38400
38407
  }
38401
- static getDerivedStateFromError(error) {
38402
- return {
38403
- didCatch: !0,
38404
- error
38408
+ }
38409
+ componentDidCatch(error, info) {
38410
+ var _this$props$onError, _this$props2;
38411
+ (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props2, error, info);
38412
+ }
38413
+ componentDidUpdate(prevProps, prevState) {
38414
+ const {
38415
+ didCatch
38416
+ } = this.state, {
38417
+ resetKeys
38418
+ } = this.props;
38419
+ if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
38420
+ var _this$props$onReset2, _this$props3;
38421
+ (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 || _this$props$onReset2.call(_this$props3, {
38422
+ next: resetKeys,
38423
+ prev: prevProps.resetKeys,
38424
+ reason: "keys"
38425
+ }), this.setState(initialState);
38426
+ }
38427
+ }
38428
+ render() {
38429
+ const {
38430
+ children: children2,
38431
+ fallbackRender,
38432
+ FallbackComponent,
38433
+ fallback
38434
+ } = this.props, {
38435
+ didCatch,
38436
+ error
38437
+ } = this.state;
38438
+ let childToRender = children2;
38439
+ if (didCatch) {
38440
+ const props2 = {
38441
+ error,
38442
+ resetErrorBoundary: this.resetErrorBoundary
38405
38443
  };
38444
+ if (typeof fallbackRender == "function")
38445
+ childToRender = fallbackRender(props2);
38446
+ else if (FallbackComponent)
38447
+ childToRender = createElement(FallbackComponent, props2);
38448
+ else if (fallback !== void 0)
38449
+ childToRender = fallback;
38450
+ else
38451
+ throw error;
38406
38452
  }
38407
- resetErrorBoundary() {
38408
- const {
38409
- error
38410
- } = this.state;
38411
- if (error !== null) {
38412
- for (var _this$props$onReset, _this$props, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
38413
- args[_key] = arguments[_key];
38414
- (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 || _this$props$onReset.call(_this$props, {
38415
- args,
38416
- reason: "imperative-api"
38417
- }), this.setState(initialState);
38418
- }
38419
- }
38420
- componentDidCatch(error, info) {
38421
- var _this$props$onError, _this$props2;
38422
- (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props2, error, info);
38423
- }
38424
- componentDidUpdate(prevProps, prevState) {
38425
- const {
38426
- didCatch
38427
- } = this.state, {
38428
- resetKeys
38429
- } = this.props;
38430
- if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
38431
- var _this$props$onReset2, _this$props3;
38432
- (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 || _this$props$onReset2.call(_this$props3, {
38433
- next: resetKeys,
38434
- prev: prevProps.resetKeys,
38435
- reason: "keys"
38436
- }), this.setState(initialState);
38437
- }
38438
- }
38439
- render() {
38440
- const {
38441
- children: children2,
38442
- fallbackRender,
38443
- FallbackComponent,
38444
- fallback
38445
- } = this.props, {
38453
+ return createElement(ErrorBoundaryContext.Provider, {
38454
+ value: {
38446
38455
  didCatch,
38447
- error
38448
- } = this.state;
38449
- let childToRender = children2;
38450
- if (didCatch) {
38451
- const props2 = {
38452
- error,
38453
- resetErrorBoundary: this.resetErrorBoundary
38454
- };
38455
- if (typeof fallbackRender == "function")
38456
- childToRender = fallbackRender(props2);
38457
- else if (FallbackComponent)
38458
- childToRender = react.createElement(FallbackComponent, props2);
38459
- else if (fallback !== void 0)
38460
- childToRender = fallback;
38461
- else
38462
- throw error;
38463
- }
38464
- return react.createElement(ErrorBoundaryContext.Provider, {
38465
- value: {
38466
- didCatch,
38467
- error,
38468
- resetErrorBoundary: this.resetErrorBoundary
38469
- }
38470
- }, childToRender);
38471
- }
38472
- }
38473
- function hasArrayChanged() {
38474
- let a2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], b2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
38475
- return a2.length !== b2.length || a2.some((item, index2) => !Object.is(item, b2[index2]));
38476
- }
38477
- function assertErrorBoundaryContext(value) {
38478
- if (value == null || typeof value.didCatch != "boolean" || typeof value.resetErrorBoundary != "function")
38479
- throw new Error("ErrorBoundaryContext not found");
38480
- }
38481
- function useErrorBoundary() {
38482
- const context2 = react.useContext(ErrorBoundaryContext);
38483
- assertErrorBoundaryContext(context2);
38484
- const [state, setState] = react.useState({
38485
- error: null,
38486
- hasError: !1
38487
- }), memoized = react.useMemo(() => ({
38488
- resetBoundary: () => {
38489
- context2.resetErrorBoundary(), setState({
38490
- error: null,
38491
- hasError: !1
38492
- });
38493
- },
38494
- showBoundary: (error) => setState({
38495
38456
  error,
38496
- hasError: !0
38497
- })
38498
- }), [context2.resetErrorBoundary]);
38499
- if (state.hasError)
38500
- throw state.error;
38501
- return memoized;
38502
- }
38503
- function withErrorBoundary(component, errorBoundaryProps) {
38504
- const Wrapped = react.forwardRef((props2, ref) => react.createElement(ErrorBoundary, errorBoundaryProps, react.createElement(component, {
38505
- ...props2,
38506
- ref
38507
- }))), name = component.displayName || component.name || "Unknown";
38508
- return Wrapped.displayName = "withErrorBoundary(".concat(name, ")"), Wrapped;
38457
+ resetErrorBoundary: this.resetErrorBoundary
38458
+ }
38459
+ }, childToRender);
38509
38460
  }
38510
- return reactErrorBoundary_cjs.ErrorBoundary = ErrorBoundary, reactErrorBoundary_cjs.ErrorBoundaryContext = ErrorBoundaryContext, reactErrorBoundary_cjs.useErrorBoundary = useErrorBoundary, reactErrorBoundary_cjs.withErrorBoundary = withErrorBoundary, reactErrorBoundary_cjs;
38511
38461
  }
38512
- var reactErrorBoundary_cjsExports = /* @__PURE__ */ requireReactErrorBoundary_cjs();
38462
+ function hasArrayChanged() {
38463
+ let a2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], b2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
38464
+ return a2.length !== b2.length || a2.some((item, index2) => !Object.is(item, b2[index2]));
38465
+ }
38513
38466
  function ErrorFallback({ error, resetErrorBoundary }) {
38514
38467
  const errorString = error instanceof Error ? error.message : "Unknown error";
38515
38468
  return /* @__PURE__ */ jsx(Box, { pos: "fixed", top: 0, left: 0, w: "100%", p: 0, style: { zIndex: 1e3 }, children: /* @__PURE__ */ jsxs(
@@ -43115,7 +43068,7 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
43115
43068
  openDelay = 130,
43116
43069
  ...rest
43117
43070
  }, ref) => {
43118
- const [opened, setOpened] = useState(openDelay === 0), dialogRef = useRef(null), isClosingRef = useRef(!1), motionNotReduced = useReducedMotionConfig() !== !0, onCloseRef = useRef(onClose);
43071
+ const [opened, setOpened] = useState(openDelay === 0), focusTrapRef = useFocusTrap(opened), dialogRef = useRef(null), isClosingRef = useRef(!1), motionNotReduced = useReducedMotionConfig() !== !0, onCloseRef = useRef(onClose);
43119
43072
  onCloseRef.current = onClose;
43120
43073
  const close = useDebouncedCallback(
43121
43074
  () => {
@@ -43137,8 +43090,17 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
43137
43090
  return backdrop?.opacity !== void 0 && (targetBackdropOpacity = `${backdrop.opacity * 100}%`), /* @__PURE__ */ jsx(
43138
43091
  m$3.dialog,
43139
43092
  {
43140
- ref: useMergedRef(dialogRef, ref),
43141
- className: cx(RemoveScroll.classNames.fullWidth, classes2?.dialog, className, styles.dialog),
43093
+ ref: useMergedRef(
43094
+ dialogRef,
43095
+ focusTrapRef,
43096
+ ref
43097
+ ),
43098
+ className: cx(
43099
+ classes2?.dialog,
43100
+ className,
43101
+ styles.dialog,
43102
+ fullscreen && RemoveScroll.classNames.fullWidth
43103
+ ),
43142
43104
  layout: !0,
43143
43105
  style: {
43144
43106
  // @ts-ignore
@@ -43194,7 +43156,17 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
43194
43156
  e2.stopPropagation(), close();
43195
43157
  },
43196
43158
  ...rest,
43197
- children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, removeScrollBar: !1, children: /* @__PURE__ */ jsx("div", { className: cx(classes2?.body, styles.body, "overlay-body"), children: opened && /* @__PURE__ */ jsx(Fragment$1, { children: children2 }) }) })
43159
+ children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: !0, children: /* @__PURE__ */ jsx(
43160
+ "div",
43161
+ {
43162
+ className: cx(
43163
+ classes2?.body,
43164
+ styles.body,
43165
+ "overlay-body"
43166
+ ),
43167
+ children: opened && /* @__PURE__ */ jsx(Fragment$1, { children: children2 })
43168
+ }
43169
+ ) })
43198
43170
  }
43199
43171
  );
43200
43172
  });
@@ -44130,11 +44102,11 @@ function Overlays({ overlaysActorRef }) {
44130
44102
  nonexhaustive(overlay2);
44131
44103
  }
44132
44104
  });
44133
- return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(reactErrorBoundary_cjsExports.ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: () => overlaysActorRef.send({ type: "close.all" }), children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: overlaysReact }) }) }) });
44105
+ return /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: () => overlaysActorRef.send({ type: "close.all" }), children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: overlaysReact }) }) }) });
44134
44106
  }
44135
44107
  const [SearchActorContext, useSearchActor] = createSafeContext("SearchActorContext"), selectSearchValue = (s2) => s2.context.searchValue;
44136
44108
  function useSearch() {
44137
- const { searchActorRef } = useSearchActor(), searchValue = xstateReact_cjsExports.useSelector(searchActorRef, selectSearchValue), updateSearch = useCallback((search) => {
44109
+ const searchActorRef = useSearchActor(), searchValue = xstateReact_cjsExports.useSelector(searchActorRef, selectSearchValue), updateSearch = useCallback((search) => {
44138
44110
  searchActorRef.send({ type: "change.search", search });
44139
44111
  }, [searchActorRef]);
44140
44112
  return [searchValue, updateSearch];
@@ -44144,18 +44116,18 @@ const selectNormalizedSearchValue = (s2) => {
44144
44116
  return v.length > 1 ? v : "";
44145
44117
  };
44146
44118
  function useNormalizedSearch() {
44147
- const { searchActorRef } = useSearchActor();
44119
+ const searchActorRef = useSearchActor();
44148
44120
  return useDeferredValue(xstateReact_cjsExports.useSelector(searchActorRef, selectNormalizedSearchValue));
44149
44121
  }
44150
44122
  function useUpdateSearch() {
44151
- const { searchActorRef } = useSearchActor();
44123
+ const searchActorRef = useSearchActor();
44152
44124
  return useCallback((search) => {
44153
44125
  searchActorRef.send({ type: "change.search", search });
44154
44126
  }, [searchActorRef]);
44155
44127
  }
44156
44128
  const selectPickViewFor = (s2) => s2.context.pickViewFor;
44157
44129
  function usePickViewFor() {
44158
- const { searchActorRef } = useSearchActor();
44130
+ const searchActorRef = useSearchActor();
44159
44131
  return xstateReact_cjsExports.useSelector(searchActorRef, selectPickViewFor);
44160
44132
  }
44161
44133
  const buttonFocused = css.raw({
@@ -44367,15 +44339,39 @@ function centerY(element) {
44367
44339
  const rect = element.getBoundingClientRect();
44368
44340
  return rect.y + Math.floor(rect.height / 2);
44369
44341
  }
44370
- function moveFocusToSearchInput() {
44371
- const input2 = document.getElementById("likec4searchinput");
44342
+ function moveFocusToSearchInput(from) {
44343
+ if (!from) {
44344
+ console.error("moveFocusToSearchInput: from is null or undefined");
44345
+ return;
44346
+ }
44347
+ const root2 = from.getRootNode();
44348
+ if (!t$2(root2.querySelector)) {
44349
+ console.error("moveFocusToSearchInput: root.querySelector is not a function");
44350
+ return;
44351
+ }
44352
+ let input2 = root2.querySelector("[data-likec4-search-input]");
44372
44353
  if (input2) {
44373
44354
  const length = input2.value.length;
44374
44355
  input2.focus(), input2.setSelectionRange(length, length);
44375
44356
  }
44376
44357
  }
44377
- function focusToFirstFoundElement() {
44378
- document.querySelector(`[data-likec4-search] .${focusable}`)?.focus();
44358
+ function focusToFirstFoundElement(from) {
44359
+ if (!from) {
44360
+ console.error("focusToFirstFoundElement: from is null or undefined");
44361
+ return;
44362
+ }
44363
+ const root2 = from.getRootNode();
44364
+ if (!t$2(root2.querySelector)) {
44365
+ console.error("focusToFirstFoundElement: root.querySelector is not a function");
44366
+ return;
44367
+ }
44368
+ root2.querySelector(`[data-likec4-search] .${focusable}`)?.focus();
44369
+ }
44370
+ function queryAllFocusable(from, where, selector3 = `.${focusable}`) {
44371
+ if (!from)
44372
+ return console.error("queryAllFocusable: from is null or undefined"), [];
44373
+ const root2 = from.getRootNode();
44374
+ return t$2(root2.querySelectorAll) ? [...root2.querySelectorAll(`[data-likec4-search-${where}] ${selector3}`)] : (console.error("queryAllFocusable: root.querySelectorAll is not a function"), []);
44379
44375
  }
44380
44376
  const _viewBtn = "likec4-view-btn", viewButton = cx(
44381
44377
  css({
@@ -44402,18 +44398,18 @@ css({
44402
44398
  }
44403
44399
  });
44404
44400
  const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, children: "Nothing found" }), ViewsColumn = memo$2(() => {
44401
+ const ref = useRef(null);
44405
44402
  let views = [...useLikeC4Model$1().views()], search = useNormalizedSearch();
44406
44403
  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(
44407
44404
  Stack,
44408
44405
  {
44406
+ ref,
44409
44407
  renderRoot: (props2) => /* @__PURE__ */ jsx(MotionDiv, { layout: !0, ...props2 }),
44410
44408
  gap: 8,
44411
44409
  "data-likec4-search-views": !0,
44412
44410
  onKeyDown: (e2) => {
44413
44411
  if (e2.key === "ArrowLeft" || e2.key === "ArrowRight") {
44414
- const maxY = e2.target.getBoundingClientRect().y, elementButtons = [...document.querySelectorAll(
44415
- "[data-likec4-search-elements] .likec4-focusable"
44416
- )];
44412
+ const maxY = e2.target.getBoundingClientRect().y, elementButtons = queryAllFocusable(ref.current, "elements", ".likec4-element-button");
44417
44413
  let elementButton = elementButtons.length > 1 ? elementButtons.find((el, i2, all) => centerY(el) > maxY || i2 === all.length - 1) : null;
44418
44414
  elementButton ??= d(elementButtons), elementButton && (e2.stopPropagation(), elementButton.focus());
44419
44415
  return;
@@ -44427,7 +44423,7 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
44427
44423
  "data-likec4-view": !0,
44428
44424
  tabIndex: -1,
44429
44425
  onFocus: (e2) => {
44430
- e2.stopPropagation(), moveFocusToSearchInput();
44426
+ e2.stopPropagation(), moveFocusToSearchInput(ref.current);
44431
44427
  }
44432
44428
  }
44433
44429
  ) }),
@@ -44444,7 +44440,11 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
44444
44440
  );
44445
44441
  }), btn$2 = buttonsva();
44446
44442
  function ViewButton({ className, view, loop = !1, search, ...props2 }) {
44447
- const diagram = useDiagram(), currentViewId = useCurrentViewId$1(), isCurrentView = view.id === currentViewId;
44443
+ const searchActorRef = useSearchActor(), diagram = useDiagram(), currentViewId = useCurrentViewId$1(), isCurrentView = view.id === currentViewId, navigate = () => {
44444
+ searchActorRef.send({ type: "close" }), setTimeout(() => {
44445
+ diagram.navigateTo(view.id);
44446
+ }, 100);
44447
+ };
44448
44448
  return /* @__PURE__ */ jsxs(
44449
44449
  UnstyledButton,
44450
44450
  {
@@ -44453,7 +44453,7 @@ function ViewButton({ className, view, loop = !1, search, ...props2 }) {
44453
44453
  "data-likec4-view": view.id,
44454
44454
  ...isCurrentView && { "data-disabled": !0 },
44455
44455
  onClick: (e2) => {
44456
- e2.stopPropagation(), diagram.navigateTo(view.id);
44456
+ e2.stopPropagation(), navigate();
44457
44457
  },
44458
44458
  onKeyDown: createScopedKeydownHandler({
44459
44459
  siblingSelector: "[data-likec4-view]",
@@ -44462,7 +44462,7 @@ function ViewButton({ className, view, loop = !1, search, ...props2 }) {
44462
44462
  loop,
44463
44463
  orientation: "vertical",
44464
44464
  onKeyDown: (e2) => {
44465
- e2.nativeEvent.code === "Space" && (e2.stopPropagation(), diagram.navigateTo(view.id));
44465
+ e2.nativeEvent.code === "Space" && (e2.stopPropagation(), navigate());
44466
44466
  }
44467
44467
  }),
44468
44468
  children: [
@@ -44540,15 +44540,13 @@ function ElementsTree({
44540
44540
  const target = e2.target, id2 = target.getAttribute("data-value"), node2 = !!id2 && byid[id2];
44541
44541
  if (node2) {
44542
44542
  if (e2.key === "ArrowUp") {
44543
- id2 === roots[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput());
44543
+ id2 === roots[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput(target));
44544
44544
  return;
44545
44545
  }
44546
44546
  if (e2.key === "ArrowRight") {
44547
44547
  if (node2.children.length > 0 && tree.expandedState[id2] === !1)
44548
44548
  return;
44549
- const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons = [...document.querySelectorAll(
44550
- `[data-likec4-search-views] .${focusable}`
44551
- )];
44549
+ const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons = queryAllFocusable(target, "views");
44552
44550
  let view = viewButtons.length > 1 ? viewButtons.find((el, i2, all2) => centerY(el) > maxY || i2 === all2.length - 1) : null;
44553
44551
  view ??= d(viewButtons), view && (stopAndPrevent(e2), view.focus());
44554
44552
  return;
@@ -44655,18 +44653,20 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
44655
44653
  ] });
44656
44654
  }
44657
44655
  function useHandleElementSelection() {
44658
- const diagram = useDiagram(), { searchActorRef } = useSearchActor();
44659
- return useCallback((element) => {
44656
+ const diagram = useDiagram(), searchActorRef = useSearchActor();
44657
+ return useCallbackRef((element) => {
44660
44658
  const views = [...element.views()];
44661
44659
  if (views.length === 0)
44662
44660
  return;
44663
44661
  const singleView = t$6(views);
44664
44662
  if (singleView) {
44665
- singleView.id === diagram.currentView.id ? searchActorRef.send({ type: "close" }) : diagram.navigateTo(singleView.id);
44663
+ searchActorRef.send({ type: "close" }), singleView.id !== diagram.currentView.id && setTimeout(() => {
44664
+ diagram.navigateTo(singleView.id);
44665
+ }, 100);
44666
44666
  return;
44667
44667
  }
44668
44668
  searchActorRef.send({ type: "pickview.open", elementFqn: element.id });
44669
- }, []);
44669
+ });
44670
44670
  }
44671
44671
  const input = css({
44672
44672
  border: "transparent",
@@ -44722,7 +44722,7 @@ css({
44722
44722
  }
44723
44723
  });
44724
44724
  function PickView({ elementFqn }) {
44725
- const { searchActorRef } = useSearchActor(), element = useLikeC4Model$1().element(elementFqn), scoped = [], others = [];
44725
+ const searchActorRef = useSearchActor(), element = useLikeC4Model$1().element(elementFqn), scoped = [], others = [];
44726
44726
  for (const view of element.views())
44727
44727
  view.viewOf === element ? scoped.push(view) : others.push(view);
44728
44728
  const closePickView = () => {
@@ -44751,7 +44751,7 @@ function PickView({ elementFqn }) {
44751
44751
  },
44752
44752
  "pickview-backdrop"
44753
44753
  ),
44754
- /* @__PURE__ */ jsxs(
44754
+ /* @__PURE__ */ jsx(FocusTrap, { children: /* @__PURE__ */ jsxs(
44755
44755
  MotionDiv,
44756
44756
  {
44757
44757
  initial: {
@@ -44791,7 +44791,7 @@ function PickView({ elementFqn }) {
44791
44791
  }
44792
44792
  )
44793
44793
  ] }),
44794
- /* @__PURE__ */ jsx(FocusTrap, { children: /* @__PURE__ */ jsxs(ScrollAreaAutosize, { mah: "calc(100vh - 8rem - 50px)", type: "never", children: [
44794
+ /* @__PURE__ */ jsxs(ScrollAreaAutosize, { mah: "calc(100vh - 110px)", type: "never", children: [
44795
44795
  scoped.length > 0 && /* @__PURE__ */ jsxs(Stack, { gap: "sm", px: "sm", className: pickviewGroup, children: [
44796
44796
  /* @__PURE__ */ jsx(Title, { order: 6, c: "dimmed", children: "scoped views of the element" }),
44797
44797
  scoped.map((view, i2) => /* @__PURE__ */ jsx(
@@ -44822,14 +44822,15 @@ function PickView({ elementFqn }) {
44822
44822
  view.id
44823
44823
  ))
44824
44824
  ] })
44825
- ] }) })
44825
+ ] })
44826
44826
  ]
44827
44827
  },
44828
44828
  "pickview"
44829
- )
44829
+ ) })
44830
44830
  ] });
44831
44831
  }
44832
44832
  function SearchByTags() {
44833
+ const ref = useRef(null);
44833
44834
  let tags = useLikeC4Model$1().tagsSortedByUsage, setSearch = useUpdateSearch(), search = useNormalizedSearch(), countBefore = tags.length;
44834
44835
  if (search.startsWith("#")) {
44835
44836
  const searchTag = search.slice(1);
@@ -44841,6 +44842,7 @@ function SearchByTags() {
44841
44842
  return /* @__PURE__ */ jsxs(
44842
44843
  HStack,
44843
44844
  {
44845
+ ref,
44844
44846
  css: {
44845
44847
  gap: "md",
44846
44848
  paddingLeft: 48,
@@ -44900,7 +44902,7 @@ function SearchByTags() {
44900
44902
  }),
44901
44903
  onClick: (e2) => {
44902
44904
  e2.stopPropagation(), setSearch(`#${tag}`), setTimeout(() => {
44903
- focusToFirstFoundElement();
44905
+ focusToFirstFoundElement(ref.current);
44904
44906
  }, 350);
44905
44907
  }
44906
44908
  },
@@ -44915,7 +44917,7 @@ function SearchByTags() {
44915
44917
  size: "compact-xs",
44916
44918
  variant: "light",
44917
44919
  onClick: (e2) => {
44918
- e2.stopPropagation(), setSearch(""), moveFocusToSearchInput();
44920
+ e2.stopPropagation(), setSearch(""), moveFocusToSearchInput(ref.current);
44919
44921
  },
44920
44922
  rightSection: /* @__PURE__ */ jsx(IconX, { size: 14 }),
44921
44923
  children: "Clear"
@@ -44929,9 +44931,7 @@ function startingWithKind(search) {
44929
44931
  return search.match(/^(k|ki|kin|kind|kind:)$/) != null;
44930
44932
  }
44931
44933
  const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
44932
- const { close, searchActorRef } = useSearchActor(), likec4model = useLikeC4Model$1(), { ref, focused } = useFocusWithin(), [search, setSearch] = useSearch();
44933
- usePreviousDistinct(search);
44934
- const combobox = useCombobox({
44934
+ const searchActorRef = useSearchActor(), likec4model = useLikeC4Model$1(), inputRef = useRef(null), { ref, focused } = useFocusWithin(), [search, setSearch] = useSearch(), combobox = useCombobox({
44935
44935
  scrollBehavior: "smooth",
44936
44936
  loop: !1
44937
44937
  });
@@ -44939,7 +44939,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
44939
44939
  "keydown",
44940
44940
  (event) => {
44941
44941
  try {
44942
- !focused && (event.key === "Backspace" || event.key.startsWith("Arrow") || event.key.match(/^\p{L}$/u)) && moveFocusToSearchInput();
44942
+ !focused && (event.key === "Backspace" || event.key.startsWith("Arrow") || event.key.match(/^\p{L}$/u)) && moveFocusToSearchInput(inputRef.current);
44943
44943
  } catch (e2) {
44944
44944
  console.warn(e2);
44945
44945
  }
@@ -44958,24 +44958,24 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
44958
44958
  // }
44959
44959
  case search.startsWith("#"): {
44960
44960
  const searchTag = search.toLocaleLowerCase().slice(1), alloptions = likec4model.tags.filter((tag) => tag.toLocaleLowerCase().includes(searchTag));
44961
- isExactMatch = t$6(alloptions)?.toLocaleLowerCase() === searchTag, alloptions.length === 0 ? options = [
44961
+ alloptions.length === 0 ? (isExactMatch = !1, options = [
44962
44962
  /* @__PURE__ */ jsx(ComboboxEmpty, { children: "No tags found" }, "empty-tags")
44963
- ] : options = alloptions.map((tag) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `#${tag}`, children: [
44963
+ ]) : (isExactMatch = likec4model.tags.some((tag) => tag.toLocaleLowerCase() === searchTag), options = alloptions.map((tag) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `#${tag}`, children: [
44964
44964
  /* @__PURE__ */ jsx(Text, { component: "span", opacity: 0.5, mr: 1, fz: "sm", children: "#" }),
44965
44965
  tag
44966
- ] }, tag));
44966
+ ] }, tag)));
44967
44967
  break;
44968
44968
  }
44969
44969
  case search.startsWith("kind:"):
44970
44970
  case startingWithKind(search): {
44971
44971
  const term = search.length > 5 ? search.slice(5).toLocaleLowerCase() : "";
44972
44972
  let alloptions = t$4(likec4model.specification.elements);
44973
- term && (alloptions = alloptions.filter((kind) => kind.toLocaleLowerCase().includes(term)), isExactMatch = t$6(alloptions)?.toLocaleLowerCase() === term), alloptions.length === 0 ? options = [
44973
+ term && (alloptions = alloptions.filter((kind) => kind.toLocaleLowerCase().includes(term))), alloptions.length === 0 ? (isExactMatch = !1, options = [
44974
44974
  /* @__PURE__ */ jsx(ComboboxEmpty, { children: "No kinds found" }, "empty-kinds")
44975
- ] : options = alloptions.map((kind) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `kind:${kind}`, children: [
44975
+ ]) : (isExactMatch = alloptions.some((kind) => kind.toLocaleLowerCase() === term), options = alloptions.map((kind) => /* @__PURE__ */ jsxs(ComboboxOption, { value: `kind:${kind}`, children: [
44976
44976
  /* @__PURE__ */ jsx(Text, { component: "span", opacity: 0.5, mr: 1, fz: "sm", children: "kind:" }),
44977
44977
  kind
44978
- ] }, kind));
44978
+ ] }, kind)));
44979
44979
  break;
44980
44980
  }
44981
44981
  }
@@ -44984,7 +44984,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
44984
44984
  {
44985
44985
  onOptionSubmit: (optionValue) => {
44986
44986
  setSearch(optionValue), combobox.resetSelectedOption(), SEARCH_PREFIXES.includes(optionValue) || (combobox.closeDropdown(), setTimeout(() => {
44987
- focusToFirstFoundElement();
44987
+ focusToFirstFoundElement(inputRef.current);
44988
44988
  }, 350));
44989
44989
  },
44990
44990
  width: "max-content",
@@ -45000,10 +45000,11 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45000
45000
  /* @__PURE__ */ jsx(ComboboxTarget, { children: /* @__PURE__ */ jsx(
45001
45001
  Input,
45002
45002
  {
45003
- ref,
45004
- id: "likec4searchinput",
45003
+ ref: useMergedRef(inputRef, ref),
45005
45004
  placeholder: "Search by title, description or start with # or kind:",
45006
45005
  autoFocus: !0,
45006
+ "data-autofocus": !0,
45007
+ "data-likec4-search-input": !0,
45007
45008
  tabIndex: 0,
45008
45009
  classNames: {
45009
45010
  input
@@ -45017,7 +45018,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45017
45018
  onClick: (e2) => {
45018
45019
  e2.stopPropagation();
45019
45020
  const openedWithSearch = searchActorRef.getSnapshot().context.openedWithSearch;
45020
- search === "" || search === openedWithSearch ? close() : setSearch("");
45021
+ search === "" || search === openedWithSearch ? searchActorRef.send({ type: "close" }) : setSearch("");
45021
45022
  }
45022
45023
  }
45023
45024
  ),
@@ -45058,7 +45059,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45058
45059
  }
45059
45060
  if (e2.key === "ArrowDown" && (!combobox.dropdownOpened || options.length === 0 || isExactMatch || // reached the last option and the search is empty
45060
45061
  search === "" && combobox.getSelectedOptionIndex() === options.length - 1)) {
45061
- combobox.closeDropdown(), stopAndPrevent(e2), focusToFirstFoundElement();
45062
+ combobox.closeDropdown(), stopAndPrevent(e2), focusToFirstFoundElement(inputRef.current);
45062
45063
  return;
45063
45064
  }
45064
45065
  }
@@ -45102,15 +45103,12 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45102
45103
  // _dark: `[rgb(34 34 34 / 0.95)]`,
45103
45104
  // _light: `[rgb(255 255 255/ 0.95)]`,
45104
45105
  // },
45105
- }), selectIsOpened = (s2) => !s2.matches("inactive"), Search = memo$2(({ searchActorRef }) => {
45106
+ }), selectIsOpened = (s2) => !s2.matches("inactive");
45107
+ function Search({ searchActorRef }) {
45106
45108
  const isOpened = xstateReact_cjsExports.useSelector(searchActorRef, selectIsOpened), openSearch = () => {
45107
45109
  searchActorRef.send({ type: "open" });
45108
- }, sendClose = () => {
45110
+ }, close = useCallbackRef(() => {
45109
45111
  searchActorRef.send({ type: "close" });
45110
- }, afterCloseCbRef = useRef(null), close = useCallbackRef((cb) => {
45111
- afterCloseCbRef.current = cb ?? null, sendClose();
45112
- }), onExitComplete = useCallbackRef(() => {
45113
- afterCloseCbRef.current && (afterCloseCbRef.current(), afterCloseCbRef.current = null);
45114
45112
  });
45115
45113
  return useHotkeys([
45116
45114
  ["mod+k", openSearch, {
@@ -45119,34 +45117,26 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45119
45117
  ["mod+f", openSearch, {
45120
45118
  preventDefault: !0
45121
45119
  }]
45122
- ]), /* @__PURE__ */ jsx(
45123
- SearchActorContext,
45120
+ ]), /* @__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(
45121
+ Overlay,
45124
45122
  {
45125
- value: {
45126
- searchActorRef,
45127
- close
45123
+ fullscreen: !0,
45124
+ withBackdrop: !1,
45125
+ backdrop: {
45126
+ opacity: 0.9
45128
45127
  },
45129
- children: /* @__PURE__ */ jsx(DiagramFeatures.Overlays, { children: /* @__PURE__ */ jsx(reactErrorBoundary_cjsExports.ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: sendClose, children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx(AnimatePresence, { onExitComplete, children: isOpened && /* @__PURE__ */ jsx(
45130
- Overlay,
45131
- {
45132
- fullscreen: !0,
45133
- withBackdrop: !1,
45134
- backdrop: {
45135
- opacity: 0.9
45136
- },
45137
- classes: {
45138
- dialog,
45139
- body
45140
- },
45141
- openDelay: 0,
45142
- onClose: close,
45143
- "data-likec4-search": "true",
45144
- children: /* @__PURE__ */ jsx(SearchOverlay, { close, searchActorRef })
45145
- }
45146
- ) }) }) }) })
45128
+ classes: {
45129
+ dialog,
45130
+ body
45131
+ },
45132
+ openDelay: 0,
45133
+ onClose: close,
45134
+ "data-likec4-search": "true",
45135
+ children: /* @__PURE__ */ jsx(SearchOverlay, { searchActorRef })
45147
45136
  }
45148
- );
45149
- }), scrollArea = css({
45137
+ ) }) }) }) });
45138
+ }
45139
+ const scrollArea = css({
45150
45140
  height: [
45151
45141
  "100%",
45152
45142
  "100cqh"
@@ -45158,18 +45148,18 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45158
45148
  height: "100%"
45159
45149
  }
45160
45150
  }
45161
- }), SearchOverlay = ({ close, searchActorRef }) => {
45162
- const pickViewFor = usePickViewFor();
45151
+ }), SearchOverlay = ({ searchActorRef }) => {
45152
+ const ref = useRef(null), pickViewFor = usePickViewFor();
45163
45153
  return useTimeoutEffect(() => {
45164
- n$5(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement();
45165
- }, 150), /* @__PURE__ */ jsxs(FocusTrap, { children: [
45154
+ n$5(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
45155
+ }, 150), /* @__PURE__ */ jsxs(Box, { ref, display: "contents", children: [
45166
45156
  /* @__PURE__ */ jsx(
45167
45157
  Group,
45168
45158
  {
45169
45159
  className: "group",
45170
45160
  wrap: "nowrap",
45171
45161
  onClick: (e2) => {
45172
- e2.stopPropagation(), moveFocusToSearchInput();
45162
+ e2.stopPropagation(), moveFocusToSearchInput(ref.current);
45173
45163
  },
45174
45164
  children: /* @__PURE__ */ jsxs(VStack, { flex: 1, px: "sm", children: [
45175
45165
  /* @__PURE__ */ jsx(LikeC4SearchInput, {}),
@@ -46695,12 +46685,12 @@ function LikeC4DiagramXYFlow({
46695
46685
  onCanvasDblClick
46696
46686
  } = useDiagramEventHandlers(), notReadOnly = !enableReadOnly, isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
46697
46687
  $isPanning.set(!0);
46698
- }, isReducedGraphics ? 100 : 200), notPanning = useDebouncedCallback$1(() => {
46688
+ }, isReducedGraphics ? 120 : 200), notPanning = useDebouncedCallback$1(() => {
46699
46689
  isPanning.clear(), $isPanning.get() && $isPanning.set(!1);
46700
- }, 200), onMove = useCallbackRef((event) => {
46690
+ }, isReducedGraphics ? 350 : 200), onMove = useCallbackRef((event) => {
46701
46691
  event && ($isPanning.get() || isPanning.start(), notPanning());
46702
46692
  }), onMoveEnd = useCallbackRef((event, viewport) => {
46703
- event && notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
46693
+ event && !isReducedGraphics && notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
46704
46694
  }), onViewportResize = useCallbackRef(() => {
46705
46695
  diagram.send({ type: "xyflow.resized" });
46706
46696
  }), nodeTypes2 = useCustomCompareMemo(
@@ -49625,12 +49615,14 @@ const _diagramMachine = xstate_cjsExports.setup({
49625
49615
  "closeAllOverlays",
49626
49616
  "closeSearch",
49627
49617
  "stopSyncLayout",
49628
- {
49629
- type: "trigger:NavigateTo",
49630
- params: ({ context: context2 }) => ({
49631
- viewId: nonNullable(context2.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
49632
- })
49633
- }
49618
+ xstate_cjsExports.enqueueActions(({ enqueue, context: context2 }) => {
49619
+ enqueue({
49620
+ type: "trigger:NavigateTo",
49621
+ params: {
49622
+ viewId: nonNullable(context2.lastOnNavigate, "Invalid state, lastOnNavigate is null").toView
49623
+ }
49624
+ });
49625
+ })
49634
49626
  ],
49635
49627
  on: {
49636
49628
  "update.view": {
@@ -49772,7 +49764,7 @@ function DiagramActorProvider({
49772
49764
  "trigger:NavigateTo": (_, { viewId }) => {
49773
49765
  setTimeout(() => {
49774
49766
  handlersRef.current.onNavigateTo?.(viewId);
49775
- }, 30);
49767
+ }, 40);
49776
49768
  },
49777
49769
  "trigger:OnChange": (_, params) => {
49778
49770
  handlersRef.current.onChange?.(params);
@@ -49843,7 +49835,7 @@ function LikeC4Diagram({
49843
49835
  pannable = !0,
49844
49836
  zoomable = !0,
49845
49837
  background = "dots",
49846
- enableElementTags = !0,
49838
+ enableElementTags = !1,
49847
49839
  enableFocusMode = !1,
49848
49840
  enableElementDetails = !1,
49849
49841
  enableRelationshipDetails = enableElementDetails,
@@ -50068,7 +50060,7 @@ const cssWebcomponentView = css({
50068
50060
  component: RouteComponent$2
50069
50061
  });
50070
50062
  function RouteComponent$2() {
50071
- return /* @__PURE__ */ jsx(Box$1, { className: cssViewOutlet, children: /* @__PURE__ */ jsx(reactErrorBoundary_cjsExports.ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(
50063
+ return /* @__PURE__ */ jsx(Box$1, { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(
50072
50064
  LikeC4ModelContext,
50073
50065
  {
50074
50066
  likec4data: $likec4data,
@@ -50191,7 +50183,7 @@ const Route$h = createFileRoute("/project/$projectId")({
50191
50183
  });
50192
50184
  function RouteComponent() {
50193
50185
  const { $likec4data: $likec4data2, $likec4model: $likec4model2, IconRenderer: IconRenderer2 } = Route$h.useLoaderData();
50194
- return /* @__PURE__ */ jsx(Box$1, { className: cssViewOutlet, children: /* @__PURE__ */ jsx(reactErrorBoundary_cjsExports.ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4data: $likec4data2, likec4model: $likec4model2, children: /* @__PURE__ */ jsx(IconRendererProvider, { value: IconRenderer2, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
50186
+ return /* @__PURE__ */ jsx(Box$1, { className: cssViewOutlet, children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: Fallback$1, children: /* @__PURE__ */ jsx(LikeC4ModelContext, { likec4data: $likec4data2, likec4model: $likec4model2, children: /* @__PURE__ */ jsx(IconRendererProvider, { value: IconRenderer2, children: /* @__PURE__ */ jsx(Outlet, {}) }) }) }) });
50195
50187
  }
50196
50188
  const Route$g = createFileRoute("/project/$projectId/")({
50197
50189
  component: () => {
@@ -50353,7 +50345,16 @@ function useDiagramsTreeData(groupBy = "by-files") {
50353
50345
  }
50354
50346
  const isFile = (node2) => isTreeNodeData(node2) && node2.type === "file", FolderIcon = ({ node: node2, expanded }) => isFile(node2) ? /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", color: "indigo", children: /* @__PURE__ */ jsx(IconFileCode, { size: 16 }) }) : /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", color: "violet", children: expanded ? /* @__PURE__ */ jsx(IconFolderOpen, { size: 16 }) : /* @__PURE__ */ jsx(IconFolderFilled, { size: 16 }) }), setHoveredNode = () => {
50355
50347
  }, DiagramsTree = /* @__PURE__ */ memo$2(({ groupBy }) => {
50356
- const data = useDiagramsTreeData(groupBy), router = useRouter(), diagram = useCurrentDiagram(), viewId = diagram?.id ?? null, tree = useTree({
50348
+ const views = useLikeC4Views(), data = useDiagramsTreeData(groupBy), navigate = useNavigate(), navigateTo = (viewId2) => {
50349
+ navigate({
50350
+ to: "./",
50351
+ viewTransition: !1,
50352
+ params: (p2) => ({
50353
+ ...p2,
50354
+ viewId: viewId2
50355
+ })
50356
+ });
50357
+ }, diagram = useCurrentDiagram(), viewId = diagram?.id ?? null, tree = useTree({
50357
50358
  multiple: !1
50358
50359
  });
50359
50360
  tree.setHoveredNode = setHoveredNode;
@@ -50371,7 +50372,7 @@ const isFile = (node2) => isTreeNodeData(node2) && node2.type === "file", Folder
50371
50372
  viewId && tree.select(viewId);
50372
50373
  }, [viewId]);
50373
50374
  const theme2 = useComputedColorScheme();
50374
- return /* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(
50375
+ return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
50375
50376
  Tree,
50376
50377
  {
50377
50378
  allowRangeSelection: !1,
@@ -50384,7 +50385,7 @@ const isFile = (node2) => isTreeNodeData(node2) && node2.type === "file", Folder
50384
50385
  }
50385
50386
  },
50386
50387
  levelOffset: "md",
50387
- renderNode: ({ node: node2, selected: selected2, expanded, elementProps, hasChildren }) => /* @__PURE__ */ jsx(DiagramPreviewHoverCard, { viewId: hasChildren ? null : node2.value, ...elementProps, children: /* @__PURE__ */ jsx(
50388
+ renderNode: ({ node: node2, selected: selected2, expanded, elementProps, hasChildren }) => /* @__PURE__ */ jsx(DiagramPreviewHoverCard, { diagram: hasChildren ? void 0 : views.find((v) => v.id === node2.value), children: /* @__PURE__ */ jsx(
50388
50389
  Button,
50389
50390
  {
50390
50391
  fullWidth: !0,
@@ -50407,16 +50408,10 @@ const isFile = (node2) => isTreeNodeData(node2) && node2.type === "file", Folder
50407
50408
  ] }),
50408
50409
  hasChildren && /* @__PURE__ */ jsx(FolderIcon, { node: node2, expanded })
50409
50410
  ] }),
50411
+ ...elementProps,
50410
50412
  ...!hasChildren && {
50411
50413
  onClick: (e2) => {
50412
- e2.stopPropagation(), router.buildAndCommitLocation({
50413
- to: ".",
50414
- viewTransition: !1,
50415
- params: (p2) => ({
50416
- ...p2,
50417
- viewId: node2.value
50418
- })
50419
- });
50414
+ e2.stopPropagation(), navigateTo(node2.value);
50420
50415
  }
50421
50416
  },
50422
50417
  children: node2.label
@@ -50424,20 +50419,15 @@ const isFile = (node2) => isTreeNodeData(node2) && node2.type === "file", Folder
50424
50419
  ) })
50425
50420
  }
50426
50421
  ) });
50427
- });
50428
- function DiagramPreviewHoverCard({
50429
- viewId,
50430
- children: children2,
50431
- onClick,
50432
- ...props2
50433
- }) {
50434
- const diagram = useLikeC4Views().find((v) => v.id === viewId), ratio = diagram ? Math.max(diagram.bounds.width / 400, diagram.bounds.height / 300) : 1, width = diagram ? Math.round(diagram.bounds.width / ratio) : 0, height = diagram ? Math.round(diagram.bounds.height / ratio) : 0;
50435
- return /* @__PURE__ */ jsxs(Box$1, { ...props2, children: [
50422
+ }, (prev, next) => prev.groupBy === next.groupBy);
50423
+ function DiagramPreviewHoverCard({ diagram, children: children2 }) {
50424
+ const ratio = diagram ? Math.max(diagram.bounds.width / 400, diagram.bounds.height / 300) : 1, width = diagram ? Math.round(diagram.bounds.width / ratio) : 0, height = diagram ? Math.round(diagram.bounds.height / ratio) : 0;
50425
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
50436
50426
  diagram && /* @__PURE__ */ jsxs(HoverCard, { position: "right-start", openDelay: 400, closeDelay: 100, keepMounted: !1, shadow: "lg", children: [
50437
50427
  /* @__PURE__ */ jsx(HoverCardTarget, { children: children2 }),
50438
- /* @__PURE__ */ jsx(HoverCardDropdown, { style: { width, height }, p: "xs", onClick, children: /* @__PURE__ */ jsx(DiagramPreview, { diagram }) })
50428
+ /* @__PURE__ */ jsx(HoverCardDropdown, { style: { width, height }, p: "xs", children: /* @__PURE__ */ jsx(DiagramPreview, { diagram }) })
50439
50429
  ] }),
50440
- !diagram && /* @__PURE__ */ jsx(Fragment$1, { children: children2 })
50430
+ !diagram && children2
50441
50431
  ] });
50442
50432
  }
50443
50433
  const DiagramPreview = memo$2(({ diagram }) => {
@@ -51484,6 +51474,7 @@ function ViewReact() {
51484
51474
  enableElementDetails: !0,
51485
51475
  enableRelationshipDetails: !0,
51486
51476
  enableRelationshipBrowser: !0,
51477
+ enableElementTags: !0,
51487
51478
  experimentalEdgeEditing: !1,
51488
51479
  showNotations: hasNotations,
51489
51480
  nodesDraggable: !1,
@@ -53231,6 +53222,7 @@ function ViewEditor() {
53231
53222
  enableElementDetails: !0,
53232
53223
  enableRelationshipDetails: !0,
53233
53224
  enableRelationshipBrowser: !0,
53225
+ enableElementTags: !0,
53234
53226
  onNavigateTo,
53235
53227
  onChange: (e2) => console.log(e2),
53236
53228
  onBurgerMenuClick: withOverviewGraph ? () => {