@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
package/LICENSE
CHANGED
package/dist/app.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-gray-200: oklch(92.8% .006 264.531);--color-gray-500: oklch(55.1% .027 264.364);--color-gray-800: oklch(27.8% .033 256.848);--color-white: #fff;--spacing: .25rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono)}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor;@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.container{width:100%;@media(width>=40rem){max-width:40rem}@media(width>=48rem){max-width:48rem}@media(width>=64rem){max-width:64rem}@media(width>=80rem){max-width:80rem}@media(width>=96rem){max-width:96rem}}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-3{height:calc(var(--spacing) * 3)}.h-full{height:100%}.w-3{width:calc(var(--spacing) * 3)}.w-80{width:calc(var(--spacing) * 80)}.w-\[70px\]{width:70px}.w-full{width:100%}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.border-r-1{border-right-style:var(--tw-border-style);border-right-width:1px}.border-gray-200{border-color:var(--color-gray-200)}.bg-\[\#ecf0f1\]{background-color:#ecf0f1}.fill-white{fill:var(--color-white)}.stroke-gray-200{stroke:var(--color-gray-200)}.py-1{padding-block:calc(var(--spacing) * 1)}.text-left{text-align:left}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.text-gray-500{color:var(--color-gray-500)}.italic{font-style:italic}.underline{text-decoration-line:underline}.shadow{--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 var(--tw-shadow-color, rgb(0 0 0 / .05));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.dark\:border-gray-800{@media(prefers-color-scheme:dark){border-color:var(--color-gray-800)}}.dark\:bg-\[\#92969d\]{@media(prefers-color-scheme:dark){background-color:#92969d}}.dark\:fill-\[\#0b0809\]{@media(prefers-color-scheme:dark){fill:#0b0809}}.dark\:stroke-\[\#0b0809\]{@media(prefers-color-scheme:dark){stroke:#0b0809}}.dark\:text-white{@media(prefers-color-scheme:dark){color:var(--color-white)}}}@property --tw-rotate-x{syntax: "*"; inherits: false;}@property --tw-rotate-y{syntax: "*"; inherits: false;}@property --tw-rotate-z{syntax: "*"; inherits: false;}@property --tw-skew-x{syntax: "*"; inherits: false;}@property --tw-skew-y{syntax: "*"; inherits: false;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-blur{syntax: "*"; inherits: false;}@property --tw-brightness{syntax: "*"; inherits: false;}@property --tw-contrast{syntax: "*"; inherits: false;}@property --tw-grayscale{syntax: "*"; inherits: false;}@property --tw-hue-rotate{syntax: "*"; inherits: false;}@property --tw-invert{syntax: "*"; inherits: false;}@property --tw-opacity{syntax: "*"; inherits: false;}@property --tw-saturate{syntax: "*"; inherits: false;}@property --tw-sepia{syntax: "*"; inherits: false;}@property --tw-drop-shadow{syntax: "*"; inherits: false;}@property --tw-drop-shadow-color{syntax: "*"; inherits: false;}@property --tw-drop-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-drop-shadow-size{syntax: "*"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x: initial;--tw-rotate-y: initial;--tw-rotate-z: initial;--tw-skew-x: initial;--tw-skew-y: initial;--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-blur: initial;--tw-brightness: initial;--tw-contrast: initial;--tw-grayscale: initial;--tw-hue-rotate: initial;--tw-invert: initial;--tw-opacity: initial;--tw-saturate: initial;--tw-sepia: initial;--tw-drop-shadow: initial;--tw-drop-shadow-color: initial;--tw-drop-shadow-alpha: 100%;--tw-drop-shadow-size: initial}}}
|
|
2
|
-
/*! tailwindcss v4.1.
|
|
1
|
+
@layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-blue-400: oklch(70.7% .165 254.624);--color-blue-500: oklch(62.3% .214 259.815);--color-gray-100: oklch(96.7% .003 264.542);--color-gray-200: oklch(92.8% .006 264.531);--color-gray-400: oklch(70.7% .022 261.325);--color-gray-500: oklch(55.1% .027 264.364);--color-gray-600: oklch(44.6% .03 256.802);--color-gray-700: oklch(37.3% .034 259.733);--color-gray-800: oklch(27.8% .033 256.848);--color-white: #fff;--spacing: .25rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-base--line-height: 1.5 ;--font-weight-medium: 500;--radius-lg: .5rem;--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono)}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor;@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.container{width:100%;@media (width >= 40rem){max-width:40rem}@media (width >= 48rem){max-width:48rem}@media (width >= 64rem){max-width:64rem}@media (width >= 80rem){max-width:80rem}@media (width >= 96rem){max-width:96rem}}.mt-2{margin-top:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-\[1\.2\%\]{margin-bottom:1.2%}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-0{height:calc(var(--spacing) * 0)}.h-3{height:calc(var(--spacing) * 3)}.h-10{height:calc(var(--spacing) * 10)}.h-full{height:100%}.w-3{width:calc(var(--spacing) * 3)}.w-10{width:calc(var(--spacing) * 10)}.w-40{width:calc(var(--spacing) * 40)}.w-80{width:calc(var(--spacing) * 80)}.w-\[25\%\]{width:25%}.w-\[70px\]{width:70px}.w-full{width:100%}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-r,.border-r-1{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b-1{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-b-gray-200{border-bottom-color:var(--color-gray-200)}.bg-\[\#ecf0f1\]{background-color:#ecf0f1}.bg-blue-500{background-color:var(--color-blue-500)}.fill-white{fill:var(--color-white)}.stroke-gray-200{stroke:var(--color-gray-200)}.p-3{padding:calc(var(--spacing) * 3)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-\[25\%\]{padding-bottom:25%}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-base{font-size:var(--text-base);line-height:var(--tw-leading, var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.font-medium{--tw-font-weight: var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-blue-500{color:var(--color-blue-500)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-white{color:var(--color-white)}.italic{font-style:italic}.underline{text-decoration-line:underline}.shadow{--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 var(--tw-shadow-color, rgb(0 0 0 / .05));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.hover\:border-blue-400{&:hover{@media (hover: hover){border-color:var(--color-blue-400)}}}.hover\:bg-gray-100{&:hover{@media (hover: hover){background-color:var(--color-gray-100)}}}.hover\:underline{&:hover{@media (hover: hover){text-decoration-line:underline}}}.hover\:shadow-sm{&:hover{@media (hover: hover){--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}.dark\:border-gray-800{@media (prefers-color-scheme: dark){border-color:var(--color-gray-800)}}.dark\:bg-\[\#92969d\]{@media (prefers-color-scheme: dark){background-color:#92969d}}.dark\:fill-\[\#0b0809\]{@media (prefers-color-scheme: dark){fill:#0b0809}}.dark\:stroke-\[\#0b0809\]{@media (prefers-color-scheme: dark){stroke:#0b0809}}.dark\:text-white{@media (prefers-color-scheme: dark){color:var(--color-white)}}}@property --tw-rotate-x{syntax: "*"; inherits: false;}@property --tw-rotate-y{syntax: "*"; inherits: false;}@property --tw-rotate-z{syntax: "*"; inherits: false;}@property --tw-skew-x{syntax: "*"; inherits: false;}@property --tw-skew-y{syntax: "*"; inherits: false;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: "*"; inherits: false;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-blur{syntax: "*"; inherits: false;}@property --tw-brightness{syntax: "*"; inherits: false;}@property --tw-contrast{syntax: "*"; inherits: false;}@property --tw-grayscale{syntax: "*"; inherits: false;}@property --tw-hue-rotate{syntax: "*"; inherits: false;}@property --tw-invert{syntax: "*"; inherits: false;}@property --tw-opacity{syntax: "*"; inherits: false;}@property --tw-saturate{syntax: "*"; inherits: false;}@property --tw-sepia{syntax: "*"; inherits: false;}@property --tw-drop-shadow{syntax: "*"; inherits: false;}@property --tw-drop-shadow-color{syntax: "*"; inherits: false;}@property --tw-drop-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-drop-shadow-size{syntax: "*"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x: initial;--tw-rotate-y: initial;--tw-rotate-z: initial;--tw-skew-x: initial;--tw-skew-y: initial;--tw-border-style: solid;--tw-font-weight: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-blur: initial;--tw-brightness: initial;--tw-contrast: initial;--tw-grayscale: initial;--tw-hue-rotate: initial;--tw-invert: initial;--tw-opacity: initial;--tw-saturate: initial;--tw-sepia: initial;--tw-drop-shadow: initial;--tw-drop-shadow-color: initial;--tw-drop-shadow-alpha: 100%;--tw-drop-shadow-size: initial}}}
|
|
2
|
+
/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
|
package/dist/app.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
|
|
6
|
-
declare const DesignEditorContainer:
|
|
7
|
-
declare const SidePanelWrap:
|
|
8
|
-
declare const WorkspaceWrap:
|
|
6
|
+
declare const DesignEditorContainer: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
declare const SidePanelWrap: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
declare const WorkspaceWrap: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
9
|
declare const DesignEditorApp: () => react_jsx_runtime.JSX.Element;
|
|
10
10
|
declare const createDesignEditorApp: () => void;
|
|
11
11
|
declare const createDemoApp: () => void;
|
package/dist/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./chunk-O2XFH626.js";import t from"styled-components";import{jsx as
|
|
1
|
+
import"./chunk-O2XFH626.js";import t from"styled-components";import{jsx as i}from"react/jsx-runtime";var e=t.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -14,4 +14,4 @@ import"./chunk-O2XFH626.js";import t from"styled-components";import{jsx as r}fro
|
|
|
14
14
|
flex: 1;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
position: relative;
|
|
17
|
-
`,
|
|
17
|
+
`,c=()=>i(e,{children:"1231232"}),r=()=>{console.log("createDesignEditorApp")},h=r;export{c as DesignEditorApp,e as DesignEditorContainer,l as SidePanelWrap,d as WorkspaceWrap,h as createDemoApp,r as createDesignEditorApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(o){return new Promise((t,r)=>{let h=new Image;h.onload=()=>{t({width:h.width,height:h.height})},h.onerror=()=>{r(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},h.src=o,h.crossOrigin="anonymous"})}function w(o,t){let r=o.width/o.height,h=t.width/t.height,n,e;r>=h?(n=t.width,e=t.width/r):(n=t.height*r,e=t.height);let i=(t.width-n)/2,c=(t.height-e)/2;return{cropX:i,cropY:c,width:n,height:e}}export{s as a,w as b};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
import{d as $}from"./chunk-
|
|
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};
|
|
@@ -0,0 +1,7 @@
|
|
|
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};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var P=({width:t,height:e,cornerRadius:r=0})=>{if(r>0){let a=Math.min(r,t/2,e/2);return`M 0 ${a} A ${a} ${a} 0 0 1 ${a} 0 L ${t-a} 0 A ${a} ${a} 0 0 1 ${t} ${a} L ${t} ${e-a} A ${a} ${a} 0 0 1 ${t-a} ${e} L ${a} ${e} A ${a} ${a} 0 0 1 0 ${e-a} Z`}return`M 0 0 L ${t} 0 L ${t} ${e} L 0 ${e} Z`},p=({width:t,height:e})=>{let r=t/2,a=e/2;return`M ${r} ${a} m -${r}, 0 a ${r},${a} 0 1,0 ${t},0 a ${r},${a} 0 1,0 -${t},0`};function m({width:t,height:e}){let r=t/2,a=e/2,o=t/2,c=e/2,$=o/2,h=c/2,s="",i=Math.PI/5;for(let n=0;n<10;n++){let u=n%2==0?c:h,l=r+(n%2==0?o:$)*Math.sin(n*i),g=a-u*Math.cos(n*i);n===0?s=`M ${l} ${g}`:s+=` L ${l} ${g}`}return s+" Z"}var d=({width:t,height:e})=>`M ${t/2} 0 L ${t} ${e} L 0 ${e} Z`,f=({width:t,height:e})=>`M 0 0 L ${t} 0 L 0 ${e} Z`;function M({width:t,height:e}){let r=t/2,a=e/2;return`M ${r} 0 L ${t} ${a} L ${r} ${e} L 0 ${a} Z`}function L({width:t,height:e}){let r=t/2,a=e/2,o=t/2,c=e/2,$="",h=2*Math.PI/5;for(let s=0;s<5;s++){let i=c,n=r+o*Math.sin(s*h),u=a-i*Math.cos(s*h);s===0?$=`M ${n} ${u}`:$+=` L ${n} ${u}`}return $+" Z"}function x({width:t,height:e}){let r=t/2,a=e/2,o=t/2,c=e/2,$="",h=2*Math.PI/6;for(let s=0;s<6;s++){let i=c,n=r+o*Math.sin(s*h),u=a-i*Math.cos(s*h);s===0?$=`M ${n} ${u}`:$+=` L ${n} ${u}`}return $+" Z"}function b({width:t,height:e}){let r=.1*Math.min(t,e),a=.2*t,o=.2*e,c=.5*t,$=`M ${r},0`;return $+=" H "+(t-r),$+=` A ${r},${r} 0 0 1 ${t},${r}`,$+=" V "+(e-r-o),$+=` A ${r},${r} 0 0 1 ${t-r},${e-o}`,$+=` H ${c+a/2}`,$+=` L ${c},${e}`,$+=` L ${c-a/2},${e-o}`,$+=` H ${r}`,$+=` A ${r},${r} 0 0 1 0,${e-r-o}`,$+=` V ${r}`,$+=` A ${r},${r} 0 0 1 ${r},0`,$+=" Z",$}function S({width:t,height:e}){let r=.3*t,a=.3*e,o=t/2,c=e/2,$=o-r/2,h=o+r/2,s=c-a/2,i=c+a/2,n=`M ${$},0 `;return n+=`H ${h} `,n+=`V ${s} `,n+=`H ${t} `,n+=`V ${i} `,n+=`H ${h} `,n+=`V ${e} `,n+=`H ${$} `,n+=`V ${i} `,n+="H 0 ",n+=`V ${s} `,n+=`H ${$} `,n+="V 0 ",n+="Z",n}var w={rect:P,circle:p,star:m,triangle:d,rightTriangle:f,diamond:M,pentagon:L,hexagon:x,speechBubble:b,cross:S};function z(t){return w[t]||P}function F(t,e){let{width:r,height:a,fill:o,stroke:c,strokeWidth:$,dash:h}=t,s=(h||[]).map(g=>g*$),i=e(t),n=1,u=1;typeof i!="string"&&(n=i.scaleX,u=i.scaleY,i=i.path);let l=`clip-${t.id||Math.random()}`;return`
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${a}">
|
|
3
|
+
<defs>
|
|
4
|
+
<clipPath id="${l}">
|
|
5
|
+
<path d="${i}" />
|
|
6
|
+
</clipPath>
|
|
7
|
+
</defs>
|
|
8
|
+
|
|
9
|
+
<!-- Path for the fill -->
|
|
10
|
+
<path d="${i}" fill="${o}" transform="scale(${n}, ${u})"/>
|
|
11
|
+
|
|
12
|
+
<!-- Path for the stroke, clipped by the star path -->
|
|
13
|
+
<path d="${i}" fill="none" stroke="${c}" stroke-width="${2*$}" clip-path="url(#${l})" transform="scale(${n}, ${u})" stroke-dasharray="${s.join(" ")}"/>
|
|
14
|
+
</svg>
|
|
15
|
+
`}function y(t){let{subType:e}=t,r=z(e);return r?F(t,r):(console.error(`error: Can not convert ${e} figure to svg.`),P(t))}export{P as a,p as b,m as c,d,f as e,M as f,L as g,x as h,b as i,S as j,w as k,y as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(n){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(n)))}export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
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
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,54 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{clsx as e}from"clsx";import{twMerge as t}from"tailwind-merge";function s(...r){return t(e(r))}export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
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
|
|
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};
|
|
@@ -0,0 +1,3 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=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}))}},s=()=>{let t="0123456789ABCDEF",o="#";for(let r=0;r<6;r++)o+=t[Math.floor(Math.random()*16)];return o},n=t=>{let o=[];if(!t)return[];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","triangle","rect","line","circle","polygon","polyline","path"]);function p(t){return!!t&&c.has(t.type)}export{i as a,s as b,n as c,p as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-WCHGSVUC.js";import{useState as m,useRef as d,useLayoutEffect as p}from"react";import b from"styled-components";import{OverflowList as v}from"react-overflow-list";import{Ellipsis as h}from"lucide-react";import{Popover as w,Button as y}from"antd";import{jsx as s}from"react/jsx-runtime";var g=b.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 50px;
|
|
4
4
|
align-items: center;
|
|
@@ -0,0 +1,16 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
package/dist/config.d.ts
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
+
import { XY } from '@ydesign/core';
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
declare const enum ShapePathFormulasKeys {
|
|
4
|
+
ROUND_RECT = "roundRect",
|
|
5
|
+
ROUND_RECT_DIAGONAL = "roundRectDiagonal",
|
|
6
|
+
ROUND_RECT_SINGLE = "roundRectSingle",
|
|
7
|
+
ROUND_RECT_SAMESIDE = "roundRectSameSide",
|
|
8
|
+
CUT_RECT_DIAGONAL = "cutRectDiagonal",
|
|
9
|
+
CUT_RECT_SINGLE = "cutRectSingle",
|
|
10
|
+
CUT_RECT_SAMESIDE = "cutRectSameSide",
|
|
11
|
+
MESSAGE = "message",
|
|
12
|
+
ROUND_MESSAGE = "roundMessage",
|
|
13
|
+
L = "L",
|
|
14
|
+
RING_RECT = "ringRect",
|
|
15
|
+
PLUS = "plus",
|
|
16
|
+
TRIANGLE = "triangle",
|
|
17
|
+
PARALLELOGRAM_LEFT = "parallelogramLeft",
|
|
18
|
+
PARALLELOGRAM_RIGHT = "parallelogramRight",
|
|
19
|
+
TRAPEZOID = "trapezoid",
|
|
20
|
+
BULLET = "bullet",
|
|
21
|
+
INDICATOR = "indicator"
|
|
22
|
+
}
|
|
23
|
+
interface PathPoolItem {
|
|
24
|
+
viewBox: [number, number];
|
|
25
|
+
path: string;
|
|
26
|
+
special?: boolean;
|
|
27
|
+
pathFormula?: ShapePathFormulasKeys;
|
|
28
|
+
outlined?: boolean;
|
|
29
|
+
type?: string;
|
|
30
|
+
}
|
|
31
|
+
interface PathListItem {
|
|
32
|
+
name: string;
|
|
33
|
+
children: PathPoolItem[];
|
|
34
|
+
}
|
|
35
|
+
declare const PathShapeLibs: PathListItem[];
|
|
36
|
+
type LinePoint = '' | 'arrow' | 'dot';
|
|
37
|
+
interface LinePoolItem {
|
|
38
|
+
path: string;
|
|
39
|
+
style: 'solid' | 'dashed';
|
|
40
|
+
points: [LinePoint, LinePoint];
|
|
41
|
+
data: XY[];
|
|
42
|
+
isBroken?: boolean;
|
|
43
|
+
isCurve?: boolean;
|
|
44
|
+
isCubic?: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface PresetLine {
|
|
47
|
+
name: string;
|
|
48
|
+
children: LinePoolItem[];
|
|
49
|
+
}
|
|
50
|
+
declare const LinePoolItems: LinePoolItem[];
|
|
51
|
+
declare const PathLineLibs: PresetLine[];
|
|
52
|
+
|
|
53
|
+
export { type LinePoint, type LinePoolItem, LinePoolItems, PathLineLibs, type PathListItem, type PathPoolItem, PathShapeLibs, type PresetLine, ShapePathFormulasKeys };
|
package/dist/config.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunk-NX3CGW6Q.js";import"./chunk-7NNOHYKX.js";import"./chunk-O2XFH626.js";export{c as LinePoolItems,d as PathLineLibs,b as PathShapeLibs,a as ShapePathFormulasKeys};
|
package/dist/lib/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-
|
|
1
|
+
import{a}from"../chunk-MXZ6RXT3.js";import"../chunk-O2XFH626.js";export{a as cn};
|
package/dist/model/store.d.ts
CHANGED
|
@@ -101,6 +101,11 @@ declare const Store: mobx_state_tree.IModelType<{
|
|
|
101
101
|
setScale(scale: number): void;
|
|
102
102
|
clone(): void;
|
|
103
103
|
addElement(): void;
|
|
104
|
+
setSize({ width, height, isClear }: {
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
isClear?: boolean;
|
|
108
|
+
}): void;
|
|
104
109
|
setupEditorListeners(): void;
|
|
105
110
|
} & {
|
|
106
111
|
_forEachElementUp(ids: Array<string>, callback: Function): void;
|
|
@@ -188,6 +193,11 @@ declare function createStore({ key }: StoreProps): mobx_state_tree.ModelInstance
|
|
|
188
193
|
setScale(scale: number): void;
|
|
189
194
|
clone(): void;
|
|
190
195
|
addElement(): void;
|
|
196
|
+
setSize({ width, height, isClear }: {
|
|
197
|
+
width: number;
|
|
198
|
+
height: number;
|
|
199
|
+
isClear?: boolean;
|
|
200
|
+
}): void;
|
|
191
201
|
setupEditorListeners(): void;
|
|
192
202
|
} & {
|
|
193
203
|
_forEachElementUp(ids: Array<string>, callback: Function): void;
|
|
@@ -270,6 +280,11 @@ declare function createStore({ key }: StoreProps): mobx_state_tree.ModelInstance
|
|
|
270
280
|
setScale(scale: number): void;
|
|
271
281
|
clone(): void;
|
|
272
282
|
addElement(): void;
|
|
283
|
+
setSize({ width, height, isClear }: {
|
|
284
|
+
width: number;
|
|
285
|
+
height: number;
|
|
286
|
+
isClear?: boolean;
|
|
287
|
+
}): void;
|
|
273
288
|
setupEditorListeners(): void;
|
|
274
289
|
} & {
|
|
275
290
|
_forEachElementUp(ids: Array<string>, callback: Function): void;
|
package/dist/model/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"../chunk-P5I43V7X.js";import{a as
|
|
1
|
+
import{a as g}from"../chunk-P5I43V7X.js";import{a as c,h as l,i as p,m}from"../chunk-WJT6VPDR.js";import"../chunk-O2XFH626.js";import{types as i,cast as u,flow as E}from"mobx-state-tree";var y=(e,t)=>{if(e?.objects)for(let r of e.objects){if(t(r)===!0)break;y(r,t)}},f=i.model("Font",{fontFamily:i.string,name:i.optional(i.string,""),url:i.optional(i.string,""),img:i.optional(i.string,""),styles:i.frozen()}).preProcessSnapshot(e=>Object.assign(Object.assign({},e),{fontFamily:e.fontFamily||e.name})),b=i.model("Store",{name:"yitu-design",width:1080,height:1080,scale:1,scaleToFit:1,unit:"px",dpi:72,bleed:0,bleedVisible:!1,rulesVisible:!1,openedSidePanel:"",selectedElementsIds:i.array(i.string),fonts:i.array(f),editor:i.frozen(null),custom:i.frozen(),objects:i.frozen(),_key:"",_updateTrigger:0,_updateHistory:0,_updateFontSize:0}).views(e=>({get selectedElements(){let t=e._updateTrigger;return console.log("_trigger\u90FD\u53D8\u5316\u662F\u89E6\u53D1\u805A\u7126\u5143\u7D20\u7684\u5237\u65B0 ---> ",t,e.selectedElementsIds.toJSON()),e.selectedElementsIds.map(r=>e.editor?.objectsHandler.findOneById(r))}})).views(e=>({get selectedShapes(){let t=[];return y({objects:e.selectedElements},r=>{r?.type!=="group"&&t.push(r)}),t}})).actions(e=>({_setEditor(t){e.editor=t},_triggerUpdate(){e._updateTrigger=e._updateTrigger+1},_historyUpdate(){e._updateHistory=e._updateHistory+1},_fontSizeUpdate(){e._updateFontSize=e._updateFontSize+1}})).actions(e=>({setObjects(t){e.objects=t},selectElements(t){e.selectedElementsIds=u(t)},openSidePanel(t){e.openedSidePanel!==t&&(e.openedSidePanel=t)},deleteElements(t){t.forEach(r=>{e.editor?.objectsHandler.remove(r)})},setScale(t){e.scale=t},clone(){e.editor?.objectsHandler.clone()},addElement(){},setSize({width:t,height:r,isClear:a}){e.width=t,e.height=r,e.editor?.workareaHandler.setSize({width:t,height:r,isClear:a})},setupEditorListeners(){e.editor&&(e.editor.on("object:modified",()=>{e._triggerUpdate()}),e.editor.on("history:change",()=>{e._historyUpdate()}),e.editor.on("textbox:modified",()=>{e._fontSizeUpdate()}))}})).actions(e=>({_forEachElementUp(t,r){if(!e.editor)return;let a=e.editor.layerHandler.getEffectiveLayers(),o=t.map(n=>({id:n,index:a.findIndex(d=>d.id===n)}));o.sort((n,d)=>d.index-n.index);for(let{index:n}of o){if(n==-1)continue;let d=n<a.length-1&&a[n+1],s=t.indexOf(d?.id)>=0;n===a.length-1||s||r(n)}},_forEachElementDown(t,r){if(!e.editor)return;let a=e.editor.layerHandler.getEffectiveLayers(),o=t.map(n=>({id:n,index:a.findIndex(d=>d.id===n)}));o.sort((n,d)=>d.index-n.index);for(let{index:n}of o){if(n==-1)continue;let d=n>0&&a[n-1],s=t.indexOf(d?.id)>=0;n===0||s||r(n)}return!1}})).actions(e=>({canMoveElementsUp(t){let r=!1;return e._forEachElementUp(t,()=>{r=!0}),r},moveElementsUp(t){if(!e.editor)return;let r=e.editor.layerHandler.getEffectiveLayers();[...t].map(o=>({id:o,index:r.findIndex(n=>n.id===o)})).filter(o=>o.index!==-1).sort((o,n)=>n.index-o.index).map(o=>o.id).forEach(o=>{e.editor?.layerHandler.bringForward(o)}),e._triggerUpdate()},canMoveElementsTop(t){return this.canMoveElementsUp(t)},moveElementsTop(t){e.editor&&(t.forEach(r=>{e.editor?.layerHandler.bringToFront(r)}),e._triggerUpdate())},canMoveElementsDown(t){let r=!1;return e._forEachElementDown(t,()=>{r=!0}),r},moveElementsDown(t){if(!e.editor)return;let r=e.editor.layerHandler.getEffectiveLayers();[...t].map(o=>({id:o,index:r.findIndex(n=>n.id===o)})).filter(o=>o.index!==-1).sort((o,n)=>o.index-n.index).map(o=>o.id).forEach(o=>{e.editor?.layerHandler.sendBackwards(o)}),e._triggerUpdate()},canMoveElementsBottom(t){return this.canMoveElementsDown(t)},moveElementsBottom(t){e.editor&&(t.forEach(r=>{e.editor?.layerHandler.sendToBack(r)}),e._triggerUpdate())},setElementZIndex(){}})).actions(e=>({async toDataURL(t){return e.editor?.rendererHandler.toDataURL(t)},async toBlob(t){return e.editor?.rendererHandler.toBlob(t)},async saveAsImage(t){if(!e.editor)return;let{fileName:r,...a}=t||{multiplier:1},o=await e.editor.rendererHandler.toBlob(a);o&&g(o,r||"yitu."+a.format)},toJSON(){return e.editor?.rendererHandler.toJSON()},toObject(){return e.editor?.rendererHandler.toObject()},loadJSON:E(function*(t){if(!e.editor)return;let r=yield e.editor.sceneHandler.importFromJSON(t);r&&(e.width=r.width,e.height=r.height)}),clear(){}})).actions(e=>({addFont(){},removeFont(){},async loadFont(t){let r=e.fonts.find(n=>n.fontFamily===t)||c.find(n=>n.fontFamily===t),o=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return r?(r.styles&&(o=r.styles.map(n=>({fontStyle:n.fontStyle||"normal",fontWeight:n.fontWeight||"normal"}))),p(r)):m(t),Promise.all(o.map(n=>l(t,n.fontStyle,n.fontWeight)))}}));function h({key:e}){return b.create({_key:e})}var j=h;export{f as Font,b as Store,h as createStore,j as default,y as forEveryChild};
|
package/dist/project.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ interface ProjectOptions {
|
|
|
10
10
|
}
|
|
11
11
|
declare class Project {
|
|
12
12
|
store: StoreType;
|
|
13
|
+
status: string;
|
|
14
|
+
name: string;
|
|
15
|
+
id: string;
|
|
16
|
+
user: {};
|
|
17
|
+
skipSaving: boolean;
|
|
18
|
+
cloudEnabled: boolean;
|
|
13
19
|
constructor({ store }: ProjectOptions);
|
|
14
20
|
firstLoad(data?: any): Promise<void>;
|
|
15
21
|
getGlobalFont(fonts?: FONT[]): Promise<FONT[]>;
|
|
@@ -17,5 +23,6 @@ declare class Project {
|
|
|
17
23
|
declare const ProjectContext: react.Context<Project | null>;
|
|
18
24
|
declare const useProject: () => Project;
|
|
19
25
|
declare const createProject: (options: ProjectOptions) => Project;
|
|
26
|
+
type ProjectType = InstanceType<typeof Project>;
|
|
20
27
|
|
|
21
|
-
export { ProjectContext, createProject, createProject as default, useProject };
|
|
28
|
+
export { ProjectContext, type ProjectType, createProject, createProject as default, useProject };
|
package/dist/project.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d
|
|
1
|
+
import{a,b,c,d}from"./chunk-KLZXBPXI.js";import"./chunk-WJT6VPDR.js";import"./chunk-O2XFH626.js";export{a as ProjectContext,c as createProject,d as default,b as useProject};
|