@progress/kendo-react-diagram 16.2.0-develop.1 → 16.2.0-develop.11

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.
Files changed (63) hide show
  1. package/dist/cdn/js/kendo-react-diagram.js +1 -1
  2. package/hooks/useDiagramTooltip.js +1 -1
  3. package/hooks/useDiagramTooltip.mjs +37 -37
  4. package/index.d.mts +3 -2
  5. package/index.d.ts +3 -2
  6. package/index.js +1 -1
  7. package/index.mjs +52 -44
  8. package/messages/index.d.ts +437 -0
  9. package/messages/index.js +8 -0
  10. package/messages/index.mjs +182 -0
  11. package/package-metadata.js +1 -1
  12. package/package-metadata.mjs +2 -2
  13. package/package.json +10 -4
  14. package/rich-text-editing/ConnectionEditingToolbar.d.ts +17 -0
  15. package/rich-text-editing/ConnectionEditingToolbar.js +8 -0
  16. package/rich-text-editing/ConnectionEditingToolbar.mjs +126 -0
  17. package/rich-text-editing/DiagramEditor.d.ts +13 -0
  18. package/rich-text-editing/DiagramEditor.js +8 -0
  19. package/rich-text-editing/DiagramEditor.mjs +197 -0
  20. package/rich-text-editing/DiagramEditorContext.d.ts +34 -0
  21. package/rich-text-editing/DiagramEditorContext.js +8 -0
  22. package/rich-text-editing/DiagramEditorContext.mjs +117 -0
  23. package/rich-text-editing/FloatingToolbarPopup.d.ts +38 -0
  24. package/rich-text-editing/FloatingToolbarPopup.js +8 -0
  25. package/rich-text-editing/FloatingToolbarPopup.mjs +97 -0
  26. package/rich-text-editing/Icons-Dropdown.d.ts +31 -0
  27. package/rich-text-editing/Icons-Dropdown.js +8 -0
  28. package/rich-text-editing/Icons-Dropdown.mjs +160 -0
  29. package/rich-text-editing/MainToolbar.d.ts +21 -0
  30. package/rich-text-editing/MainToolbar.js +8 -0
  31. package/rich-text-editing/MainToolbar.mjs +143 -0
  32. package/rich-text-editing/ShapeEditingToolbar.d.ts +18 -0
  33. package/rich-text-editing/ShapeEditingToolbar.js +8 -0
  34. package/rich-text-editing/ShapeEditingToolbar.mjs +154 -0
  35. package/rich-text-editing/TextEditingToolbar.d.ts +25 -0
  36. package/rich-text-editing/TextEditingToolbar.js +8 -0
  37. package/rich-text-editing/TextEditingToolbar.mjs +212 -0
  38. package/rich-text-editing/border-style.d.ts +15 -0
  39. package/rich-text-editing/border-style.js +8 -0
  40. package/rich-text-editing/border-style.mjs +39 -0
  41. package/rich-text-editing/border-width.d.ts +19 -0
  42. package/rich-text-editing/border-width.js +8 -0
  43. package/rich-text-editing/border-width.mjs +112 -0
  44. package/rich-text-editing/cap-type.d.ts +25 -0
  45. package/rich-text-editing/cap-type.js +8 -0
  46. package/rich-text-editing/cap-type.mjs +40 -0
  47. package/rich-text-editing/connection-style.d.ts +15 -0
  48. package/rich-text-editing/connection-style.js +8 -0
  49. package/rich-text-editing/connection-style.mjs +39 -0
  50. package/rich-text-editing/connection-types.d.ts +15 -0
  51. package/rich-text-editing/connection-types.js +8 -0
  52. package/rich-text-editing/connection-types.mjs +33 -0
  53. package/rich-text-editing/default-toolbar-tools.d.ts +77 -0
  54. package/rich-text-editing/default-toolbar-tools.js +8 -0
  55. package/rich-text-editing/default-toolbar-tools.mjs +63 -0
  56. package/rich-text-editing/index.d.ts +10 -0
  57. package/rich-text-editing/shapes-dropdown.d.ts +23 -0
  58. package/rich-text-editing/shapes-dropdown.js +8 -0
  59. package/rich-text-editing/shapes-dropdown.mjs +66 -0
  60. package/rich-text-editing/types.d.ts +14 -0
  61. package/rich-text-editing/utils.d.ts +48 -0
  62. package/rich-text-editing/utils.js +8 -0
  63. package/rich-text-editing/utils.mjs +42 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-diagram",
3
- "version": "16.2.0-develop.1",
3
+ "version": "16.2.0-develop.11",
4
4
  "description": "React Diagram component. KendoReact Diagram package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -26,12 +26,18 @@
26
26
  "sideEffects": false,
27
27
  "peerDependencies": {
28
28
  "@progress/kendo-licensing": "^1.7.2",
29
- "@progress/kendo-react-common": "16.2.0-develop.1",
29
+ "@progress/kendo-react-buttons": "16.2.0-develop.11",
30
+ "@progress/kendo-react-common": "16.2.0-develop.11",
31
+ "@progress/kendo-react-editor": "16.2.0-develop.11",
32
+ "@progress/kendo-react-inputs": "16.2.0-develop.11",
33
+ "@progress/kendo-react-intl": "16.2.0-develop.11",
34
+ "@progress/kendo-react-popup": "16.2.0-develop.11",
35
+ "@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
30
36
  "react": "^18.0.0 || ^19.0.0",
31
37
  "react-dom": "^18.0.0 || ^19.0.0"
32
38
  },
33
39
  "dependencies": {
34
- "@progress/kendo-diagram-common": "^2.7.0",
40
+ "@progress/kendo-diagram-common": "^2.7.2",
35
41
  "prop-types": "^15.6.0"
36
42
  },
