@ydesign/react-editor 0.0.3 → 0.0.5

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 (146) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/app.js +1 -1
  3. package/dist/canvas/workspace-canvas.d.ts +4 -0
  4. package/dist/canvas/workspace.d.ts +4 -0
  5. package/dist/chunk-2PAJLUQH.js +1 -0
  6. package/dist/chunk-2SA3ZNHH.js +9 -0
  7. package/dist/chunk-4BG4CHIB.js +1 -0
  8. package/dist/{chunk-LW2W4B2N.js → chunk-4HH3B3W3.js} +4 -3
  9. package/dist/chunk-4LUZF4CB.js +2 -0
  10. package/dist/chunk-4WITBL6X.js +1 -0
  11. package/dist/chunk-5C2MNUBC.js +1 -0
  12. package/dist/chunk-ARZMBVXU.js +1 -0
  13. package/dist/chunk-BDQSWJYF.js +1 -0
  14. package/dist/chunk-DCGJ6RKU.js +1 -0
  15. package/dist/chunk-FGCLY24Q.js +45 -0
  16. package/dist/chunk-FOMWIGAQ.js +50 -0
  17. package/dist/chunk-H6GI5LUP.js +54 -0
  18. package/dist/chunk-HD2T2D4D.js +1 -0
  19. package/dist/chunk-HQSM4X2M.js +1 -0
  20. package/dist/chunk-INRJE7VS.js +1 -0
  21. package/dist/chunk-ISNCNIFJ.js +27 -0
  22. package/dist/chunk-KCNKLCD5.js +1 -0
  23. package/dist/chunk-N5KI6CPA.js +1 -0
  24. package/dist/chunk-NQYSJ5MN.js +1 -0
  25. package/dist/chunk-OA7Z7HNL.js +1 -0
  26. package/dist/chunk-OBJ5NZSC.js +1 -0
  27. package/dist/chunk-OFA6JIQB.js +9 -0
  28. package/dist/chunk-ONY3GLGA.js +1 -0
  29. package/dist/chunk-QX7ZGRSR.js +1 -0
  30. package/dist/chunk-R452ARGU.js +1 -0
  31. package/dist/chunk-RUVPKBI5.js +3 -0
  32. package/dist/chunk-TNBL7KOG.js +1 -0
  33. package/dist/chunk-TWH7TO5J.js +1 -0
  34. package/dist/chunk-TYHXQPZQ.js +1 -0
  35. package/dist/chunk-XXR5YN2B.js +9 -0
  36. package/dist/chunk-Y7RXJ3FI.js +16 -0
  37. package/dist/chunk-YLXPQ2GI.js +1 -0
  38. package/dist/chunk-YOQ663QO.js +1 -0
  39. package/dist/config.d.ts +1 -0
  40. package/dist/config.js +1 -1
  41. package/dist/hooks/use-duplicate-element.d.ts +4 -0
  42. package/dist/hooks/use-lock.d.ts +4 -0
  43. package/dist/hooks/use-remove-element.d.ts +4 -0
  44. package/dist/model/store.d.ts +55 -44
  45. package/dist/model/store.js +1 -1
  46. package/dist/project.d.ts +11 -2
  47. package/dist/project.js +1 -1
  48. package/dist/side-panel/background-panel.d.ts +10 -3
  49. package/dist/side-panel/background-panel.js +1 -1
  50. package/dist/side-panel/images-grid.d.ts +4 -1
  51. package/dist/side-panel/images-grid.js +1 -41
  52. package/dist/side-panel/index.d.ts +4 -0
  53. package/dist/side-panel/index.js +1 -1
  54. package/dist/side-panel/layers-panel.d.ts +8 -2
  55. package/dist/side-panel/layers-panel.js +1 -1
  56. package/dist/side-panel/photos-panel.d.ts +8 -2
  57. package/dist/side-panel/photos-panel.js +1 -1
  58. package/dist/side-panel/shapes-panel.d.ts +8 -2
  59. package/dist/side-panel/shapes-panel.js +1 -1
  60. package/dist/side-panel/side-panel.d.ts +4 -0
  61. package/dist/side-panel/side-panel.js +1 -1
  62. package/dist/side-panel/size-panel.d.ts +8 -2
  63. package/dist/side-panel/size-panel.js +1 -1
  64. package/dist/side-panel/tab-button.js +1 -1
  65. package/dist/side-panel/templates-panel.d.ts +8 -2
  66. package/dist/side-panel/templates-panel.js +1 -1
  67. package/dist/side-panel/text-panel.d.ts +8 -2
  68. package/dist/side-panel/text-panel.js +1 -1
  69. package/dist/side-panel/upload-panel.d.ts +10 -3
  70. package/dist/side-panel/upload-panel.js +1 -1
  71. package/dist/toolbar/default-toolbar.d.ts +10 -1
  72. package/dist/toolbar/default-toolbar.js +1 -1
  73. package/dist/toolbar/download-button.d.ts +8 -2
  74. package/dist/toolbar/download-button.js +1 -1
  75. package/dist/toolbar/duplicate-button.d.ts +4 -0
  76. package/dist/toolbar/duplicate-button.js +1 -1
  77. package/dist/toolbar/figure-toolbar.d.ts +4 -0
  78. package/dist/toolbar/figure-toolbar.js +1 -1
  79. package/dist/toolbar/filters-picker.d.ts +4 -0
  80. package/dist/toolbar/filters-picker.js +1 -1
  81. package/dist/toolbar/flip-button.d.ts +8 -2
  82. package/dist/toolbar/flip-button.js +1 -1
  83. package/dist/toolbar/group-button.d.ts +4 -0
  84. package/dist/toolbar/group-button.js +1 -1
  85. package/dist/toolbar/history-buttons.d.ts +4 -0
  86. package/dist/toolbar/history-buttons.js +1 -1
  87. package/dist/toolbar/image-eraser-pen.d.ts +4 -2
  88. package/dist/toolbar/image-eraser-pen.js +1 -1
  89. package/dist/toolbar/image-remove-background.d.ts +4 -2
  90. package/dist/toolbar/image-remove-background.js +1 -1
  91. package/dist/toolbar/image-toolbar.d.ts +8 -2
  92. package/dist/toolbar/image-toolbar.js +1 -1
  93. package/dist/toolbar/lock-button.d.ts +4 -0
  94. package/dist/toolbar/lock-button.js +1 -1
  95. package/dist/toolbar/opacity-picker.d.ts +4 -0
  96. package/dist/toolbar/opacity-picker.js +1 -1
  97. package/dist/toolbar/position-picker.d.ts +4 -0
  98. package/dist/toolbar/position-picker.js +1 -1
  99. package/dist/toolbar/remove-button.d.ts +4 -0
  100. package/dist/toolbar/remove-button.js +1 -1
  101. package/dist/toolbar/text-ai-write.js +1 -1
  102. package/dist/toolbar/text-toolbar.d.ts +4 -0
  103. package/dist/toolbar/text-toolbar.js +1 -1
  104. package/dist/toolbar/toolbar.d.ts +4 -0
  105. package/dist/toolbar/toolbar.js +1 -1
  106. package/dist/toolbar/zoom-buttons.d.ts +4 -0
  107. package/dist/topbar/file-menu.d.ts +11 -2
  108. package/dist/topbar/file-menu.js +1 -1
  109. package/dist/topbar/topbar.d.ts +4 -0
  110. package/dist/topbar/topbar.js +5 -5
  111. package/dist/utils/l10n.d.ts +205 -3
  112. package/dist/utils/l10n.js +1 -1
  113. package/dist/utils/text.d.ts +3 -0
  114. package/dist/utils/text.js +1 -0
  115. package/dist/utils/unit.d.ts +18 -0
  116. package/dist/utils/unit.js +1 -0
  117. package/package.json +4 -10
  118. package/dist/chunk-3TTTJUTT.js +0 -1
  119. package/dist/chunk-4FFLRF6N.js +0 -1
  120. package/dist/chunk-4HEMGHOQ.js +0 -1
  121. package/dist/chunk-6BG6R2IO.js +0 -7
  122. package/dist/chunk-6LFGFFHI.js +0 -1
  123. package/dist/chunk-B35ZYWID.js +0 -1
  124. package/dist/chunk-CRTMZEJE.js +0 -1
  125. package/dist/chunk-CS6Z4TQU.js +0 -1
  126. package/dist/chunk-DBQHEZPG.js +0 -1
  127. package/dist/chunk-DJBTBRPS.js +0 -1
  128. package/dist/chunk-EOBIVNFF.js +0 -1
  129. package/dist/chunk-GYDTKPW5.js +0 -1
  130. package/dist/chunk-H67HTXU4.js +0 -1
  131. package/dist/chunk-KLZXBPXI.js +0 -1
  132. package/dist/chunk-LCOWX5JR.js +0 -1
  133. package/dist/chunk-LHQI6WDJ.js +0 -54
  134. package/dist/chunk-M33EDDXB.js +0 -1
  135. package/dist/chunk-M4S26KQG.js +0 -1
  136. package/dist/chunk-MCBL6QAP.js +0 -1
  137. package/dist/chunk-MNACXCF5.js +0 -1
  138. package/dist/chunk-NX3CGW6Q.js +0 -1
  139. package/dist/chunk-PSXS4WMN.js +0 -1
  140. package/dist/chunk-QJBRJELT.js +0 -1
  141. package/dist/chunk-R6Z6F447.js +0 -1
  142. package/dist/chunk-RFPYC6DZ.js +0 -3
  143. package/dist/chunk-TX4BNXQC.js +0 -1
  144. package/dist/chunk-WIM26GEM.js +0 -1
  145. package/dist/chunk-YVRHDXYK.js +0 -16
  146. package/dist/chunk-ZVWJRZOZ.js +0 -1
@@ -1 +1 @@
1
- import"../chunk-O2XFH626.js";import{observable as e,toJS as t}from"mobx";var o=e({toolbar:{opacity:"Opacity",effects:"Effects",position:"Position",ungroupElements:"Ungroup",groupElements:"Group"},workspace:{},scale:{reset:"Reset"},sidePanel:{templates:"Templates"}}),n=()=>t(o);export{n as getTranslations};
1
+ import{a,b,c}from"../chunk-ARZMBVXU.js";import"../chunk-O2XFH626.js";export{b as getTranslations,a as setTranslations,c as translate};
@@ -0,0 +1,3 @@
1
+ declare function removeTags(e?: string): string;
2
+
3
+ export { removeTags };
@@ -0,0 +1 @@
1
+ import{a}from"../chunk-4LUZF4CB.js";import"../chunk-O2XFH626.js";export{a as removeTags};
@@ -0,0 +1,18 @@
1
+ type UnitType = 'pt' | 'mm' | 'cm' | 'in' | 'px';
2
+ type fromPx = {
3
+ px: number;
4
+ unit: UnitType;
5
+ dpi: number;
6
+ };
7
+ declare function pxToUnit({ px, unit, dpi }: fromPx): number;
8
+ declare function pxToUnitRounded({ px, precious, dpi, unit, }: fromPx & {
9
+ precious?: number;
10
+ }): number;
11
+ declare function unitToPx({ unitVal, dpi, unit }: {
12
+ unitVal: any;
13
+ dpi: any;
14
+ unit: any;
15
+ }): number;
16
+ declare function pxToUnitString(params: fromPx): string;
17
+
18
+ export { type UnitType, pxToUnit, pxToUnitRounded, pxToUnitString, unitToPx };
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"../chunk-5C2MNUBC.js";import"../chunk-O2XFH626.js";export{a as pxToUnit,b as pxToUnitRounded,d as pxToUnitString,c as unitToPx};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ydesign/react-editor",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "设计编辑器UI组件库,基于react版本",
5
5
  "main": "dist/app.js",
