@ydesign/react-editor 0.0.2 → 0.0.3
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.
- package/LICENSE +1 -1
- package/dist/app.css +2 -2
- package/dist/app.d.ts +4 -4
- package/dist/app.js +2 -2
- package/dist/chunk-3TO57JPN.js +1 -0
- package/dist/chunk-3TTTJUTT.js +1 -0
- package/dist/chunk-4FFLRF6N.js +1 -0
- package/dist/{chunk-V5RJX32O.js → chunk-4HEMGHOQ.js} +1 -1
- package/dist/chunk-6BG6R2IO.js +7 -0
- package/dist/chunk-7NNOHYKX.js +15 -0
- package/dist/chunk-CB23VFSC.js +1 -0
- package/dist/chunk-CRTMZEJE.js +1 -0
- package/dist/{chunk-GMISU6MD.js → chunk-CS6Z4TQU.js} +1 -1
- package/dist/chunk-EOBIVNFF.js +1 -0
- package/dist/chunk-KLZXBPXI.js +1 -0
- package/dist/chunk-LCOWX5JR.js +1 -0
- package/dist/chunk-LHQI6WDJ.js +54 -0
- package/dist/chunk-M4S26KQG.js +1 -0
- package/dist/chunk-MCBL6QAP.js +1 -0
- package/dist/chunk-MXZ6RXT3.js +1 -0
- package/dist/chunk-NX3CGW6Q.js +1 -0
- package/dist/{chunk-FIAIYSJ7.js → chunk-PSXS4WMN.js} +1 -1
- package/dist/chunk-RFPYC6DZ.js +3 -0
- package/dist/chunk-RVXI723F.js +1 -0
- package/dist/{chunk-JWQ2DUXA.js → chunk-WCHGSVUC.js} +1 -1
- package/dist/{chunk-3HQUN5MA.js → chunk-YRJUN267.js} +1 -1
- package/dist/chunk-YVRHDXYK.js +16 -0
- package/dist/chunk-ZVWJRZOZ.js +1 -0
- package/dist/config.d.ts +52 -1
- package/dist/config.js +1 -0
- package/dist/lib/utils.js +1 -1
- package/dist/model/store.d.ts +15 -0
- package/dist/model/store.js +1 -1
- package/dist/project.d.ts +8 -1
- package/dist/project.js +1 -1
- package/dist/side-panel/images-grid.d.ts +24 -0
- package/dist/side-panel/images-grid.js +41 -0
- package/dist/side-panel/index.js +1 -1
- package/dist/side-panel/shapes-panel.js +1 -1
- package/dist/side-panel/side-panel.js +1 -1
- package/dist/toolbar/default-toolbar.js +1 -1
- package/dist/toolbar/element-container.js +1 -1
- package/dist/toolbar/figure-toolbar.d.ts +29 -0
- package/dist/toolbar/figure-toolbar.js +1 -0
- package/dist/toolbar/filters-picker.js +1 -1
- package/dist/toolbar/flip-button.js +1 -1
- package/dist/toolbar/group-button.js +1 -1
- package/dist/toolbar/history-buttons.js +1 -1
- package/dist/toolbar/image-eraser-pen.d.ts +4 -1
- package/dist/toolbar/image-eraser-pen.js +1 -1
- package/dist/toolbar/image-remove-background.d.ts +4 -1
- package/dist/toolbar/image-remove-background.js +1 -1
- package/dist/toolbar/image-toolbar.d.ts +8 -2
- package/dist/toolbar/image-toolbar.js +1 -1
- package/dist/toolbar/opacity-picker.js +1 -1
- package/dist/toolbar/text-ai-write.js +1 -1
- package/dist/toolbar/text-toolbar.js +1 -1
- package/dist/toolbar/toolbar.d.ts +2 -2
- package/dist/toolbar/toolbar.js +1 -1
- package/dist/toolbar/zoom-buttons.js +2 -2
- package/dist/topbar/file-menu.d.ts +10 -0
- package/dist/topbar/file-menu.js +1 -0
- package/dist/topbar/topbar.d.ts +12 -0
- package/dist/topbar/topbar.js +28 -0
- package/dist/utils/figure-to-svg.d.ts +36 -0
- package/dist/utils/figure-to-svg.js +1 -0
- package/dist/utils/image.d.ts +9 -3
- package/dist/utils/image.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/screen.js +1 -1
- package/dist/utils/svg.d.ts +3 -0
- package/dist/utils/svg.js +1 -0
- package/package.json +10 -2
- package/dist/chunk-2AWYWIIK.js +0 -1
- package/dist/chunk-55FJG4FK.js +0 -1
- package/dist/chunk-5MWZMSER.js +0 -1
- package/dist/chunk-7LU5UGIG.js +0 -16
- package/dist/chunk-E7ZSWHPU.js +0 -1
- package/dist/chunk-EMAFC3HG.js +0 -1
- package/dist/chunk-JW76IC3E.js +0 -1
- package/dist/chunk-TE6HYOIP.js +0 -7
- package/dist/chunk-U7HIFGXC.js +0 -1
- package/dist/chunk-V6ZZKUTN.js +0 -1
- package/dist/chunk-XDLFQXMN.js +0 -54
- package/dist/chunk-XZAP76LL.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FabricObject } from '@ydesign/core';
|
|
3
|
+
|
|
4
|
+
type Props<ImageType> = {
|
|
5
|
+
images: ImageType[] | undefined;
|
|
6
|
+
onSelect: (image: ImageType, pos?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, element?: FabricObject | undefined, event?: any) => void;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
getPreview: (image: ImageType) => string;
|
|
12
|
+
loadMore?: false | undefined | null | (() => void);
|
|
13
|
+
getCredit?: (image: ImageType) => any;
|
|
14
|
+
getImageClassName?: (image: ImageType) => string;
|
|
15
|
+
rowsNumber?: number;
|
|
16
|
+
crossOrigin?: string;
|
|
17
|
+
shadowEnabled?: boolean;
|
|
18
|
+
itemHeight?: number;
|
|
19
|
+
error?: any;
|
|
20
|
+
hideNoResults?: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare const ImagesGrid: <ImageType>({ images, rowsNumber, isLoading, getPreview, getCredit, getImageClassName, onSelect, crossOrigin, shadowEnabled, itemHeight, error, hideNoResults, }: Props<ImageType>) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { ImagesGrid };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{c as w}from"../chunk-WCHGSVUC.js";import"../chunk-O2XFH626.js";import a from"styled-components";import{useRef as v,useEffect as O}from"react";import{Spin as $}from"antd";import{jsx as o,jsxs as u}from"react/jsx-runtime";var D=a.div`
|
|
2
|
+
height: 100%;
|
|
3
|
+
overflow: auto;
|
|
4
|
+
`,W=a.div`
|
|
5
|
+
width: 33%;
|
|
6
|
+
float: left;
|
|
7
|
+
`,j=a.div`
|
|
8
|
+
padding: 6px;
|
|
9
|
+
width: 100%;
|
|
10
|
+
&:hover .credit {
|
|
11
|
+
opacity: 1;
|
|
12
|
+
}
|
|
13
|
+
${w(".credit {opacity: 1;}")}
|
|
14
|
+
`,P=a.div`
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
position: relative;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
box-shadow: ${e=>e.$dataShadowenabled?"0 0 5px rgba(16, 22, 26, 0.3)":""};
|
|
19
|
+
`,z=a.img`
|
|
20
|
+
width: 100%;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
display: block;
|
|
23
|
+
max-height: 300px;
|
|
24
|
+
min-height: 50px;
|
|
25
|
+
object-fit: contain;
|
|
26
|
+
`,F=a.div`
|
|
27
|
+
position: absolute;
|
|
28
|
+
bottom: 0px;
|
|
29
|
+
left: 0px;
|
|
30
|
+
font-size: 10px;
|
|
31
|
+
padding: 3px;
|
|
32
|
+
padding-top: 10px;
|
|
33
|
+
text-align: center;
|
|
34
|
+
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6));
|
|
35
|
+
width: 100%;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
color: white;
|
|
38
|
+
`,I=a.p`
|
|
39
|
+
text-align: center;
|
|
40
|
+
padding: 30px;
|
|
41
|
+
`,H=({url:e,onSelect:d,shadowEnabled:i,className:g,itemHeight:r,crossOrigin:s,onLoad:m,credit:l})=>o(j,{className:"ydesign-close-panel",onClick:d,children:u(P,{$dataShadowenabled:i,children:[o(z,{className:g,style:{height:r??"auto "},src:e,draggable:!0,loading:"lazy",crossOrigin:s,onLoad:m}),l&&o(F,{className:"credit",children:l})]})}),B=({images:e,rowsNumber:d,isLoading:i,getPreview:g,getCredit:r,getImageClassName:s,onSelect:m,crossOrigin:l="anonymous",shadowEnabled:x,itemHeight:N,error:b,hideNoResults:S=!1})=>{let p=d||2,T=v(null),y=[];for(let t=0;t<p;t++)y.push((e||[]).filter((h,n)=>n%p===t));let c=v(null),f=()=>{},R=()=>{f()};return O(()=>(f(),()=>{c.current&&(window.clearTimeout(c.current),c.current=null)}),[e?.length,i]),u(D,{ref:T,onScroll:t=>{console.log(t)},children:[y.map((t,h)=>u(W,{style:{width:100/p+"%"},children:[t.map((n,C)=>o(H,{image:n,url:g(n),onSelect:(L,k,E)=>{m(n,L,k,E)},credit:r&&r(n),crossOrigin:l,shadowEnabled:x,itemHeight:N,className:s&&s(n),onLoad:R},C)),i&&o("div",{style:{padding:30},children:o($,{})})]},h)),!i&&(!e||!e.length)&&!b&&!S&&o(I,{children:"No results found"}),b&&o(I,{children:"Loading is failed..."})]})};export{B as ImagesGrid};
|
package/dist/side-panel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as e,c as f,d as m,e as p,f as t,g as x,h as a,i as b,j as c}from"../chunk-
|
|
1
|
+
import{a as r,b as e,c as f,d as m,e as p,f as t,g as x,h as a,i as b,j as c}from"../chunk-LHQI6WDJ.js";import"../chunk-MCBL6QAP.js";import"../chunk-WIM26GEM.js";import{a as o}from"../chunk-LW2W4B2N.js";import"../chunk-QJBRJELT.js";import"../chunk-6LFGFFHI.js";import"../chunk-DBQHEZPG.js";import"../chunk-MXZ6RXT3.js";import"../chunk-TX4BNXQC.js";import"../chunk-WCHGSVUC.js";import"../chunk-M33EDDXB.js";import"../chunk-DJBTBRPS.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-O2XFH626.js";export{t as BackgroundSection,b as DEFAULT_SECTIONS,x as LayersSection,f as PhotosSection,o as SectionTab,m as ShapesSection,c as SidePanel,a as SizeSection,r as TemplatesSection,e as TextSection,p as UploadSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-MCBL6QAP.js";import"../chunk-MXZ6RXT3.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-O2XFH626.js";export{a as ShapesPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l}from"../chunk-
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l}from"../chunk-LHQI6WDJ.js";import"../chunk-MCBL6QAP.js";import"../chunk-WIM26GEM.js";import{a}from"../chunk-LW2W4B2N.js";import"../chunk-QJBRJELT.js";import"../chunk-6LFGFFHI.js";import"../chunk-DBQHEZPG.js";import"../chunk-MXZ6RXT3.js";import"../chunk-TX4BNXQC.js";import"../chunk-WCHGSVUC.js";import"../chunk-M33EDDXB.js";import"../chunk-DJBTBRPS.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-O2XFH626.js";export{g as BackgroundSection,j as DEFAULT_SECTIONS,h as LayersSection,d as PhotosSection,a as SectionTab,e as ShapesSection,k as SidePanel,i as SizeSection,b as TemplatesSection,c as TextSection,f as UploadSection,l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-ZVWJRZOZ.js";import"../chunk-OQ6HU62L.js";import"../chunk-YRJUN267.js";import"../chunk-RVXI723F.js";import"../chunk-WCHGSVUC.js";import"../chunk-O2XFH626.js";export{a as DefaultToolbar,b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-YRJUN267.js";import"../chunk-WCHGSVUC.js";import"../chunk-O2XFH626.js";export{b as ElementContainer,a as extendToolbar};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoreType } from '../model/store.js';
|
|
3
|
+
import { FabricObject } from '@ydesign/core';
|
|
4
|
+
import 'mobx-state-tree';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
store: StoreType;
|
|
8
|
+
components?: any;
|
|
9
|
+
};
|
|
10
|
+
type ButtonProps = {
|
|
11
|
+
element?: FabricObject;
|
|
12
|
+
store: StoreType;
|
|
13
|
+
elements: FabricObject[];
|
|
14
|
+
};
|
|
15
|
+
declare const getFillKey: (fill: any) => string;
|
|
16
|
+
declare const FigureFill: (({ store, elements }: ButtonProps) => react_jsx_runtime.JSX.Element) & {
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
declare const FigureSettings: (({ store, element }: ButtonProps) => react_jsx_runtime.JSX.Element) & {
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
declare const FigureStroke: (({ store, elements }: ButtonProps) => react_jsx_runtime.JSX.Element | null) & {
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
declare const FigureToolbar: (({ store, components }: Props) => react_jsx_runtime.JSX.Element) & {
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { FigureFill, FigureSettings, FigureStroke, FigureToolbar, getFillKey };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-CRTMZEJE.js";import"../chunk-YRJUN267.js";import"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-WCHGSVUC.js";import"../chunk-O2XFH626.js";export{b as FigureFill,c as FigureSettings,d as FigureStroke,e as FigureToolbar,a as getFillKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-O2XFH626.js";export{a as FiltersPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-CS6Z4TQU.js";import"../chunk-O2XFH626.js";export{a as FlipButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-4FFLRF6N.js";import"../chunk-O2XFH626.js";export{a as GroupButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"../chunk-
|
|
1
|
+
import{e as a}from"../chunk-YVRHDXYK.js";import"../chunk-MNACXCF5.js";import"../chunk-R6Z6F447.js";import"../chunk-6BG6R2IO.js";import"../chunk-PSXS4WMN.js";import"../chunk-4FFLRF6N.js";import"../chunk-RFPYC6DZ.js";import"../chunk-CB23VFSC.js";import"../chunk-3TO57JPN.js";import"../chunk-M4S26KQG.js";import"../chunk-EOBIVNFF.js";import"../chunk-GYDTKPW5.js";import"../chunk-XRRO2RT7.js";import"../chunk-3TTTJUTT.js";import"../chunk-ZVWJRZOZ.js";import"../chunk-OQ6HU62L.js";import"../chunk-B35ZYWID.js";import"../chunk-H67HTXU4.js";import"../chunk-CRTMZEJE.js";import"../chunk-YRJUN267.js";import"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-CS6Z4TQU.js";import"../chunk-IUFYYEGO.js";import"../chunk-MXZ6RXT3.js";import"../chunk-WCHGSVUC.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-WJT6VPDR.js";import"../chunk-JMIN2XMC.js";import"../chunk-75WC3GVB.js";import"../chunk-O2XFH626.js";export{a as HistoryButtons};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FabricImage } from '@ydesign/core';
|
|
2
3
|
|
|
3
|
-
declare const ImageEraserPen: (
|
|
4
|
+
declare const ImageEraserPen: ({ element }: {
|
|
5
|
+
element: FabricImage;
|
|
6
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
4
7
|
|
|
5
8
|
export { ImageEraserPen };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-M4S26KQG.js";import"../chunk-O2XFH626.js";export{a as ImageEraserPen};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FabricImage } from '@ydesign/core';
|
|
2
3
|
|
|
3
|
-
declare const ImageRemoveBackground: (
|
|
4
|
+
declare const ImageRemoveBackground: ({ element }: {
|
|
5
|
+
element: FabricImage;
|
|
6
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
4
7
|
|
|
5
8
|
export { ImageRemoveBackground };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-EOBIVNFF.js";import"../chunk-O2XFH626.js";export{a as ImageRemoveBackground};
|
|
@@ -11,10 +11,16 @@ declare const ImageFitToBackground: ({ element, store }: {
|
|
|
11
11
|
element: FabricImage;
|
|
12
12
|
store: StoreType;
|
|
13
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
14
|
-
declare const ImageCrop: ((
|
|
14
|
+
declare const ImageCrop: (({ element, store }: {
|
|
15
|
+
element: FabricImage;
|
|
16
|
+
store: StoreType;
|
|
17
|
+
}) => react_jsx_runtime.JSX.Element) & {
|
|
15
18
|
displayName: string;
|
|
16
19
|
};
|
|
17
|
-
declare const ImageClip: ((
|
|
20
|
+
declare const ImageClip: (({ element, store }: {
|
|
21
|
+
element: FabricImage;
|
|
22
|
+
store: StoreType;
|
|
23
|
+
}) => react_jsx_runtime.JSX.Element) & {
|
|
18
24
|
displayName: string;
|
|
19
25
|
};
|
|
20
26
|
declare const ImageToolbar: (({ store, components }: Props) => react_jsx_runtime.JSX.Element) & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-RFPYC6DZ.js";import"../chunk-CB23VFSC.js";import"../chunk-3TO57JPN.js";import"../chunk-M4S26KQG.js";import"../chunk-EOBIVNFF.js";import"../chunk-YRJUN267.js";import"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-CS6Z4TQU.js";import"../chunk-MXZ6RXT3.js";import"../chunk-WCHGSVUC.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-O2XFH626.js";export{c as ImageClip,b as ImageCrop,a as ImageFitToBackground,d as ImageToolbar,e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-3TTTJUTT.js";import"../chunk-O2XFH626.js";export{a as OpacityPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-PSXS4WMN.js";import"../chunk-O2XFH626.js";export{a as TextAiWrite};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-6BG6R2IO.js";import"../chunk-PSXS4WMN.js";import"../chunk-YRJUN267.js";import"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-WCHGSVUC.js";import"../chunk-WJT6VPDR.js";import"../chunk-O2XFH626.js";export{a as ALIGN_OPTIONS,b as TextToolbar,c as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
3
3
|
import * as styled_components from 'styled-components';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { StoreType } from '../model/store.js';
|
|
6
6
|
import 'mobx-state-tree';
|
|
7
7
|
import '@ydesign/core';
|
|
8
8
|
|
|
9
|
-
declare const NavBarGroup:
|
|
9
|
+
declare const NavBarGroup: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
10
|
declare function registerToolbarComponent(type: string, reactComponent: any): void;
|
|
11
11
|
type ToolbarProps = {
|
|
12
12
|
store: StoreType;
|
package/dist/toolbar/toolbar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-YVRHDXYK.js";import"../chunk-MNACXCF5.js";import"../chunk-R6Z6F447.js";import"../chunk-6BG6R2IO.js";import"../chunk-PSXS4WMN.js";import"../chunk-4FFLRF6N.js";import"../chunk-RFPYC6DZ.js";import"../chunk-CB23VFSC.js";import"../chunk-3TO57JPN.js";import"../chunk-M4S26KQG.js";import"../chunk-EOBIVNFF.js";import"../chunk-GYDTKPW5.js";import"../chunk-XRRO2RT7.js";import"../chunk-3TTTJUTT.js";import"../chunk-ZVWJRZOZ.js";import"../chunk-OQ6HU62L.js";import"../chunk-B35ZYWID.js";import"../chunk-H67HTXU4.js";import"../chunk-CRTMZEJE.js";import"../chunk-YRJUN267.js";import"../chunk-4HEMGHOQ.js";import"../chunk-RVXI723F.js";import"../chunk-CS6Z4TQU.js";import"../chunk-IUFYYEGO.js";import"../chunk-MXZ6RXT3.js";import"../chunk-WCHGSVUC.js";import"../chunk-NX3CGW6Q.js";import"../chunk-7NNOHYKX.js";import"../chunk-WJT6VPDR.js";import"../chunk-JMIN2XMC.js";import"../chunk-75WC3GVB.js";import"../chunk-O2XFH626.js";export{a as NavBarGroup,c as Toolbar,d as default,b as registerToolbarComponent};
|
|
@@ -3,10 +3,10 @@ import"../chunk-O2XFH626.js";import{observer as S}from"mobx-react-lite";import m
|
|
|
3
3
|
height: 0px;
|
|
4
4
|
`,k=m.div`
|
|
5
5
|
position: absolute;
|
|
6
|
-
bottom:
|
|
6
|
+
bottom: 20px;
|
|
7
7
|
width: auto;
|
|
8
8
|
left: 50%;
|
|
9
9
|
transform: translateX(-50%);
|
|
10
10
|
border-radius: 5px;
|
|
11
11
|
overflow: hidden;
|
|
12
|
-
`,i=[.1,.25,.5,.75,1,1.5,2,3],y=i[i.length-1],b=i[0],v=S(({store:t})=>{let p=Math.max(y,t.scaleToFit),s=Math.min(b,t.scaleToFit),d=t.scale<p,c=t.scale>s,u=i.map((r,C)=>({key:C,label:o("div",{style:{minWidth:80,textAlign:"center"},onClick:()=>{t.editor?.zoomHandler.zoomToRatio(r)},children:`${Math.round(100*r)}%`})}));return n(B,{children:[n(a.Compact,{children:[o(e,{disabled:!c,onClick:()=>t.editor?.zoomHandler.
|
|
12
|
+
`,i=[.1,.25,.5,.75,1,1.5,2,3],y=i[i.length-1],b=i[0],v=S(({store:t})=>{let p=Math.max(y,t.scaleToFit),s=Math.min(b,t.scaleToFit),d=t.scale<p,c=t.scale>s,u=i.map((r,C)=>({key:C,label:o("div",{style:{minWidth:80,textAlign:"center"},onClick:()=>{t.editor?.zoomHandler.zoomToRatio(r)},children:`${Math.round(100*r)}%`})}));return n(B,{children:[n(a.Compact,{children:[o(e,{disabled:!c,onClick:()=>t.editor?.zoomHandler.zoomIn(),children:o(f,{size:16})}),o(M,{menu:{items:u},placement:"top",children:n(e,{children:[Math.round(100*t.scale),"%"]})}),o(e,{disabled:!d,onClick:()=>t.editor?.zoomHandler.zoomOut(),children:o(h,{size:16})})]}),n(a.Compact,{style:{marginLeft:10},children:[o(l,{title:"\u9002\u5408\u5C4F\u5E55",children:o(e,{onClick:()=>t.editor?.workareaHandler.auto(),children:o(x,{size:16})})}),o(l,{title:"\u586B\u6EE1\u5C4F\u5E55",children:o(e,{onClick:()=>t.editor?.workareaHandler.one(),children:o(z,{size:16})})})]})]})}),A=({store:t})=>o(T,{children:o(k,{children:o(v,{store:t})})}),E=A;export{A as ZoomButtons,v as ZoomGroup,E as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoreType } from '../model/store.js';
|
|
3
|
+
import 'mobx-state-tree';
|
|
4
|
+
import '@ydesign/core';
|
|
5
|
+
|
|
6
|
+
declare const FileMenu: ({ store }: {
|
|
7
|
+
store: StoreType;
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { FileMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-LCOWX5JR.js";import"../chunk-O2XFH626.js";export{a as FileMenu};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoreType } from '../model/store.js';
|
|
3
|
+
import 'mobx-state-tree';
|
|
4
|
+
import '@ydesign/core';
|
|
5
|
+
|
|
6
|
+
declare const Topbar: (({ store }: {
|
|
7
|
+
store: StoreType;
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element) & {
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { Topbar };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{a as n}from"../chunk-B35ZYWID.js";import{a}from"../chunk-LCOWX5JR.js";import{b as r}from"../chunk-KLZXBPXI.js";import"../chunk-WJT6VPDR.js";import"../chunk-O2XFH626.js";import o from"styled-components";import{observer as p}from"mobx-react-lite";import{Divider as l,Input as s,Tooltip as g,Button as m}from"antd";import{CloudUpload as h}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";var v=o("div")`
|
|
2
|
+
white-space: nowrap;
|
|
3
|
+
height: 50px;
|
|
4
|
+
padding: 0 15px;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
z-index: 10;
|
|
8
|
+
|
|
9
|
+
@media screen and (max-width: 500px) {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
overflow-y: hidden;
|
|
12
|
+
max-width: 100vw;
|
|
13
|
+
}
|
|
14
|
+
`,f=o("div")`
|
|
15
|
+
@media screen and (max-width: 500px) {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
`,c=o("div")`
|
|
19
|
+
float: left;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
height: 50px;
|
|
23
|
+
`,x=o("div")`
|
|
24
|
+
float: right;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
height: 50px;
|
|
28
|
+
`,y=p(({project:e})=>(console.log(e.status),t(g,{title:"\u4FDD\u5B58\u4F5C\u56FE\u8BB0\u5F55",children:t(m,{type:"text",style:{marginLeft:16},icon:t(h,{size:16,style:{display:"flex"}}),children:"Save"})}))),L=p(({store:e})=>{let d=r();return t(v,{className:"topbar border-b-1 border-b-gray-200",children:i(f,{children:[i(c,{children:[i("div",{style:{display:"flex",alignItems:"center",gap:10,paddingRight:8,paddingLeft:16},children:[t("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{width:"20",height:"20",fill:"blue"})}),t("span",{style:{fontWeight:500,fontSize:20,lineHeight:"100%",letterSpacing:.25},children:"Ydesign"})]}),t(l,{orientation:"vertical"}),t(a,{store:e}),t("div",{style:{paddingLeft:10,maxWidth:200},children:t(s,{placeholder:"Design name"})}),i("div",{style:{paddingLeft:16},className:"text-gray-600",children:[e.width," x ",e.height," px"]}),t(y,{project:d})]}),t(x,{children:t(n,{store:e})})]})})});export{L as Topbar};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface SizeParams {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
interface RectParams extends SizeParams {
|
|
6
|
+
cornerRadius?: number;
|
|
7
|
+
}
|
|
8
|
+
interface FigureParams extends SizeParams {
|
|
9
|
+
id?: string;
|
|
10
|
+
fill: string;
|
|
11
|
+
stroke: string;
|
|
12
|
+
strokeWidth: number;
|
|
13
|
+
dash?: number[];
|
|
14
|
+
subType: string;
|
|
15
|
+
cornerRadius?: number;
|
|
16
|
+
}
|
|
17
|
+
type PathResult = string | {
|
|
18
|
+
path: string;
|
|
19
|
+
scaleX: number;
|
|
20
|
+
scaleY: number;
|
|
21
|
+
};
|
|
22
|
+
type PathDataFunc = (params: FigureParams) => PathResult;
|
|
23
|
+
declare const rectData: ({ width, height, cornerRadius }: RectParams) => string;
|
|
24
|
+
declare const circleData: ({ width, height }: SizeParams) => string;
|
|
25
|
+
declare function starPath({ width: t, height: h }: SizeParams): string;
|
|
26
|
+
declare const triangleData: ({ width: t, height: h }: SizeParams) => string;
|
|
27
|
+
declare const rightTriangleData: ({ width: t, height: h }: SizeParams) => string;
|
|
28
|
+
declare function diamondPath({ width: t, height: h }: SizeParams): string;
|
|
29
|
+
declare function pentagonPath({ width: t, height: h }: SizeParams): string;
|
|
30
|
+
declare function hexagonPath({ width: t, height: h }: SizeParams): string;
|
|
31
|
+
declare function speechBubblePath({ width: t, height: h }: SizeParams): string;
|
|
32
|
+
declare function crossPath({ width: t, height: h }: SizeParams): string;
|
|
33
|
+
declare const TYPES: Record<string, PathDataFunc>;
|
|
34
|
+
declare function figureToSvg(params: FigureParams): string;
|
|
35
|
+
|
|
36
|
+
export { TYPES, circleData, crossPath, diamondPath, figureToSvg, hexagonPath, pentagonPath, rectData, rightTriangleData, speechBubblePath, starPath, triangleData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-7NNOHYKX.js";import"../chunk-O2XFH626.js";export{k as TYPES,b as circleData,j as crossPath,f as diamondPath,l as figureToSvg,h as hexagonPath,g as pentagonPath,a as rectData,e as rightTriangleData,i as speechBubblePath,c as starPath,d as triangleData};
|
package/dist/utils/image.d.ts
CHANGED
|
@@ -3,11 +3,17 @@ type Size = {
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 计算图片适配到目标尺寸的裁剪参数(Cover 模式,居中裁剪)
|
|
8
|
+
* @param targetSize 目标尺寸(画布/workarea)
|
|
9
|
+
* @param imageSize 原始图片尺寸
|
|
10
|
+
* @returns Fabric.js v6 裁剪参数(像素值)
|
|
11
|
+
*/
|
|
12
|
+
declare function getCrop(targetSize: Size, imageSize: Size): {
|
|
7
13
|
cropX: number;
|
|
8
14
|
cropY: number;
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
export { getCrop, getImageSize };
|
package/dist/utils/image.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-3TO57JPN.js";import"../chunk-O2XFH626.js";export{b as getCrop,a as getImageSize};
|
package/dist/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-RVXI723F.js";import"../chunk-O2XFH626.js";export{a as convertFillToPickerValue,c as getJSONFontFamily,b as getRandomColor,d as isVectorShape};
|
package/dist/utils/screen.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-WCHGSVUC.js";import"../chunk-O2XFH626.js";export{a as MOBILE_BREAKPOINT,b as isMobile,c as mobileStyle,d as useMobile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-CB23VFSC.js";import"../chunk-O2XFH626.js";export{a as svgToURL};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ydesign/react-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "设计编辑器UI组件库,基于react版本",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"module": "dist/app.js",
|
|
@@ -71,6 +71,14 @@
|
|
|
71
71
|
"./project": {
|
|
72
72
|
"import": "./dist/project.js",
|
|
73
73
|
"types": "./dist/project.d.ts"
|
|
74
|
+
},
|
|
75
|
+
"./topbar/*": {
|
|
76
|
+
"import": "./dist/topbar/*.js",
|
|
77
|
+
"types": "./dist/topbar/*.d.ts"
|
|
78
|
+
},
|
|
79
|
+
"./topbar": {
|
|
80
|
+
"import": "./dist/topbar/topbar.js",
|
|
81
|
+
"types": "./dist/topbar/topbar.d.ts"
|
|
74
82
|
}
|
|
75
83
|
},
|
|
76
84
|
"author": "junhaoliao",
|
|
@@ -112,7 +120,7 @@
|
|
|
112
120
|
"tailwind-merge": "^3.3.1",
|
|
113
121
|
"tailwindcss": "^4.1.17",
|
|
114
122
|
"tw-animate-css": "^1.4.0",
|
|
115
|
-
"@ydesign/core": "^0.0.
|
|
123
|
+
"@ydesign/core": "^0.0.2"
|
|
116
124
|
},
|
|
117
125
|
"browserslist": [
|
|
118
126
|
"> 0.5%",
|
package/dist/chunk-2AWYWIIK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"antd";import{Eraser as r}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var s=()=>t(e,{type:"text",icon:t(r,{size:16,style:{display:"flex"}}),styles:{root:{padding:"0 10px"}},children:"Eraser pen"});export{s as a};
|
package/dist/chunk-55FJG4FK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";var p=({store:e})=>(console.log("ShapesPanel",e),o("div",{children:"\u5F62\u72B6"}));export{p as a};
|
package/dist/chunk-5MWZMSER.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-2AWYWIIK.js";import{a as u}from"./chunk-U7HIFGXC.js";import{a as c,b as y}from"./chunk-3HQUN5MA.js";import{a as d}from"./chunk-V5RJX32O.js";import{a as I}from"./chunk-GMISU6MD.js";import{a as g,b as l}from"./chunk-EMAFC3HG.js";import{observer as s}from"mobx-react-lite";import{Button as i,Tooltip as k}from"antd";import{Crop as C}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var x={root:{padding:"0 6px"}},F=({element:n,store:e})=>t(i,{type:"text",styles:x,onClick:async()=>{let o=e.width+2*e.bleed,m=e.height+2*e.bleed;console.log("w, h ---> ",o,m);let p=await g(n.getSrc()),r=l({width:o,height:m},p);console.log("cropImg",r)},children:"Fit to page"}),T=s(()=>t(k,{title:"Crop",children:t(i,{type:"text",styles:{root:{padding:"0 7px"}},children:t(C,{size:16})})})),B=s(()=>t(i,{type:"text",styles:x,children:"Apply mask"})),b={ImageFlip:I,ImageFilters:d,ImageFitToBackground:F,ImageCrop:T,ImageClip:B,ImageRemoveBackground:u,ImageEraserPen:f},h=s(({store:n,components:e})=>{let o=n.selectedElements,p=c({type:"text",usedItems:["ImageFlip","ImageFilters","ImageFitToBackground","ImageClip","ImageCrop","ImageRemoveBackground","ImageEraserPen"],components:e});return t(y,{items:p,itemRender:r=>{let a=e[r]||b[r];return a&&t(a,{elements:o,element:o[0],store:n},r)}})}),O=h;export{F as a,T as b,B as c,h as d,O as e};
|
package/dist/chunk-7LU5UGIG.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{a as k}from"./chunk-R6Z6F447.js";import{c as h}from"./chunk-TE6HYOIP.js";import{d as E}from"./chunk-5MWZMSER.js";import{a as C}from"./chunk-GYDTKPW5.js";import{a as H}from"./chunk-XRRO2RT7.js";import{a as B}from"./chunk-JW76IC3E.js";import{a as x}from"./chunk-MNACXCF5.js";import{a as v}from"./chunk-XZAP76LL.js";import{b}from"./chunk-B35ZYWID.js";import{a as g}from"./chunk-H67HTXU4.js";import{a as T}from"./chunk-V6ZZKUTN.js";import u from"styled-components";import{useRef as q}from"react";import{Tooltip as N,Button as R}from"antd";import{Undo2 as A,Redo2 as U}from"lucide-react";import{observer as F}from"mobx-react-lite";import{useEffect as M}from"react";import{jsx as n,jsxs as _}from"react/jsx-runtime";var w=F(({store:o})=>(M(()=>{},[o._updateHistory]),_(c,{style:{float:"left",paddingRight:10},children:[n(N,{title:"\u64A4\u9500",placement:"bottom",children:n(R,{type:"text",disabled:!o.editor?.historyHandler.canUndo(),styles:{root:{padding:"0 7px"}},onClick:()=>{o.editor?.historyHandler.undo()},children:n(A,{size:16})})}),n(N,{title:"\u91CD\u505A",placement:"bottom",children:n(R,{type:"text",disabled:!o.editor?.historyHandler.canRedo(),styles:{root:{padding:"0 7px"}},onClick:()=>{o.editor?.historyHandler.redo()},children:n(U,{size:16})})})]})));import{observer as J}from"mobx-react-lite";import{Divider as K}from"antd";import{Fragment as X,jsx as e,jsxs as d}from"react/jsx-runtime";var Q=u.div`
|
|
2
|
-
white-space: nowrap;
|
|
3
|
-
|
|
4
|
-
height: 50px;
|
|
5
|
-
padding: 0 15px;
|
|
6
|
-
position: relative;
|
|
7
|
-
width: 100%;
|
|
8
|
-
z-index: 10;
|
|
9
|
-
`,V=u.div`
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
`,c=u.div`
|
|
13
|
-
align-items: center;
|
|
14
|
-
display: flex;
|
|
15
|
-
height: 50px;
|
|
16
|
-
`,s={textbox:h,image:E,many:H};function xo(o,a){s[o]=a}var W=J(({store:o,downloadButtonEnabled:a,components:i={}})=>{let G=new Set(o.selectedElements.map(r=>r?.type)).size===1,P=o.selectedElements.length===1,m=o.selectedElements[0],y=o.selectedElements.length&&o.selectedElements.every(r=>r?.locked),l=P&&s[m?.type];G?l=s[m?.type]:o.selectedElements.length>1&&(l=s.many);let p=q(i);(Object.keys(i).some(r=>i[r]!==p.current[r])||Object.keys(p.current).some(r=>!(r in i)))&&(p.current=Object.assign({},i));let t=p.current,f=t?.ActionControls||(a?b:null),D=t?.Position||x,O=t?.Opacity||B,S=t?.Lock||C,z=t?.Duplicate||g,L=t?.Remove||k,I=t?.History||w,j=t?.Group||T;return e(Q,{className:"bp5-navbar design-toolbar",children:d(V,{children:[e(I,{store:o}),!m&&e(v,{store:o,components:t}),l&&!y&&e(l,{store:o,components:t}),d(c,{style:{float:"right"},children:[e(j,{store:o}),e(D,{store:o}),!y&&e(O,{store:o}),e(S,{store:o}),e(z,{store:o}),e(L,{store:o}),f&&d(X,{children:[e(K,{orientation:"vertical",style:{margin:"0 15px"}}),e(f,{store:o})]})]})]})})}),Bo=W;export{c as a,xo as b,W as c,Bo as d,w as e};
|
package/dist/chunk-E7ZSWHPU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=t=>{if(t){if(typeof t=="string")return t;if(typeof t=="object"&&"colorStops"in t&&Array.isArray(t.colorStops))return t.colorStops.map(o=>({color:o.color,percent:o.offset*100}))}},i=()=>{let t="0123456789ABCDEF",o="#";for(let r=0;r<6;r++)o+=t[Math.floor(Math.random()*16)];return o},n=t=>{let o=[];for(let r of t){if(r.type==="group"){let e=n(r.objects);o.push(...e)}r.type==="textbox"&&(o.some(e=>e===r.fontFamily)||o.push(r.fontFamily))}return o},c=new Set(["ellipse","polygon","triangle","rect","line","circle","polyline","path"]);function p(t){return!!t&&c.has(t.type)}export{s as a,i as b,n as c,p as d};
|
package/dist/chunk-EMAFC3HG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function p(o){return new Promise((t,s)=>{let h=new Image;h.onload=()=>{t({width:h.width,height:h.height})},h.onerror=()=>{s(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},h.src=o,h.crossOrigin="anonymous"})}function e(o,t){console.log(o),console.log(t);let{width:s,height:h}=o,w=s/h,c,r;w>=t.width/t.height?(c=t.width,r=t.width/w):(c=t.height*w,r=t.height);let d=(t.width-c)/2,n=(t.height-r)/2;return{cropX:d/t.width,cropY:n/t.height,cropWidth:c/t.width,cropHeight:r/t.height}}export{p as a,e as b};
|
package/dist/chunk-JW76IC3E.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Blend as s}from"lucide-react";import{Popover as d,Tooltip as m,Button as c,InputNumber as v,Slider as u}from"antd";import{observer as y}from"mobx-react-lite";import{jsx as t,jsxs as r}from"react/jsx-runtime";var x=y(({store:e})=>{let a=e.selectedShapes.length>0,o=e.selectedShapes[0],i=Math.round(100*o?.opacity),n=p=>{let l=Math.max(0,Math.min(p,100));e.editor?.objectsHandler.update({opacity:l/100})};return t(m,{title:"Opacity",placement:"bottom",children:t(d,{content:r("div",{children:[t("div",{style:{textAlign:"center",marginBottom:10},children:"Transparency"}),r("div",{style:{display:"flex"},children:[t("div",{style:{width:170,paddingRight:20},children:t(u,{min:0,max:100,onChange:n,value:i})}),t(v,{min:0,max:100,value:i,onChange:n,size:"small",styles:{root:{width:65}}})]})]}),trigger:"click",children:t(c,{type:"text",disabled:!a,styles:{root:{padding:"0 7px"}},children:t(s,{size:16})})})})});export{x as a};
|
package/dist/chunk-TE6HYOIP.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a as j}from"./chunk-FIAIYSJ7.js";import{a as I,b as H}from"./chunk-3HQUN5MA.js";import{a as B}from"./chunk-V5RJX32O.js";import{a as w,c as z}from"./chunk-E7ZSWHPU.js";import{a as v}from"./chunk-WJT6VPDR.js";import{observer as f}from"mobx-react-lite";import{useEffect as u,useState as y,useCallback as N}from"react";import{ColorPicker as M,Popover as L,Button as m,Input as W,InputNumber as b,Space as G,Slider as A,Tooltip as x}from"antd";import{cssGradient2FabricGradient as O}from"@ydesign/core";import{ChevronDown as E,TextAlignStart as V,TextAlignCenter as _,TextAlignEnd as R,TextAlignJustify as U,Bold as D,Italic as J,Underline as K,Strikethrough as $,ListChevronsUpDown as q,TextWrap as Q}from"lucide-react";import{FixedSizeList as X}from"react-window";import Y from"styled-components";import{jsx as t,jsxs as h}from"react/jsx-runtime";var Z=Y.img`
|
|
2
|
-
height: 20px;
|
|
3
|
-
|
|
4
|
-
.bp5-dark & {
|
|
5
|
-
filter: invert(1);
|
|
6
|
-
}
|
|
7
|
-
`,{Search:tt}=W,et=({fontFamily:i,handleClick:n,modifiers:e,store:s,isCustom:c})=>{let[o,d]=y(!c);if(console.log(d,Z),u(()=>{o||s.loadFont(i)},[i,o]),i==="_divider")return t("div",{style:{width:"100%",height:1,background:"#e8e8e8"}});let l=i;return t(m,{type:e.active?"primary":"text",block:!0,style:{justifyContent:"start"},onClick:()=>n(i),disabled:e.disabled,styles:{root:{fontFamily:'"'+i+'"'},content:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},children:l})},nt=({onChange:i,defaultValue:n})=>t(tt,{placeholder:n,allowClear:!0,onChange:e=>{i(e.target.value)},style:{width:210}}),ot=({store:i,fonts:n,activeFont:e,activeFontLabel:s,onFontSelect:c})=>{let[o,d]=y(""),l=n.filter(r=>r.toLowerCase().includes(o.toLowerCase()));return t(L,{content:h("div",{children:[t(nt,{defaultValue:"\u641C\u7D22\u5B57\u4F53",onChange:r=>d(r??"")}),t("div",{style:{paddingTop:5},children:t(X,{itemCount:l.length,itemSize:28,width:210,height:Math.min(400,28*l.length)+10,children:({index:r,style:p})=>{let a=l[r];return t("div",{style:{...p,display:"flex",alignItems:"center",justifyContent:"center"},children:t(et,{fontFamily:a,modifiers:{active:e===a},handleClick:()=>c(a),store:i,isCustom:i.fonts.find(g=>g.fontFamily===a)||v.find(g=>g.fontFamily===a)},a)})}})})]}),trigger:"click",children:t(m,{type:"text",style:{marginRight:5,fontFamily:'"'+e+'"',overflow:"hidden",whiteSpace:"nowrap",maxHeight:30,padding:"0 10px"},icon:t(E,{size:16,style:{display:"flex"}}),iconPlacement:"end",children:s})})},S=["left","center","right","justify"],it=f(({elements:i,store:n})=>{let e=n.fonts.concat(v).map(d=>d.fontFamily),s=i[0].fontFamily;s.length>15&&(s=s.slice(0,15)+"...");let c=z(n.objects),o=[...new Set(c.concat("_divider").concat(e))];return t(ot,{fonts:o,activeFont:i[0].fontFamily,activeFontLabel:s,store:n,onFontSelect:d=>{n.editor?.objectsHandler.setTextStyle({fontFamily:d})}})}),lt=f(({elements:i,store:n})=>{let e=i[0],[s,c]=y(e.fill),o=N(()=>{let{selectionStart:l,selectionEnd:r}=e;if(l!==r&&l!==void 0){let p=e.getSelectionStyles(l,l+1);if(p.length>0&&p[0].fill!==void 0)return p[0].fill}return e.fill},[e]);u(()=>{let l=n.editor?.customCanvas?.canvas;if(!l)return;let r=()=>{c(o())};return l.on("text:selection:changed",r),l.on("text:editing:entered",r),l.on("text:editing:exited",r),c(o()),()=>{l.off("text:selection:changed",r),l.off("text:editing:entered",r),l.off("text:editing:exited",r)}},[n.editor?.customCanvas?.canvas,o]),u(()=>{c(o())},[e,o]);let d=w(s);return t(M,{value:d,allowClear:!0,mode:["single","gradient"],onChangeComplete:l=>{let r=l.toCssString();if(r.includes("gradient")){let p=O(r);n.editor?.objectsHandler.setTextStyle({fill:p})}else n.editor?.objectsHandler.setTextStyle({fill:r});c(o())}})}),rt=f(({elements:i,store:n})=>{let[e,s]=y(i[0].fontSize);u(()=>{s(i[0].fontSize)},[i[0]?.fontSize,n._updateFontSize]);let c=o=>{Number.isNaN(o)||(n.editor?.objectsHandler.setTextStyle({fontSize:Number(o)}),s(Number(o)))};return t(b,{min:5,max:4*n.height,value:Math.round(e),onChange:c,style:{width:70}})}),st=f(({elements:i,store:n})=>{let e=i[0],[s,c]=y(e.textAlign),[o,d]=y(e.fontWeight),[l,r]=y(e.fontStyle),[p,a]=y(e.underline),[g,C]=y(e.linethrough),[T,P]=y(e.splitByGrapheme);return u(()=>{c(e.textAlign),d(e.fontWeight),r(e.fontStyle),a(e.underline),C(e.linethrough),P(e.splitByGrapheme)},[e]),h(G.Compact,{children:[t(x,{placement:"bottom",title:`Text align ${s}`,children:t(m,{type:"text",icon:s==="left"?t(V,{size:16,style:{display:"flex"}}):s==="center"?t(_,{size:16,style:{display:"flex"}}):s==="right"?t(R,{size:16,style:{display:"flex"}}):t(U,{size:16,style:{display:"flex"}}),onClick:()=>{let F=(S.indexOf(s)+1+S.length)%S.length,k=S[F];n.editor?.objectsHandler.setTextStyle({textAlign:k}),c(k)}})}),t(x,{placement:"bottom",title:"Bold",children:t(m,{type:o==="bold"||o==="700"?"primary":"text",icon:t(D,{size:16,style:{display:"flex"}}),onClick:()=>{o==="bold"||o==="700"?(n.editor?.objectsHandler.setTextStyle({fontWeight:"normal"}),d("normal")):(n.editor?.objectsHandler.setTextStyle({fontWeight:"bold"}),d("bold"))}})}),t(x,{placement:"bottom",title:"Italic",children:t(m,{type:l==="italic"?"primary":"text",icon:t(J,{size:16,style:{display:"flex"}}),onClick:()=>{l==="italic"?(n.editor?.objectsHandler.setTextStyle({fontStyle:"normal"}),r("normal")):(n.editor?.objectsHandler.setTextStyle({fontStyle:"italic"}),r("italic"))}})}),t(x,{placement:"bottom",title:"Underline",children:t(m,{type:p?"primary":"text",icon:t(K,{size:16,style:{display:"flex"}}),onClick:()=>{n.editor?.objectsHandler.setTextStyle({underline:!p}),a(!p)}})}),t(x,{placement:"bottom",title:"Strikethrough",children:t(m,{type:g?"primary":"text",icon:t($,{size:16,style:{display:"flex"}}),onClick:()=>{n.editor?.objectsHandler.setTextStyle({linethrough:!g}),C(!g)}})}),t(x,{placement:"bottom",title:"Split by grapheme",children:t(m,{type:T?"primary":"text",icon:t(Q,{size:16,style:{display:"flex"}}),onClick:()=>{n.editor?.objectsHandler.setTextStyle({splitByGrapheme:!T}),P(!T)}})})]})}),at=f(({elements:i,store:n})=>{let e=i[0],s={display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"5px",paddingBottom:"5px"},c=typeof e.lineHeight=="number"?100*e.lineHeight:120,[o,d]=y(c),[l,r]=y(e.charSpacing),p=a=>{n.editor?.objectsHandler.setTextStyle(a)};return t(L,{trigger:"click",content:h("div",{style:{padding:"0 6px",width:"230px"},children:[h("div",{style:s,children:[t("div",{children:"Line height"}),t("div",{children:t(b,{min:50,max:250,value:Math.round(o),style:{width:80},onChange:a=>{p({lineHeight:a/100}),d(a)}})})]}),t(A,{value:Math.round(o),min:50,max:250,step:1,onChange:a=>{p({lineHeight:a/100}),d(a)}}),h("div",{style:s,children:[t("div",{children:"Letter spacing"}),t("div",{children:t(b,{min:-50,max:250,value:Math.round(l/10),style:{width:80},onChange:a=>{p({charSpacing:(a??0)*10}),r((a??0)*10)}})})]}),t(A,{value:Math.round(l/10),min:-50,max:250,step:1,onChange:a=>{p({charSpacing:(a??0)*10}),r((a??0)*10)}})]}),children:t(m,{type:"text",icon:t(q,{size:16,style:{display:"flex"}})})})}),ct={TextFill:lt,TextFontFamily:it,TextFontSize:rt,TextFontVariant:st,TextSpacing:at,TextFilters:B,TextAiWrite:j},dt=f(({store:i,components:n})=>{let e=i.selectedElements,c=I({type:"text",usedItems:["TextFill","TextFontFamily","TextFontSize","TextFontVariant","TextSpacing","TextFilters","TextAiWrite"],components:n});return t(H,{items:c,itemRender:o=>{let d=n[o]||ct[o];return d&&t(d,{elements:e,element:e[0],store:i},o)}})}),Ct=dt;export{S as a,dt as b,Ct as c};
|
package/dist/chunk-U7HIFGXC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Button as o}from"antd";import{jsx as t}from"react/jsx-runtime";var n=()=>t(o,{type:"text",styles:{root:{padding:"0 6px"}},children:"Remove background"});export{n as a};
|
package/dist/chunk-V6ZZKUTN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"antd";import{observer as p}from"mobx-react-lite";import{Fragment as l,jsx as o,jsxs as s}from"react/jsx-runtime";var c=p(({store:t})=>{let n=t.selectedElements.length>1,r=t.selectedElements.length===1&&t.selectedElements[0]?.type==="group";return s(l,{children:[n&&o(e,{type:"text",onClick:()=>{},children:"Group"}),r&&o(e,{type:"text",onClick:()=>{},children:"Ungroup"})]})});export{c as a};
|
package/dist/chunk-XDLFQXMN.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import{c as s,d as S}from"./chunk-JWQ2DUXA.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{a as y}from"./chunk-M33EDDXB.js";import{a as f}from"./chunk-DJBTBRPS.js";import{a as T}from"./chunk-55FJG4FK.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
|
-
${s(`
|
|
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
|
-
${s(`
|
|
52
|
-
display: none;
|
|
53
|
-
`)}
|
|
54
|
-
`,A=({onClick:e})=>n(W,{onClick:e,children:n("div",{children:p("button",{className:"grid relative justify-center arrow",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:l})=>n(l,{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 l=t.target.closest(".design-close-panel"),w=t.target.closest(".design-mobile");l&&(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};
|
package/dist/chunk-XZAP76LL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u,b as m}from"./chunk-3HQUN5MA.js";import{a as s}from"./chunk-OQ6HU62L.js";import{a as c,b as p}from"./chunk-E7ZSWHPU.js";import{ColorPicker as y,Tooltip as k,Button as f}from"antd";import{CirclePlus as g}from"lucide-react";import{cssGradient2FabricGradient as T}from"@ydesign/core";import{jsx as t,jsxs as d}from"react/jsx-runtime";var C=async e=>s(e),x=({store:e})=>{let i=e.editor?.workareaHandler.workarea?.fill,o=c(i);return t(k,{title:"\u80CC\u666F\u989C\u8272",children:t("div",{style:{height:32},children:t(y,{value:o,allowClear:!0,mode:["single","gradient"],onChangeComplete:r=>{let n=r.toCssString();if(n.includes("gradient")){let a=T(n);e.editor?.workareaHandler.setWorkareaBgColor(a)}else e.editor?.workareaHandler.setWorkareaBgColor(n)}})})})},P=({store:e})=>t("div",{children:d("label",{htmlFor:"input-file",children:[d(f,{type:"text",styles:{root:{padding:"0 8px"}},onClick:()=>{document.querySelector("#input-file")?.click()},children:[t(g,{size:16})," add image"]}),t("input",{type:"file",id:"input-file",style:{display:"none"},onChange:async i=>{let{target:o}=i;if(!(!o.files||o.files.length===0)){for(let r of o.files){let a={type:"image",src:await C(r)};e.editor?.objectsHandler.add(a)}o.value=""}},multiple:!0,accept:"image/*"})]})}),v=({store:e})=>t("div",{children:d(f,{type:"text",styles:{root:{padding:"0 8px"}},onClick:()=>{e.editor?.objectsHandler.add({originX:"left",originY:"top",fontSize:100,textAlign:"left",fill:p(),text:"Hello World",type:"textbox"})},children:[t(g,{size:16}),"add text"]})}),b={DefaultBackgroundPicker:x,DefaultAddImage:P,DefaultAddText:v},h=({store:e,components:l})=>{let o=u({type:"text",usedItems:["DefaultBackgroundPicker","DefaultAddImage","DefaultAddText"],components:l});return t(m,{items:o,itemRender:r=>{let n=l[r]||b[r];return n&&t(n,{store:e},r)}})},I=h;export{h as a,I as b};
|