likec4 1.6.1-next.4 → 1.6.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.
@@ -20880,13 +20880,11 @@ function DiagramContextProvider({
20880
20880
  ), useUpdateEffect(
20881
20881
  () => {
20882
20882
  if (!store.current) return;
20883
- const state = store.current.getState();
20884
- state.view !== view && state.updateView(view);
20885
- const newProps = i$1(props, l$1);
20886
- o$1(state, newProps) || store.current.setState(newProps, !1, "update incoming props");
20883
+ const state = store.current.getState(), newProps = i$1(props, l$1);
20884
+ o$1(state, newProps) || store.current.setState(newProps, !1, "update incoming props"), state.view !== view && state.updateView(view);
20887
20885
  },
20888
20886
  [view, props],
20889
- shallowEqual
20887
+ (prev, next) => shallowEqual(prev[0], next[0]) && shallowEqual(prev[1], next[1])
20890
20888
  ), /* @__PURE__ */ jsx(
20891
20889
  "div",
20892
20890
  {
@@ -23682,7 +23680,7 @@ const Text = Text$1.withProps({
23682
23680
  // tap: {
23683
23681
  // scale: 0.9
23684
23682
  // }
23685
- }, isEqualProps = (prev, next) => prev.id === next.id && deepEqual$1(prev.selected ?? !1, next.selected ?? !1) && deepEqual$1(prev.dragging ?? !1, next.dragging ?? !1) && deepEqual$1(prev.draggable ?? !1, next.draggable ?? !1) && deepEqual$1(prev.width ?? 0, next.width ?? 0) && deepEqual$1(prev.height ?? 0, next.height ?? 0) && deepEqual$1(prev.data.element, next.data.element), ElementNodeMemo = memo$1(function({
23683
+ }, isEqualProps = (prev, next) => prev.id === next.id && deepEqual$1(prev.selected ?? !1, next.selected ?? !1) && deepEqual$1(prev.dragging ?? !1, next.dragging ?? !1) && deepEqual$1(prev.width ?? 0, next.width ?? 0) && deepEqual$1(prev.height ?? 0, next.height ?? 0) && deepEqual$1(prev.data.element, next.data.element), ElementNodeMemo = memo$1(function({
23686
23684
  id: id2,
23687
23685
  data: {
23688
23686
  element
@@ -23693,7 +23691,7 @@ const Text = Text$1.withProps({
23693
23691
  width,
23694
23692
  height
23695
23693
  }) {
23696
- const { isHovered, isDimmed, hasOnNavigateTo, isHovercards, isInteractive } = useDiagramState((s2) => ({
23694
+ const store = useDiagramStoreApi(), { isHovered, isDimmed, hasOnNavigateTo, isHovercards, isInteractive } = useDiagramState((s2) => ({
23697
23695
  isHovered: s2.hoveredNodeId === id2,
23698
23696
  isDimmed: s2.dimmed.has(id2),
23699
23697
  isInteractive: s2.nodesDraggable || s2.nodesSelectable || !!s2.onNavigateTo,
@@ -23715,6 +23713,7 @@ const Text = Text$1.withProps({
23715
23713
  animate = "selected";
23716
23714
  break;
23717
23715
  }
23716
+ const elementIcon2 = ElementIcon({ node: element, store });
23718
23717
  return /* @__PURE__ */ jsxs(Fragment, { children: [
23719
23718
  /* @__PURE__ */ jsx(
23720
23719
  Handle,
@@ -23778,11 +23777,11 @@ const Text = Text$1.withProps({
23778
23777
  {
23779
23778
  className: clsx(
23780
23779
  elementDataContainer,
23781
- n$4(element.icon) && hasIcon,
23780
+ n$4(elementIcon2) && hasIcon,
23782
23781
  "likec4-element"
23783
23782
  ),
23784
23783
  children: [
23785
- n$4(element.icon) && /* @__PURE__ */ jsx(ElementIcon, { node: element }),
23784
+ elementIcon2,
23786
23785
  /* @__PURE__ */ jsxs("div", { className: clsx(elementTextData, "likec4-element-main-props"), children: [
23787
23786
  /* @__PURE__ */ jsx(
23788
23787
  Text,
@@ -23823,13 +23822,12 @@ const Text = Text$1.withProps({
23823
23822
  }
23824
23823
  )
23825
23824
  ] });
23826
- }, isEqualProps), ElementIcon = ({ node }) => {
23827
- const RenderIcon = useDiagramState((s2) => s2.renderIcon);
23825
+ }, isEqualProps), ElementIcon = ({ node, store }) => {
23828
23826
  if (!node.icon)
23829
23827
  return null;
23830
23828
  if (node.icon.startsWith("http://") || node.icon.startsWith("https://"))
23831
23829
  return /* @__PURE__ */ jsx("div", { className: clsx(elementIcon, "likec4-element-icon"), children: /* @__PURE__ */ jsx("img", { src: node.icon, alt: node.title }) });
23832
- const icon = RenderIcon ? /* @__PURE__ */ jsx(RenderIcon, { node }) : null;
23830
+ const RenderIcon = store.getState().renderIcon, icon = RenderIcon ? /* @__PURE__ */ jsx(RenderIcon, { node }) : null;
23833
23831
  return icon ? /* @__PURE__ */ jsx("div", { className: clsx(elementIcon, "likec4-element-icon"), children: icon }) : null;
23834
23832
  };
23835
23833
  function useXYFlowEvents() {
@@ -24693,6 +24691,7 @@ const XYFlowInner = memo$1(function({
24693
24691
  children2
24694
24692
  ] });
24695
24693
  }, shallowEqual);
24694
+ XYFlowInner.displayName = "XYFlowInner";
24696
24695
  function LikeC4Diagram({
24697
24696
  view,
24698
24697
  className,
@@ -26958,13 +26958,11 @@ function DiagramContextProvider({
26958
26958
  ), useUpdateEffect(
26959
26959
  () => {
26960
26960
  if (!store.current) return;
26961
- const state = store.current.getState();
26962
- state.view !== view && state.updateView(view);
26963
- const newProps = i$2(props2, l$1);
26964
- o$2(state, newProps) || store.current.setState(newProps, !1, "update incoming props");
26961
+ const state = store.current.getState(), newProps = i$2(props2, l$1);
26962
+ o$2(state, newProps) || store.current.setState(newProps, !1, "update incoming props"), state.view !== view && state.updateView(view);
26965
26963
  },
26966
26964
  [view, props2],
26967
- shallowEqual
26965
+ (prev, next) => shallowEqual(prev[0], next[0]) && shallowEqual(prev[1], next[1])
26968
26966
  ), /* @__PURE__ */ jsx(
26969
26967
  "div",
26970
26968
  {
@@ -30015,11 +30013,8 @@ const Text = Text$1.withProps({
30015
30013
  // scale: 0.9
30016
30014
  // }
30017
30015
  }, isEqualProps = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? !1, next.selected ?? !1) && deepEqual(prev.dragging ?? !1, next.dragging ??
30018
- !1) && deepEqual(prev.draggable ?? !1, next.draggable ?? !1) && deepEqual(prev.width ?? 0, next.width ?? 0) && deepEqual(prev.height ?? 0, next.height ??
30019
- 0) && deepEqual(
30020
- prev.data.element,
30021
- next.data.element
30022
- ), ElementNodeMemo = memo$1(function({
30016
+ !1) && deepEqual(prev.width ?? 0, next.width ?? 0) && deepEqual(prev.height ?? 0, next.height ?? 0) && deepEqual(prev.data.element, next.data.element),
30017
+ ElementNodeMemo = memo$1(function({
30023
30018
  id: id2,
30024
30019
  data: {
30025
30020
  element
@@ -30030,7 +30025,7 @@ const Text = Text$1.withProps({
30030
30025
  width,
30031
30026
  height
30032
30027
  }) {
30033
- const { isHovered, isDimmed, hasOnNavigateTo, isHovercards, isInteractive } = useDiagramState((s2) => ({
30028
+ const store = useDiagramStoreApi(), { isHovered, isDimmed, hasOnNavigateTo, isHovercards, isInteractive } = useDiagramState((s2) => ({
30034
30029
  isHovered: s2.hoveredNodeId === id2,
30035
30030
  isDimmed: s2.dimmed.has(id2),
30036
30031
  isInteractive: s2.nodesDraggable || s2.nodesSelectable || !!s2.onNavigateTo,
@@ -30052,6 +30047,7 @@ const Text = Text$1.withProps({
30052
30047
  animate = "selected";
30053
30048
  break;
30054
30049
  }
30050
+ const elementIcon2 = ElementIcon({ node: element, store });
30055
30051
  return /* @__PURE__ */ jsxs(Fragment, { children: [
30056
30052
  /* @__PURE__ */ jsx(
30057
30053
  Handle,
@@ -30115,11 +30111,11 @@ const Text = Text$1.withProps({
30115
30111
  {
30116
30112
  className: clsx(
30117
30113
  elementDataContainer,
30118
- n$4(element.icon) && hasIcon,
30114
+ n$4(elementIcon2) && hasIcon,
30119
30115
  "likec4-element"
30120
30116
  ),
30121
30117
  children: [
30122
- n$4(element.icon) && /* @__PURE__ */ jsx(ElementIcon, { node: element }),
30118
+ elementIcon2,
30123
30119
  /* @__PURE__ */ jsxs("div", { className: clsx(elementTextData, "likec4-element-main-props"), children: [
30124
30120
  /* @__PURE__ */ jsx(
30125
30121
  Text,
@@ -30160,8 +30156,7 @@ const Text = Text$1.withProps({
30160
30156
  }
30161
30157
  )
30162
30158
  ] });
30163
- }, isEqualProps), ElementIcon = ({ node }) => {
30164
- const RenderIcon2 = useDiagramState((s2) => s2.renderIcon);
30159
+ }, isEqualProps), ElementIcon = ({ node, store }) => {
30165
30160
  if (!node.icon)
30166
30161
  return null;
30167
30162
  if (node.icon.startsWith("http://") || node.icon.startsWith("https://"))
@@ -30169,7 +30164,7 @@ const Text = Text$1.withProps({
30169
30164
  src: node.icon,
30170
30165
  alt: node.title
30171
30166
  }) });
30172
- const icon = RenderIcon2 ? /* @__PURE__ */ jsx(RenderIcon2, { node }) : null;
30167
+ const RenderIcon2 = store.getState().renderIcon, icon = RenderIcon2 ? /* @__PURE__ */ jsx(RenderIcon2, { node }) : null;
30173
30168
  return icon ? /* @__PURE__ */ jsx("div", { className: clsx(elementIcon, "likec4-element-icon"), children: icon }) : null;
30174
30169
  };
30175
30170
  function useXYFlowEvents() {
@@ -31042,6 +31037,7 @@ const XYFlowInner = memo$1(function({
31042
31037
  children2
31043
31038
  ] });
31044
31039
  }, shallowEqual);
31040
+ XYFlowInner.displayName = "XYFlowInner";
31045
31041
  function LikeC4Diagram({
31046
31042
  view,
31047
31043
  className,