6
6
  "module": "dist/app.js",
@@ -100,27 +100,21 @@
100
100
  },
101
101
  "license": "SEE LICENSE IN LICENSE.md",
102
102
  "dependencies": {
103
- "@radix-ui/react-dropdown-menu": "^2.1.16",
104
- "@radix-ui/react-popover": "^1.1.15",
105
- "@radix-ui/react-select": "^2.2.6",
106
- "@radix-ui/react-separator": "^1.1.8",
107
- "@radix-ui/react-slot": "^1.2.4",
108
- "@radix-ui/react-tooltip": "^1.2.8",
109
103
  "antd": "^6.0.0",
110
- "class-variance-authority": "^0.7.1",
111
104
  "clsx": "^2.1.1",
112
- "lodash-es": "^4.17.21",
105
+ "es-toolkit": "^1.44.0",
113
106
  "lucide-react": "^0.553.0",
114
107
  "mobx": "^6.15.0",
115
108
  "mobx-react-lite": "^4.1.1",
116
109
  "mobx-state-tree": "^6.0.1",
117
110
  "react-overflow-list": "^0.5.0",
111
+ "react-sortablejs": "^6.1.4",
118
112
  "react-window": "^1.8.11",
119
113
  "styled-components": "^6.1.19",
120
114
  "tailwind-merge": "^3.3.1",
121
115
  "tailwindcss": "^4.1.17",
122
116
  "tw-animate-css": "^1.4.0",
123
- "@ydesign/core": "^0.0.2"
117
+ "@ydesign/core": "^0.0.5"
124
118
  },