37
43
  "keywords": [
@@ -52,7 +58,7 @@
52
58
  "package": {
53
59
  "productName": "KendoReact",
54
60
  "productCode": "KENDOUIREACT",
55
- "publishDate": 1789024430,
61
+ "publishDate": 1790167787,
56
62
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
57
63
  }
58
64
  },
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { Connection } from '@progress/kendo-diagram-common';
9
+ import { ToolbarTools } from './types';
10
+ import * as React from 'react';
11
+ interface ConnectionEditingToolbarProps {
12
+ connection: Connection | null;
13
+ tools: ToolbarTools;
14
+ }
15
+ /** @hidden */
16
+ export declare const ConnectionEditingToolbar: (props: ConnectionEditingToolbarProps) => React.JSX.Element | null;
17
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),s=require("@progress/kendo-react-buttons"),B=require("@progress/kendo-react-inputs"),V=require("@progress/kendo-react-popup"),z=require("@progress/kendo-diagram-common"),_=require("./border-width.js"),N=require("./connection-types.js"),U=require("./connection-style.js"),S=require("./cap-type.js"),l=require("@progress/kendo-svg-icons"),f=require("./utils.js"),A=require("@progress/kendo-react-intl"),F=require("./default-toolbar-tools.js"),t=require("../messages/index.js"),m=require("./DiagramEditorContext.js");function G(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:()=>n[a]})}}return r.default=n,Object.freeze(r)}const b=G(j),{ConnectionCommands:v,Data:H}=z.EditingUtils,{leftCapTypes:k,rightCapTypes:h,floatingToolbarStyle:J}=H,K=n=>{var C,T;const{connection:r,tools:a=F.defaultConnectionToolbarTools}=n,{controller:o}=m.useDiagramEditorContext(),x=m.useDiagramEditorPopupProps("connection-toolbar"),i=A.useLocalization();if(!r)return null;const c=r.options,u=c.type||"cascading",p=typeof c.stroke=="string"?{color:c.stroke}:c.stroke||{},q=p.color||"#000000",E=p.dashType||"solid",D=p.width||1,d=v.getCapTypeValue(c.startCap,"start"),g=v.getCapTypeValue(c.endCap,"end"),I=e=>{e!==u&&o.execute({type:"setConnectionType",value:e})},O=e=>{o.execute({type:"setConnectionStrokeColor",value:e})},P=e=>{o.execute({type:"setConnectionStrokeWidth",value:e})},w=e=>{o.execute({type:"setConnectionStrokeDashType",value:e})},L=e=>{o.execute({type:"setConnectionStartCap",value:e})},M=e=>{o.execute({type:"setConnectionEndCap",value:e})},R=()=>{o.execute({type:"deleteSelection"})},W={color:{component:B.ColorPicker,props:{value:q,gradientSettings:{opacity:!1},fillMode:"flat",onChange:e=>O(e.value),title:i.toLanguageString(t.editingConnectionColor,t.messages[t.editingConnectionColor])}},width:{component:_.BorderWidth,props:{value:D,onSelect:e=>P(e),label:i.toLanguageString(t.editingConnectionWidth,t.messages[t.editingConnectionWidth]),min:1,overlayOwner:"connection-toolbar"}},style:{component:U.ConnectionStyle,props:{value:E,onSelect:e=>w(e),overlayOwner:"connection-toolbar"}},text:{component:s.Button,props:{type:"button",fillMode:"flat",svgIcon:l.freeTextIcon,onClick:()=>o.execute({type:"openSelectedTextEditor"}),title:i.toLanguageString(t.editingEditText,t.messages[t.editingEditText])}},startCap:{component:S.CapType,props:{value:d,onSelect:e=>L(e),data:k,buttonIcon:((C=k.find(e=>e.value===d))==null?void 0:C.icon)||l.arrowLeftIcon,buttonTitle:i.toLanguageString(t.editingStartCapType,t.messages[t.editingStartCapType]),overlayOwner:"connection-toolbar"}},type:{component:N.ConnectionTypes,props:{value:u,onSelect:e=>I(e),overlayOwner:"connection-toolbar"}},endCap:{component:S.CapType,props:{value:g,onSelect:e=>M(e),data:h,buttonIcon:((T=h.find(e=>e.value===g))==null?void 0:T.icon)||l.arrowRightIcon,buttonTitle:i.toLanguageString(t.editingEndCapType,t.messages[t.editingEndCapType]),overlayOwner:"connection-toolbar"}},delete:{component:s.Button,props:{fillMode:"flat",onClick:R,svgIcon:l.trashIcon,title:i.toLanguageString(t.editingDelete,t.messages[t.editingDelete])}},separator:{component:s.ToolbarSeparator,props:{}}},y=f.mapTools(a,W);return y.length===0?null:b.createElement(V.PopupPropsContext.Provider,{value:x},b.createElement(s.Toolbar,{fillMode:"flat",style:J,buttons:f.floatingToolbarButtons},y))};exports.ConnectionEditingToolbar=K;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as d from "react";
9
+ import { Toolbar as j, ToolbarSeparator as q, Button as g } from "@progress/kendo-react-buttons";
10
+ import { ColorPicker as A } from "@progress/kendo-react-inputs";
11
+ import { PopupPropsContext as F } from "@progress/kendo-react-popup";
12
+ import { EditingUtils as G } from "@progress/kendo-diagram-common";
13
+ import { BorderWidth as H } from "./border-width.mjs";
14
+ import { ConnectionTypes as J } from "./connection-types.mjs";
15
+ import { ConnectionStyle as K } from "./connection-style.mjs";
16
+ import { CapType as C } from "./cap-type.mjs";
17
+ import { arrowRightIcon as N, arrowLeftIcon as Q, trashIcon as X, freeTextIcon as Y } from "@progress/kendo-svg-icons";
18
+ import { mapTools as Z, floatingToolbarButtons as _ } from "./utils.mjs";
19
+ import { useLocalization as $ } from "@progress/kendo-react-intl";
20
+ import { defaultConnectionToolbarTools as oo } from "./default-toolbar-tools.mjs";
21
+ import { editingDelete as y, messages as r, editingEndCapType as f, editingStartCapType as T, editingEditText as S, editingConnectionWidth as v, editingConnectionColor as b } from "../messages/index.mjs";
22
+ import { useDiagramEditorContext as to, useDiagramEditorPopupProps as eo } from "./DiagramEditorContext.mjs";
23
+ const { ConnectionCommands: h, Data: no } = G, { leftCapTypes: k, rightCapTypes: x, floatingToolbarStyle: ro } = no, vo = (E) => {
24
+ var u, m;
25
+ const { connection: p, tools: w = oo } = E, { controller: t } = to(), D = eo("connection-toolbar"), e = $();
26
+ if (!p)
27
+ return null;
28
+ const n = p.options, l = n.type || "cascading", a = typeof n.stroke == "string" ? { color: n.stroke } : n.stroke || {}, I = a.color || "#000000", L = a.dashType || "solid", P = a.width || 1, i = h.getCapTypeValue(n.startCap, "start"), c = h.getCapTypeValue(n.endCap, "end"), M = (o) => {
29
+ o !== l && t.execute({ type: "setConnectionType", value: o });
30
+ }, O = (o) => {
31
+ t.execute({ type: "setConnectionStrokeColor", value: o });
32
+ }, W = (o) => {
33
+ t.execute({ type: "setConnectionStrokeWidth", value: o });
34
+ }, V = (o) => {
35
+ t.execute({ type: "setConnectionStrokeDashType", value: o });
36
+ }, B = (o) => {
37
+ t.execute({ type: "setConnectionStartCap", value: o });
38
+ }, z = (o) => {
39
+ t.execute({ type: "setConnectionEndCap", value: o });
40
+ }, R = () => {
41
+ t.execute({ type: "deleteSelection" });
42
+ }, U = {
43
+ color: {
44
+ component: A,
45
+ props: {
46
+ value: I,
47
+ gradientSettings: { opacity: !1 },
48
+ fillMode: "flat",
49
+ onChange: (o) => O(o.value),
50
+ title: e.toLanguageString(b, r[b])
51
+ }
52
+ },
53
+ width: {
54
+ component: H,
55
+ props: {
56
+ value: P,
57
+ onSelect: (o) => W(o),
58
+ label: e.toLanguageString(v, r[v]),
59
+ min: 1,
60
+ overlayOwner: "connection-toolbar"
61
+ }
62
+ },
63
+ style: {
64
+ component: K,
65
+ props: {
66
+ value: L,
67
+ onSelect: (o) => V(o),
68
+ overlayOwner: "connection-toolbar"
69
+ }
70
+ },
71
+ text: {
72
+ component: g,
73
+ props: {
74
+ type: "button",
75
+ fillMode: "flat",
76
+ svgIcon: Y,
77
+ onClick: () => t.execute({ type: "openSelectedTextEditor" }),
78
+ title: e.toLanguageString(S, r[S])
79
+ }
80
+ },
81
+ startCap: {
82
+ component: C,
83
+ props: {
84
+ value: i,
85
+ onSelect: (o) => B(o),
86
+ data: k,
87
+ buttonIcon: ((u = k.find((o) => o.value === i)) == null ? void 0 : u.icon) || Q,
88
+ buttonTitle: e.toLanguageString(T, r[T]),
89
+ overlayOwner: "connection-toolbar"
90
+ }
91
+ },
92
+ type: {
93
+ component: J,
94
+ props: {
95
+ value: l,
96
+ onSelect: (o) => M(o),
97
+ overlayOwner: "connection-toolbar"
98
+ }
99
+ },
100
+ endCap: {
101
+ component: C,
102
+ props: {
103
+ value: c,
104
+ onSelect: (o) => z(o),
105
+ data: x,
106
+ buttonIcon: ((m = x.find((o) => o.value === c)) == null ? void 0 : m.icon) || N,
107
+ buttonTitle: e.toLanguageString(f, r[f]),
108
+ overlayOwner: "connection-toolbar"
109
+ }
110
+ },
111
+ delete: {
112
+ component: g,
113
+ props: {
114
+ fillMode: "flat",
115
+ onClick: R,
116
+ svgIcon: X,
117
+ title: e.toLanguageString(y, r[y])
118
+ }
119
+ },
120
+ separator: { component: q, props: {} }
121
+ }, s = Z(w, U);
122
+ return s.length === 0 ? null : /* @__PURE__ */ d.createElement(F.Provider, { value: D }, /* @__PURE__ */ d.createElement(j, { fillMode: "flat", style: ro, buttons: _ }, s));
123
+ };
124
+ export {
125
+ vo as ConnectionEditingToolbar
126
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { DiagramEditorProps } from './types';
9
+ import * as React from 'react';
10
+ /**
11
+ * The `DiagramEditor` component provides tools for editing diagram shapes, connections, and text, including rich-text editing capabilities.
12
+ */
13
+ export declare const DiagramEditor: React.FC<DiagramEditorProps>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("react"),l=require("@progress/kendo-react-editor"),Se=require("@progress/kendo-react-intl"),ye=require("./TextEditingToolbar.js"),xe=require("./ShapeEditingToolbar.js"),Pe=require("./ConnectionEditingToolbar.js"),k=require("./default-toolbar-tools.js"),y=require("@progress/kendo-diagram-common"),Ce=require("./MainToolbar.js"),I=require("./FloatingToolbarPopup.js"),K=require("./utils.js"),S=require("./DiagramEditorContext.js"),z=require("../messages/index.js");function ve(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const b in n)if(b!=="default"){const m=Object.getOwnPropertyDescriptor(n,b);Object.defineProperty(s,b,m.get?m:{enumerable:!0,get:()=>n[b]})}}return s.default=n,Object.freeze(s)}const t=ve(Ee),{pmDocToRTContent:we,rtContentToPM:ke,schemaSpec:Me,styleEditor:De,scheduleRafCall:te,recalcVerticalAlign:oe}=y.EditingUtils,ne=new l.ProseMirror.Schema(Me),Re=ke(l.ProseMirror.Node,ne),{imageResizing:Oe}=l.EditorUtils;class Ve extends l.ProseMirror.EditorView{}class Ie extends l.ProseMirror.Node{}const qe='[tabindex]:not([tabindex="-1"]), button:not([disabled]), .k-dropdownlist, .k-colorpicker',Ae=n=>{const s=n.content.firstChild;return n.childCount===0||!!(n.childCount===1&&(s!=null&&s.inlineContent)&&s.childCount===0)},Ne=n=>{var $,G;const{diagram:s,toolbars:b={}}=n,m={position:"top",tools:k.defaultMainToolbarTools,shapes:n.shapes},F={tools:k.defaultShapeToolbarTools,shapes:n.shapes},_={tools:k.defaultConnectionToolbarTools},j={tools:k.defaultTextToolbarTools,fontNames:n.fontTypes,fontSizes:n.fontSizes},{diagram:M=m,shape:D=F,connection:R=_,text:O=j}=b,B=typeof M=="boolean"?M?m:{position:"top",tools:[]}:M,V=typeof D=="boolean"?D?F:{tools:[]}:D,q=typeof R=="boolean"?R?_:{tools:[]}:R,L=typeof O=="boolean"?O?j:{tools:[]}:O,{controller:r,snapshot:e}=S.useDiagramEditorController(s),re=S.useRegisteredSurfaceRef(r),se=S.useRegisteredSurfaceRef(r),U=S.useRegisteredSurfaceRef(r),W=t.useRef(null),[h,A]=t.useState(null),x=t.useRef(null),[u,T]=t.useState(null),i=t.useRef(null),ie=Se.useLocalization(),ae=e.editingSession?`${e.editingSession.target.type}:${e.editingSession.target.id}`:null,le=t.useCallback(o=>{var a;(a=i.current)==null||a.call(i),i.current=o&&r?r.registerSurface(o):null},[r]),ce=t.useCallback(o=>{W.current=o,U(o)},[U]),ue=t.useCallback(()=>{var a;const o=(a=W.current)==null?void 0:a.querySelector(qe);return o?(o.focus({preventScroll:!0}),!0):!1},[]);t.useEffect(()=>()=>{var o;(o=i.current)==null||o.call(i),i.current=null},[]),t.useLayoutEffect(()=>{var a;if(!r||!e.editingSession){A(null),x.current=null,T(null),r==null||r.setTextEditingAdapter(null),(a=i.current)==null||a.call(i),i.current=null;return}const o=Re(e.editingSession.item._contentVisual.options);return A(o),x.current=o,T(null),r.setTextEditingAdapter({getCommitPayload:()=>{const d=x.current;return d?{content:we(d),isEmpty:Ae(d),textContent:d.textContent}:null}}),()=>{r.setTextEditingAdapter(null)}},[r,ae,e.editingSession]);const de=e.editingSession?e.editingSession.item._contentVisual.options:{},g=e.selectedShape,p=e.selectedConnection,f=($=s==null?void 0:s.element)!=null?$:null,P=t.useMemo(()=>y.getContextToolbarAnchors(g,e.anchors.shape),[g,e.anchors.shape]),C=t.useMemo(()=>y.getContextToolbarAnchors(p,e.anchors.connection),[p,e.anchors.connection]),be=t.useMemo(()=>!!(g&&P.base&&e.visibility.shape&&V.tools.length>0&&y.isDiagramItemVisibleInViewport(g,f)),[g,P.base,e.visibility.shape,V.tools.length,f]),ge=t.useMemo(()=>!!(p&&C.base&&e.visibility.connection&&q.tools.length>0&&y.isDiagramItemVisibleInViewport(p,f)),[p,C.base,e.visibility.connection,q.tools.length,f]),pe=o=>{A(o.value),x.current=o.value,u&&T({view:u.view})},fe=o=>{var Q;const a=o.target;if(!e.editingSession||!a.element||!r||!h)return;const d=a.element;le(d);const{item:v}=e.editingSession,H=v.name==="Shape"?v._contentVisual.padding():{top:0,bottom:0,left:0,right:0},N=o.dom,J=ie.toLanguageString(z.placeholder,z.messages[z.placeholder]);let E;const he=new l.ProseMirror.Plugin({filterTransaction:w=>(te(oe,[w.doc.attrs.alignment,N,H]),T({view:E}),!0)}),Te=l.ProseMirror.EditorState.create({doc:h,schema:ne,plugins:[Oe(),...o.viewProps.state.plugins,l.EditorUtils.placeholder(J),he]});return E=new Ve({mount:N},{...o.viewProps,state:Te,handleKeyDown:(w,c)=>{var X,Y,Z,ee;return c.key==="Escape"?(r.handleKeyDown(c),c.defaultPrevented||((Y=(X=o.viewProps).handleKeyDown)==null?void 0:Y.call(X,w,c))===!0):c.key==="F10"&&c.altKey&&ue()?(c.preventDefault(),!0):(ee=(Z=o.viewProps).handleKeyDown)==null?void 0:ee.call(Z,w,c)}}),De(v,d,J),E.focus(),te(oe,[(Q=v.options.content)==null?void 0:Q.align,N,H]),T({view:E}),E},me=t.useCallback(o=>{o.key!=="Tab"||o.shiftKey||u&&(o.preventDefault(),u.view.focus())},[u]);return r?t.createElement(S.DiagramEditorProvider,{value:{controller:r,snapshot:e}},t.createElement(t.Fragment,null,t.createElement("div",{style:{position:"relative"}},t.createElement(Ce.MainToolbar,{diagram:s,visible:e.visibility.main&&B.tools.length>0,...B}),t.createElement(I.FloatingToolbarPopup,{show:be,baseAnchor:P.base,fallbackAnchor:P.fallback,boundaryElement:f},t.createElement("div",{ref:re,className:K.toolbarPopupWrapClass},t.createElement(xe.ShapeEditingToolbar,{shape:g,...V}))),t.createElement(I.FloatingToolbarPopup,{show:ge,baseAnchor:C.base,fallbackAnchor:C.fallback,boundaryElement:f},t.createElement("div",{ref:se,className:K.toolbarPopupWrapClass},t.createElement(Pe.ConnectionEditingToolbar,{connection:p,...q}))),t.createElement(I.FloatingToolbarPopup,{show:!!(e.editingSession&&u&&h&&e.anchors.textEditing&&e.visibility.textEditing&&L.tools.length>0),baseAnchor:e.anchors.textEditing?{left:e.anchors.textEditing.x,top:e.anchors.textEditing.y}:null},t.createElement("div",{ref:ce,className:K.toolbarPopupWrapClass,onKeyDown:me},t.createElement(ye.TextEditingToolbar,{editorView:u,editItem:(G=e.editingSession)==null?void 0:G.item,defaultStyles:de,...L})))),e.editingSession&&h&&t.createElement(l.Editor,{value:h,onChange:pe,defaultEditMode:"div",className:"k-diagram-rich-text-editor",style:{background:"transparent"},onMount:fe}))):null};exports.DiagramEditor=Ne;
@@ -0,0 +1,197 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as t from "react";
9
+ import { Editor as ye, ProseMirror as b, EditorUtils as oe } from "@progress/kendo-react-editor";
10
+ import { useLocalization as Se } from "@progress/kendo-react-intl";
11
+ import { TextEditingToolbar as xe } from "./TextEditingToolbar.mjs";
12
+ import { ShapeEditingToolbar as ve } from "./ShapeEditingToolbar.mjs";
13
+ import { ConnectionEditingToolbar as we } from "./ConnectionEditingToolbar.mjs";
14
+ import { defaultTextToolbarTools as Ce, defaultMainToolbarTools as Pe, defaultShapeToolbarTools as ke, defaultConnectionToolbarTools as Ve } from "./default-toolbar-tools.mjs";
15
+ import { getContextToolbarAnchors as X, isDiagramItemVisibleInViewport as Y, EditingUtils as Ae } from "@progress/kendo-diagram-common";
16
+ import { MainToolbar as De } from "./MainToolbar.mjs";
17
+ import { FloatingToolbarPopup as M } from "./FloatingToolbarPopup.mjs";
18
+ import { toolbarPopupWrapClass as R } from "./utils.mjs";
19
+ import { useDiagramEditorController as Me, useRegisteredSurfaceRef as N, DiagramEditorProvider as Re } from "./DiagramEditorContext.mjs";
20
+ import { placeholder as Z, messages as Ne } from "../messages/index.mjs";
21
+ const { pmDocToRTContent: Oe, rtContentToPM: Ke, schemaSpec: ze, styleEditor: Be, scheduleRafCall: ee, recalcVerticalAlign: te } = Ae, ne = new b.Schema(ze), Ie = Ke(b.Node, ne), { imageResizing: Fe } = oe;
22
+ class Le extends b.EditorView {
23
+ }
24
+ class tt extends b.Node {
25
+ }
26
+ const _e = '[tabindex]:not([tabindex="-1"]), button:not([disabled]), .k-dropdownlist, .k-colorpicker', Ue = (i) => {
27
+ const r = i.content.firstChild;
28
+ return i.childCount === 0 || !!(i.childCount === 1 && (r != null && r.inlineContent) && r.childCount === 0);
29
+ }, ot = (i) => {
30
+ var U, $;
31
+ const { diagram: r, toolbars: se = {} } = i, O = {
32
+ position: "top",
33
+ tools: Pe,
34
+ shapes: i.shapes
35
+ }, K = { tools: ke, shapes: i.shapes }, z = { tools: Ve }, B = {
36
+ tools: Ce,
37
+ fontNames: i.fontTypes,
38
+ fontSizes: i.fontSizes
39
+ }, {
40
+ diagram: v = O,
41
+ shape: w = K,
42
+ connection: C = z,
43
+ text: P = B
44
+ } = se, I = typeof v == "boolean" ? v ? O : { position: "top", tools: [] } : v, k = typeof w == "boolean" ? w ? K : { tools: [] } : w, V = typeof C == "boolean" ? C ? z : { tools: [] } : C, F = typeof P == "boolean" ? P ? B : { tools: [] } : P, { controller: n, snapshot: e } = Me(r), ie = N(n), le = N(n), L = N(n), _ = t.useRef(null), [p, A] = t.useState(null), T = t.useRef(null), [c, g] = t.useState(null), s = t.useRef(null), re = Se(), ae = e.editingSession ? `${e.editingSession.target.type}:${e.editingSession.target.id}` : null, ce = t.useCallback(
45
+ (o) => {
46
+ var l;
47
+ (l = s.current) == null || l.call(s), s.current = o && n ? n.registerSurface(o) : null;
48
+ },
49
+ [n]
50
+ ), ue = t.useCallback(
51
+ (o) => {
52
+ _.current = o, L(o);
53
+ },
54
+ [L]
55
+ ), de = t.useCallback(() => {
56
+ var l;
57
+ const o = (l = _.current) == null ? void 0 : l.querySelector(_e);
58
+ return o ? (o.focus({ preventScroll: !0 }), !0) : !1;
59
+ }, []);
60
+ t.useEffect(() => () => {
61
+ var o;
62
+ (o = s.current) == null || o.call(s), s.current = null;
63
+ }, []), t.useLayoutEffect(() => {
64
+ var l;
65
+ if (!n || !e.editingSession) {
66
+ A(null), T.current = null, g(null), n == null || n.setTextEditingAdapter(null), (l = s.current) == null || l.call(s), s.current = null;
67
+ return;
68
+ }
69
+ const o = Ie(e.editingSession.item._contentVisual.options);
70
+ return A(o), T.current = o, g(null), n.setTextEditingAdapter({
71
+ getCommitPayload: () => {
72
+ const u = T.current;
73
+ return u ? {
74
+ content: Oe(u),
75
+ isEmpty: Ue(u),
76
+ textContent: u.textContent
77
+ } : null;
78
+ }
79
+ }), () => {
80
+ n.setTextEditingAdapter(null);
81
+ };
82
+ }, [n, ae, e.editingSession]);
83
+ const me = e.editingSession ? e.editingSession.item._contentVisual.options : {}, d = e.selectedShape, m = e.selectedConnection, f = (U = r == null ? void 0 : r.element) != null ? U : null, E = t.useMemo(() => X(d, e.anchors.shape), [d, e.anchors.shape]), y = t.useMemo(() => X(m, e.anchors.connection), [m, e.anchors.connection]), fe = t.useMemo(() => !!(d && E.base && e.visibility.shape && k.tools.length > 0 && Y(d, f)), [
84
+ d,
85
+ E.base,
86
+ e.visibility.shape,
87
+ k.tools.length,
88
+ f
89
+ ]), be = t.useMemo(() => !!(m && y.base && e.visibility.connection && V.tools.length > 0 && Y(m, f)), [
90
+ m,
91
+ y.base,
92
+ e.visibility.connection,
93
+ V.tools.length,
94
+ f
95
+ ]), pe = (o) => {
96
+ A(o.value), T.current = o.value, c && g({ view: c.view });
97
+ }, ge = (o) => {
98
+ var j;
99
+ const l = o.target;
100
+ if (!e.editingSession || !l.element || !n || !p)
101
+ return;
102
+ const u = l.element;
103
+ ce(u);
104
+ const { item: S } = e.editingSession, q = S.name === "Shape" ? S._contentVisual.padding() : { top: 0, bottom: 0, left: 0, right: 0 }, D = o.dom, W = re.toLanguageString(Z, Ne[Z]);
105
+ let h;
106
+ const Te = new b.Plugin({
107
+ filterTransaction: (x) => (ee(te, [x.doc.attrs.alignment, D, q]), g({ view: h }), !0)
108
+ }), Ee = b.EditorState.create({
109
+ doc: p,
110
+ schema: ne,
111
+ plugins: [
112
+ Fe(),
113
+ ...o.viewProps.state.plugins,
114
+ oe.placeholder(W),
115
+ Te
116
+ ]
117
+ });
118
+ return h = new Le(
119
+ { mount: D },
120
+ {
121
+ ...o.viewProps,
122
+ state: Ee,
123
+ handleKeyDown: (x, a) => {
124
+ var G, H, J, Q;
125
+ return a.key === "Escape" ? (n.handleKeyDown(a), a.defaultPrevented || ((H = (G = o.viewProps).handleKeyDown) == null ? void 0 : H.call(G, x, a)) === !0) : a.key === "F10" && a.altKey && de() ? (a.preventDefault(), !0) : (Q = (J = o.viewProps).handleKeyDown) == null ? void 0 : Q.call(J, x, a);
126
+ }
127
+ }
128
+ ), Be(S, u, W), h.focus(), ee(te, [(j = S.options.content) == null ? void 0 : j.align, D, q]), g({ view: h }), h;
129
+ }, he = t.useCallback(
130
+ (o) => {
131
+ o.key !== "Tab" || o.shiftKey || c && (o.preventDefault(), c.view.focus());
132
+ },
133
+ [c]
134
+ );
135
+ return n ? /* @__PURE__ */ t.createElement(Re, { value: { controller: n, snapshot: e } }, /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ t.createElement(
136
+ De,
137
+ {
138
+ diagram: r,
139
+ visible: e.visibility.main && I.tools.length > 0,
140
+ ...I
141
+ }
142
+ ), /* @__PURE__ */ t.createElement(
143
+ M,
144
+ {
145
+ show: fe,
146
+ baseAnchor: E.base,
147
+ fallbackAnchor: E.fallback,
148
+ boundaryElement: f
149
+ },
150
+ /* @__PURE__ */ t.createElement("div", { ref: ie, className: R }, /* @__PURE__ */ t.createElement(ve, { shape: d, ...k }))
151
+ ), /* @__PURE__ */ t.createElement(
152
+ M,
153
+ {
154
+ show: be,
155
+ baseAnchor: y.base,
156
+ fallbackAnchor: y.fallback,
157
+ boundaryElement: f
158
+ },
159
+ /* @__PURE__ */ t.createElement("div", { ref: le, className: R }, /* @__PURE__ */ t.createElement(we, { connection: m, ...V }))
160
+ ), /* @__PURE__ */ t.createElement(
161
+ M,
162
+ {
163
+ show: !!(e.editingSession && c && p && e.anchors.textEditing && e.visibility.textEditing && F.tools.length > 0),
164
+ baseAnchor: e.anchors.textEditing ? { left: e.anchors.textEditing.x, top: e.anchors.textEditing.y } : null
165
+ },
166
+ /* @__PURE__ */ t.createElement(
167
+ "div",
168
+ {
169
+ ref: ue,
170
+ className: R,
171
+ onKeyDown: he
172
+ },
173
+ /* @__PURE__ */ t.createElement(
174
+ xe,
175
+ {
176
+ editorView: c,
177
+ editItem: ($ = e.editingSession) == null ? void 0 : $.item,
178
+ defaultStyles: me,
179
+ ...F
180
+ }
181
+ )
182
+ )
183
+ )), e.editingSession && p && /* @__PURE__ */ t.createElement(
184
+ ye,
185
+ {
186
+ value: p,
187
+ onChange: pe,
188
+ defaultEditMode: "div",
189
+ className: "k-diagram-rich-text-editor",
190
+ style: { background: "transparent" },
191
+ onMount: ge
192
+ }
193
+ ))) : null;
194
+ };
195
+ export {
196
+ ot as DiagramEditor
197
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { PopupProps } from '@progress/kendo-react-popup';
9
+ import { Diagram, DiagramEditorController, DiagramEditorOverlayOwner, DiagramEditorSnapshot } from '@progress/kendo-diagram-common';
10
+ import * as React from 'react';
11
+ interface DiagramEditorContextValue {
12
+ controller: DiagramEditorController;
13
+ snapshot: DiagramEditorSnapshot;
14
+ }
15
+ /** @hidden */
16
+ export declare const DiagramEditorProvider: React.Provider<DiagramEditorContextValue | null>;
17
+ /** @hidden */
18
+ export declare const useDiagramEditorController: (diagram: Diagram | null) => {
19
+ controller: DiagramEditorController | null;
20
+ snapshot: DiagramEditorSnapshot;
21
+ };
22
+ /** @hidden */
23
+ export declare const useDiagramEditorContext: () => DiagramEditorContextValue;
24
+ /** @hidden */
25
+ export declare const useRegisteredSurfaceRef: <T extends HTMLElement>(controller: DiagramEditorController | null) => (element: T | null) => void;
26
+ /** @hidden */
27
+ export declare const useControlledDiagramOverlay: (owner: DiagramEditorOverlayOwner) => {
28
+ overlayId: string;
29
+ open: boolean;
30
+ setOpen: (nextOpen: boolean | ((current: boolean) => boolean)) => void;
31
+ };
32
+ /** @hidden */
33
+ export declare const useDiagramEditorPopupProps: (owner: DiagramEditorOverlayOwner) => (popupProps: PopupProps) => PopupProps;
34
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),f=require("@progress/kendo-diagram-common");function E(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return e.default=r,Object.freeze(e)}const a=E(y),v=()=>{};let C=0;const m=a.createContext(null),O=m.Provider,D=r=>{const[e,n]=a.useState(null);a.useEffect(()=>{if(!r){n(null);return}const o=new f.DiagramEditorController({diagram:r});return n(o),()=>{o.destroy(),n(c=>c===o?null:c)}},[r]);const t=a.useCallback(o=>e?e.subscribe(o):v,[e]),l=a.useCallback(()=>e?e.getSnapshot():f.emptyDiagramEditorSnapshot,[e]),s=a.useSyncExternalStore(t,l,()=>f.emptyDiagramEditorSnapshot);return{controller:e,snapshot:s}},g=()=>{const r=a.useContext(m);if(!r)throw new Error("DiagramEditorContext is not available.");return r},b=r=>{const e=a.useRef(null);return a.useEffect(()=>()=>{var n;(n=e.current)==null||n.call(e),e.current=null},[]),a.useCallback(n=>{var t;(t=e.current)==null||t.call(e),e.current=n&&r?r.registerSurface(n):null},[r])},S=r=>{const{controller:e,snapshot:n}=g(),t=a.useId(),l=n.openOverlays.has(t);a.useEffect(()=>()=>{e.closeOverlay(t)},[e,t]);const s=a.useCallback(o=>{const c=typeof o=="function"?o(l):o;if(c!==l){if(c){e.openOverlay(t,r);return}e.closeOverlay(t)}},[e,l,t,r]);return{overlayId:t,open:l,setOpen:s}},h=r=>{const{controller:e}=g(),n=a.useRef(new Map);return a.useEffect(()=>()=>{n.current.forEach((t,l)=>{t(),e.closeOverlay(l)}),n.current.clear()},[e]),a.useCallback(t=>({...t,animate:!1,onOpen:l=>{var c,u,i,d;(c=t.onOpen)==null||c.call(t,l);const s=(i=(u=l.target)==null?void 0:u.element)==null?void 0:i.querySelector(".k-popup");if(!(s instanceof HTMLElement))return;let o=s.dataset.diagramEditorOverlayId;o||(o=`${r}-${C++}`,s.dataset.diagramEditorOverlayId=o),e.openOverlay(o,r),(d=n.current.get(o))==null||d(),n.current.set(o,e.registerSurface(s))},onClose:l=>{var c,u,i,d;const s=(u=(c=l.target)==null?void 0:c.element)==null?void 0:u.querySelector(".k-popup"),o=s instanceof HTMLElement?s.dataset.diagramEditorOverlayId:void 0;o&&((i=n.current.get(o))==null||i(),n.current.delete(o),e.closeOverlay(o)),(d=t.onClose)==null||d.call(t,l)}}),[e,r])};exports.DiagramEditorProvider=O;exports.useControlledDiagramOverlay=S;exports.useDiagramEditorContext=g;exports.useDiagramEditorController=D;exports.useDiagramEditorPopupProps=h;exports.useRegisteredSurfaceRef=b;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as a from "react";
9
+ import { DiagramEditorController as y, emptyDiagramEditorSnapshot as f } from "@progress/kendo-diagram-common";
10
+ const g = () => {
11
+ };
12
+ let v = 0;
13
+ const E = a.createContext(null), O = E.Provider, S = (o) => {
14
+ const [e, n] = a.useState(null);
15
+ a.useEffect(() => {
16
+ if (!o) {
17
+ n(null);
18
+ return;
19
+ }
20
+ const r = new y({ diagram: o });
21
+ return n(r), () => {
22
+ r.destroy(), n((c) => c === r ? null : c);
23
+ };
24
+ }, [o]);
25
+ const t = a.useCallback(
26
+ (r) => e ? e.subscribe(r) : g,
27
+ [e]
28
+ ), l = a.useCallback(() => e ? e.getSnapshot() : f, [e]), s = a.useSyncExternalStore(t, l, () => f);
29
+ return {
30
+ controller: e,
31
+ snapshot: s
32
+ };
33
+ }, m = () => {
34
+ const o = a.useContext(E);
35
+ if (!o)
36
+ throw new Error("DiagramEditorContext is not available.");
37
+ return o;
38
+ }, b = (o) => {
39
+ const e = a.useRef(null);
40
+ return a.useEffect(
41
+ () => () => {
42
+ var n;
43
+ (n = e.current) == null || n.call(e), e.current = null;
44
+ },
45
+ []
46
+ ), a.useCallback(
47
+ (n) => {
48
+ var t;
49
+ (t = e.current) == null || t.call(e), e.current = n && o ? o.registerSurface(n) : null;
50
+ },
51
+ [o]
52
+ );
53
+ }, D = (o) => {
54
+ const { controller: e, snapshot: n } = m(), t = a.useId(), l = n.openOverlays.has(t);
55
+ a.useEffect(
56
+ () => () => {
57
+ e.closeOverlay(t);
58
+ },
59
+ [e, t]
60
+ );
61
+ const s = a.useCallback(
62
+ (r) => {
63
+ const c = typeof r == "function" ? r(l) : r;
64
+ if (c !== l) {
65
+ if (c) {
66
+ e.openOverlay(t, o);
67
+ return;
68
+ }
69
+ e.closeOverlay(t);
70
+ }
71
+ },
72
+ [e, l, t, o]
73
+ );
74
+ return {
75
+ overlayId: t,
76
+ open: l,
77
+ setOpen: s
78
+ };
79
+ }, h = (o) => {
80
+ const { controller: e } = m(), n = a.useRef(/* @__PURE__ */ new Map());
81
+ return a.useEffect(
82
+ () => () => {
83
+ n.current.forEach((t, l) => {
84
+ t(), e.closeOverlay(l);
85
+ }), n.current.clear();
86
+ },
87
+ [e]
88
+ ), a.useCallback(
89
+ (t) => ({
90
+ ...t,
91
+ animate: !1,
92
+ onOpen: (l) => {
93
+ var c, u, i, d;
94
+ (c = t.onOpen) == null || c.call(t, l);
95
+ const s = (i = (u = l.target) == null ? void 0 : u.element) == null ? void 0 : i.querySelector(".k-popup");
96
+ if (!(s instanceof HTMLElement))
97
+ return;
98
+ let r = s.dataset.diagramEditorOverlayId;
99
+ r || (r = `${o}-${v++}`, s.dataset.diagramEditorOverlayId = r), e.openOverlay(r, o), (d = n.current.get(r)) == null || d(), n.current.set(r, e.registerSurface(s));
100
+ },
101
+ onClose: (l) => {
102
+ var c, u, i, d;
103
+ const s = (u = (c = l.target) == null ? void 0 : c.element) == null ? void 0 : u.querySelector(".k-popup"), r = s instanceof HTMLElement ? s.dataset.diagramEditorOverlayId : void 0;
104
+ r && ((i = n.current.get(r)) == null || i(), n.current.delete(r), e.closeOverlay(r)), (d = t.onClose) == null || d.call(t, l);
105
+ }
106
+ }),
107
+ [e, o]
108
+ );
109
+ };
110
+ export {
111
+ O as DiagramEditorProvider,
112
+ D as useControlledDiagramOverlay,
113
+ m as useDiagramEditorContext,
114
+ S as useDiagramEditorController,
115
+ h as useDiagramEditorPopupProps,
116
+ b as useRegisteredSurfaceRef
117
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { PopupProps } from '@progress/kendo-react-popup';
9
+ import { DiagramFloatingToolbarPoint } from '@progress/kendo-diagram-common';
10
+ import * as React from 'react';
11
+ interface FloatingToolbarPopupProps {
12
+ show: boolean;
13
+ baseAnchor: DiagramFloatingToolbarPoint | null;
14
+ fallbackAnchor?: DiagramFloatingToolbarPoint | null;
15
+ boundaryElement?: HTMLElement | null;
16
+ anchorAlign?: PopupProps['anchorAlign'];
17
+ popupAlign?: PopupProps['popupAlign'];
18
+ offset?: PopupProps['offset'];
19
+ children: React.ReactNode;
20
+ }
21
+ /** @hidden */
22
+ export declare const FloatingToolbarPopup: ({ show, baseAnchor, fallbackAnchor, boundaryElement, anchorAlign, popupAlign, offset, children }: FloatingToolbarPopupProps) => React.JSX.Element;
23
+ /** @hidden */
24
+ export declare const floatingToolbarPopupAlign: {
25
+ above: {
26
+ readonly horizontal: "center";
27
+ readonly vertical: "bottom";
28
+ };
29
+ below: {
30
+ readonly horizontal: "center";
31
+ readonly vertical: "top";
32
+ };
33
+ top: {
34
+ readonly horizontal: "center";
35
+ readonly vertical: "top";
36
+ };
37
+ };
38
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),L=require("@progress/kendo-react-popup"),z=require("@progress/kendo-diagram-common");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const r=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(t,c,r.get?r:{enumerable:!0,get:()=>e[c]})}}return t.default=e,Object.freeze(t)}const s=_(F),{floatingToolbarStyle:S}=z.EditingUtils.Data,x={horizontal:"center",vertical:"center"},B={horizontal:"center",vertical:"bottom"},V={horizontal:"center",vertical:"top"},W={above:B,below:V},P={left:0,top:0},y={offset:P,placement:"above",visible:!1},j=(e,t)=>({left:e.left+(t?t.left:0),top:e.top+(t?t.top:0)}),O=(e,t,c)=>({offset:e||P,placement:t,visible:c}),Y=e=>(e==null?void 0:e.vertical)==="top"?"below":"above",g=(e,t)=>e.visible===t.visible&&e.offset.left===t.offset.left&&e.offset.top===t.offset.top&&e.placement===t.placement,N=({show:e,baseAnchor:t,fallbackAnchor:c=null,boundaryElement:r,anchorAlign:D=x,popupAlign:T=B,offset:f=P,children:H})=>{const h=s.useRef(null),u=s.useRef(0),m=Y(T),l=s.useMemo(()=>t?j(t,f):null,[t,f]),b=s.useMemo(()=>c?j(c,f):null,[c,f]),[i,d]=s.useState(()=>l?O(l,m,!0):y),k=s.useCallback(o=>{var a;const p=(a=o==null?void 0:o.element)==null?void 0:a.querySelector(".k-popup");h.current=p instanceof HTMLElement?p:null,p instanceof HTMLElement&&Object.keys(S).forEach(R=>{const v=S[R];p.style[R]=v})},[]),w=e&&!!t;s.useLayoutEffect(()=>{var A,M;if(!w||!l){d(n=>g(n,y)?n:y);return}let o;if(!r||!b){o=O(l,m,!0),d(n=>g(n,o)?n:o);return}const p=((A=h.current)==null?void 0:A.getBoundingClientRect().height)||u.current;if(p>0&&(u.current=p),u.current<=0){o=O(l,m,!0),d(n=>g(n,o)?n:o);return}const a=r.getBoundingClientRect(),v=(((M=r.ownerDocument)==null?void 0:M.defaultView)||window).scrollY;o=z.resolveFloatingToolbarPlacement({baseAnchor:l,fallbackAnchor:b,popupHeight:u.current,boundaryTop:a.top+v,boundaryBottom:a.bottom+v}),d(n=>g(n,o)?n:o)},[r,m,w,l,b]);const q=w&&(i.visible||u.current<=0||!r||!b),C=i.visible?i.offset:l||P,E=i.visible?W[i.placement]:T;return s.createElement(L.Popup,{show:q,anchorAlign:D,popupAlign:E,offset:C,positionMode:"fixed",ref:k,animate:!1},H)};exports.FloatingToolbarPopup=N;