@layers-app/editor 0.0.13 → 0.0.15-swagger

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),D=require("react-i18next"),t=require("./layers.D1A3jNDb.js"),E=require("@mantine/core"),U=require("@tabler/icons-react"),F=i=>{const{width:g,height:r,isLoading:l,isError:u,src:f,id:m,altText:p,imageRef:j,maxWidth:v}=i;return n.jsxs("div",{className:"media-wrapper",style:{width:g,height:r,display:"inline-flex",position:"relative"},children:[n.jsx(E.LoadingOverlay,{visible:l,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),n.jsx(E.LoadingOverlay,{visible:u,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{children:n.jsx(E.Flex,{bg:"white",maw:300,justify:"center",children:n.jsx(E.Alert,{variant:"light",color:"red",title:"Ошибка загрузки",icon:n.jsx(U.IconInfoCircle,{}),children:"Попробуйте загрузить заново."})})}}),n.jsx(B,{className:null,src:f,altText:p,imageRef:j,width:"inherit",height:"inherit",maxWidth:v||"auto",id:m})]})};function B({altText:i,className:g,imageRef:r,src:l,width:u,height:f,maxWidth:m,id:p}){return n.jsx("img",{className:g||void 0,src:l,alt:i,ref:r,style:{height:f,maxWidth:m,width:u},draggable:"false","data-id":p})}function G({src:i,altText:g,nodeKey:r,width:l,height:u,maxWidth:f,showCaption:m,caption:p,id:j,create:v,alignment:H}){const W=s.useRef(null),[P,S]=s.useState(!0),[R,M]=s.useState(!1),{isCollabActive:O}=t.l(),[h]=t.u(),[x,b]=s.useState(!0),[d,w]=s.useState({width:0,height:0}),{fetchUploadImage:z,fetchDeleteImage:L}=s.useContext(t.Context),{t:y}=D.useTranslation();s.useEffect(()=>{if(!i||i.startsWith("data:image/")){S(!1);return}const e=new Image;e.src=i,e.onload=()=>S(!1),e.onerror=()=>{S(!1),M(!0)}},[i]);const T=(e,a)=>{h.update(()=>{t.Ft(null);const c=t.Ct(r);t.$isImageNode(c)&&c.setWidthAndHeight(e,a)})},{historyState:k}=t.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:q}}=t.useSettings(),[C,I]=s.useState(!1);function $(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function _(e){return new Promise((a,c)=>{if($(e)){a(0);return}const o=new Image;o.src=e,o.onload=()=>{a(o.width)},o.onerror=()=>{c(new Error("Failed to load image"))}})}return s.useEffect(()=>{v&&I(!0)},[v]),s.useEffect(()=>{let e=l,a=u,c=100;i&&_(i).then(o=>{typeof e=="number"&&e<c&&o<c?(b(!0),w({width:e,height:a})):o<c?(b(!0),w({width:"auto",height:"auto"})):(w({width:o,height:o}),b(!1))})},[i]),s.useEffect(()=>{d.width&&d.height&&x&&h.update(()=>{const e=t.Ct(r);t.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,x]),s.useEffect(()=>{const e=document.documentElement;t.toggleLockScroll(C,e)},[C]),i?x?n.jsx(F,{width:d.width,height:d.height,isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y}):n.jsx(t.ResizableContainer,{editor:h,isIcon:x,width:typeof l=="string"&&l.includes("%")?parseFloat(l):l,height:typeof u=="string"&&u.includes("%")?parseFloat(u):l,initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:T,alignment:H,children:n.jsx(F,{width:"inherit",height:"inherit",isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y})}):n.jsx(t.ImagePicker,{uploading:!1,onUpload:e=>{!z||!e.length||(e.forEach((a,c)=>{z(a,(o,A)=>{c===0?h.update(()=>{const N=t.Ct(r);t.$isImageNode(N)&&(N.setSrc(o),N.setId(A))}):h.dispatchCommand(t.INSERT_IMAGE_COMMAND,{altText:"",src:o,id:A})})}),I(!1))},popoverProps:{opened:C,position:"bottom",onChange:I},onChange:e=>{I(!1),h.update(()=>{const a=t.Ct(r);t.$isImageNode(a)&&a.setSrc(e)})},children:n.jsx(t.EmptyNodeButton,{title:y("editor.image.add_photo"),icon:"photo",onClick:()=>I(!C)})})}exports.default=G;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as f, jsx as e, Fragment as L } from "react/jsx-runtime";
2
2
  import { useRef as w, useState as E, useCallback as _, useEffect as A, Suspense as M } from "react";
3
- import { e as U, f as q, u as z, w as k, g as F, c as B, h as O, F as D, N as W, i as G, K as h, j as H, k as J, m as Q, D as V, r as X, n as Y, L as Z, o as K, p as ee, q as te, s as ne, B as ae } from "./layers.BI3mGLaL.js";
4
- import { d as le, P as oe } from "./layers.D-cYnkWE.js";
3
+ import { e as U, f as q, u as z, w as k, g as F, c as B, h as O, F as D, N as W, i as G, K as h, j as H, k as J, m as Q, D as V, r as X, n as Y, L as Z, o as K, p as ee, q as te, s as ne, B as ae } from "./layers.36_3ol3v.js";
4
+ import { d as le, P as oe } from "./layers.Di1ekcMX.js";
5
5
  import { TextInput as re } from "@mantine/core";
6
6
  function ie({
7
7
  children: n,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@layers-app/editor",
3
3
  "private": false,
4
- "version": "0.0.13",
4
+ "version": "0.0.15-swagger",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "start": "vite",
8
- "build": "vite build",
7
+ "start": "vite --mode full",
8
+ "build": "VITE_LAYERS=true vite build",
9
+ "build:specific": "VITE_LAYERS=false vite build",
9
10
  "lint": "eslint . --ext .ts,.tsx",
10
11
  "lint:fix": "eslint . --ext .ts,.tsx --fix",
11
12
  "preview": "vite preview",
@@ -29,12 +30,11 @@
29
30
  "@lexical/markdown": "0.21.0",
30
31
  "@lexical/react": "0.21.0",
31
32
  "@tanstack/react-query": "^5.64.1",
32
- "@types/swagger-ui-react": "^5.18.0",
33
33
  "install": "^0.13.0",
34
34
  "lexical": "0.21.0",
35
35
  "npm": "^11.0.0",
36
36
  "react-selecto": "^1.26.3",
37
- "swagger-ui-react": "^5.20.2",
37
+ "swagger-ui-react": "^5.20.1",
38
38
  "y-websocket": "^1.5.3",
39
39
  "yjs": "^13.6.20"
40
40
  },
@@ -55,6 +55,7 @@
55
55
  "@types/prettier": "2.7.3",
56
56
  "@types/react": "^18.2.55",
57
57
  "@types/react-dom": "^18.2.19",
58
+ "@types/swagger-ui-react": "^5.18.0",
58
59
  "@typescript-eslint/eslint-plugin": "^8.27.0",
59
60
  "@typescript-eslint/parser": "^8.27.0",
60
61
  "@vitejs/plugin-basic-ssl": "^1.1.0",
@@ -76,6 +77,7 @@
76
77
  "rollup-plugin-typescript-paths": "^1.5.0",
77
78
  "rollup-plugin-visualizer": "^5.12.0",
78
79
  "sass": "^1.71.1",
80
+ "terser": "^5.39.0",
79
81
  "typescript": "^5.5.4",
80
82
  "typescript-eslint": "^8.2.0",
81
83
  "vite": "^6.2.2",