125
119
  "browserslist": [
126
120
  "> 0.5%",
@@ -1 +0,0 @@
1
- import{Blend as d}from"lucide-react";import{Popover as l,Tooltip as c,Button as y,InputNumber as u,Slider as h}from"antd";import{observer as v}from"mobx-react-lite";import{useState as g,useEffect as f}from"react";import{jsx as t,jsxs as p}from"react/jsx-runtime";var T=v(({store:o})=>{let s=o.selectedShapes.length>0,e=o.selectedShapes[0],[i,n]=g(()=>Math.round(100*(e?.opacity??1)));f(()=>{e&&n(Math.round(100*(e.opacity??1)))},[e,e?.opacity]);let r=m=>{let a=Math.max(0,Math.min(m,100));n(a),o.editor?.objectsHandler.update({opacity:a/100})};return t(c,{title:"Opacity",placement:"bottom",children:t(l,{content:p("div",{children:[t("div",{style:{textAlign:"center",marginBottom:10},children:"Transparency"}),p("div",{style:{display:"flex"},children:[t("div",{style:{width:170,paddingRight:20},children:t(h,{min:0,max:100,onChange:r,value:i})}),t(u,{min:0,max:100,value:i,onChange:r,size:"small",styles:{root:{width:65}}})]})]}),trigger:"click",children:t(y,{type:"text",disabled:!s,styles:{root:{padding:"0 7px"}},children:t(d,{size:16})})})})});export{T as a};
@@ -1 +0,0 @@
1
- import{Button as e}from"antd";import{observer as p}from"mobx-react-lite";import{Fragment as u,jsx as o,jsxs as l}from"react/jsx-runtime";var i=p(({store:t})=>{let r=t.selectedElements.length>1,n=t.selectedElements.length===1&&t.selectedElements[0]?.type==="group";return l(u,{children:[r&&o(e,{type:"text",onClick:()=>{t.editor?.objectsHandler.group()},children:"Group"}),n&&o(e,{type:"text",onClick:()=>{t.editor?.objectsHandler.ungroup()},children:"Ungroup"})]})});export{i as a};
@@ -1 +0,0 @@
1
- import{d as $}from"./chunk-RVXI723F.js";import{Popover as pe,Button as ye,Switch as z,Slider as k,InputNumber as h,ColorPicker as ee}from"antd";import{observer as xe}from"mobx-react-lite";import{Sparkles as Ce}from"lucide-react";import{useEffect as He,useState as r}from"react";import{Fragment as W,jsx as a,jsxs as l}from"react/jsx-runtime";var f=(u,c,g)=>Math.max(c,Math.min(g,u)),te={display:"inline-flex",justifyContent:"space-between",width:"100%",padding:6},E={display:"flex",alignItems:"center",justifyContent:"space-between",padding:6},d=({label:u,enabled:c,visible:g=!0,onEnabledChange:M,numberValue:n,min:t,max:v,onNumberValueChange:s,step:F})=>g?l(W,{children:[l("div",{style:{display:"inline-flex",justifyContent:"space-between",width:"100%",padding:"6px"},children:[a("span",{children:u}),a(z,{checked:c,onChange:m=>{M(m)}})]}),c?l("div",{style:{display:"flex",width:"100%",justifyContent:"space-between",marginTop:10,marginBottom:10},children:[a("div",{style:{flex:1},children:a(k,{value:n,onChange:m=>{s(m)},min:t,max:v,step:F})}),a(h,{size:"small",style:{width:60,marginLeft:10},value:n,step:F,onChange:m=>{s(f(m,t,v))}})]}):null]}):null,Ie=xe(({element:u,store:c,elements:g})=>{let n=(g||[u])[0],t=c.editor,v=n?.type==="textbox",s=n?.type==="image",F=$(n);console.log("isImageOrShape ---> ",s||F);let p=t?.imageFiltersHandler.getFilter("blur"),y=t?.imageFiltersHandler.getFilter("brightness"),x=t?.imageFiltersHandler.getFilter("contrast"),C=t?.imageFiltersHandler.getFilter("saturation"),H=t?.imageFiltersHandler.getFilter("vibrance"),V=t?.imageFiltersHandler.getFilter("hueRotation"),w=t?.imageFiltersHandler.getFilter("noise"),S=t?.imageFiltersHandler.getFilter("pixelate"),[ae,I]=r(!!p),[ne,L]=r(p?.blur||.5),[ie,_]=r(!!y),[re,q]=r(y?.brightness||.05),[le,N]=r(!!x),[se,D]=r(x?.contrast||.25),[oe,R]=r(!!C),[be,G]=r(C?.saturation||1),[de,B]=r(!!H),[ce,J]=r(H?.vibrance||1),[me,O]=r(!!V),[ue,K]=r(V?.rotation||-.5),[ge,j]=r(!!w),[he,Q]=r(w?.noise||30),[fe,A]=r(!!S),[ve,U]=r(S?.blocksize||30),[Fe,P]=r(n?.stroke),[X,Y]=r(n?.strokeWidth),[o,Z]=r({enabled:!!n?.shadow,offsetX:n?.shadow?.offsetX||15,offsetY:n?.shadow?.offsetY||15,blur:n?.shadow?.blur||25,color:n?.shadow?.color||"rgba(0,0,0,0.45)",affectStroke:!1,nonScaling:!1,type:"shadow"});He(()=>{P(n?.stroke),Y(n?.strokeWidth),Z({enabled:!!n?.shadow,offsetX:n?.shadow?.offsetX||15,offsetY:n?.shadow?.offsetY||15,blur:n?.shadow?.blur||25,color:n?.shadow?.color||"rgba(0,0,0,0.45)",affectStroke:!1,nonScaling:!1,type:"shadow"}),I(!!p),L(p?.blur||.5),_(!!y),q(y?.brightness||.05),N(!!x),D(x?.contrast||.25),R(!!C),G(C?.saturation||1),B(!!H),J(H?.vibrance||1),O(!!V),K(V?.rotation||-.5),j(!!w),Q(w?.noise||30),A(!!S),U(S?.blocksize||30)},[n]);let T=e=>{t?.objectsHandler.setTextStyle(e)},b=(e,i)=>{Z({...o,[e]:i}),t&&t.objectsHandler.setShadow({...o,[e]:i})};return a(pe,{trigger:"click",content:l("div",{style:{width:"280px",maxHeight:"calc(100vh - 150px)",overflow:"auto"},children:[a(d,{label:"Blur",visible:s,enabled:ae,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"blur",{blur:.5}),I(!0)):(t?.imageFiltersHandler._removeFilter(i,"blur"),I(!1))},min:0,max:1,step:.1,numberValue:ne,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("blur","blur",e),L(e)}}),a(d,{label:"Brightness",visible:s,enabled:ie,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"brightness",{brightness:.05}),_(!0)):(t?.imageFiltersHandler._removeFilter(i,"brightness"),_(!1))},min:-1,max:1,step:.01,numberValue:re,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("brightness","brightness",e),q(e)}}),a(d,{label:"Contrast",visible:s,enabled:le,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"contrast",{contrast:.25}),N(!0)):(t?.imageFiltersHandler._removeFilter(i,"contrast"),N(!1))},min:-1,max:1,step:.01,numberValue:se,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("contrast","contrast",e),D(e)}}),a(d,{label:"Saturation",visible:s,enabled:oe,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"saturation",{saturation:1}),R(!0)):(t?.imageFiltersHandler._removeFilter(i,"saturation"),R(!1))},min:-1,max:1,step:.01,numberValue:be,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("saturation","saturation",e),G(e)}}),a(d,{label:"Vibrance",visible:s,enabled:de,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"vibrance",{vibrance:1}),B(!0)):(t?.imageFiltersHandler._removeFilter(i,"vibrance"),B(!1))},min:-1,max:1,step:.01,numberValue:ce,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("vibrance","vibrance",e),J(e)}}),a(d,{label:"HueRotation",visible:s,enabled:me,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"hueRotation",{rotation:-.5}),O(!0)):(t?.imageFiltersHandler._removeFilter(i,"hueRotation"),O(!1))},min:-1,max:1,step:.01,numberValue:ue,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("hueRotation","rotation",e),K(e)}}),a(d,{label:"Noise",visible:s,enabled:ge,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"noise",{noise:30}),j(!0)):(t?.imageFiltersHandler._removeFilter(i,"noise"),j(!1))},min:0,max:1e3,step:1,numberValue:he,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("noise","noise",e),Q(e)}}),a(d,{label:"Pixelate",visible:s,enabled:fe,onEnabledChange:e=>{let i=n;e?(t?.imageFiltersHandler._createFilter(i,"pixelate",{blocksize:10}),A(!0)):(t?.imageFiltersHandler._removeFilter(i,"pixelate"),A(!1))},min:.01,max:100,step:.01,numberValue:ve,onNumberValueChange:e=>{t?.imageFiltersHandler._changeAttr("pixelate","blocksize",e),U(e)}}),v&&l(W,{children:[l("div",{style:te,children:[a("span",{children:"Text Stroke"}),a(z,{checked:!!X,onChange:e=>{T({strokeWidth:e?10:0,stroke:e?"red":null}),Y(e?10:0),P(e?"red":null)}})]}),!!X&&l("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px"},children:[a(ee,{value:Fe,onChange:e=>{let i=e.toCssString();T({stroke:i}),P(i)}}),a(h,{value:X,onChange:e=>{T({strokeWidth:f(e,1,30)}),Y(f(e,1,30))},style:{width:60},min:1,max:Math.round(n.fontSize/2)})]})]}),l("div",{style:te,children:[a("span",{children:"Shadow"}),a(z,{checked:!!o.enabled,onChange:e=>{b("enabled",e)}})]}),o.enabled&&l(W,{children:[l("div",{style:E,children:[a("div",{children:"Blur"}),a("div",{children:a(h,{value:o.blur,style:{width:60},min:0,max:50,onChange:e=>{b("blur",e)}})})]}),a(k,{value:o.blur,onChange:e=>b("blur",e),min:0,max:50}),l("div",{style:E,children:[a("div",{children:"Offset X"}),a("div",{children:a(h,{value:o.offsetX,style:{width:60},min:-50,max:50,onChange:e=>{b("offsetX",f(e,-50,50))}})})]}),a(k,{value:o.offsetX,onChange:e=>b("offsetX",e),min:-50,max:50}),l("div",{style:E,children:[a("div",{children:"Offset Y"}),a("div",{children:a(h,{value:o.offsetY,style:{width:60},min:-50,max:50,onChange:e=>{b("offsetY",f(e,-50,50))}})})]}),a(k,{value:o.offsetY,onChange:e=>b("offsetY",e),min:-50,max:50}),l("div",{style:E,children:[a("div",{children:"Color"}),a(ee,{defaultFormat:"rgb",value:o.color,onChange:e=>{b("color",e.toRgbString())}})]})]})]}),children:a(ye,{type:"text",icon:a(Ce,{size:16,style:{display:"flex"}}),styles:{root:{padding:"0 7px"}},children:"Effects"})})});export{Ie as a};
@@ -1,7 +0,0 @@
1
- import{a as A}from"./chunk-PSXS4WMN.js";import{a as I,b as H}from"./chunk-YRJUN267.js";import{a as j}from"./chunk-4HEMGHOQ.js";import{a as T,c as B}from"./chunk-RVXI723F.js";import{a as b}from"./chunk-WJT6VPDR.js";import{observer as u}from"mobx-react-lite";import{useEffect as S,useState as m,useCallback as O,useRef as L,useMemo as G}from"react";import{ColorPicker as W,Popover as M,Button as g,Input as E,InputNumber as P,Space as V,Slider as N,Tooltip as f}from"antd";import{cssGradient2FabricGradient as R}from"@ydesign/core";import{ChevronDown as _,TextAlignStart as J,TextAlignCenter as K,TextAlignEnd as U,TextAlignJustify as D,Bold as $,Italic as q,Underline as Q,Strikethrough as X,ListChevronsUpDown as Y,TextWrap as Z}from"lucide-react";import{FixedSizeList as tt}from"react-window";import et from"styled-components";import{jsx as t,jsxs as h}from"react/jsx-runtime";var nt=et.img`
2
- height: 20px;
3
-
4
- .bp5-dark & {
5
- filter: invert(1);
6
- }
7
- `,{Search:ot}=E,it=({fontFamily:o,handleClick:i,modifiers:n,store:r,isCustom:c})=>{let[s,a]=m(!c);if(console.log(a,nt),S(()=>{s||r.loadFont(o)},[o,s]),o==="_divider")return t("div",{style:{width:"100%",height:1,background:"#e8e8e8"}});let d=o;return t(g,{type:n.active?"primary":"text",block:!0,style:{justifyContent:"start"},onClick:()=>i(o),disabled:n.disabled,styles:{root:{fontFamily:'"'+o+'"'},content:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},children:d})},lt=({onChange:o,defaultValue:i})=>t(ot,{placeholder:i,allowClear:!0,onChange:n=>{o(n.target.value)},style:{width:210}}),rt=({store:o,fonts:i,activeFont:n,activeFontLabel:r,onFontSelect:c})=>{let[s,a]=m(""),d=i.filter(y=>y.toLowerCase().includes(s.toLowerCase()));return t(M,{content:h("div",{children:[t(lt,{defaultValue:"\u641C\u7D22\u5B57\u4F53",onChange:y=>a(y??"")}),t("div",{style:{paddingTop:5},children:t(tt,{itemCount:d.length,itemSize:28,width:210,height:Math.min(400,28*d.length)+10,children:({index:y,style:l})=>{let e=d[y];return t("div",{style:{...l,display:"flex",alignItems:"center",justifyContent:"center"},children:t(it,{fontFamily:e,modifiers:{active:n===e},handleClick:()=>c(e),store:o,isCustom:o.fonts.find(p=>p.fontFamily===e)||b.find(p=>p.fontFamily===e)},e)})}})})]}),trigger:"click",children:t(g,{type:"text",style:{marginRight:5,fontFamily:'"'+n+'"',overflow:"hidden",whiteSpace:"nowrap",maxHeight:30,padding:"0 10px"},icon:t(_,{size:16,style:{display:"flex"}}),iconPlacement:"end",children:r})})},F=["left","center","right","justify"],st=u(({elements:o,store:i})=>{let n=i.fonts.concat(b).map(a=>a.fontFamily),r=o[0].fontFamily;r.length>15&&(r=r.slice(0,15)+"...");let c=B(i.objects),s=[...new Set(c.concat("_divider").concat(n))];return t(rt,{fonts:s,activeFont:o[0].fontFamily,activeFontLabel:r,store:i,onFontSelect:a=>{i.editor?.objectsHandler.setTextStyle({fontFamily:a})}})}),x=o=>o?typeof o=="string"?o:o.colorStops?JSON.stringify(o.colorStops):JSON.stringify(o):"",at=u(({elements:o,store:i})=>{let n=o[0],r=O(()=>{let{selectionStart:l,selectionEnd:e}=n;if(l!==e&&l!==void 0){let p=n.getSelectionStyles(l,l+1);if(p.length>0&&p[0].fill!==void 0)return p[0].fill}return n.fill},[n]),[c,s]=m(()=>T(r())),a=L(!1),d=L(x(r()));S(()=>{let l=i.editor?.customCanvas?.canvas;if(!l)return;let e=()=>{if(!a.current){let p=r();d.current=x(p),s(T(p))}};return l.on("text:selection:changed",e),l.on("text:editing:entered",e),l.on("text:editing:exited",e),()=>{l.off("text:selection:changed",e),l.off("text:editing:entered",e),l.off("text:editing:exited",e)}},[i.editor?.customCanvas?.canvas,r]),S(()=>{if(!a.current){let l=r(),e=x(l);e!==d.current&&(d.current=e,s(T(l)))}},[n,r]);let y=G(()=>c,[x(c)]);return t(W,{value:y,allowClear:!0,mode:["single","gradient"],onOpenChange:l=>{if(a.current=l,!l){let e=r();d.current=x(e)}},onChange:l=>{s(l)},onChangeComplete:l=>{let e=l.toCssString();if(e.includes("gradient")){let p=R(e);i.editor?.objectsHandler.setTextStyle({fill:p})}else i.editor?.objectsHandler.setTextStyle({fill:e})}})}),ct=u(({elements:o,store:i})=>{let[n,r]=m(o[0].fontSize);S(()=>{r(o[0].fontSize)},[o[0]?.fontSize,i._updateFontSize]);let c=s=>{Number.isNaN(s)||(i.editor?.objectsHandler.setTextStyle({fontSize:Number(s)}),r(Number(s)))};return t(P,{min:5,max:4*i.height,value:Math.round(n),onChange:c,style:{width:70}})}),dt=u(({elements:o,store:i})=>{let n=o[0],[r,c]=m(n.textAlign),[s,a]=m(n.fontWeight),[d,y]=m(n.fontStyle),[l,e]=m(n.underline),[p,k]=m(n.linethrough),[v,w]=m(n.splitByGrapheme);return S(()=>{c(n.textAlign),a(n.fontWeight),y(n.fontStyle),e(n.underline),k(n.linethrough),w(n.splitByGrapheme)},[n]),h(V.Compact,{children:[t(f,{placement:"bottom",title:`Text align ${r}`,children:t(g,{type:"text",icon:r==="left"?t(J,{size:16,style:{display:"flex"}}):r==="center"?t(K,{size:16,style:{display:"flex"}}):r==="right"?t(U,{size:16,style:{display:"flex"}}):t(D,{size:16,style:{display:"flex"}}),onClick:()=>{let C=(F.indexOf(r)+1+F.length)%F.length,z=F[C];i.editor?.objectsHandler.setTextStyle({textAlign:z}),c(z)}})}),t(f,{placement:"bottom",title:"Bold",children:t(g,{type:s==="bold"||s==="700"?"primary":"text",icon:t($,{size:16,style:{display:"flex"}}),onClick:()=>{s==="bold"||s==="700"?(i.editor?.objectsHandler.setTextStyle({fontWeight:"normal"}),a("normal")):(i.editor?.objectsHandler.setTextStyle({fontWeight:"bold"}),a("bold"))}})}),t(f,{placement:"bottom",title:"Italic",children:t(g,{type:d==="italic"?"primary":"text",icon:t(q,{size:16,style:{display:"flex"}}),onClick:()=>{d==="italic"?(i.editor?.objectsHandler.setTextStyle({fontStyle:"normal"}),y("normal")):(i.editor?.objectsHandler.setTextStyle({fontStyle:"italic"}),y("italic"))}})}),t(f,{placement:"bottom",title:"Underline",children:t(g,{type:l?"primary":"text",icon:t(Q,{size:16,style:{display:"flex"}}),onClick:()=>{i.editor?.objectsHandler.setTextStyle({underline:!l}),e(!l)}})}),t(f,{placement:"bottom",title:"Strikethrough",children:t(g,{type:p?"primary":"text",icon:t(X,{size:16,style:{display:"flex"}}),onClick:()=>{i.editor?.objectsHandler.setTextStyle({linethrough:!p}),k(!p)}})}),t(f,{placement:"bottom",title:"Split by grapheme",children:t(g,{type:v?"primary":"text",icon:t(Z,{size:16,style:{display:"flex"}}),onClick:()=>{i.editor?.objectsHandler.setTextStyle({splitByGrapheme:!v}),w(!v)}})})]})}),pt=u(({elements:o,store:i})=>{let n=o[0],r={display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"5px",paddingBottom:"5px"},c=typeof n.lineHeight=="number"?100*n.lineHeight:120,[s,a]=m(c),[d,y]=m(n.charSpacing),l=e=>{i.editor?.objectsHandler.setTextStyle(e)};return t(M,{trigger:"click",content:h("div",{style:{padding:"0 6px",width:"230px"},children:[h("div",{style:r,children:[t("div",{children:"Line height"}),t("div",{children:t(P,{min:50,max:250,value:Math.round(s),style:{width:80},onChange:e=>{l({lineHeight:e/100}),a(e)}})})]}),t(N,{value:Math.round(s),min:50,max:250,step:1,onChange:e=>{l({lineHeight:e/100}),a(e)}}),h("div",{style:r,children:[t("div",{children:"Letter spacing"}),t("div",{children:t(P,{min:-50,max:250,value:Math.round(d/10),style:{width:80},onChange:e=>{l({charSpacing:(e??0)*10}),y((e??0)*10)}})})]}),t(N,{value:Math.round(d/10),min:-50,max:250,step:1,onChange:e=>{l({charSpacing:(e??0)*10}),y((e??0)*10)}})]}),children:t(g,{type:"text",icon:t(Y,{size:16,style:{display:"flex"}})})})}),yt={TextFill:at,TextFontFamily:st,TextFontSize:ct,TextFontVariant:dt,TextSpacing:pt,TextFilters:j,TextAiWrite:A},mt=u(({store:o,components:i})=>{let n=o.selectedElements,c=I({type:"text",usedItems:["TextFill","TextFontFamily","TextFontSize","TextFontVariant","TextSpacing","TextFilters","TextAiWrite"],components:i});return t(H,{items:c,itemRender:s=>{let a=i[s]||yt[s];return a&&t(a,{elements:n,element:n[0],store:o},s)}})}),wt=mt;export{F as a,mt as b,wt as c};
@@ -1 +0,0 @@
1
- import{jsx as o}from"react/jsx-runtime";var t=({store:e})=>(console.log("TextPanel",e),o("div",{children:"\u6587\u672C\u9762\u677F"}));export{t as a};
@@ -1 +0,0 @@
1
- import{Download as s}from"lucide-react";import{useState as l}from"react";import{Button as d,Popover as g,Slider as m,Select as n}from"antd";import{jsx as t,jsxs as e}from"react/jsx-runtime";var u=({store:i})=>{let[a,r]=l("png"),[p,v]=l(1),[o,c]=l(1);return t(g,{content:e("div",{className:"w-80",children:[e("div",{className:"mb-4",children:[t("div",{style:{marginBottom:"8px"},className:"text-gray-500",children:"File type"}),e(n,{value:a,onChange:r,style:{width:"100%"},children:[t(n.Option,{value:"png",children:"PNG"}),t(n.Option,{value:"jpeg",children:"JPEG"})]})]}),e("div",{className:"mb-4",children:[t("div",{style:{marginBottom:"8px"},className:"text-gray-500",children:"Quality"}),t("div",{style:{padding:"0 15px"},children:t(m,{min:.2,max:1,value:p,step:.2,onChange:v,marks:{.2:"20%",.4:"40%",.6:"60%",.8:"80%",1:"100%"}})})]}),e("div",{className:"mb-4",children:[t("div",{style:{marginBottom:"8px"},className:"text-gray-500",children:"Multiplier"}),t("div",{style:{padding:"0 15px"},children:t(m,{min:.5,max:3,value:o,step:.5,onChange:c,marks:{.5:.5,1:1,1.5:1.5,2:2,2.5:2.5,3:3}})}),e("div",{className:"text-sm text-gray-500 py-1",children:["size\uFF1A",Math.round(i.width*o)," x ",Math.round(i.height*o)," px"]})]}),t("div",{children:e(d,{type:"primary",block:!0,onClick:async()=>{let y=i.toJSON();console.log("\u5BFC\u51FAjson",y),i.saveAsImage({format:a,quality:p,multiplier:o})},icon:t(s,{size:16}),children:["Download ",a.toUpperCase()]})})]}),trigger:"click",children:t(d,{type:"primary",icon:t(s,{size:16}),style:{width:155},children:"Download"})})},w=u;export{u as a,w as b};
@@ -1 +0,0 @@
1
- import{a as C,b as m}from"./chunk-YRJUN267.js";import{a as w}from"./chunk-4HEMGHOQ.js";import{a as u}from"./chunk-RVXI723F.js";import{cssGradient2FabricGradient as W}from"@ydesign/core";import{observer as y}from"mobx-react-lite";import{useState as F,useRef as k,useMemo as P}from"react";import{ColorPicker as S,Popover as B,Button as g,InputNumber as x,Slider as b}from"antd";import{Logs as j,Ban as A}from"lucide-react";import{Fragment as _,jsx as e,jsxs as h}from"react/jsx-runtime";var n=r=>r?typeof r=="string"?r:r.colorStops?JSON.stringify(r.colorStops):JSON.stringify(r):"",D=y(({store:r,elements:t})=>{let o=t[0],[c,d]=F(()=>u(o.fill)),a=k(!1),s=k(n(o.fill)),p=n(o.fill);p!==s.current&&!a.current&&(s.current=p,d(u(o.fill)));let f=P(()=>c,[n(c)]);return e(S,{value:f,allowClear:!0,mode:["single","gradient"],onOpenChange:i=>{a.current=i,i||(s.current=n(o.fill))},onChange:i=>{d(i)},onChangeComplete:i=>{let l=i.toCssString();if(l.includes("gradient")){let v=W(l);r.editor?.objectsHandler.update({fill:v})}else r.editor?.objectsHandler.update({fill:l})}})}),H=y(({store:r,element:t})=>(console.log("element ---> ",t),e(B,{trigger:"click",content:h("div",{style:{width:270},children:[h("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:15},children:[e(g,{color:t?.strokeWidth===0?"primary":"default",variant:"filled",onClick:()=>{r.editor?.objectsHandler.update({strokeWidth:0}),r._triggerUpdate()},children:e(A,{size:16})}),e(g,{color:t?.strokeWidth&&t?.strokeDashArray?.length===0?"primary":"default",variant:"filled",onClick:()=>{r.editor?.objectsHandler.update({strokeDashArray:[],strokeWidth:t?.strokeWidth||10,stroke:t?.stroke||"#000000"}),r._triggerUpdate()},children:e("svg",{width:16,height:16,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("line",{x2:24,y1:"50%",y2:"50%",stroke:"currentColor",strokeWidth:"2"})})}),e(g,{color:t?.strokeWidth&&Array.isArray(t.strokeDashArray)&&t.strokeDashArray[0]===4?"primary":"default",variant:"filled",onClick:()=>{r.editor?.objectsHandler.update({strokeDashArray:[4,1],strokeWidth:t?.strokeWidth||10,stroke:t?.stroke||"#000000"}),r._triggerUpdate()},children:e("svg",{width:16,height:16,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("line",{x1:"-1",x2:"25",y1:"50%",y2:"50%",stroke:"currentColor",strokeDasharray:"12 2",strokeWidth:"2"})})}),e(g,{color:t?.strokeWidth&&Array.isArray(t.strokeDashArray)&&t.strokeDashArray[0]===2?"primary":"default",variant:"filled",onClick:()=>{r.editor?.objectsHandler.update({strokeDashArray:[2,1],strokeWidth:t?.strokeWidth||10,stroke:t?.stroke||"#000000"}),r._triggerUpdate()},children:e("svg",{width:16,height:16,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("line",{x1:"1",x2:"23",y1:"50%",y2:"50%",stroke:"currentColor",strokeDasharray:"6 2",strokeWidth:"2"})})}),e(g,{color:t?.strokeWidth&&Array.isArray(t.strokeDashArray)&&t.strokeDashArray[0]===1?"primary":"default",variant:"filled",onClick:()=>{r.editor?.objectsHandler.update({strokeDashArray:[1,1],strokeWidth:t?.strokeWidth||10,stroke:t?.stroke||"#000000"}),r._triggerUpdate()},children:e("svg",{width:16,height:16,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("line",{x1:"1",x2:"23",y1:"50%",y2:"50%",stroke:"currentColor",strokeDasharray:"2 2",strokeWidth:"2"})})})]}),h("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:5},children:[e("div",{children:"Stroke Width"}),e("div",{children:e(x,{value:t?.strokeWidth,style:{width:60},min:0,max:Math.round(Math.min(t?.width,t?.height)/2),onChange:o=>{r.editor?.objectsHandler.update({strokeWidth:o}),r._triggerUpdate()}})})]}),e(b,{value:t?.strokeWidth,onChange:o=>{r.editor?.objectsHandler.update({strokeWidth:o}),r._triggerUpdate()},min:0,max:Math.round(Math.min(t?.width,t?.height)/2)}),t?.type==="rect"&&h(_,{children:[h("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:15,paddingBottom:5},children:[e("div",{children:"Corner Radius"}),e("div",{children:e(x,{value:t?.rx,style:{width:60},min:0,max:Math.round(Math.min(t?.width,t?.height)/2),onChange:o=>{r.editor?.objectsHandler.update({rx:o,ry:o}),r._triggerUpdate()}})})]}),e(b,{value:t?.rx,onChange:o=>{r.editor?.objectsHandler.update({rx:o,ry:o}),r._triggerUpdate()},min:0,max:Math.round(Math.min(t?.width,t?.height)/2)})]})]}),children:e(g,{type:"text",styles:{root:{padding:"0 7px"}},icon:e(j,{size:16,style:{display:"flex"}}),children:"Stroke settings"})}))),R=y(({store:r,elements:t})=>{let o=t[0],[c,d]=F(()=>u(o?.stroke)),a=k(!1),s=k(n(o?.stroke)),p=n(o?.stroke);p!==s.current&&!a.current&&(s.current=p,d(u(o?.stroke)));let f=P(()=>c,[n(c)]);return o?.strokeWidth?e(S,{value:f,allowClear:!0,mode:["single","gradient"],onOpenChange:i=>{a.current=i,i||(s.current=n(o.stroke))},onChange:i=>{d(i)},onChangeComplete:i=>{let l=i.toCssString();if(l.includes("gradient")){let v=W(l);r.editor?.objectsHandler.update({stroke:v})}else r.editor?.objectsHandler.update({stroke:l})}}):null}),M={FigureFill:D,FigureStroke:R,FigureSettings:H,FigureFilters:w},L=y(({store:r,components:t})=>{let o=r.selectedElements[0],d=C({type:"figure",usedItems:["FigureFill","FigureStroke","FigureSettings","FigureFilters"],components:t});return e(m,{items:d,itemRender:a=>{let s=t[a]||M[a];return s&&e(s,{elements:r.selectedElements,element:o,store:r},a)}})});export{n as a,D as b,H as c,R as d,L as e};
@@ -1 +0,0 @@
1
- import{Popover as a,Button as p}from"antd";import{Rotate3d as c,FlipHorizontal as n,FlipVertical as y}from"lucide-react";import{useState as d,useEffect as u,useCallback as r}from"react";import{jsx as i,jsxs as b}from"react/jsx-runtime";var X=({element:l,store:e})=>{let[t,o]=d({flipX:!1,flipY:!1}),f=r(()=>{e.editor?.objectsHandler.update({flipX:!t.flipX}),o({...t,flipX:!t.flipX})},[e.editor,t]),s=r(()=>{e.editor?.objectsHandler.update({flipY:!t.flipY}),o({...t,flipY:!t.flipY})},[e.editor,t]);return u(()=>{l&&o({flipX:l.flipX,flipY:l.flipY})},[l]),i(a,{trigger:"click",content:b("div",{style:{width:165},children:[i(p,{type:"text",block:!0,style:{justifyContent:"start"},icon:i(n,{size:16,style:{display:"flex"}}),onClick:f,children:"Flip horizontally"}),i(p,{type:"text",block:!0,style:{justifyContent:"start"},icon:i(y,{size:16,style:{display:"flex"}}),onClick:s,children:"Flip vertically"})]}),children:i(p,{type:"text",icon:i(c,{size:16,style:{display:"flex"}}),styles:{root:{padding:"0 7px"}},children:"Flip"})})};export{X as a};
@@ -1 +0,0 @@
1
- import{jsx as l}from"react/jsx-runtime";var e=({store:o})=>(console.log("UploadPanel",o),l("div",{children:"\u4E0A\u4F20\u56FE\u7247"})),p=e;export{e as a,p as b};
@@ -1 +0,0 @@
1
- import{jsx as e}from"react/jsx-runtime";var t=({store:o})=>(console.log("PhotosPanel",o),e("div",{children:"\u56FE\u7247\u9762\u677F"}));export{t as a};
@@ -1 +0,0 @@
1
- import{Button as i,Modal as m}from"antd";import{useState as n,useEffect as c}from"react";import{observer as l}from"mobx-react-lite";import{Fragment as g,jsx as t,jsxs as p}from"react/jsx-runtime";var d=l(({isOpen:r,onClose:o,element:e})=>{let[a,s]=n(e.getSrc());return c(()=>{s(e.getSrc())},[e.id]),t(m,{title:"Remove background from image",open:r,onOk:o,onCancel:o,width:{xs:"90%",sm:"80%",md:"70%",lg:"60%",xl:"50%",xxl:"40%"},styles:{body:{padding:"35px 0"}},children:t("img",{src:a,style:{width:"100%",maxHeight:"400px",objectFit:"contain"}})})}),x=({element:r})=>{let[o,e]=n(!1);return p(g,{children:[t(i,{type:"text",styles:{root:{padding:"0 7px"}},onClick:()=>e(!0),children:"Remove background"}),t(d,{isOpen:o,onClose:()=>e(!1),element:r})]})};export{x as a};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-75WC3GVB.js";import{LockKeyholeOpen as i,LockKeyhole as n}from"lucide-react";import{Tooltip as m,Button as s}from"antd";import{observer as k}from"mobx-react-lite";import{jsx as o}from"react/jsx-runtime";var b=k(({store:r})=>{let{disabled:p,locked:t,lock:c,unlock:l}=e({store:r});return o(m,{title:"Lock",placement:"bottom",children:o(s,{type:"text",styles:{root:{padding:"0 7px"}},disabled:p,onClick:()=>{t?l():c()},children:o(t?n:i,{size:16})})})});export{b as a};
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-JMIN2XMC.js";import{Copy as i}from"lucide-react";import{Tooltip as l,Button as m}from"antd";import{observer as n}from"mobx-react-lite";import{jsx as t}from"react/jsx-runtime";var d=n(({store:e})=>{let{disabled:p,duplicate:r}=o({store:e});return t(l,{title:"Duplicate",placement:"bottom",children:t(m,{type:"text",styles:{root:{padding:"0 7px"}},disabled:p,onClick:()=>{r()},children:t(i,{size:16})})})});export{d as a};
@@ -1 +0,0 @@
1
- import{d as s}from"./chunk-WJT6VPDR.js";import{a as e}from"./chunk-O2XFH626.js";import*as n from"mobx";import{createContext as c,useContext as a}from"react";var r=class{constructor({store:t}){e(this,"store");e(this,"status","saved");e(this,"name","");e(this,"id","");e(this,"user",{});e(this,"skipSaving",!1);e(this,"cloudEnabled",!1);n.makeAutoObservable(this),this.store=t}async firstLoad(t){this.store.loadJSON(t)}async getGlobalFont(t){return t?.length?(s(t),t):[]}},p=c(null),j=()=>{let o=a(p);if(!o)throw new Error("useProject must be used within a ProjectProvider");return o},i=o=>new r(o),P=i;export{p as a,j as b,i as c,P as d};
@@ -1 +0,0 @@
1
- import{Dropdown as S,Button as d,Modal as z,Input as g,Select as P}from"antd";import{Menu as I,Plus as B,Grid2X2 as D,Star as T,ShoppingBag as b,FileText as F,Presentation as j,Share2 as H,Printer as O,Link2 as W,Image as _,FileImage as q,Smartphone as A,Monitor as G,Square as L}from"lucide-react";import{useState as o}from"react";import{Fragment as $,jsx as t,jsxs as i}from"react/jsx-runtime";var U=[{key:"all",label:"\u5168\u90E8",icon:D},{key:"common",label:"\u5E38\u7528\u5C3A\u5BF8",icon:T},{key:"ecommerce",label:"\u7535\u5546\u7269\u6599",icon:b},{key:"office",label:"\u884C\u653F\u529E\u516C",icon:F},{key:"presentation",label:"\u6F14\u793A\u6587\u7A3F",icon:j},{key:"social",label:"\u793E\u4EA4\u5A92\u4F53",icon:H},{key:"print",label:"\u5370\u5237\u7269\u6599",icon:O}],x=[{name:"\u7535\u5546\u4E3B\u56FE\uFF081:1\uFF09",width:1440,height:1440,unit:"px"},{name:"\u7535\u5546\u4E3B\u56FE\uFF081:1\uFF09",width:800,height:800,unit:"px"},{name:"\u624B\u673A\u6D77\u62A5",width:1242,height:2208,unit:"px"},{name:"\u5C0F\u7EA2\u4E66\u5C01\u9762",width:1242,height:1656,unit:"px"},{name:"\u7AD6\u7248\u89C6\u9891\u5C01\u9762",width:1080,height:1920,unit:"px"},{name:"PPT\uFF0816:9\uFF09",width:1920,height:1080,unit:"px"}],X=[{label:"\u521B\u5EFA\u8BBE\u8BA1",key:"new_design",icon:t(B,{size:16})}],Q=({store:m})=>{let[v,l]=o(!1),[y,f]=o("all"),[s,c]=o(800),[n,h]=o(800),[r,w]=o("px"),N=({key:e})=>{e==="new_design"&&l(!0)},k=()=>{let e=s,a=n;r==="mm"?(e=Math.round(s*3.7795275591),a=Math.round(n*3.7795275591)):r==="cm"&&(e=Math.round(s*37.795275591),a=Math.round(n*37.795275591)),m.setSize({width:e,height:a,isClear:!0}),l(!1)},u=e=>{let a=e.width,p=e.height;e.unit==="mm"&&(a=Math.round(e.width*3.7795275591),p=Math.round(e.height*3.7795275591)),m.setSize({width:a,height:p,isClear:!0}),l(!1)},C=()=>{l(!1)},M=()=>{c(n),h(s)};return i($,{children:[t(S,{menu:{items:X,onClick:N},trigger:["click"],styles:{root:{width:168}},children:t(d,{type:"text",children:t(I,{size:16})})}),t(z,{title:"\u521B\u5EFA\u8BBE\u8BA1",open:v,onCancel:C,footer:null,maskClosable:!1,width:840,styles:{container:{height:540,overflow:"hidden"},body:{height:488}},children:i("div",{className:"flex",style:{padding:"16px 0px 0px 0px",height:"100%"},children:[t("div",{className:"w-40 border-r border-gray-100 pr-2",children:U.map(e=>{let a=e.icon;return i("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer mb-1 ${y===e.key?"bg-blue-500 text-white":"hover:bg-gray-100"}`,onClick:()=>f(e.key),children:[t(a,{size:16}),t("span",{className:"text-sm",children:e.label})]},e.key)})}),i("div",{className:"flex-1 pl-6 overflow-y-auto",children:[i("div",{className:"flex gap-4 mb-6",children:[i("div",{className:"flex-1 flex items-center gap-2 px-4 py-3 border border-gray-200 rounded-lg cursor-pointer hover:border-blue-400",children:[t(_,{size:20,className:"text-blue-500"}),t("span",{children:"\u6253\u5F00\u56FE\u7247"})]}),i("div",{className:"flex-1 flex items-center gap-2 px-4 py-3 border border-gray-200 rounded-lg cursor-pointer hover:border-blue-400",children:[t(q,{size:20,className:"text-blue-500"}),t("span",{children:"\u6253\u5F00PSD"})]})]}),i("div",{className:"mb-6",children:[t("h3",{className:"text-base font-medium mb-3",children:"\u5E38\u7528\u5C3A\u5BF8"}),i("div",{className:"flex items-center gap-2 mb-4",children:[t(g,{type:"number",value:s,onChange:e=>c(Number(e.target.value)),suffix:"\u5BBD",style:{width:100}}),t(d,{type:"text",icon:t(W,{size:16}),onClick:M}),t(g,{type:"number",value:n,onChange:e=>h(Number(e.target.value)),suffix:"\u9AD8",style:{width:100}}),t(P,{value:r,onChange:w,style:{width:100},options:[{value:"px",label:"px \u50CF\u7D20"},{value:"mm",label:"mm \u6BEB\u7C73"},{value:"cm",label:"cm \u5398\u7C73"}]}),t(d,{type:"primary",onClick:k,children:"\u521B\u5EFA"})]}),t("div",{className:"grid grid-cols-6 gap-3",children:x.map((e,a)=>i("div",{className:"flex flex-col items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:border-blue-400 hover:shadow-sm",onClick:()=>u(e),children:[t("div",{className:"w-10 h-10 flex items-center justify-center mb-2 text-gray-400",children:e.width===e.height?t(L,{size:24}):e.width<e.height?t(A,{size:24}):t(G,{size:24})}),t("span",{className:"text-xs text-center text-gray-700",children:e.name}),i("span",{className:"text-xs text-gray-400",children:[e.width,"*",e.height," ",e.unit]})]},a))})]}),i("div",{children:[i("div",{className:"flex items-center justify-between mb-3",children:[t("h3",{className:"text-base font-medium",children:"\u7535\u5546\u7269\u6599"}),t("span",{className:"text-sm text-blue-500 cursor-pointer hover:underline",children:"\u67E5\u770B\u66F4\u591A >"})]}),t("div",{className:"grid grid-cols-6 gap-3",children:x.slice(0,4).map((e,a)=>i("div",{className:"flex flex-col items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:border-blue-400 hover:shadow-sm",onClick:()=>u(e),children:[t("div",{className:"w-10 h-10 flex items-center justify-center mb-2 text-gray-400",children:t(b,{size:24})}),t("span",{className:"text-xs text-center text-gray-700",children:e.name}),i("span",{className:"text-xs text-gray-400",children:[e.width,"*",e.height," ",e.unit]})]},a))})]})]})]})})]})};export{Q as a};
@@ -1,54 +0,0 @@
1
- import{a as T}from"./chunk-MCBL6QAP.js";import{a as x}from"./chunk-WIM26GEM.js";import{a as o}from"./chunk-LW2W4B2N.js";import{a as P}from"./chunk-QJBRJELT.js";import{a as u}from"./chunk-6LFGFFHI.js";import{a as h}from"./chunk-DBQHEZPG.js";import{a as m}from"./chunk-TX4BNXQC.js";import{c as l,d as S}from"./chunk-WCHGSVUC.js";import{a as y}from"./chunk-M33EDDXB.js";import{a as f}from"./chunk-DJBTBRPS.js";import a from"styled-components";import{useRef as g,useLayoutEffect as C}from"react";import{observer as i}from"mobx-react-lite";import{LayoutTemplate as z,TypeOutline as L,Image as N,Shapes as M,Upload as B,Wallpaper as H,Layers as I,ImageUpscale as E}from"lucide-react";import{clsx as R}from"clsx";import{jsx as n,jsxs as p}from"react/jsx-runtime";var U=a.div`
2
- display: flex;
3
- height: 100% !important;
4
- padding: 0px !important;
5
- position: relative;
6
-
7
- &.bp5-navbar {
8
- box-shadow: none;
9
- }
10
- `,$=a.div`
11
- @media screen and (min-width: 501px) {
12
- overflow-y: auto;
13
- overflow-x: hidden;
14
- min-width: 72px;
15
- }
16
- `,D=a.div`
17
- display: flex;
18
- flex-direction: column;
19
- `,F=a.div`
20
- padding: 10px 10px 0px 10px !important;
21
- height: 100% !important;
22
-
23
- &.bp5-navbar {
24
- width: 350px;
25
- }
26
-
27
- &.bp5-navbar.collapsed {
28
- width: 0px;
29
- }
30
- `,O=a.div`
31
- display: none;
32
- ${l(`
33
- position: absolute;
34
- bottom: 72px;
35
- display: block;
36
- width: 100vw;
37
- height: 100vh;
38
- background-color: rgba(0, 0, 0, 0.05);
39
- `)}
40
- `,W=a.div`
41
- position: absolute;
42
- right: 1px;
43
- top: 50%;
44
- height: 96px;
45
- width: 15px;
46
- fill: white;
47
- cursor: pointer;
48
- z-index: 10;
49
- transform: translate(100%, -50%);
50
-
51
- ${l(`
52
- display: none;
53
- `)}
54
- `,A=({onClick:e})=>n(W,{onClick:e,children:n("div",{children:p("button",{className:"grid relative justify-center arrow cursor-pointer",children:[p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 96",width:"13",height:"96",fill:"none",children:[n("path",{d:"M0,0 h1 c0,20,12,12,12,32 v32 c0,20,-12,12,-12,32 H0 z",className:"fill-white dark:fill-[#0b0809]"}),n("path",{d:"M0.5,0 c0,20,12,12,12,32 v32 c0,20,-12,12,-12,32",className:"fill-white stroke-gray-200 dark:fill-[#0b0809] dark:stroke-[#0b0809]"})]}),n("div",{className:"absolute self-center",children:n("span",{className:"w-3 h-3 text-block inline-flex items-center box-border dark:text-white",children:n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",children:n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.25",d:"M7 3.17 4.88 5.3a1 1 0 0 0 0 1.42L7 8.83"})})})})]})})}),_={name:"templates",Tab:i(e=>n(o,{name:"templates",...e,children:n(z,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(P,{store:e})},j={name:"text",Tab:i(e=>n(o,{name:"text",...e,children:n(L,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(u,{store:e})},q={name:"photos",Tab:i(e=>n(o,{name:"photos",...e,children:n(N,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(f,{store:e})},G={name:"shapes",Tab:i(e=>n(o,{name:"shapes",...e,children:n(M,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(T,{store:e})},J={name:"upload",Tab:i(e=>n(o,{name:"upload",...e,children:n(B,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(h,{store:e})},K={name:"background",Tab:i(e=>n(o,{name:"background",...e,children:n(H,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(m,{store:e})},Q={name:"layers",Tab:i(e=>n(o,{name:"layers",...e,children:n(I,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(y,{store:e})},V={name:"size",Tab:i(e=>n(o,{name:"size",...e,children:n(E,{style:{display:"inline-block"},size:20})})),Panel:({store:e})=>n(x,{store:e})},X=[_,j,q,G,J,K,Q,V],Y=i(({store:e,sections:v,defaultSection:c="templates"})=>{(()=>{let t=g(!0);t.current&&(t.current=!1,e.openSidePanel(c))})();let r=S();C(()=>{r?e.openSidePanel(""):e.openSidePanel(c)},[r]);let d=[...v||X].filter(t=>t.visibleInList!==!1),b=d.find(t=>t.name===e.openedSidePanel)?.Panel,k=g(null);return p(U,{className:`bp5-navbar design-side-panel ${e.openedSidePanel?"":"collapsed"}`,children:[n($,{className:"design-side-tabs-container border-r-1 border-gray-200 dark:border-gray-800",ref:k,children:n(D,{className:"design-side-tabs-inner",children:d.map(({name:t,Tab:s})=>n(s,{name:t,onClick:()=>{t===e.openedSidePanel?e.openSidePanel(""):e.openSidePanel(t)},active:e.openedSidePanel===t},t))})}),b&&n(F,{className:R("bp5-navbar design-panel-container","border-r-1 border-gray-200 dark:border-gray-800"),onClick:t=>{let s=t.target.closest(".design-close-panel"),w=t.target.closest(".design-mobile");s&&(r||w)&&e.openSidePanel("")},children:n(b,{store:e})}),e.openedSidePanel&&n(O,{onClick:()=>e.openSidePanel("")}),e.openedSidePanel&&n(A,{onClick:()=>e.openSidePanel("")})]})}),Pe=Y;export{_ as a,j as b,q as c,G as d,J as e,K as f,Q as g,V as h,X as i,Y as j,Pe as k};
@@ -1 +0,0 @@
1
- import{jsx as o}from"react/jsx-runtime";var r=({store:e})=>(console.log("LayersPanel",e),o("div",{children:"\u56FE\u5C42"}));export{r as a};
@@ -1 +0,0 @@
1
- import{Button as i,Modal as l}from"antd";import{Eraser as p}from"lucide-react";import{useState as s,useEffect as m}from"react";import{observer as c}from"mobx-react-lite";import{Fragment as g,jsx as t,jsxs as f}from"react/jsx-runtime";var d=c(({isOpen:r,onClose:o,element:e})=>{let[n,a]=s(e.getSrc());return m(()=>{a(e.getSrc())},[e.id]),t(l,{title:"Eraser pen",open:r,onOk:o,onCancel:o,width:{xs:"90%",sm:"80%",md:"70%",lg:"60%",xl:"50%",xxl:"40%"},styles:{body:{padding:"35px 0"}},children:t("img",{src:n,style:{width:"100%",maxHeight:"400px",objectFit:"contain"}})})}),E=({element:r})=>{let[o,e]=s(!1);return f(g,{children:[t(i,{type:"text",icon:t(p,{size:16,style:{display:"flex"}}),styles:{root:{padding:"0 7px"}},onClick:()=>e(!0),children:"Eraser pen"}),t(d,{isOpen:o,onClose:()=>e(!1),element:r})]})};export{E as a};
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-MXZ6RXT3.js";import{b as i}from"./chunk-NX3CGW6Q.js";import{jsx as e,jsxs as m}from"react/jsx-runtime";var h=({store:r})=>{let s=t=>{r.editor?.objectsHandler.createPathElement(t.path)},l=t=>{r.editor?.objectsHandler.createShapeElement(t.type)};return e("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"auto"},children:i.map((t,n)=>m("div",{className:"category",children:[e("div",{className:o("category-name","text-base px-2 mt-2"),children:t.name},t.name),e("div",{className:o("shape-list","flex flex-wrap content-start mb-2"),children:t.children.map((a,c)=>e("div",{className:o("shape-item","w-[25%] h-0 pb-[25%] relative cursor-pointer shrink-0 mb-[1.2%]"),onClick:()=>{a.type?l(a):s(a)},children:e("div",{className:o("shape-content","absolute inset-0 flex justify-center items-center"),children:e("svg",{overflow:"visible",width:"50",height:"50",children:e("g",{transform:`scale(${50/a.viewBox[0]}, ${50/a.viewBox[1]}) translate(0,0) matrix(1,0,0,1,0,0)`,children:e("path",{className:"shape-path",d:a.path,fill:"#ccc",strokeMiterlimit:8,strokeLinecap:"butt"})})})})},c))})]},n))})};export{h as a};
@@ -1 +0,0 @@
1
- import{Layers as x}from"lucide-react";import{Popover as m,Button as n,Divider as o}from"antd";import{observer as r}from"mobx-react-lite";import{ChevronUp as v,ChevronsUp as g,ChevronDown as y,ChevronsDown as k,AlignStartVertical as w,AlignCenterVertical as f,AlignEndVertical as z,AlignStartHorizontal as b,AlignCenterHorizontal as u,AlignEndHorizontal as B,AlignVerticalSpaceAround as C,AlignHorizontalSpaceAround as h}from"lucide-react";import{Fragment as a,jsx as t,jsxs as l}from"react/jsx-runtime";var D=r(({store:e})=>{let d=e.selectedElements.length>0,i=e.selectedElementsIds,s=e.selectedElements.every(p=>p?.locked),c=!s&&e.selectedElements.length>1;return t(m,{styles:{container:{padding:"10px 5px"}},content:l("div",{style:{width:280},children:[t(o,{size:"small",children:"layering"}),l("div",{style:{display:"flex"},children:[l("div",{style:{width:"50%"},children:[t(n,{type:"text",block:!0,icon:t(v,{size:16}),disabled:!e.canMoveElementsUp(i),onClick:()=>{e.moveElementsUp(i)},children:t("span",{className:"w-[70px] text-left text-xs",children:"Forward"})}),t(n,{type:"text",block:!0,icon:t(g,{size:16}),disabled:!e.canMoveElementsTop(i),onClick:()=>{e.moveElementsTop(i)},children:t("span",{className:"w-[70px] text-left text-xs",children:"To Front"})})]}),l("div",{style:{width:"50%"},children:[t(n,{type:"text",block:!0,icon:t(y,{size:16}),disabled:!e.canMoveElementsDown(i),onClick:()=>{e.moveElementsDown(i)},children:t("span",{className:"w-[70px] text-left text-xs",children:"Backward"})}),t(n,{type:"text",block:!0,icon:t(k,{size:16}),disabled:!e.canMoveElementsBottom(i),onClick:()=>{e.moveElementsBottom(i)},children:t("span",{className:"w-[70px] text-left text-xs",children:"To Back"})})]})]}),!s&&l(a,{children:[t(o,{size:"small",children:"Position"}),l("div",{style:{display:"flex"},children:[l("div",{style:{width:"50%"},children:[t(n,{type:"text",block:!0,icon:t(w,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignLeft()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align left"})}),t(n,{type:"text",block:!0,icon:t(f,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignCenter()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align center"})}),t(n,{type:"text",block:!0,icon:t(z,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignRight()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align right"})})]}),l("div",{style:{width:"50%"},children:[t(n,{type:"text",block:!0,icon:t(b,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignTop()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align top"})}),t(n,{type:"text",block:!0,icon:t(u,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignMiddle()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align middle"})}),t(n,{type:"text",block:!0,icon:t(B,{size:16}),onClick:()=>{e.editor?.alignmentHandler.alignBottom()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Align bottom"})})]})]})]}),c&&l(a,{children:[t(o,{size:"small",children:"Space evenly"}),l("div",{style:{display:"flex"},children:[t("div",{style:{width:"50%"},children:t(n,{type:"text",block:!0,icon:t(C,{size:16}),onClick:()=>{e.editor?.alignmentHandler.yequation()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Vertically"})})}),t("div",{style:{width:"50%"},children:t(n,{type:"text",block:!0,icon:t(h,{size:16}),onClick:()=>{e.editor?.alignmentHandler.xequation()},children:t("span",{className:"w-[70px] text-left text-xs",children:"Horizontally"})})})]})]})]}),trigger:"click",placement:"bottom",children:l(n,{type:"text",disabled:!d,styles:{root:{padding:"0 7px"}},children:[t(x,{size:16})," Position"]})})});export{D as a};
@@ -1 +0,0 @@
1
- import{b as e,c as i,d as o,e as n,f as L,g as a,h as r,i as d,j as h}from"./chunk-7NNOHYKX.js";var p=(t=>(t.ROUND_RECT="roundRect",t.ROUND_RECT_DIAGONAL="roundRectDiagonal",t.ROUND_RECT_SINGLE="roundRectSingle",t.ROUND_RECT_SAMESIDE="roundRectSameSide",t.CUT_RECT_DIAGONAL="cutRectDiagonal",t.CUT_RECT_SINGLE="cutRectSingle",t.CUT_RECT_SAMESIDE="cutRectSameSide",t.MESSAGE="message",t.ROUND_MESSAGE="roundMessage",t.L="L",t.RING_RECT="ringRect",t.PLUS="plus",t.TRIANGLE="triangle",t.PARALLELOGRAM_LEFT="parallelogramLeft",t.PARALLELOGRAM_RIGHT="parallelogramRight",t.TRAPEZOID="trapezoid",t.BULLET="bullet",t.INDICATOR="indicator",t))(p||{}),l=[{name:"\u57FA\u7840",children:[{viewBox:[200,200],path:"M 0 0 L 200 0 L 200 200 L 0 200 Z",type:"rect"},{viewBox:[200,200],path:e({width:200,height:200}),type:"circle"},{viewBox:[200,200],path:"M 0,100 A 100,50 0 1 1 200,100 A 100,50 0 1 1 0,100 Z",type:"ellipse"},{viewBox:[200,200],path:"M 100,50 L 200,150 L 0,150 Z",type:"triangle"}]},{name:"\u77E9\u5F62",children:[{viewBox:[200,200],path:"M 50 0 L 150 0 Q 200 0 200 50 L 200 150 Q 200 200 150 200 L 50 200 Q 0 200 0 150 L 0 50 Q 0 0 50 0 Z"},{viewBox:[200,200],path:"M 0 150 L 0 0 L 150 0 L 200 50 L 200 200 L 50 200 Z"},{viewBox:[200,200],path:"M 0 200 L 0 0 L 150 0 L 200 50 L 200 200 Z"},{viewBox:[200,200],path:"M 0 50 L 50 0 L 150 0 L 200 50 L 200 200 L 0 200 Z"},{viewBox:[200,200],path:"M 0 0 L 150 0 Q 200 0 200 50 L 200 200 L 50 200 Q 0 200 0 150 L 0 0 Z"},{viewBox:[200,200],path:"M 0 0 L 150 0 Q 200 0 200 50 L 200 200 L 0 200 L 0 0 Z"},{viewBox:[200,200],path:"M 0 50 Q 0 0 50 0 L 150 0 Q 200 0 200 50 L 200 200 L 0 200 Z"}]},{name:"\u5E38\u7528\u5F62\u72B6",children:[{viewBox:[200,200],path:i({width:200,height:200})},{viewBox:[200,200],path:o({width:200,height:200})},{viewBox:[200,200],path:n({width:200,height:200})},{viewBox:[200,200],path:L({width:200,height:200})},{viewBox:[200,200],path:a({width:200,height:200})},{viewBox:[200,200],path:r({width:200,height:200})},{viewBox:[200,200],path:d({width:200,height:200})},{viewBox:[200,200],path:h({width:200,height:200})}]}],c=[{path:"M 0 0 L 20 20",style:"solid",points:["",""],data:[{x:0,y:0},{x:200,y:0}]}],w=[{name:"\u76F4\u7EBF",children:[{path:"M 0 0 L 20 20",style:"solid",points:["",""],data:[{x:0,y:0},{x:200,y:0}]},{path:"M 0 0 L 20 20",style:"dashed",points:["",""],data:[{x:0,y:0},{x:200,y:0}]},{path:"M 0 0 L 20 20",style:"solid",points:["","arrow"],data:[{x:0,y:0},{x:200,y:0}]},{path:"M 0 0 L 20 20",style:"dashed",points:["","arrow"],data:[{x:0,y:0},{x:200,y:0}]},{path:"M 0 0 L 20 20",style:"solid",points:["","dot"],data:[{x:0,y:0},{x:200,y:0}]}]},{name:"\u6298\u7EBF\u3001\u66F2\u7EBF",children:[{path:"M 0 0 L 0 20 L 20 20",style:"solid",points:["","arrow"],isBroken:!0,data:[{x:0,y:0},{x:0,y:100},{x:200,y:100}]},{path:"M 0 0 Q 0 20 20 20",style:"solid",points:["","arrow"],isCurve:!0,data:[{x:0,y:0},{x:200,y:0}]},{path:"M 0 0 C 20 0 0 20 20 20",style:"solid",points:["","arrow"],isCubic:!0,data:[{x:0,y:0},{x:200,y:0}]}]}];export{p as a,l as b,c,w as d};
@@ -1 +0,0 @@
1
- import{observer as o}from"mobx-react-lite";import{Popover as e,Button as r}from"antd";import{Pencil as i}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var s=o(()=>t(e,{trigger:"click",content:t("div",{children:"AI write"}),children:t(r,{type:"text",icon:t(i,{size:16,style:{display:"flex"}}),styles:{root:{padding:"0 7px"}},children:"AI write"})}));export{s as a};
@@ -1 +0,0 @@
1
- import{Button as o}from"antd";import{jsx as l,jsxs as i}from"react/jsx-runtime";var a=({store:t})=>i("div",{onClick:()=>{console.log("TemplatesPanel",t)},style:{display:"flex",flexDirection:"column",gap:10},children:["\u6A21\u677F\u4E2D\u5FC3",l(o,{onClick:()=>{},children:"\u6DFB\u52A0\u6587\u5B57"}),l(o,{onClick:()=>{let e=t.editor?.customCanvas.canvas.getActiveObject();if(e){let{selectionStart:n,selectionEnd:c}=e;n!==c?(console.log("\u6709\u5C40\u90E8\u6587\u5B57\u9009\u4E2D"),e.setSelectionStyles({fill:"red"},n,c)):e.set({fill:"red"}),t.editor?.customCanvas.canvas.requestRenderAll()}},children:"\u8BBE\u7F6E\u5C40\u90E8\u6587\u5B57\u4E3A\u7EA2\u8272"}),l(o,{children:"\u6DFB\u52A0\u56FE\u7247"})]});export{a};
@@ -1 +0,0 @@
1
- import{a as t}from"./chunk-IUFYYEGO.js";import{Trash2 as p}from"lucide-react";import{Tooltip as i,Button as s}from"antd";import{observer as l}from"mobx-react-lite";import{jsx as o}from"react/jsx-runtime";var T=l(({store:e})=>{let{disabled:r,remove:m}=t({store:e});return o(i,{title:"Remove",placement:"bottom",children:o(s,{type:"text",styles:{root:{padding:"0 7px"}},disabled:r,onClick:()=>{m()},children:o(p,{size:16})})})});export{T as a};
@@ -1,3 +0,0 @@
1
- import{a as x}from"./chunk-CB23VFSC.js";import{b as k}from"./chunk-3TO57JPN.js";import{a as b}from"./chunk-M4S26KQG.js";import{a as I}from"./chunk-EOBIVNFF.js";import{a as y,b as u}from"./chunk-YRJUN267.js";import{a as f}from"./chunk-4HEMGHOQ.js";import{a as v}from"./chunk-CS6Z4TQU.js";import{a as p}from"./chunk-MXZ6RXT3.js";import{b as h}from"./chunk-NX3CGW6Q.js";import{k as g,l as d}from"./chunk-7NNOHYKX.js";import{observer as m}from"mobx-react-lite";import{Button as c,Tooltip as T,Popover as P}from"antd";import{Crop as S}from"lucide-react";import w from"styled-components";import{jsx as o}from"react/jsx-runtime";var F=Object.keys(g),E=[{width:300,height:300,fill:"lightgray",stroke:"#0c0c0c",strokeWidth:0,url:""}],C=[];F.forEach(t=>{E.forEach(e=>{C.push(Object.assign({subType:t},e))})});C.forEach(t=>{t.url=x(d(t))});var B=w.div`
2
- height: 220px;
3
- `,l={root:{padding:"0 7px"}},R=({element:t,store:e})=>o(c,{type:"text",styles:l,onClick:async()=>{let i=e.width+2*e.bleed,s=e.height+2*e.bleed,r=t.getOriginalSize(),a={width:r.width,height:r.height},n=k({width:i,height:s},a);t.set({cropX:n.cropX,cropY:n.cropY,width:n.width,height:n.height,scaleX:i/n.width,scaleY:s/n.height,left:-e.bleed,top:-e.bleed}),t.setCoords(),e.editor?.customCanvas?.canvas?.requestRenderAll()},children:"Fit to page"}),H=m(({element:t,store:e})=>o(T,{title:"Crop",children:o(c,{type:"text",styles:{root:{padding:"0 7px"}},onClick:()=>{let i=e.editor?.layerHandler.getLayer();e.editor?.imageCropHandler.cropStart(t,i,t.getSrc())},children:o(S,{size:16})})})),U=m(({element:t,store:e})=>{let i=h.reduce((r,a)=>r.concat(a.children),[]),s=Math.ceil(i.length/4)||1;return t.clipPath?o(c,{type:"text",styles:l,onClick:()=>{t.set({clipPath:null}),e.editor?.customCanvas?.canvas?.requestRenderAll(),e._triggerUpdate()},children:"Remove mask"}):o(P,{styles:{container:{padding:"5px 10px"}},content:o("div",{style:{maxHeight:313,overflowY:"auto"},children:o(B,{style:{height:80*s,width:300},children:o("div",{className:p("shape-list","flex flex-wrap content-start mb-2"),children:i.map((r,a)=>o("div",{className:p("shape-item","w-[25%] h-0 pb-[25%] relative cursor-pointer shrink-0 mb-[1.2%]"),onClick:()=>{e.editor?.objectsHandler.createMaskElement(t,r),e._triggerUpdate()},children:o("div",{className:p("shape-content","absolute inset-0 flex justify-center items-center"),children:o("svg",{overflow:"visible",width:"50",height:"50",children:o("g",{transform:`scale(${50/r.viewBox[0]}, ${50/r.viewBox[1]}) translate(0,0) matrix(1,0,0,1,0,0)`,children:o("path",{className:"shape-path",d:r.path,fill:"#ccc",strokeMiterlimit:8,strokeLinecap:"butt"})})})})},a))})})}),trigger:"click",children:o(c,{type:"text",styles:l,children:"Apply mask"})})}),A={ImageFlip:v,ImageFilters:f,ImageFitToBackground:R,ImageCrop:H,ImageClip:U,ImageRemoveBackground:I,ImageEraserPen:b},L=m(({store:t,components:e})=>{let i=t.selectedElements,r=y({type:"text",usedItems:["ImageFlip","ImageFilters","ImageFitToBackground","ImageClip","ImageCrop","ImageRemoveBackground","ImageEraserPen"],components:e});return o(u,{items:r,itemRender:a=>{let n=e[a]||A[a];return n&&o(n,{elements:i,element:i[0],store:t},a)}})}),K=L;export{R as a,H as b,U as c,L as d,K as e};
@@ -1 +0,0 @@
1
- import{jsx as e}from"react/jsx-runtime";var r=({store:o})=>(console.log("BackgroundPanel",o),e("div",{children:"\u80CC\u666F"}));export{r as a};
@@ -1 +0,0 @@
1
- import{jsx as o}from"react/jsx-runtime";var r=({store:e})=>(console.log("SizePanel",e),o("div",{children:"\u5C3A\u5BF8\u8C03\u6574"}));export{r as a};
@@ -1,16 +0,0 @@
1
- import{a as k}from"./chunk-MNACXCF5.js";import{a as N}from"./chunk-R6Z6F447.js";import{c as x}from"./chunk-6BG6R2IO.js";import{a as B}from"./chunk-4FFLRF6N.js";import{d as R}from"./chunk-RFPYC6DZ.js";import{a as H}from"./chunk-GYDTKPW5.js";import{a as S}from"./chunk-XRRO2RT7.js";import{a as E}from"./chunk-3TTTJUTT.js";import{a as h}from"./chunk-ZVWJRZOZ.js";import{b as T}from"./chunk-B35ZYWID.js";import{a as C}from"./chunk-H67HTXU4.js";import{e as n}from"./chunk-CRTMZEJE.js";import y from"styled-components";import{useRef as K}from"react";import{Tooltip as w,Button as D}from"antd";import{Undo2 as M,Redo2 as X}from"lucide-react";import{observer as _}from"mobx-react-lite";import{useEffect as q}from"react";import{jsx as i,jsxs as J}from"react/jsx-runtime";var G=_(({store:o})=>(q(()=>{},[o._updateHistory]),J(u,{style:{float:"left",paddingRight:10},children:[i(w,{title:"\u64A4\u9500",placement:"bottom",children:i(D,{type:"text",disabled:!o.editor?.historyHandler.canUndo(),styles:{root:{padding:"0 7px"}},onClick:()=>{o.editor?.historyHandler.undo()},children:i(M,{size:16})})}),i(w,{title:"\u91CD\u505A",placement:"bottom",children:i(D,{type:"text",disabled:!o.editor?.historyHandler.canRedo(),styles:{root:{padding:"0 7px"}},onClick:()=>{o.editor?.historyHandler.redo()},children:i(X,{size:16})})})]})));import{observer as Q}from"mobx-react-lite";import{Button as P,Divider as V,Space as W}from"antd";import{Check as Y,X as Z}from"lucide-react";import{Fragment as ro,jsx as e,jsxs as l}from"react/jsx-runtime";var $=y.div`
2
- white-space: nowrap;
3
-
4
- height: 50px;
5
- padding: 0 15px;
6
- position: relative;
7
- width: 100%;
8
- z-index: 10;
9
- `,oo=y.div`
10
- width: 100%;
11
- height: 100%;
12
- `,u=y.div`
13
- align-items: center;
14
- display: flex;
15
- height: 50px;
16
- `,to=({store:o})=>l(W,{style:{height:50},children:[l(P,{onClick:()=>{o.editor?.imageCropHandler.cropImg.onDeselectEvent()},children:[e(Y,{size:16}),"\u5B8C\u6210"]}),l(P,{onClick:()=>{o.editor?.imageCropHandler.cropCancel()},children:[e(Z,{size:16}),"\u53D6\u6D88"]})]}),c={textbox:x,image:R,path:n,rect:n,circle:n,ellipse:n,triangle:n,cropimage:to,many:S};function wo(o,d){c[o]=d}var eo=Q(({store:o,downloadButtonEnabled:d,components:p={}})=>{let z=new Set(o.selectedElements.map(r=>r?.type)).size===1,f=o.selectedElements.length===1,a=o.selectedElements[0],g=o.selectedElements.length&&o.selectedElements.every(r=>r?.locked),v=f&&a?.isCropping,s=f&&c[a?.type];z?s=c[a?.type]:o.selectedElements.length>1&&(s=c.many);let m=K(p);(Object.keys(p).some(r=>p[r]!==m.current[r])||Object.keys(m.current).some(r=>!(r in p)))&&(m.current=Object.assign({},p));let t=m.current,b=t?.ActionControls||(d?T:null),O=t?.Position||k,I=t?.Opacity||E,L=t?.Lock||H,j=t?.Duplicate||C,A=t?.Remove||N,F=t?.History||G,U=t?.Group||B;return e($,{className:"bp5-navbar design-toolbar",children:l(oo,{children:[!v&&e(F,{store:o}),!a&&e(h,{store:o,components:t}),s&&!g&&e(s,{store:o,components:t}),!v&&l(u,{style:{float:"right"},children:[e(U,{store:o}),e(O,{store:o}),!g&&e(I,{store:o}),e(L,{store:o}),e(j,{store:o}),e(A,{store:o}),b&&l(ro,{children:[e(V,{orientation:"vertical",style:{margin:"0 15px"}}),e(b,{store:o})]})]})]})})}),Do=eo;export{u as a,wo as b,eo as c,Do as d,G as e};
@@ -1 +0,0 @@
1
- import{a as y}from"./chunk-OQ6HU62L.js";import{a as g,b as m}from"./chunk-YRJUN267.js";import{a as p,b as k}from"./chunk-RVXI723F.js";import{ColorPicker as S,Tooltip as h,Button as P}from"antd";import{CirclePlus as T}from"lucide-react";import{useState as b,useRef as C,useMemo as F}from"react";import{cssGradient2FabricGradient as w}from"@ydesign/core";import{observer as A}from"mobx-react-lite";import{jsx as t,jsxs as u}from"react/jsx-runtime";var B=async e=>y(e),c=e=>e?typeof e=="string"?e:e.colorStops?JSON.stringify(e.colorStops):JSON.stringify(e):"",H=A(({store:e})=>{let r=e.editor?.workareaHandler.workarea?.fill,[o,n]=b(()=>p(r)),i=C(!1),a=C(c(r)),f=c(r);f!==a.current&&!i.current&&(a.current=f,n(p(r)));let x=F(()=>o,[c(o)]);return t(h,{title:"\u80CC\u666F\u989C\u8272",children:t("div",{style:{height:32},children:t(S,{value:x,allowClear:!0,mode:["single","gradient"],onOpenChange:l=>{i.current=l,l||(a.current=c(r))},onChange:l=>{n(l)},onChangeComplete:l=>{let d=l.toCssString();if(d.includes("gradient")){let v=w(d);e.editor?.workareaHandler.setWorkareaBgColor(v)}else e.editor?.workareaHandler.setWorkareaBgColor(d)}})})})}),I=({store:e})=>t("div",{children:u("label",{htmlFor:"input-file",children:[u(P,{type:"text",styles:{root:{padding:"0 8px"}},onClick:()=>{document.querySelector("#input-file")?.click()},children:[t(T,{size:16})," add image"]}),t("input",{type:"file",id:"input-file",style:{display:"none"},onChange:async r=>{let{target:o}=r;if(!(!o.files||o.files.length===0)){for(let n of o.files){let a={type:"image",src:await B(n)};e.editor?.objectsHandler.add(a)}o.value=""}},multiple:!0,accept:"image/*"})]})}),R=({store:e})=>t("div",{children:u(P,{type:"text",styles:{root:{padding:"0 8px"}},onClick:()=>{e.editor?.objectsHandler.add({originX:"left",originY:"top",fontSize:100,textAlign:"left",fill:k(),text:"Hello World",type:"textbox"})},children:[t(T,{size:16}),"add text"]})}),D={DefaultBackgroundPicker:H,DefaultAddImage:I,DefaultAddText:R},E=({store:e,components:s})=>{let o=g({type:"text",usedItems:["DefaultBackgroundPicker","DefaultAddImage","DefaultAddText"],components:s});return t(m,{items:o,itemRender:n=>{let i=s[n]||D[n];return i&&t(i,{store:e},n)}})},V=E;export{E as a,V as b};