@layers-app/editor 0.7.18 → 0.7.20

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 (249) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.d.ts +77 -1
  3. package/dist/index.js +15 -9
  4. package/dist/layers.-pxItkuK.js +11 -0
  5. package/dist/layers.4783bPvO.js +39 -0
  6. package/dist/layers.4XOTUH37.js +1089 -0
  7. package/dist/layers.4peyl00A.js +2 -0
  8. package/dist/layers.4wAcqQtQ.js +423 -0
  9. package/dist/layers.4ykD0YcM.js +40 -0
  10. package/dist/layers.52famHy6.js +1 -0
  11. package/dist/layers.6Feq9YXQ.js +40 -0
  12. package/dist/layers.6GQPwq_6.js +960 -0
  13. package/dist/layers.7JqFgE4-.js +15 -0
  14. package/dist/layers.7wQbmwwB.js +1034 -0
  15. package/dist/layers.8JNx1FTq.js +35 -0
  16. package/dist/layers.8jhm9FEJ.js +10 -0
  17. package/dist/layers.8lNrKfca.js +41 -0
  18. package/dist/layers.9kQUqqYe.js +139 -0
  19. package/dist/layers.9pNaFvaX.js +1 -0
  20. package/dist/layers.AO3vHISA.js +33 -0
  21. package/dist/layers.Ab6Lx44l.js +129 -0
  22. package/dist/layers.B-w9_4cB.js +22 -0
  23. package/dist/layers.B0bpRgNT.js +122 -0
  24. package/dist/layers.B19hGmey.js +1 -0
  25. package/dist/layers.B2OK_mI8.js +1 -0
  26. package/dist/layers.B3D4g2HH.js +1 -0
  27. package/dist/layers.B3mzJc8P.js +907 -0
  28. package/dist/layers.B5YhL7Gw.js +40 -0
  29. package/dist/layers.B7K7JjK6.js +1510 -0
  30. package/dist/layers.B885pkJL.js +794 -0
  31. package/dist/layers.B961U-Vk.js +1 -0
  32. package/dist/layers.B9jATAXU.js +42 -0
  33. package/dist/layers.BAtv1CM7.js +1 -0
  34. package/dist/layers.BBv6P-Uu.js +37 -0
  35. package/dist/layers.BC6JEDP2.js +796 -0
  36. package/dist/layers.BEagxCE_.js +35 -0
  37. package/dist/layers.BH34WCDb.js +6 -0
  38. package/dist/layers.BIeVwYKL.js +1 -0
  39. package/dist/layers.BIkD0WQr.js +10 -0
  40. package/dist/layers.BIlhFIEz.js +37 -0
  41. package/dist/layers.BJDrjORS.js +244 -0
  42. package/dist/{layers.D99OBX9u.js → layers.BJLOp9cg.js} +88 -86
  43. package/dist/layers.BJsWSYrS.js +323 -0
  44. package/dist/layers.BKwcxD8A.js +5 -0
  45. package/dist/layers.BLd2spTm.js +1 -0
  46. package/dist/layers.BLv_frn1.js +10 -0
  47. package/dist/layers.BO2V23mI.js +1 -0
  48. package/dist/layers.BO_D4q5p.js +42 -0
  49. package/dist/layers.BP7EcZBZ.js +1 -0
  50. package/dist/layers.BP8OcU0T.js +10 -0
  51. package/dist/layers.BRaRY9tU.js +373 -0
  52. package/dist/layers.BSTBZrFn.js +1 -0
  53. package/dist/layers.BT2iHuSm.js +8 -0
  54. package/dist/layers.BU-tjKWq.js +33 -0
  55. package/dist/layers.BWEUOe94.js +40 -0
  56. package/dist/layers.BXAu7G4b.js +4 -0
  57. package/dist/layers.BZ9zcjtY.js +8 -0
  58. package/dist/layers.BZa5A6cg.js +425 -0
  59. package/dist/layers.BZlzQFiI.js +51 -0
  60. package/dist/layers.BagtOD0V.js +1 -0
  61. package/dist/layers.BbCfEXyj.js +55 -0
  62. package/dist/layers.Be94M_F4.js +7 -0
  63. package/dist/layers.BhdUQN6J.js +1583 -0
  64. package/dist/layers.Bj915C_T.js +5 -0
  65. package/dist/layers.BnHSrOPr.js +40 -0
  66. package/dist/layers.BngaRys_.js +8583 -0
  67. package/dist/layers.BoRvGzPp.js +1 -0
  68. package/dist/layers.Bob38w8X.js +5 -0
  69. package/dist/layers.BpTkSHkL.js +38 -0
  70. package/dist/layers.BpVR__4s.js +32 -0
  71. package/dist/layers.BpilXLfW.js +6 -0
  72. package/dist/layers.Br9HAzwf.js +2482 -0
  73. package/dist/layers.Bt7brqhi.js +116 -0
  74. package/dist/layers.BtqAfMks.js +1 -0
  75. package/dist/layers.BtvHse58.js +1 -0
  76. package/dist/layers.BwzogUnt.js +41 -0
  77. package/dist/layers.ByB5f2g3.js +7 -0
  78. package/dist/layers.ByipH4AB.js +207 -0
  79. package/dist/layers.BzC5N3hu.js +1619 -0
  80. package/dist/layers.C-KP-jFZ.js +8 -0
  81. package/dist/layers.C0iFGBoQ.js +213 -0
  82. package/dist/layers.C1AULvj_.js +40 -0
  83. package/dist/layers.C2f7uCzl.js +21620 -0
  84. package/dist/layers.C47t6lve.js +2 -0
  85. package/dist/layers.C4gRYt-z.js +9 -0
  86. package/dist/layers.C4nmPqDc.js +9 -0
  87. package/dist/layers.C5UKJ24R.js +271 -0
  88. package/dist/layers.C5qsYNKq.js +7 -0
  89. package/dist/layers.C70jnpZq.js +42 -0
  90. package/dist/layers.C7Qg5l_Q.js +5 -0
  91. package/dist/layers.C7v0beLV.js +9 -0
  92. package/dist/layers.C8_lu5UH.js +23 -0
  93. package/dist/layers.CAcCDIzK.js +32 -0
  94. package/dist/layers.CCWJVHwX.js +26946 -0
  95. package/dist/layers.CF2BAIC-.js +1 -0
  96. package/dist/layers.CFUGAgBV.js +805 -0
  97. package/dist/layers.CHZsXQcr.js +1 -0
  98. package/dist/layers.CIo6HbVI.js +37 -0
  99. package/dist/layers.CJaSQy6k.js +70 -0
  100. package/dist/layers.CJhFGqXY.js +1 -0
  101. package/dist/layers.CKU_klOZ.js +41 -0
  102. package/dist/layers.CKrtSnTU.js +7 -0
  103. package/dist/layers.CNoIsdHV.js +223 -0
  104. package/dist/layers.CQ-g_IO8.js +39 -0
  105. package/dist/layers.CRWtU7Vx.js +1268 -0
  106. package/dist/layers.CSattQNk.js +8 -0
  107. package/dist/layers.CT-8Geho.js +118 -0
  108. package/dist/layers.CWTjwUqI.js +9 -0
  109. package/dist/layers.CY3nuiOZ.js +39 -0
  110. package/dist/layers.CYDGmR2c.js +1 -0
  111. package/dist/layers.CYPtUh0S.js +36 -0
  112. package/dist/layers.CYjyWg9h.js +139 -0
  113. package/dist/layers.CZCoH1Jq.js +189 -0
  114. package/dist/layers.CZVe7Rrz.js +4 -0
  115. package/dist/layers.C_8NFZw0.js +84 -0
  116. package/dist/layers.C_IvrzZ3.js +7 -0
  117. package/dist/layers.C_vVmOaW.js +7 -0
  118. package/dist/layers.Cb3vLPzi.js +1 -0
  119. package/dist/layers.Cblg5KAJ.js +1286 -0
  120. package/dist/layers.CeUsnn-s.js +41 -0
  121. package/dist/layers.Cfwoj-CP.js +76 -0
  122. package/dist/layers.Cfxt2JbX.js +160 -0
  123. package/dist/layers.CjixIcYE.js +205 -0
  124. package/dist/layers.CliEt_s4.js +8 -0
  125. package/dist/layers.Cmumbtn4.js +11 -0
  126. package/dist/layers.Cnkh0zSn.js +5 -0
  127. package/dist/layers.Co0MEzNt.js +32 -0
  128. package/dist/layers.CpgPovn6.js +32 -0
  129. package/dist/layers.CqVTtuYm.js +6 -0
  130. package/dist/layers.Cr_8J_Ls.js +36 -0
  131. package/dist/layers.Cs7THreY.js +42 -0
  132. package/dist/layers.CtQHRQJd.js +65 -0
  133. package/dist/layers.Cuv2Lipq.js +10 -0
  134. package/dist/layers.Cuy--_Li.js +14 -0
  135. package/dist/layers.Cxrjuyke.js +38 -0
  136. package/dist/layers.Cxuu78R8.js +1 -0
  137. package/dist/layers.Cy_jbtrS.js +198 -0
  138. package/dist/layers.CyabQ7I1.js +40 -0
  139. package/dist/layers.CyqF5h2Z.js +1 -0
  140. package/dist/layers.Cyzu9PKQ.js +1 -0
  141. package/dist/layers.CzDyzzM2.js +36 -0
  142. package/dist/layers.D-LL79P8.js +32 -0
  143. package/dist/layers.D-uQN6e4.js +271 -0
  144. package/dist/layers.D00djYUT.js +9 -0
  145. package/dist/layers.D0zn4_Mx.js +1 -0
  146. package/dist/layers.D1PMEoqL.js +41 -0
  147. package/dist/layers.D1WSB9zI.js +806 -0
  148. package/dist/layers.D2dRxQww.js +10 -0
  149. package/dist/layers.D3KEnhiI.js +6 -0
  150. package/dist/layers.D3SlAvNp.js +934 -0
  151. package/dist/layers.D3eKKoAb.js +1 -0
  152. package/dist/layers.D4T8fTcj.js +1223 -0
  153. package/dist/layers.D7gfmd9A.js +36 -0
  154. package/dist/layers.D7jGxypv.js +8 -0
  155. package/dist/layers.DA1OUhKy.js +10 -0
  156. package/dist/layers.DB4o6Xfv.js +42 -0
  157. package/dist/layers.DBUjVgMd.js +1 -0
  158. package/dist/layers.DCkmUFPh.js +2966 -0
  159. package/dist/layers.DD4QPdYS.js +96 -0
  160. package/dist/layers.DE2Io1k7.js +295 -0
  161. package/dist/layers.DKnEcoKx.js +1088 -0
  162. package/dist/layers.DKsXm_hK.js +9 -0
  163. package/dist/layers.DLeGllIz.js +1 -0
  164. package/dist/layers.DLwuMfdd.js +84 -0
  165. package/dist/layers.DMkBISW1.js +1 -0
  166. package/dist/layers.DN9HoVxI.js +18 -0
  167. package/dist/layers.DOrgOHBr.js +1 -0
  168. package/dist/layers.DPipd7Yf.js +1 -0
  169. package/dist/layers.DQpNkl-s.js +39 -0
  170. package/dist/layers.DSNr6P6_.js +40 -0
  171. package/dist/layers.DWGLEZg1.js +34 -0
  172. package/dist/layers.DWxUDz1V.js +13 -0
  173. package/dist/layers.DYk9FILk.js +8 -0
  174. package/dist/layers.DZ3Nv-_j.js +8 -0
  175. package/dist/layers.DZGvjyDH.js +1 -0
  176. package/dist/layers.DZucH9TB.js +40 -0
  177. package/dist/layers.D__NkOsa.js +7 -0
  178. package/dist/layers.DbaKVP5e.js +1 -0
  179. package/dist/layers.DfkAyTyX.js +39 -0
  180. package/dist/layers.Dgie_iy2.js +772 -0
  181. package/dist/layers.DhHIDfZ5.js +1 -0
  182. package/dist/layers.Di-7t8Xt.js +6 -0
  183. package/dist/layers.DiPSTN4q.js +1 -0
  184. package/dist/layers.DjLIeP8d.js +257 -0
  185. package/dist/layers.DjUOC4st.js +16 -0
  186. package/dist/layers.Dk6h-6Wb.js +2 -0
  187. package/dist/layers.DkRR3p16.js +61 -0
  188. package/dist/layers.DnXxZJQo.js +48149 -0
  189. package/dist/layers.DpahuC02.js +6 -0
  190. package/dist/layers.Dpqc2FAN.js +40 -0
  191. package/dist/layers.DqScp2vq.js +1126 -0
  192. package/dist/layers.Dr1JRZ_S.js +4 -0
  193. package/dist/layers.DrTaVUsA.js +39 -0
  194. package/dist/layers.DrXLa4el.js +44 -0
  195. package/dist/layers.DtKxMd0g.js +4 -0
  196. package/dist/layers.DxA6ocdw.js +70 -0
  197. package/dist/layers.DxRZNwMP.js +1 -0
  198. package/dist/layers.Dy1naDTQ.js +14 -0
  199. package/dist/layers.FArKPCKA.js +21941 -0
  200. package/dist/layers.FXdB_jrR.js +9 -0
  201. package/dist/layers.GbuD0dtx.js +6 -0
  202. package/dist/layers.ILs-xE7i.js +11 -0
  203. package/dist/layers.JWCLFILJ.js +1 -0
  204. package/dist/layers.L9obQAvP.js +10 -0
  205. package/dist/layers.Lb5VQ9U4.js +504 -0
  206. package/dist/layers.MCy444Ia.js +41 -0
  207. package/dist/layers.QyDQqf0G.js +39 -0
  208. package/dist/layers.R4CPUhiF.js +8 -0
  209. package/dist/layers.R8mPlCA0.js +261 -0
  210. package/dist/layers.Sjtd5SpD.js +84 -0
  211. package/dist/layers.XlzBx5CM.js +437 -0
  212. package/dist/layers.YD8zq7G1.js +41 -0
  213. package/dist/layers.YWM6eRUH.js +1 -0
  214. package/dist/layers.a6EbdnVa.js +37 -0
  215. package/dist/layers.b0h5ZBmD.js +61 -0
  216. package/dist/layers.b9B2NY7n.js +11690 -0
  217. package/dist/layers.bS5nz97o.js +3 -0
  218. package/dist/layers.biaV5QcU.js +7 -0
  219. package/dist/layers.dxw35GiE.js +52 -0
  220. package/dist/layers.gFW_9pGM.js +1225 -0
  221. package/dist/layers.ge00jJfz.js +38 -0
  222. package/dist/layers.iryDeY19.js +9 -0
  223. package/dist/layers.jN02hLg8.js +7 -0
  224. package/dist/layers.jqEynR2I.js +8 -0
  225. package/dist/layers.lCpg7dOn.js +21 -0
  226. package/dist/layers.lIg0cncJ.js +39 -0
  227. package/dist/layers.lKk6bx4R.js +1 -0
  228. package/dist/layers.m4XcFQDd.js +6 -0
  229. package/dist/layers.m6FDW_ho.js +8 -0
  230. package/dist/layers.r6u8p96p.js +2238 -0
  231. package/dist/layers.rWob7btU.js +10 -0
  232. package/dist/layers.rYZbXo4d.js +32 -0
  233. package/dist/layers.sldWqHdD.js +11 -0
  234. package/dist/layers.tFqdqg82.js +10 -0
  235. package/dist/layers.v25uTBY8.js +39 -0
  236. package/dist/layers.wNarGMxP.js +9 -0
  237. package/dist/layers.wxYowcaq.js +41 -0
  238. package/dist/layers.xjN3ile4.js +9 -0
  239. package/dist/layers.yNlD-OCA.js +35 -0
  240. package/dist/layers.z-RuimGg.js +11 -0
  241. package/dist/layers.zvsP8spW.js +1 -0
  242. package/package.json +1 -1
  243. package/dist/layers.94hwidA2.js +0 -198
  244. package/dist/layers.B4l6ta1Q.js +0 -1
  245. package/dist/layers.BMrOAD_P.js +0 -1
  246. package/dist/layers.DOzLBYZr.js +0 -304
  247. package/dist/layers.YRyXopy_.js +0 -151
  248. package/dist/layers.usKC_Id5.js +0 -1
  249. package/dist/layers.zu-IYGYU.js +0 -47463
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),N=require("react-i18next"),a=require("./layers.94hwidA2.js"),t=require("@mantine/core"),P=require("@layers-app/shared"),C={};class L extends r.Component{render(){const{getComponent:l}=this.props,c=l("operations",!0);return e.jsx("div",{className:"swagger-ui",children:e.jsx(c,{})})}}const T=()=>({components:{OperationsLayout:L}}),q=s=>({statePlugins:{spec:{wrapSelectors:{taggedOperations:l=>(c,...f)=>{const i=l(c,...f);return s.operation?i.map(u=>u.update("operations",h=>h.filter(p=>p.get("operation").get("operationId")===s.operation))).filter(u=>u.get("operations").size>0):i}}}}}),U=({inputUrl:s,inputJSON:l,className:c,format:f,nodeKey:i,editor:u,create:h})=>{const{t:p}=N.useTranslation(),[j,m]=r.useState(""),[d,v]=r.useState(""),[k,w]=r.useState(!1),[B,O]=r.useState(!1),[g,x]=r.useState(!1),[b,S]=r.useState(!0);r.useEffect(()=>{h&&x(!0)},[h]),r.useEffect(()=>{g?a.blockScroll():a.unblockScroll()},[g]);const y=o=>{o.preventDefault(),u.update(()=>{const n=a.xo(i);a.$isSwaggerNode(n)&&(x(!1),n.setSrc(j||d),n.setJSON(d))})},{operation:I}=r.useMemo(()=>s?{operation:new URL(s).hash.split("/").pop()||""}:{operation:""},[s,l]);return s?e.jsxs(t.Box,{pos:"relative",mih:45,children:[e.jsx(t.LoadingOverlay,{visible:b,zIndex:1e3,overlayProps:{blur:4},loaderProps:{size:"xs"}}),e.jsx(C,{url:l,onComplete:()=>{S(!1)},responseInterceptor:o=>(o.ok||(S(!1),u.update(()=>{const n=a.xo(i);a.$isSwaggerNode(n)&&(x(!1),n.setSrc(""),n.setJSON(""))}),P.showErrorNotification({message:p("editor.validation.swaggerUnavailable")}),S(!0)),o),plugins:[q({operation:I}),T],layout:"OperationsLayout"})]}):e.jsxs(t.Popover,{width:400,position:"bottom",shadow:"md",opened:g,onChange:x,defaultOpened:!0,withinPortal:!0,children:[e.jsx(t.Popover.Target,{children:e.jsx(t.Flex,{w:"100%",children:e.jsx(a.p,{className:c,format:f,nodeKey:i,children:e.jsx(a.EmptyNodeButton,{title:p("editor.swagger.add"),icon:"api",onClick:()=>x(o=>!o),nodeKey:i})})})}),e.jsx(t.Popover.Dropdown,{"aria-hidden":!g,tabIndex:g?0:-1,children:e.jsx("form",{onSubmit:y,children:e.jsxs(t.Stack,{gap:16,children:[e.jsx(t.Box,{children:e.jsx(t.TextInput,{maxLength:500,placeholder:"https://api.example.com/v3/swagger.json","data-autofocus":!0,type:"url",value:d,rightSection:d?null:e.jsx("span",{style:{color:"red"},children:"*"}),onChange:o=>{v(o.currentTarget.value),O(!1)}})}),e.jsx(t.Box,{children:e.jsx(t.TextInput,{maxLength:500,placeholder:"https://api.swagger.io/#/user/getUser","data-autofocus":!0,type:"url",value:j,onChange:o=>{m(o.currentTarget.value),w(!1)}})}),e.jsx(t.Center,{children:e.jsx(t.Button,{w:"100%",type:"submit",disabled:!d,children:p("editor.video.apply")})})]})})})]})};exports.default=U;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),V=require("react-i18next"),i=require("./layers.94hwidA2.js"),J=require("@mantine/core"),Q=require("@layers-app/shared"),$=t=>{const{width:c,height:r,isLoading:h,isError:S,src:f,id:m,altText:p,imageRef:x,maxWidth:g}=t;return u.jsxs("div",{className:"media-wrapper",style:{width:c,height:r,display:"inline-flex",position:"relative"},children:[u.jsx(J.LoadingOverlay,{visible:h,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),u.jsx(X,{className:null,src:f,altText:p,imageRef:x,width:"inherit",height:"inherit",maxWidth:g||"auto",id:m})]})};function X({altText:t,className:c,imageRef:r,src:h,width:S,height:f,maxWidth:m,id:p}){const[x,g]=n.useState(!1);return u.jsx("img",{className:`${c||void 0} ${x?"":"loading"}`,src:h,alt:t,ref:r,style:{height:f,maxWidth:m,width:S},onLoad:()=>{h.includes("splash")?setTimeout(()=>{g(!0)},100):g(!0)},draggable:"false","data-id":p})}function Y({src:t,altText:c,nodeKey:r,width:h,height:S,maxWidth:f,showCaption:m,caption:p,id:x,create:g,alignment:k}){var q,U;const M=n.useRef(null),[C,I]=n.useState(!0),[l]=i.o(),[w,j]=n.useState(!0),[d,y]=n.useState({width:0,height:0}),{start:H,cancel:D}=i.useCancelUpload(),[T,z]=n.useState(0),{fetchUploadMedia:L,fetchDeleteMedia:W,maxFileSize:Z}=n.useContext(i.Context),v=i.mediaMap.has(t)&&(((q=i.mediaMap.get(t))==null?void 0:q.mediaNodeKeys.length)===0||((U=i.mediaMap.get(t))==null?void 0:U.mediaNodeKeys.length)===void 0||t.trim()===""),{t:N}=V.useTranslation(),[K,_]=n.useState(0);n.useEffect(()=>l.registerDecoratorListener(()=>{_(e=>e+1)}),[v]),n.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){I(!1);return}const e=new Image;e.src=t,e.onload=()=>I(!1),e.onerror=()=>{I(!1)}},[t,v]);const F=(e,s)=>{l.update(()=>{i.wo(null);const o=i.xo(r);i.$isImageNode(o)&&o.setWidthAndHeight(e,s)})},{historyState:P}=i.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:A}}=i.useSettings(),[b,E]=n.useState(!1);function B(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function G(e){return new Promise((s,o)=>{if(B(e)){s(0);return}const a=new Image;a.src=e,a.onload=()=>{s(a.width)},a.onerror=()=>{o(new Error("Failed to load image"))}})}n.useEffect(()=>{g&&E(!0)},[g]),n.useEffect(()=>{let e=h,s=S,o=100;(t.includes("unsplash")?t.trim():!v&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&G(t).then(a=>{typeof e=="number"&&e<o&&a<o?(j(!0),y({width:e,height:s})):a<o?(j(!0),y({width:"auto",height:"auto"})):(y({width:a,height:a}),j(!1))}).catch(a=>{console.warn("Ошибка при загрузке изображения:",a.message)})},[t,v]),n.useEffect(()=>{d.width&&d.height&&w&&l.update(()=>{const e=i.xo(r);i.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,w]),n.useEffect(()=>{const e=document.documentElement;i.toggleLockScroll(b,e)},[b]),n.useEffect(()=>l.registerCommand(i.UPLOAD_IMAGE_COMMAND,e=>(t==="upload"&&O(e),!1),i.zi),[t,C]);const R=(e,s)=>{I(!1),l.update(()=>{const o=i.xo(r);i.$isImageNode(o)&&(o.setSrc(e),o.setId(s))})},O=e=>{I(!0);const s=H();L&&L(e[0],(o,a)=>{R(o,a),z(0)},o=>{o&&Q.showErrorNotification({message:N("editor.gallery.errorFile")}),z(0),R("","")},s,o=>{z(o)})};return!t||t==="upload"?u.jsx(i.ImagePicker,{uploading:!1,onUpload:e=>{!L||!e.length||(O(e),E(!1))},popoverProps:{opened:b,position:"bottom",onChange:E},onChange:e=>{E(!1),l.update(()=>{const s=i.xo(r);i.$isImageNode(s)&&s.setSrc(e)})},children:u.jsx(i.EmptyNodeButton,{title:N("editor.image.add_photo"),icon:"photo",onClick:()=>E(!b),isLoading:C,progress:T,onAfterCancel:()=>{D(),I(!1)}})}):w?u.jsx($,{width:d.width,height:d.height,isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N}):u.jsx(i.ResizableContainer,{editor:l,isIcon:w,width:i.parseContainerSize(h),height:i.parseContainerSize(S),initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:F,alignment:k,children:u.jsx($,{width:"inherit",height:"inherit",isLoading:C,isError:!1,isIcon:w,src:t,id:x,editor:l,nodeKey:r,fetchDeleteMedia:W,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:P,showNestedEditorTreeView:A,t:N})})}exports.default=Y;
@@ -1,304 +0,0 @@
1
- import { jsx as n, jsxs as k, Fragment as z } from "react/jsx-runtime";
2
- import { useRef as D, useContext as O, useMemo as K, useEffect as F, useState as M, useCallback as y, Suspense as X } from "react";
3
- import { r as A, c as q, X as G, j as U, d as $, l as H, e as J, f as Q, o as V, g as P, L as R, x as W, h as Y, w as j, i as Z, k as ee, z as S, N as te, n as ne, O as ae, q as se, s as oe, v as re, y as ie, F as le, A as ce, B as de, D as ue, G as fe } from "./layers.zu-IYGYU.js";
4
- import { TextInput as pe } from "@mantine/core";
5
- function ge({ initialEditor: e, children: l, initialNodes: a, initialTheme: h, skipCollabChecks: c, skipEditableListener: d }) {
6
- const r = D(!1), E = O(A);
7
- E == null && (function(t, ...x) {
8
- const v = new URL("https://lexical.dev/docs/error"), m = new URLSearchParams();
9
- m.append("code", t);
10
- for (const s of x) m.append("v", s);
11
- throw v.search = m.toString(), Error(`Minified Lexical error #${t}; visit ${v.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
12
- })(9);
13
- const [u, { getTheme: N }] = E, w = K(() => {
14
- const t = h || N() || void 0, x = q(E, t);
15
- t !== void 0 && (e._config.theme = t), e._parentEditor = e._parentEditor || u;
16
- const v = e._createEditorArgs, m = v && v.namespace;
17
- if (a) {
18
- m || (e._config.namespace = u._config.namespace);
19
- for (let s of a) {
20
- let _ = null, p = null;
21
- if (typeof s != "function") {
22
- const o = s;
23
- s = o.replace, _ = o.with, p = o.withKlass || null;
24
- }
25
- const T = G(e, s.getType());
26
- e._nodes.set(s.getType(), { exportDOM: T ? T.exportDOM : void 0, klass: s, replace: _, replaceWithKlass: p, sharedNodeState: $(s), transforms: U(s) });
27
- }
28
- } else if (v && v.nodes) m || (e._config.namespace = u._config.namespace);
29
- else {
30
- const s = e._nodes = new Map(u._nodes);
31
- m || (e._config.namespace = u._config.namespace);
32
- for (const [_, p] of s) e._nodes.set(_, { exportDOM: p.exportDOM, klass: p.klass, replace: p.replace, replaceWithKlass: p.replaceWithKlass, sharedNodeState: $(p.klass), transforms: U(p.klass) });
33
- }
34
- return [e, x];
35
- }, []), C = O(H), { isCollabActive: g, yjsDocMap: f } = C ?? {}, I = c || r.current || f && f.has(e.getKey());
36
- return F(() => {
37
- I && (r.current = !0);
38
- }, [I]), F(() => {
39
- if (!d) {
40
- const t = (x) => e.setEditable(x);
41
- return t(u.isEditable()), u.registerEditableListener(t);
42
- }
43
- }, [e, u, d]), n(A.Provider, { value: w, children: !g || I ? l : null });
44
- }
45
- function me({
46
- children: e,
47
- className: l
48
- }) {
49
- return /* @__PURE__ */ n("div", { className: l || "Placeholder__root", children: e });
50
- }
51
- function he({
52
- label: e,
53
- value: l,
54
- onChange: a,
55
- placeholder: h = "",
56
- "data-test-id": c,
57
- type: d = "text"
58
- }) {
59
- return /* @__PURE__ */ n(
60
- pe,
61
- {
62
- type: d,
63
- placeholder: h,
64
- value: l,
65
- onChange: (r) => {
66
- a(r.target.value);
67
- },
68
- label: e,
69
- "data-test-id": c,
70
- mb: 10
71
- }
72
- );
73
- }
74
- const B = /* @__PURE__ */ new Set();
75
- function ve(e) {
76
- if (!B.has(e))
77
- throw new Promise((l) => {
78
- const a = new Image();
79
- a.src = e, a.onload = () => {
80
- B.add(e), l(null);
81
- };
82
- });
83
- }
84
- function Ee({
85
- altText: e,
86
- className: l,
87
- imageRef: a,
88
- src: h,
89
- width: c,
90
- height: d,
91
- position: r
92
- }) {
93
- return ve(h), /* @__PURE__ */ n(
94
- "img",
95
- {
96
- className: l || void 0,
97
- src: h,
98
- alt: e,
99
- ref: a,
100
- "data-position": r,
101
- style: {
102
- display: "block",
103
- height: d,
104
- width: c
105
- },
106
- draggable: "false"
107
- }
108
- );
109
- }
110
- function be({
111
- activeEditor: e,
112
- nodeKey: l,
113
- onClose: a
114
- }) {
115
- const c = e.getEditorState().read(
116
- () => W(l)
117
- ), [d, r] = M(c.getAltText()), [E, u] = M(c.getShowCaption()), [N, w] = M(c.getPosition()), C = (f) => {
118
- u(f.target.checked);
119
- }, g = () => {
120
- const f = { altText: d, position: N, showCaption: E };
121
- c && e.update(() => {
122
- c.update(f);
123
- }), a();
124
- };
125
- return /* @__PURE__ */ k(z, { children: [
126
- /* @__PURE__ */ n("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ n(
127
- he,
128
- {
129
- label: "Alt-текст",
130
- placeholder: "Альтернативный текст",
131
- onChange: r,
132
- value: d,
133
- "data-test-id": "image-modal-alt-text-input"
134
- }
135
- ) }),
136
- /* @__PURE__ */ k("div", { className: "Input__wrapper", children: [
137
- /* @__PURE__ */ n(
138
- "input",
139
- {
140
- id: "caption",
141
- type: "checkbox",
142
- checked: E,
143
- onChange: C
144
- }
145
- ),
146
- /* @__PURE__ */ n("label", { htmlFor: "caption", children: "Show Caption" })
147
- ] }),
148
- /* @__PURE__ */ n(
149
- fe,
150
- {
151
- "data-test-id": "image-modal-file-upload-btn",
152
- onClick: () => g(),
153
- children: "Применить"
154
- }
155
- )
156
- ] });
157
- }
158
- function we({
159
- src: e,
160
- altText: l,
161
- nodeKey: a,
162
- width: h,
163
- height: c,
164
- showCaption: d,
165
- caption: r,
166
- position: E
167
- }) {
168
- const [u, N] = J(), w = D(null), C = D(null), [g, f, I] = Q(a), [t] = V(), [x, v] = M(null), m = D(null), s = y(
169
- (o) => {
170
- if (g && P(R())) {
171
- o.preventDefault();
172
- const i = W(a);
173
- Y(i) && i.remove();
174
- }
175
- return !1;
176
- },
177
- [g, a]
178
- ), _ = y(
179
- (o) => {
180
- const b = R(), i = C.current;
181
- if (g && P(b) && b.getNodes().length === 1) {
182
- if (d)
183
- return j(null), o.preventDefault(), r.focus(), !0;
184
- if (i !== null && i !== document.activeElement)
185
- return o.preventDefault(), i.focus(), !0;
186
- }
187
- return !1;
188
- },
189
- [r, g, d]
190
- ), p = y(
191
- (o) => m.current === r || C.current === o.target ? (j(null), t.update(() => {
192
- f(!0);
193
- const b = t.getRootElement();
194
- b !== null && b.focus();
195
- }), !0) : !1,
196
- [r, t, f]
197
- );
198
- return F(() => {
199
- let o = !0;
200
- const b = Z(
201
- t.registerUpdateListener(({ editorState: i }) => {
202
- o && v(i.read(() => R()));
203
- }),
204
- t.registerCommand(
205
- re,
206
- (i, L) => (m.current = L, !1),
207
- S
208
- ),
209
- t.registerCommand(
210
- oe,
211
- (i) => {
212
- const L = i;
213
- return L.target === w.current ? (L.shiftKey ? f(!g) : (I(), f(!0)), !0) : !1;
214
- },
215
- S
216
- ),
217
- t.registerCommand(
218
- se,
219
- (i) => i.target === w.current ? (i.preventDefault(), !0) : !1,
220
- S
221
- ),
222
- t.registerCommand(
223
- ae,
224
- s,
225
- S
226
- ),
227
- t.registerCommand(
228
- ne,
229
- s,
230
- S
231
- ),
232
- t.registerCommand(te, _, S),
233
- t.registerCommand(
234
- ee,
235
- p,
236
- S
237
- )
238
- );
239
- return () => {
240
- o = !1, b();
241
- };
242
- }, [
243
- I,
244
- t,
245
- g,
246
- a,
247
- s,
248
- _,
249
- p,
250
- f
251
- ]), /* @__PURE__ */ k(X, { fallback: null, children: [
252
- /* @__PURE__ */ k(z, { children: [
253
- /* @__PURE__ */ k("div", { draggable: !1, children: [
254
- /* @__PURE__ */ n(
255
- "button",
256
- {
257
- className: "image-edit-button",
258
- ref: C,
259
- onClick: () => {
260
- N("Update Inline Image", (o) => /* @__PURE__ */ n(
261
- be,
262
- {
263
- activeEditor: t,
264
- nodeKey: a,
265
- onClose: o
266
- }
267
- ));
268
- },
269
- children: "Edit"
270
- }
271
- ),
272
- /* @__PURE__ */ n(
273
- Ee,
274
- {
275
- className: g ? `focused ${P(x) ? "draggable" : ""}` : null,
276
- src: e,
277
- altText: l,
278
- imageRef: w,
279
- width: h,
280
- height: c,
281
- position: E
282
- }
283
- )
284
- ] }),
285
- d && /* @__PURE__ */ n("div", { className: "image-caption-container", children: /* @__PURE__ */ k(ge, { initialEditor: r, children: [
286
- /* @__PURE__ */ n(ie, {}),
287
- /* @__PURE__ */ n(le, {}),
288
- /* @__PURE__ */ n(
289
- ce,
290
- {
291
- contentEditable: /* @__PURE__ */ n(ue, { className: "InlineImageNode__contentEditable" }),
292
- placeholder: /* @__PURE__ */ n(me, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
293
- ErrorBoundary: de
294
- }
295
- )
296
- ] }) })
297
- ] }),
298
- u
299
- ] });
300
- }
301
- export {
302
- be as UpdateInlineImageDialog,
303
- we as default
304
- };
@@ -1,151 +0,0 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { useState as i, useEffect as x, useMemo as k, Component as T } from "react";
3
- import { useTranslation as E } from "react-i18next";
4
- import { H as j, J as z, K as B, E as M, x as O, M as b } from "./layers.zu-IYGYU.js";
5
- import { Popover as v, Flex as D, Stack as F, Box as S, TextInput as y, Center as H, Button as R, LoadingOverlay as $ } from "@mantine/core";
6
- import { showErrorNotification as q } from "@layers-app/shared";
7
- const A = {};
8
- class G extends T {
9
- render() {
10
- const { getComponent: a } = this.props, l = a("operations", !0);
11
- return /* @__PURE__ */ e("div", { className: "swagger-ui", children: /* @__PURE__ */ e(l, {}) });
12
- }
13
- }
14
- const Q = () => ({
15
- components: {
16
- OperationsLayout: G
17
- }
18
- }), V = (o) => ({
19
- statePlugins: {
20
- spec: {
21
- wrapSelectors: {
22
- taggedOperations: (a) => (l, ...h) => {
23
- const n = a(l, ...h);
24
- return o.operation ? n.map(
25
- (s) => s.update(
26
- "operations",
27
- (g) => g.filter((p) => p.get("operation").get("operationId") === o.operation)
28
- )
29
- ).filter((s) => s.get("operations").size > 0) : n;
30
- }
31
- }
32
- }
33
- }
34
- }), oe = ({
35
- inputUrl: o,
36
- inputJSON: a,
37
- className: l,
38
- format: h,
39
- nodeKey: n,
40
- editor: s,
41
- create: g
42
- }) => {
43
- const { t: p } = E(), [w, C] = i(""), [d, I] = i(""), [W, L] = i(!1), [X, N] = i(!1), [c, u] = i(!1), [P, f] = i(!0);
44
- x(() => {
45
- g && u(!0);
46
- }, [g]), x(() => {
47
- c ? j() : z();
48
- }, [c]);
49
- const J = (t) => {
50
- t.preventDefault(), s.update(() => {
51
- const r = O(n);
52
- b(r) && (u(!1), r.setSrc(w || d), r.setJSON(d));
53
- });
54
- }, { operation: U } = k(() => o ? {
55
- operation: new URL(o).hash.split("/").pop() || ""
56
- } : { operation: "" }, [o, a]);
57
- return o ? /* @__PURE__ */ m(S, { pos: "relative", mih: 45, children: [
58
- /* @__PURE__ */ e(
59
- $,
60
- {
61
- visible: P,
62
- zIndex: 1e3,
63
- overlayProps: { blur: 4 },
64
- loaderProps: { size: "xs" }
65
- }
66
- ),
67
- /* @__PURE__ */ e(
68
- A,
69
- {
70
- url: a,
71
- onComplete: () => {
72
- f(!1);
73
- },
74
- responseInterceptor: (t) => (t.ok || (f(!1), s.update(() => {
75
- const r = O(n);
76
- b(r) && (u(!1), r.setSrc(""), r.setJSON(""));
77
- }), q({
78
- message: p("editor.validation.swaggerUnavailable")
79
- }), f(!0)), t),
80
- plugins: [
81
- V({ operation: U }),
82
- Q
83
- ],
84
- layout: "OperationsLayout"
85
- }
86
- )
87
- ] }) : /* @__PURE__ */ m(
88
- v,
89
- {
90
- width: 400,
91
- position: "bottom",
92
- shadow: "md",
93
- opened: c,
94
- onChange: u,
95
- defaultOpened: !0,
96
- withinPortal: !0,
97
- children: [
98
- /* @__PURE__ */ e(v.Target, { children: /* @__PURE__ */ e(D, { w: "100%", children: /* @__PURE__ */ e(
99
- B,
100
- {
101
- className: l,
102
- format: h,
103
- nodeKey: n,
104
- children: /* @__PURE__ */ e(
105
- M,
106
- {
107
- title: p("editor.swagger.add"),
108
- icon: "api",
109
- onClick: () => u((t) => !t),
110
- nodeKey: n
111
- }
112
- )
113
- }
114
- ) }) }),
115
- /* @__PURE__ */ e(v.Dropdown, { "aria-hidden": !c, tabIndex: c ? 0 : -1, children: /* @__PURE__ */ e("form", { onSubmit: J, children: /* @__PURE__ */ m(F, { gap: 16, children: [
116
- /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
117
- y,
118
- {
119
- maxLength: 500,
120
- placeholder: "https://api.example.com/v3/swagger.json",
121
- "data-autofocus": !0,
122
- type: "url",
123
- value: d,
124
- rightSection: d ? null : /* @__PURE__ */ e("span", { style: { color: "red" }, children: "*" }),
125
- onChange: (t) => {
126
- I(t.currentTarget.value), N(!1);
127
- }
128
- }
129
- ) }),
130
- /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
131
- y,
132
- {
133
- maxLength: 500,
134
- placeholder: "https://api.swagger.io/#/user/getUser",
135
- "data-autofocus": !0,
136
- type: "url",
137
- value: w,
138
- onChange: (t) => {
139
- C(t.currentTarget.value), L(!1);
140
- }
141
- }
142
- ) }),
143
- /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(R, { w: "100%", type: "submit", disabled: !d, children: p("editor.video.apply") }) })
144
- ] }) }) })
145
- ]
146
- }
147
- );
148
- };
149
- export {
150
- oe as default
151
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),e=require("./layers.94hwidA2.js"),y=require("@mantine/core");function D({initialEditor:t,children:u,initialNodes:r,initialTheme:b,skipCollabChecks:d,skipEditableListener:f}){const l=a.useRef(!1),v=a.useContext(e.r);v==null&&(function(s,...S){const j=new URL("https://lexical.dev/docs/error"),x=new URLSearchParams;x.append("code",s);for(const o of S)x.append("v",o);throw j.search=x.toString(),Error(`Minified Lexical error #${s}; visit ${j.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(9);const[g,{getTheme:w}]=v,I=a.useMemo(()=>{const s=b||w()||void 0,S=e.t(v,s);s!==void 0&&(t._config.theme=s),t._parentEditor=t._parentEditor||g;const j=t._createEditorArgs,x=j&&j.namespace;if(r){x||(t._config.namespace=g._config.namespace);for(let o of r){let _=null,m=null;if(typeof o!="function"){const i=o;o=i.replace,_=i.with,m=i.withKlass||null}const N=e.Xi(t,o.getType());t._nodes.set(o.getType(),{exportDOM:N?N.exportDOM:void 0,klass:o,replace:_,replaceWithKlass:m,sharedNodeState:e.at(o),transforms:e.ji(o)})}}else if(j&&j.nodes)x||(t._config.namespace=g._config.namespace);else{const o=t._nodes=new Map(g._nodes);x||(t._config.namespace=g._config.namespace);for(const[_,m]of o)t._nodes.set(_,{exportDOM:m.exportDOM,klass:m.klass,replace:m.replace,replaceWithKlass:m.replaceWithKlass,sharedNodeState:e.at(m.klass),transforms:e.ji(m.klass)})}return[t,S]},[]),E=a.useContext(e.l),{isCollabActive:h,yjsDocMap:p}=E??{},k=d||l.current||p&&p.has(t.getKey());return a.useEffect(()=>{k&&(l.current=!0)},[k]),a.useEffect(()=>{if(!f){const s=S=>t.setEditable(S);return s(g.isEditable()),g.registerEditableListener(s)}},[t,g,f]),n.jsx(e.r.Provider,{value:I,children:!h||k?u:null})}function T({children:t,className:u}){return n.jsx("div",{className:u||"Placeholder__root",children:t})}function P({label:t,value:u,onChange:r,placeholder:b="","data-test-id":d,type:f="text"}){return n.jsx(y.TextInput,{type:f,placeholder:b,value:u,onChange:l=>{r(l.target.value)},label:t,"data-test-id":d,mb:10})}const M=new Set;function z(t){if(!M.has(t))throw new Promise(u=>{const r=new Image;r.src=t,r.onload=()=>{M.add(t),u(null)}})}function O({altText:t,className:u,imageRef:r,src:b,width:d,height:f,position:l}){return z(b),n.jsx("img",{className:u||void 0,src:b,alt:t,ref:r,"data-position":l,style:{display:"block",height:f,width:d},draggable:"false"})}function R({activeEditor:t,nodeKey:u,onClose:r}){const d=t.getEditorState().read(()=>e.xo(u)),[f,l]=a.useState(d.getAltText()),[v,g]=a.useState(d.getShowCaption()),[w,I]=a.useState(d.getPosition()),E=p=>{g(p.target.checked)},h=()=>{const p={altText:f,position:w,showCaption:v};d&&t.update(()=>{d.update(p)}),r()};return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{marginBottom:"1em"},children:n.jsx(P,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:l,value:f,"data-test-id":"image-modal-alt-text-input"})}),n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("input",{id:"caption",type:"checkbox",checked:v,onChange:E}),n.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),n.jsx(e.Button,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>h(),children:"Применить"})]})}function U({src:t,altText:u,nodeKey:r,width:b,height:d,showCaption:f,caption:l,position:v}){const[g,w]=e.useModal(),I=a.useRef(null),E=a.useRef(null),[h,p,k]=e.u(r),[s]=e.o(),[S,j]=a.useState(null),x=a.useRef(null),o=a.useCallback(i=>{if(h&&e.xr(e.Lr())){i.preventDefault();const c=e.xo(r);e.$isInlineImageNode(c)&&c.remove()}return!1},[h,r]),_=a.useCallback(i=>{const C=e.Lr(),c=E.current;if(h&&e.xr(C)&&C.getNodes().length===1){if(f)return e.wo(null),i.preventDefault(),l.focus(),!0;if(c!==null&&c!==document.activeElement)return i.preventDefault(),c.focus(),!0}return!1},[l,h,f]),m=a.useCallback(i=>x.current===l||E.current===i.target?(e.wo(null),s.update(()=>{p(!0);const C=s.getRootElement();C!==null&&C.focus()}),!0):!1,[l,s,p]);a.useEffect(()=>{let i=!0;const C=e.U(s.registerUpdateListener(({editorState:c})=>{i&&j(c.read(()=>e.Lr()))}),s.registerCommand(e.ie,(c,L)=>(x.current=L,!1),e.zi),s.registerCommand(e.se,c=>{const L=c;return L.target===I.current?(L.shiftKey?p(!h):(k(),p(!0)),!0):!1},e.zi),s.registerCommand(e.Ie,c=>c.target===I.current?(c.preventDefault(),!0):!1,e.zi),s.registerCommand(e.Oe,o,e.zi),s.registerCommand(e.we,o,e.zi),s.registerCommand(e.Ne,_,e.zi),s.registerCommand(e.Ee,m,e.zi));return()=>{i=!1,C()}},[k,s,h,r,o,_,m,p]);const N=h;return n.jsxs(a.Suspense,{fallback:null,children:[n.jsxs(n.Fragment,{children:[n.jsxs("div",{draggable:!1,children:[n.jsx("button",{className:"image-edit-button",ref:E,onClick:()=>{w("Update Inline Image",i=>n.jsx(R,{activeEditor:s,nodeKey:r,onClose:i}))},children:"Edit"}),n.jsx(O,{className:N?`focused ${e.xr(S)?"draggable":""}`:null,src:t,altText:u,imageRef:I,width:b,height:d,position:v})]}),f&&n.jsx("div",{className:"image-caption-container",children:n.jsxs(D,{initialEditor:l,children:[n.jsx(e.LinkPlugin,{}),n.jsx(e.FloatingTextFormatToolbarPlugin,{}),n.jsx(e.L,{contentEditable:n.jsx(e.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:n.jsx(T,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:e.n})]})})]}),g]})}exports.UpdateInlineImageDialog=R;exports.default=U;