@bylqwjc/media-editor-image 1.0.26
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 +21 -0
- package/README.md +48 -0
- package/dist/chunk-5TBO732O.js +1 -0
- package/dist/index-CU3vkvDR.d.ts +44 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +36 -0
- package/dist/lazy.css +1 -0
- package/dist/lazy.d.ts +8 -0
- package/dist/lazy.js +1 -0
- package/node_modules/@media-editor/core/LICENSE +21 -0
- package/node_modules/@media-editor/core/README.md +14 -0
- package/node_modules/@media-editor/core/dist/browser.cjs +1 -0
- package/node_modules/@media-editor/core/dist/browser.d.ts +117 -0
- package/node_modules/@media-editor/core/dist/browser.js +1 -0
- package/node_modules/@media-editor/core/dist/chunk-7D4QE3R2.js +1 -0
- package/node_modules/@media-editor/core/dist/chunk-7PSQLYXL.js +1 -0
- package/node_modules/@media-editor/core/dist/chunk-FAFKY4LX.js +1 -0
- package/node_modules/@media-editor/core/dist/chunk-VDEZTXEA.js +1 -0
- package/node_modules/@media-editor/core/dist/engine.cjs +1 -0
- package/node_modules/@media-editor/core/dist/engine.d.ts +663 -0
- package/node_modules/@media-editor/core/dist/engine.js +1 -0
- package/node_modules/@media-editor/core/dist/filerobot.cjs +1 -0
- package/node_modules/@media-editor/core/dist/filerobot.d.ts +88 -0
- package/node_modules/@media-editor/core/dist/filerobot.js +1 -0
- package/node_modules/@media-editor/core/dist/index.cjs +1 -0
- package/node_modules/@media-editor/core/dist/index.d.ts +250 -0
- package/node_modules/@media-editor/core/dist/index.js +1 -0
- package/node_modules/@media-editor/core/dist/platform-presets-Ca2LbKQ3.d.ts +80 -0
- package/node_modules/@media-editor/core/dist/state-D2oM5s1a.d.ts +2098 -0
- package/node_modules/@media-editor/core/node_modules/zod/LICENSE +21 -0
- package/node_modules/@media-editor/core/node_modules/zod/README.md +208 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/package.json +76 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.cjs +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.js +1 -0
- package/node_modules/@media-editor/core/package.json +42 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 media-editor-sdk contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @media-editor/image
|
|
2
|
+
|
|
3
|
+
框架无关图片编辑器运行时。内部封装 React、ReactDOM 和 Filerobot,业务应用不需要自己安装或改造图片编辑器内部 UI。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @media-editor/image @media-editor/styles
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { mountImageEditor } from '@media-editor/image';
|
|
15
|
+
import '@media-editor/image/style.css';
|
|
16
|
+
import '@media-editor/styles/theme.css';
|
|
17
|
+
import '@media-editor/styles/filerobot.css';
|
|
18
|
+
|
|
19
|
+
const handle = mountImageEditor(el, {
|
|
20
|
+
source: fileOrUrl,
|
|
21
|
+
locale: 'zh',
|
|
22
|
+
theme: 'auto',
|
|
23
|
+
onSave: async (result, designState) => {
|
|
24
|
+
await saveImageToYourApp(result, designState);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
handle.update({ source: nextFileOrUrl });
|
|
29
|
+
handle.destroy();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Lazy
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { mountImageEditorLazy, preloadImageEditor } from '@media-editor/image/lazy';
|
|
36
|
+
|
|
37
|
+
preloadImageEditor();
|
|
38
|
+
await mountImageEditorLazy(el, options);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 选项
|
|
42
|
+
|
|
43
|
+
- `source`: 图片 URL、File、Blob 或 data URL。
|
|
44
|
+
- `locale`: `zh`、`en`、`es` 或 `zh-Hant`。
|
|
45
|
+
- `theme`: `auto`、`light` 或 `dark`。
|
|
46
|
+
- `fullscreen`: `false` 可关闭内置全屏,也可传 `{ target, buttonContainer, mode }`。
|
|
47
|
+
- `onSave`: 用户点击保存后的回调。
|
|
48
|
+
- `onClose`: 用户关闭编辑器后的回调。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";const t="__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE",r=e[t],o=r?new Proxy(r,{set:(e,t,r)=>("A"===t&&r&&"function"!=typeof r.getOwner&&(r={...r,getOwner:()=>null}),Reflect.set(e,t,r))}):r,n=o?new Proxy(e,{get:(e,r)=>r===t?o:Reflect.get(e,r)}):e;var a=Object.create,c=Object.defineProperty,p=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,l=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,s=e=>{if("react"===e)return n;throw Error(`Unsupported dynamic require: ${e}`)},u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},b=(e,t,r)=>(r=null!=e?a(l(e)):{},((e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of f(t))!O.call(e,r)&&void 0!==r&&c(e,r,{get:()=>t[r],enumerable:!(o=p(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?r:c(r,"default",{value:e,enumerable:!0}),e));export{s as a,u as b,_ as c,b as d};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ImageEditorConfigOptions } from '@media-editor/core/filerobot';
|
|
2
|
+
|
|
3
|
+
interface FullscreenToggleOptions {
|
|
4
|
+
mode?: 'overlay' | 'inline';
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
type ImageEditorFullscreenOptions = false | (FullscreenToggleOptions & {
|
|
8
|
+
/** Element that should enter fullscreen. Defaults to the editor target. */
|
|
9
|
+
target?: HTMLElement;
|
|
10
|
+
/** Element that should receive the toggle button. Defaults to the editor target. */
|
|
11
|
+
buttonContainer?: HTMLElement | null;
|
|
12
|
+
});
|
|
13
|
+
/** mountImageEditor 入参:同内核配置项,但 baseTranslations/renderRatioIcon 由本层注入;themeMode 改为更友好的 theme */
|
|
14
|
+
type MountImageEditorOptions = Omit<ImageEditorConfigOptions, 'baseTranslations' | 'renderRatioIcon' | 'themeMode'> & {
|
|
15
|
+
/** 明暗主题:'auto'(默认,跟随系统 prefers-color-scheme)/ 'light' / 'dark' */
|
|
16
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
17
|
+
/** 全屏按钮配置;传 false 可关闭内置按钮,也可把按钮放进宿主返回栏 */
|
|
18
|
+
fullscreen?: ImageEditorFullscreenOptions;
|
|
19
|
+
};
|
|
20
|
+
/** 挂载句柄:命令式更新 / 卸载 */
|
|
21
|
+
interface ImageEditorHandle {
|
|
22
|
+
/** 用新配置重渲染(locale 变更会触发内部重挂) */
|
|
23
|
+
update(opts: MountImageEditorOptions): void;
|
|
24
|
+
/** 卸载并释放 React root */
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 把图片编辑器挂载到 target 元素。框架无关:Vue/React/原生 都调它。
|
|
30
|
+
* @param target 宿主 DOM 元素(编辑器占满其尺寸,高度由宿主控制)
|
|
31
|
+
* @param opts 配置项(至少 source);locale 默认 'zh'
|
|
32
|
+
*/
|
|
33
|
+
declare function mountImageEditor(target: HTMLElement, opts: MountImageEditorOptions): ImageEditorHandle;
|
|
34
|
+
|
|
35
|
+
declare const __index_ImageEditorConfigOptions: typeof ImageEditorConfigOptions;
|
|
36
|
+
type __index_ImageEditorFullscreenOptions = ImageEditorFullscreenOptions;
|
|
37
|
+
type __index_ImageEditorHandle = ImageEditorHandle;
|
|
38
|
+
type __index_MountImageEditorOptions = MountImageEditorOptions;
|
|
39
|
+
declare const __index_mountImageEditor: typeof mountImageEditor;
|
|
40
|
+
declare namespace __index {
|
|
41
|
+
export { __index_ImageEditorConfigOptions as ImageEditorConfigOptions, type __index_ImageEditorFullscreenOptions as ImageEditorFullscreenOptions, type __index_ImageEditorHandle as ImageEditorHandle, type __index_MountImageEditorOptions as MountImageEditorOptions, __index_mountImageEditor as mountImageEditor };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { type ImageEditorHandle as I, type MountImageEditorOptions as M, __index as _, type ImageEditorFullscreenOptions as a, mountImageEditor as m };
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.tippy-box[data-animation=scale][data-placement^=top]{transform-origin:bottom}.tippy-box[data-animation=scale][data-placement^=bottom]{transform-origin:top}.tippy-box[data-animation=scale][data-placement^=left]{transform-origin:right}.tippy-box[data-animation=scale][data-placement^=right]{transform-origin:left}.tippy-box[data-animation=scale][data-state=hidden]{transform:scale(.5);opacity:0}
|
package/dist/index.d.ts
ADDED