@univerjs/watermark 0.4.2 → 0.5.0-beta.0
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/lib/cjs/facade.js +1 -0
- package/lib/cjs/index.js +1 -9
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/facade.js +33 -0
- package/lib/es/index.js +151 -810
- package/lib/es/locale/en-US.js +35 -0
- package/lib/es/locale/fa-IR.js +35 -0
- package/lib/es/locale/ru-RU.js +35 -0
- package/lib/es/locale/vi-VN.js +35 -0
- package/lib/es/locale/zh-CN.js +35 -0
- package/lib/es/locale/zh-TW.js +35 -0
- package/lib/types/controllers/config.schema.d.ts +0 -1
- package/lib/types/facade/f-univer.d.ts +26 -0
- package/lib/types/facade/index.d.ts +16 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/plugin.d.ts +2 -4
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +1 -9
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +37 -20
- package/lib/index.css +0 -1
- package/lib/locale/en-US.json +0 -32
- package/lib/locale/fa-IR.json +0 -32
- package/lib/locale/ru-RU.json +0 -32
- package/lib/locale/vi-VN.json +0 -32
- package/lib/locale/zh-CN.json +0 -32
- package/lib/locale/zh-TW.json +0 -32
- package/lib/types/commands/operations/open-watermark-panel.operation.d.ts +0 -2
- package/lib/types/controllers/menu.d.ts +0 -3
- package/lib/types/controllers/menu.schema.d.ts +0 -2
- package/lib/types/controllers/watermark.menu.controller.d.ts +0 -9
- package/lib/types/views/components/WatermarkImageSetting.d.ts +0 -8
- package/lib/types/views/components/WatermarkPanel.d.ts +0 -2
- package/lib/types/views/components/WatermarkPanelFooter.d.ts +0 -2
- package/lib/types/views/components/WatermarkTextSetting.d.ts +0 -8
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "Watermark",
|
|
4
|
+
type: "Type",
|
|
5
|
+
text: "Text",
|
|
6
|
+
image: "Image",
|
|
7
|
+
uploadImage: "Upload Image",
|
|
8
|
+
replaceImage: "Replace Image",
|
|
9
|
+
keepRatio: "Keep Ratio",
|
|
10
|
+
width: "Width",
|
|
11
|
+
height: "Height",
|
|
12
|
+
style: "Style Settings",
|
|
13
|
+
content: "Content",
|
|
14
|
+
textPlaceholder: "Enter text",
|
|
15
|
+
fontSize: "Font Size",
|
|
16
|
+
direction: "Direction",
|
|
17
|
+
ltr: "Left to Right",
|
|
18
|
+
rtl: "Right to Left",
|
|
19
|
+
inherits: "Inherit",
|
|
20
|
+
opacity: "Opacity",
|
|
21
|
+
layout: "Layout Settings",
|
|
22
|
+
rotate: "Rotate",
|
|
23
|
+
repeat: "Repeat",
|
|
24
|
+
spacingX: "Horizontal Spacing",
|
|
25
|
+
spacingY: "Vertical Spacing",
|
|
26
|
+
startX: "Horizontal Start Position",
|
|
27
|
+
startY: "Vertical Start Position",
|
|
28
|
+
cancel: "Cancel Watermark",
|
|
29
|
+
close: "Close Panel",
|
|
30
|
+
copy: "Copy Config"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "علامت آب",
|
|
4
|
+
type: "نوع",
|
|
5
|
+
text: "متن",
|
|
6
|
+
image: "تصویر",
|
|
7
|
+
uploadImage: "آپلود تصویر",
|
|
8
|
+
replaceImage: "جایگزینی تصویر",
|
|
9
|
+
keepRatio: "حفظ نسبت",
|
|
10
|
+
width: "عرض",
|
|
11
|
+
height: "ارتفاع",
|
|
12
|
+
style: "تنظیمات سبک",
|
|
13
|
+
content: "محتوا",
|
|
14
|
+
textPlaceholder: "متن را وارد کنید",
|
|
15
|
+
fontSize: "اندازه فونت",
|
|
16
|
+
direction: "جهت",
|
|
17
|
+
ltr: "چپ به راست",
|
|
18
|
+
rtl: "راست به چپ",
|
|
19
|
+
inherits: "ارث بردن",
|
|
20
|
+
opacity: "شفافیت",
|
|
21
|
+
layout: "تنظیمات چیدمان",
|
|
22
|
+
rotate: "چرخاندن",
|
|
23
|
+
repeat: "تکرار",
|
|
24
|
+
spacingX: "فاصله افقی",
|
|
25
|
+
spacingY: "فاصله عمودی",
|
|
26
|
+
startX: "موقعیت شروع افقی",
|
|
27
|
+
startY: "موقعیت شروع عمودی",
|
|
28
|
+
cancel: "لغو علامت آب",
|
|
29
|
+
close: "بستن پنل",
|
|
30
|
+
copy: "کپی تنظیمات"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "Водяной знак",
|
|
4
|
+
type: "Тип",
|
|
5
|
+
text: "Текст",
|
|
6
|
+
image: "Изображение",
|
|
7
|
+
uploadImage: "Загрузить изображение",
|
|
8
|
+
replaceImage: "Заменить изображение",
|
|
9
|
+
keepRatio: "Сохранить пропорции",
|
|
10
|
+
width: "Ширина",
|
|
11
|
+
height: "Высота",
|
|
12
|
+
style: "Настройки стиля",
|
|
13
|
+
content: "Содержание",
|
|
14
|
+
textPlaceholder: "Введите текст",
|
|
15
|
+
fontSize: "Размер шрифта",
|
|
16
|
+
direction: "Направление",
|
|
17
|
+
ltr: "Слева направо",
|
|
18
|
+
rtl: "Справа налево",
|
|
19
|
+
inherits: "Наследовать",
|
|
20
|
+
opacity: "Прозрачность",
|
|
21
|
+
layout: "Настройки макета",
|
|
22
|
+
rotate: "Поворот",
|
|
23
|
+
repeat: "Повтор",
|
|
24
|
+
spacingX: "Горизонтальный интервал",
|
|
25
|
+
spacingY: "Вертикальный интервал",
|
|
26
|
+
startX: "Горизонтальная начальная позиция",
|
|
27
|
+
startY: "Вертикальная начальная позиция",
|
|
28
|
+
cancel: "Отменить водяной знак",
|
|
29
|
+
close: "Закрыть панель",
|
|
30
|
+
copy: "Копировать конфигурацию"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "Hình mờ",
|
|
4
|
+
type: "Loại",
|
|
5
|
+
text: "Văn bản",
|
|
6
|
+
image: "Hình ảnh",
|
|
7
|
+
uploadImage: "Tải lên hình ảnh",
|
|
8
|
+
replaceImage: "Thay thế hình ảnh",
|
|
9
|
+
keepRatio: "Giữ tỷ lệ",
|
|
10
|
+
width: "Chiều rộng",
|
|
11
|
+
height: "Chiều cao",
|
|
12
|
+
style: "Cài đặt kiểu",
|
|
13
|
+
content: "Nội dung",
|
|
14
|
+
textPlaceholder: "Nhập văn bản",
|
|
15
|
+
fontSize: "Kích thước phông chữ",
|
|
16
|
+
direction: "Hướng",
|
|
17
|
+
ltr: "Trái sang phải",
|
|
18
|
+
rtl: "Phải sang trái",
|
|
19
|
+
inherits: "Thừa kế",
|
|
20
|
+
opacity: "Độ mờ",
|
|
21
|
+
layout: "Cài đặt bố cục",
|
|
22
|
+
rotate: "Xoay",
|
|
23
|
+
repeat: "Lặp lại",
|
|
24
|
+
spacingX: "Khoảng cách ngang",
|
|
25
|
+
spacingY: "Khoảng cách dọc",
|
|
26
|
+
startX: "Vị trí bắt đầu ngang",
|
|
27
|
+
startY: "Vị trí bắt đầu dọc",
|
|
28
|
+
cancel: "Hủy hình mờ",
|
|
29
|
+
close: "Đóng bảng điều khiển",
|
|
30
|
+
copy: "Sao chép cấu hình"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "水印",
|
|
4
|
+
type: "类型",
|
|
5
|
+
text: "文本",
|
|
6
|
+
image: "图片",
|
|
7
|
+
uploadImage: "上传图片",
|
|
8
|
+
replaceImage: "替换图片",
|
|
9
|
+
keepRatio: "保持比例",
|
|
10
|
+
width: "长度",
|
|
11
|
+
height: "高度",
|
|
12
|
+
style: "样式设置",
|
|
13
|
+
content: "内容",
|
|
14
|
+
textPlaceholder: "请输入文本",
|
|
15
|
+
fontSize: "字体大小",
|
|
16
|
+
direction: "方向",
|
|
17
|
+
ltr: "从左到右",
|
|
18
|
+
rtl: "从右到左",
|
|
19
|
+
inherits: "继承",
|
|
20
|
+
opacity: "透明度",
|
|
21
|
+
layout: "布局设置",
|
|
22
|
+
rotate: "旋转",
|
|
23
|
+
repeat: "重复",
|
|
24
|
+
spacingX: "水平间距",
|
|
25
|
+
spacingY: "垂直间距",
|
|
26
|
+
startX: "水平起始位置",
|
|
27
|
+
startY: "垂直起始位置",
|
|
28
|
+
cancel: "取消水印",
|
|
29
|
+
close: "关闭面板",
|
|
30
|
+
copy: "复制配置"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
title: "浮水印",
|
|
4
|
+
type: "類型",
|
|
5
|
+
text: "文字",
|
|
6
|
+
image: "圖片",
|
|
7
|
+
uploadImage: "上傳圖片",
|
|
8
|
+
replaceImage: "替換圖片",
|
|
9
|
+
keepRatio: "保持比例",
|
|
10
|
+
width: "長度",
|
|
11
|
+
height: "高度",
|
|
12
|
+
style: "樣式設置",
|
|
13
|
+
content: "內容",
|
|
14
|
+
textPlaceholder: "請輸入文字",
|
|
15
|
+
fontSize: "字體大小",
|
|
16
|
+
direction: "方向",
|
|
17
|
+
ltr: "從左到右",
|
|
18
|
+
rtl: "從右到左",
|
|
19
|
+
inherits: "繼承",
|
|
20
|
+
opacity: "透明度",
|
|
21
|
+
layout: "佈局設置",
|
|
22
|
+
rotate: "旋轉",
|
|
23
|
+
repeat: "重複",
|
|
24
|
+
spacingX: "水平間距",
|
|
25
|
+
spacingY: "垂直間距",
|
|
26
|
+
startX: "水平起始位置",
|
|
27
|
+
startY: "垂直起始位置",
|
|
28
|
+
cancel: "取消浮水印",
|
|
29
|
+
close: "關閉面板",
|
|
30
|
+
copy: "複製配置"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
t as default
|
|
35
|
+
};
|
|
@@ -4,7 +4,6 @@ export declare const PLUGIN_CONFIG_KEY = "watermark.config";
|
|
|
4
4
|
export declare const configSymbol: unique symbol;
|
|
5
5
|
export interface IUniverWatermarkConfig {
|
|
6
6
|
menu?: MenuConfig;
|
|
7
|
-
showMenu?: boolean;
|
|
8
7
|
userWatermarkSettings?: Partial<IUserInfoWatermarkConfig>;
|
|
9
8
|
textWatermarkSettings?: Partial<ITextWatermarkConfig>;
|
|
10
9
|
imageWatermarkSettings?: Partial<IImageWatermarkConfig>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IWatermarkTypeEnum } from '@univerjs/watermark';
|
|
2
|
+
interface IFUniverWatermarkMixin {
|
|
3
|
+
/**
|
|
4
|
+
* Adds a watermark to the unit. Supports both text and image watermarks based on the specified type.
|
|
5
|
+
*
|
|
6
|
+
* @param {IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image} type - The type of watermark to add. Can be either 'Text' or 'Image'.
|
|
7
|
+
* @param {ITextWatermarkConfig | IImageWatermarkConfig} config - The configuration object for the watermark.
|
|
8
|
+
* - If the type is 'Text', the config should follow the ITextWatermarkConfig interface.
|
|
9
|
+
* - If the type is 'Image', the config should follow the IImageWatermarkConfig interface.
|
|
10
|
+
* @throws {Error} Throws an error if the watermark type is unknown.
|
|
11
|
+
*/
|
|
12
|
+
addWatermark(type: IWatermarkTypeEnum.Text, config: ITextWatermarkConfig): void;
|
|
13
|
+
addWatermark(type: IWatermarkTypeEnum.Image, config: IImageWatermarkConfig): void;
|
|
14
|
+
addWatermark(type: IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image, config: ITextWatermarkConfig | IImageWatermarkConfig): void;
|
|
15
|
+
/**
|
|
16
|
+
* Deletes the currently applied watermark from the unit.
|
|
17
|
+
*
|
|
18
|
+
* This function retrieves the watermark service and invokes the method to remove any existing watermark configuration.
|
|
19
|
+
*/
|
|
20
|
+
deleteWatermark(): void;
|
|
21
|
+
}
|
|
22
|
+
declare module '@univerjs/core' {
|
|
23
|
+
interface FUniver extends IFUniverWatermarkMixin {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import './f-univer';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { UniverWatermarkPlugin } from './plugin';
|
|
17
|
-
export { WatermarkImageBaseConfig, WatermarkTextBaseConfig, WatermarkUserInfoBaseConfig } from './common/const';
|
|
17
|
+
export { UNIVER_WATERMARK_STORAGE_KEY, WATERMARK_IMAGE_ALLOW_IMAGE_LIST, WatermarkImageBaseConfig, WatermarkTextBaseConfig, WatermarkUserInfoBaseConfig } from './common/const';
|
|
18
18
|
export type { IImageWatermarkConfig, ITextWatermarkConfig } from './common/type';
|
|
19
19
|
export { IWatermarkTypeEnum } from './common/type';
|
|
20
20
|
export { WatermarkService } from './services/watermark.service';
|
|
21
|
+
export type { IWatermarkConfig, IWatermarkConfigWithType } from './common/type';
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { IUniverWatermarkConfig } from './controllers/config.schema';
|
|
2
|
-
import {
|
|
2
|
+
import { IConfigService, ILocalStorageService, Injector, Plugin } from '@univerjs/core';
|
|
3
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
export declare class UniverWatermarkPlugin extends Plugin {
|
|
5
5
|
private readonly _config;
|
|
6
6
|
protected _injector: Injector;
|
|
7
7
|
private readonly _configService;
|
|
8
|
-
private readonly _commandService;
|
|
9
8
|
private readonly _renderManagerSrv;
|
|
10
9
|
private readonly _localStorageService;
|
|
11
10
|
static pluginName: string;
|
|
12
|
-
constructor(_config: Partial<IUniverWatermarkConfig> | undefined, _injector: Injector, _configService: IConfigService,
|
|
11
|
+
constructor(_config: Partial<IUniverWatermarkConfig> | undefined, _injector: Injector, _configService: IConfigService, _renderManagerSrv: IRenderManagerService, _localStorageService: ILocalStorageService);
|
|
13
12
|
private _initWatermarkStorage;
|
|
14
13
|
private _initDependencies;
|
|
15
|
-
private _initRegisterCommand;
|
|
16
14
|
onRendered(): void;
|
|
17
15
|
private _initRenderDependencies;
|
|
18
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(require("@univerjs/core"),require("@univerjs/watermark")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/watermark"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.UniverCore,r.UniverWatermark))})(this,function(r,e){"use strict";class a extends r.FUniver{addWatermark(t,i){const n=this._injector.get(e.WatermarkService);if(t===e.IWatermarkTypeEnum.Text)n.updateWatermarkConfig({type:e.IWatermarkTypeEnum.Text,config:{text:{...e.WatermarkTextBaseConfig,...i}}});else if(t===e.IWatermarkTypeEnum.Image)n.updateWatermarkConfig({type:e.IWatermarkTypeEnum.Image,config:{image:{...e.WatermarkImageBaseConfig,...i}}});else throw new Error("Unknown watermark type")}deleteWatermark(){this._injector.get(e.WatermarkService).deleteWatermarkConfig()}}r.FUniver.extend(a)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("react"),require("@univerjs/design"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/ui","react","@univerjs/design","rxjs"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverWatermark={},global.UniverCore,global.UniverEngineRender,global.UniverUi,global.React,global.UniverDesign,global.rxjs))})(this,function(exports2,core,engineRender,ui,require$$0,design,rxjs){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c,_d;const UNIVER_WATERMARK_MENU="UNIVER_WATERMARK_MENU",WATERMARK_PANEL="WATERMARK_PANEL",WATERMARK_PANEL_FOOTER="WATERMARK_PANEL_FOOTER",UNIVER_WATERMARK_STORAGE_KEY="UNIVER_WATERMARK_STORAGE_KEY",WATERMARK_IMAGE_ALLOW_IMAGE_LIST=["image/png","image/jpeg","image/jpg","image/bmp"],WatermarkTextBaseConfig={content:"",fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},WatermarkImageBaseConfig={url:"",width:100,height:100,maintainAspectRatio:!0,originRatio:1,x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},WatermarkUserInfoBaseConfig={name:!0,email:!1,phone:!1,uid:!1,fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:60,repeat:!0,spacingX:200,spacingY:100,rotate:-30,opacity:.15},OpenWatermarkPanelOperation={type:core.CommandType.OPERATION,id:"univer.operation.open-watermark-panel",handler(accessor){const sidebarService=accessor.get(ui.ISidebarService),localeService=accessor.get(core.LocaleService);return sidebarService.open({header:{title:localeService.t("univer-watermark.title")},children:{label:WATERMARK_PANEL},footer:{label:WATERMARK_PANEL_FOOTER},onClose:__name(()=>{},"onClose"),width:330}),!0}};var IWatermarkTypeEnum=(IWatermarkTypeEnum2=>(IWatermarkTypeEnum2.UserInfo="userInfo",IWatermarkTypeEnum2.Text="text",IWatermarkTypeEnum2.Image="image",IWatermarkTypeEnum2))(IWatermarkTypeEnum||{}),__assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},BoldSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"bold-single",ref,icon:element$3}))});BoldSingle.displayName="BoldSingle";var element$2={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_102_1198",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#DCDCDC",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{mask:"url(#mask0_102_1198)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.68731 9.98425C5.73282 9.87144 5.77827 9.75442 5.82366 9.63323L6.3312 8.27586H9.65859L10.3523 10.1159C10.405 10.284 10.4868 10.4276 10.6023 10.5378C10.74 10.669 10.9119 10.7236 11.1014 10.714C11.3544 10.7131 11.5919 10.6379 11.6996 10.4032L11.7013 10.3992C11.7901 10.1937 11.7749 9.9634 11.6929 9.7289L8.85351 1.86337C8.79546 1.68828 8.6901 1.54881 8.54213 1.45002C8.38836 1.33863 8.1989 1.29112 7.98798 1.29112C7.78272 1.29112 7.59752 1.34014 7.4446 1.45198C7.30481 1.55223 7.20617 1.69184 7.14935 1.86343L4.324 9.70145L4.32281 9.70495C4.27002 9.86052 4.23828 10.0056 4.23828 10.1346C4.23828 10.2646 4.27116 10.3937 4.36281 10.4909C4.50256 10.6468 4.6921 10.714 4.90604 10.714C5.0369 10.714 5.15805 10.6745 5.26156 10.5916C5.3633 10.5247 5.44621 10.4332 5.51101 10.3217C5.57988 10.2177 5.63858 10.1051 5.68731 9.98425ZM6.72105 7.00152L8.00144 3.32827L9.28183 7.00152H6.72105Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"rect",attrs:{width:11.58,height:2.56,x:2.21,y:12.2,fill:"colorChannel1",rx:1.28}}]}]},FontColor=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"font-color",ref,icon:element$2}))});FontColor.displayName="FontColor";var element$1={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},ItalicSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"italic-single",ref,icon:element$1}))});ItalicSingle.displayName="ItalicSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.93949 12.3363L1.94048 12.3357 1.95034 12.33C1.95981 12.3245 1.97499 12.3158 1.99548 12.3043 2.0365 12.2813 2.09866 12.2474 2.17888 12.2061 2.33971 12.1234 2.57112 12.0123 2.84885 11.9012 3.41339 11.6754 4.12822 11.4664 4.81552 11.4664 5.82167 11.4664 6.71309 11.8774 7.74399 12.3643 7.7595 12.3717 7.77504 12.379 7.79061 12.3864 8.77119 12.8497 9.88765 13.3772 11.185 13.3772 12.0901 13.3772 12.9676 13.1085 13.5973 12.8566 13.9167 12.7289 14.1829 12.6011 14.3704 12.5047 14.4644 12.4564 14.5391 12.4157 14.5914 12.3864 14.6175 12.3717 14.6381 12.3599 14.6527 12.3514L14.6702 12.3412 14.6755 12.3381 14.6772 12.337 14.6782 12.3365C14.6782 12.3365 14.6784 12.3363 14.3697 11.8218L14.6782 12.3365C14.9623 12.166 15.0547 11.7973 14.8842 11.5131 14.7138 11.2291 14.3454 11.1369 14.0613 11.3071L14.06 11.3079 14.0502 11.3137C14.0407 11.3192 14.0255 11.3279 14.005 11.3394 13.964 11.3623 13.9019 11.3963 13.8216 11.4375 13.6608 11.5202 13.4294 11.6314 13.1517 11.7424 12.5871 11.9683 11.8723 12.1772 11.185 12.1772 10.1788 12.1772 9.28742 11.7663 8.25652 11.2793 8.24101 11.272 8.22547 11.2646 8.2099 11.2573 7.22931 10.7939 6.11286 10.2664 4.81552 10.2664 3.91046 10.2664 3.03292 10.5351 2.40318 10.787 2.08377 10.9148 1.81757 11.0425 1.63007 11.139 1.53613 11.1873 1.46144 11.228 1.40916 11.2573 1.383 11.2719 1.36241 11.2837 1.34778 11.2922L1.33033 11.3024 1.32504 11.3056 1.32327 11.3066 1.32233 11.3072C1.32233 11.3072 1.32209 11.3073 1.63068 11.8217L1.32233 11.3072C1.03818 11.4777.945803 11.8464 1.11629 12.1305 1.28674 12.4146 1.65536 12.5066 1.93949 12.3363zM1.93949 8.51464L1.94048 8.51406 1.95034 8.50829C1.95981 8.50279 1.97499 8.49407 1.99548 8.4826 2.0365 8.45963 2.09866 8.4257 2.17888 8.38443 2.33971 8.30172 2.57112 8.19061 2.84885 8.07952 3.41339 7.85371 4.12822 7.64473 4.81552 7.64473 5.82167 7.64473 6.71309 8.05572 7.74399 8.54267 7.7595 8.54999 7.77504 8.55733 7.79061 8.56469 8.77119 9.02803 9.88765 9.55557 11.185 9.55557 12.0901 9.55557 12.9676 9.28684 13.5973 9.03494 13.9167 8.90718 14.1829 8.77943 14.3704 8.683 14.4644 8.63469 14.5391 8.59398 14.5914 8.5647 14.6175 8.55006 14.6381 8.53825 14.6527 8.52975L14.6702 8.51954 14.6755 8.51641 14.6772 8.51535 14.6782 8.51479C14.6782 8.51479 14.6784 8.51464 14.3697 8.00015L14.6782 8.51479C14.9623 8.3443 15.0547 7.9756 14.8842 7.69145 14.7138 7.4074 14.3454 7.31523 14.0613 7.48547L14.06 7.48623 14.0502 7.492C14.0407 7.4975 14.0255 7.50622 14.005 7.5177 13.964 7.54067 13.9019 7.5746 13.8216 7.61586 13.6608 7.69857 13.4294 7.80968 13.1517 7.92077 12.5871 8.14659 11.8723 8.35557 11.185 8.35557 10.1788 8.35557 9.28742 7.94457 8.25652 7.45762 8.24101 7.4503 8.22547 7.44296 8.2099 7.4356 7.22931 6.97226 6.11286 6.44473 4.81552 6.44473 3.91046 6.44473 3.03292 6.71346 2.40318 6.96535 2.08377 7.09311 1.81757 7.22086 1.63007 7.31729 1.53613 7.3656 1.46144 7.40631 1.40916 7.43559 1.383 7.45024 1.36241 7.46205 1.34778 7.47054L1.33033 7.48075 1.32504 7.48389 1.32327 7.48494 1.32233 7.48551C1.32233 7.48551 1.32209 7.48565 1.63068 7.99997L1.32233 7.48551C1.03818 7.656.945803 8.0247 1.11629 8.30884 1.28674 8.59292 1.65536 8.68496 1.93949 8.51464zM1.93949 4.69296L1.94048 4.69238 1.95034 4.68661C1.95981 4.68111 1.97499 4.67239 1.99548 4.66092 2.0365 4.63795 2.09866 4.60402 2.17888 4.56276 2.33971 4.48004 2.57112 4.36893 2.84885 4.25784 3.41339 4.03203 4.12822 3.82305 4.81552 3.82305 5.82167 3.82305 6.71309 4.23404 7.74399 4.72099 7.7595 4.72831 7.77504 4.73566 7.79061 4.74301 8.77119 5.20635 9.88765 5.73389 11.185 5.73389 12.0901 5.73389 12.9676 5.46516 13.5973 5.21326 13.9167 5.0855 14.1829 4.95775 14.3704 4.86132 14.4644 4.81301 14.5391 4.7723 14.5914 4.74302 14.6175 4.72838 14.6381 4.71657 14.6527 4.70807L14.6702 4.69786 14.6755 4.69473 14.6772 4.69367 14.6782 4.69311C14.6782 4.69311 14.6784 4.69296 14.3697 4.17847L14.6782 4.69311C14.9623 4.52262 15.0547 4.15392 14.8842 3.86977 14.7138 3.58572 14.3454 3.49355 14.0613 3.66379L14.06 3.66455 14.0502 3.67032C14.0407 3.67582 14.0255 3.68454 14.005 3.69602 13.964 3.71899 13.9019 3.75292 13.8216 3.79418 13.6608 3.87689 13.4294 3.988 13.1517 4.09909 12.5871 4.32491 11.8723 4.53389 11.185 4.53389 10.1788 4.53389 9.28742 4.12289 8.25652 3.63594 8.24101 3.62862 8.22547 3.62128 8.2099 3.61392 7.22931 3.15058 6.11286 2.62305 4.81552 2.62305 3.91046 2.62305 3.03292 2.89178 2.40318 3.14367 2.08377 3.27143 1.81757 3.39918 1.63007 3.49561 1.53613 3.54392 1.46144 3.58463 1.40916 3.61391 1.383 3.62856 1.36241 3.64037 1.34778 3.64886L1.33033 3.65907 1.32504 3.66221 1.32327 3.66326 1.32233 3.66383C1.32233 3.66383 1.32209 3.66397 1.63068 4.17829L1.32233 3.66383C1.03818 3.83432.945803 4.20302 1.11629 4.48716 1.28674 4.77124 1.65536 4.86329 1.93949 4.69296z",fillRule:"evenodd",clipRule:"evenodd"}}]},WatermarkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"watermark-single",ref,icon:element}))});WatermarkSingle.displayName="WatermarkSingle";var jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q"),reactJsxRuntime_production_min.Fragment=l,reactJsxRuntime_production_min.jsx=q,reactJsxRuntime_production_min.jsxs=q,jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,__defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");exports2.WatermarkService=(_a=class extends core.Disposable{constructor(_localStorageService){super();__publicField(this,"_updateConfig$",new rxjs.Subject);__publicField(this,"updateConfig$",this._updateConfig$.asObservable());__publicField(this,"_refresh$",new rxjs.Subject);__publicField(this,"refresh$",this._refresh$.asObservable());this._localStorageService=_localStorageService}async getWatermarkConfig(){return await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY)}updateWatermarkConfig(config){this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY,config),this._updateConfig$.next(config)}deleteWatermarkConfig(){this._localStorageService.removeItem(UNIVER_WATERMARK_STORAGE_KEY),this._updateConfig$.next(null)}refresh(){this._refresh$.next(Math.random())}dispose(){this._refresh$.complete(),this._updateConfig$.complete()}},__name(_a,"WatermarkService"),_a),exports2.WatermarkService=__decorateClass$3([__decorateParam$3(0,core.Inject(core.ILocalStorageService))],exports2.WatermarkService);const styles={watermarkPanel:"univer-watermark-panel",watermarkPanelTypeTitle:"univer-watermark-panel-type-title",watermarkPanelTypeSelect:"univer-watermark-panel-type-select",watermarkPanelSetting:"univer-watermark-panel-setting",watermarkPanelFooter:"univer-watermark-panel-footer",watermarkPanelFooterButtonWrapper:"univer-watermark-panel-footer-button-wrapper",watermarkPanelFooterReset:"univer-watermark-panel-footer-reset",watermarkTextSetting:"univer-watermark-text-setting",watermarkTextSettingHeader:"univer-watermark-text-setting-header",watermarkTextSettingFontContent:"univer-watermark-text-setting-font-content",watermarkTextSettingFontStylePart:"univer-watermark-text-setting-font-style-part",watermarkTextSettingLayoutFontWrapper:"univer-watermark-text-setting-layout-font-wrapper",watermarkImageSetting:"univer-watermark-image-setting",watermarkInput:"univer-watermark-input",watermarkInputContent:"univer-watermark-input-content",watermarkIcon:"univer-watermark-icon",watermarkIconWrapper:"univer-watermark-icon-wrapper",watermarkIconWrapperSelect:"univer-watermark-icon-wrapper-select",watermarkColorPickerWrapper:"univer-watermark-color-picker-wrapper"},WatermarkImageSetting=__name(({config,onChange})=>{const fileOpenService=core.useDependency(ui.ILocalFileService),localeService=core.useDependency(core.LocaleService);if(!config)return null;const handleUpdateImageUrl=__name(async()=>{const files=await fileOpenService.openFile({multiple:!1,accept:WATERMARK_IMAGE_ALLOW_IMAGE_LIST.map(image=>`.${image.replace("image/","")}`).join(",")});if(files.length===0)return!1;const file=files[0],reader=new FileReader;reader.onload=function(event){var _a2;if((_a2=event.target)!=null&&_a2.result){const base64String=event.target.result,img=new Image;img.onload=function(){onChange({...config,url:base64String,width:Math.max(20,img.width),height:Math.max(img.height,20),originRatio:img.width/img.height})},img.src=base64String}},reader.readAsDataURL(file)},"handleUpdateImageUrl");return jsxRuntimeExports.jsxs("div",{className:styles.watermarkImageSetting,children:[jsxRuntimeExports.jsx("div",{className:styles.watermarkTextSettingHeader,children:localeService.t("univer-watermark.image")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayout,children:[jsxRuntimeExports.jsx("span",{children:localeService.t("univer-watermark.image")}),jsxRuntimeExports.jsx(design.Button,{onClick:handleUpdateImageUrl,style:{marginLeft:8},children:config.url?localeService.t("univer-watermark.replaceImage"):localeService.t("univer-watermark.uploadImage")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.opacity")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.opacity,onChange:__name(val=>{val!=null&&onChange({...config,opacity:Number.parseFloat(val.toString())})},"onChange"),max:1,min:0,step:.05,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.keepRatio")}),jsxRuntimeExports.jsx(design.Checkbox,{checked:config.maintainAspectRatio,onChange:__name(val=>{onChange(val===!0?{...config,maintainAspectRatio:val,height:Math.round(config.width/config.originRatio)}:{...config,maintainAspectRatio:val})},"onChange")})]})]})]}),jsxRuntimeExports.jsx("div",{className:styles.watermarkTextSettingLayout,children:jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.width")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.width,onChange:__name(val=>{if(val!=null){const newWidth=Math.max(20,Number.parseInt(val.toString()));config.maintainAspectRatio?onChange({...config,width:newWidth,height:Math.round(newWidth/config.originRatio)}):onChange({...config,width:newWidth})}},"onChange"),min:20,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.height")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.height,onChange:__name(val=>{if(val!=null){const newHeight=Math.max(20,Number.parseInt(val.toString()));config.maintainAspectRatio?onChange({...config,height:newHeight,width:Math.round(newHeight*config.originRatio)}):onChange({...config,height:Number.parseInt(val.toString())})}},"onChange"),min:20,className:styles.watermarkInput})]})]})}),jsxRuntimeExports.jsx("div",{className:styles.watermarkTextSettingHeader,children:localeService.t("univer-watermark.layout")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayout,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.rotate")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.rotate,onChange:__name(val=>{val!=null&&onChange({...config,rotate:Number.parseInt(val.toString())})},"onChange"),max:360,min:-360,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.repeat")}),jsxRuntimeExports.jsx(design.Checkbox,{checked:config.repeat,onChange:__name(val=>onChange({...config,repeat:val}),"onChange")})]})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.spacingX")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.spacingX,onChange:__name(val=>{val!=null&&onChange({...config,spacingX:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.spacingY")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.spacingY,onChange:__name(val=>{val!=null&&onChange({...config,spacingY:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.startX")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.x,onChange:__name(val=>{val!=null&&onChange({...config,x:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.startY")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.y,onChange:__name(val=>{val!=null&&onChange({...config,y:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]})]})]})]})},"WatermarkImageSetting");function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const WatermarkTextSetting=__name(props=>{var _a2;const{config,onChange}=props,localeService=core.useDependency(core.LocaleService);return config?jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSetting,children:[jsxRuntimeExports.jsx("div",{className:styles.watermarkTextSettingHeader,children:localeService.t("univer-watermark.style")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontContent,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.content")}),jsxRuntimeExports.jsx(design.Input,{value:config.content,onChange:__name(val=>onChange({...config,content:val}),"onChange"),className:styles.watermarkInputContent,placeholder:localeService.t("univer-watermark.textPlaceholder")})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStyle,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.fontSize")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.fontSize,onChange:__name(val=>{val!=null&&onChange({...config,fontSize:Number.parseInt(val.toString())})},"onChange"),max:72,min:12,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{style:{margin:"0 8px"},children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.direction")}),jsxRuntimeExports.jsx(design.Select,{value:config.direction,onChange:__name(v=>onChange({...config,direction:v}),"onChange"),options:[{label:localeService.t("univer-watermark.ltr"),value:"ltr"},{label:localeService.t("univer-watermark.rtl"),value:"rtl"}]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.opacity")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.opacity,onChange:__name(val=>{val!=null&&onChange({...config,opacity:Number.parseFloat(val.toString())})},"onChange"),max:1,min:0,step:.05,className:styles.watermarkInput})]})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsx("div",{className:styles.watermarkIconWrapper,children:jsxRuntimeExports.jsx(design.Dropdown,{overlay:jsxRuntimeExports.jsx("div",{className:styles.watermarkColorPickerWrapper,children:jsxRuntimeExports.jsx(design.ColorPicker,{color:config.color,onChange:__name(val=>onChange({...config,color:val}),"onChange")})}),children:jsxRuntimeExports.jsx(FontColor,{className:styles.watermarkIcon,extend:{colorChannel1:(_a2=config.color)!=null?_a2:"rgb(var(--primary-color))"}})})}),jsxRuntimeExports.jsx("div",{className:clsx(styles.watermarkIconWrapper,{[styles.watermarkIconWrapperSelect]:config.bold}),onClick:__name(()=>{onChange({...config,bold:!config.bold})},"onClick"),children:jsxRuntimeExports.jsx(BoldSingle,{className:styles.watermarkIcon})}),jsxRuntimeExports.jsx("div",{className:clsx(styles.watermarkIconWrapper,{[styles.watermarkIconWrapperSelect]:config.italic}),onClick:__name(()=>{onChange({...config,italic:!config.italic})},"onClick"),children:jsxRuntimeExports.jsx(ItalicSingle,{className:styles.watermarkIcon})})]})]}),jsxRuntimeExports.jsx("div",{className:styles.watermarkTextSettingHeader,children:localeService.t("univer-watermark.layout")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayout,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.rotate")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.rotate,onChange:__name(val=>{val!=null&&onChange({...config,rotate:Number.parseInt(val.toString())})},"onChange"),max:360,min:-360,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.repeat")}),jsxRuntimeExports.jsx(design.Checkbox,{checked:config.repeat,onChange:__name(val=>onChange({...config,repeat:val}),"onChange")})]})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.spacingX")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.spacingX,onChange:__name(val=>{val!=null&&onChange({...config,spacingX:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.spacingY")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.spacingY,onChange:__name(val=>{val!=null&&onChange({...config,spacingY:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingFontStylePart,children:[jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.startX")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.x,onChange:__name(val=>{val!=null&&onChange({...config,x:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkTextSettingLayoutFontWrapper,children:[jsxRuntimeExports.jsx("div",{children:localeService.t("univer-watermark.startY")}),jsxRuntimeExports.jsx(design.InputNumber,{value:config.y,onChange:__name(val=>{val!=null&&onChange({...config,y:Number.parseInt(val.toString())})},"onChange"),min:0,className:styles.watermarkInput})]})]})]})]}):null},"WatermarkTextSetting"),WatermarkPanel=__name(()=>{const[watermarkType,setWatermarkType]=require$$0.useState(IWatermarkTypeEnum.Text),[config,setConfig]=require$$0.useState(),watermarkService=core.useDependency(exports2.WatermarkService),localStorageService=core.useDependency(core.ILocalStorageService),_refresh=core.useObservable(watermarkService.refresh$),localeService=core.useDependency(core.LocaleService);function handleConfigChange(config2,type){setConfig(config2),watermarkService.updateWatermarkConfig({type:type!=null?type:watermarkType,config:config2})}__name(handleConfigChange,"handleConfigChange");const getWatermarkConfig=require$$0.useCallback(async()=>{const watermarkConfig=await localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);watermarkConfig?(setWatermarkType(watermarkConfig.type),setConfig(watermarkConfig.config)):setConfig({text:WatermarkTextBaseConfig})},[]);return require$$0.useEffect(()=>{getWatermarkConfig()},[_refresh,getWatermarkConfig]),jsxRuntimeExports.jsxs("div",{className:styles.watermarkPanel,children:[jsxRuntimeExports.jsx("div",{className:styles.watermarkPanelTypeTitle,children:localeService.t("univer-watermark.type")}),jsxRuntimeExports.jsx(design.Select,{value:watermarkType,onChange:__name(v=>{setWatermarkType(v),v===IWatermarkTypeEnum.Text?handleConfigChange({text:WatermarkTextBaseConfig},IWatermarkTypeEnum.Text):v===IWatermarkTypeEnum.Image&&handleConfigChange({image:WatermarkImageBaseConfig},IWatermarkTypeEnum.Image)},"onChange"),options:[{label:localeService.t("univer-watermark.text"),value:IWatermarkTypeEnum.Text},{label:localeService.t("univer-watermark.image"),value:IWatermarkTypeEnum.Image}],className:styles.watermarkPanelTypeSelect}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkPanelSetting,children:[watermarkType===IWatermarkTypeEnum.Text&&jsxRuntimeExports.jsx(WatermarkTextSetting,{config:config==null?void 0:config.text,onChange:__name(v=>handleConfigChange({text:v}),"onChange")}),watermarkType===IWatermarkTypeEnum.Image&&jsxRuntimeExports.jsx(WatermarkImageSetting,{config:config==null?void 0:config.image,onChange:__name(v=>handleConfigChange({image:v}),"onChange")})]})]})},"WatermarkPanel"),WatermarkPanelFooter=__name(()=>{const sidebarService=core.useDependency(ui.ISidebarService),watermarkService=core.useDependency(exports2.WatermarkService),localeService=core.useDependency(core.LocaleService),clipboardService=core.useDependency(ui.IClipboardInterfaceService);return jsxRuntimeExports.jsxs("div",{className:styles.watermarkPanelFooter,children:[jsxRuntimeExports.jsx("div",{className:styles.watermarkPanelFooterReset,onClick:__name(()=>{watermarkService.updateWatermarkConfig({type:IWatermarkTypeEnum.Text,config:{text:WatermarkTextBaseConfig}}),watermarkService.refresh()},"onClick"),children:localeService.t("univer-watermark.cancel")}),jsxRuntimeExports.jsxs("div",{className:styles.watermarkPanelFooterButtonWrapper,children:[jsxRuntimeExports.jsx(design.Button,{style:{marginRight:8},onClick:__name(async()=>{const watermarkConfig=await watermarkService.getWatermarkConfig();let config;(watermarkConfig==null?void 0:watermarkConfig.type)===IWatermarkTypeEnum.Text?config=watermarkConfig.config.text:(watermarkConfig==null?void 0:watermarkConfig.type)===IWatermarkTypeEnum.Image&&(config=watermarkConfig.config.image),clipboardService.writeText(JSON.stringify(config))},"onClick"),children:localeService.t("univer-watermark.copy")}),jsxRuntimeExports.jsx(design.Button,{onClick:__name(async()=>{var _a2,_b2;const watermarkConfig=await watermarkService.getWatermarkConfig();((watermarkConfig==null?void 0:watermarkConfig.type)===IWatermarkTypeEnum.Text&&!((_a2=watermarkConfig.config.text)!=null&&_a2.content)||(watermarkConfig==null?void 0:watermarkConfig.type)===IWatermarkTypeEnum.Image&&!((_b2=watermarkConfig.config.image)!=null&&_b2.url))&&watermarkService.deleteWatermarkConfig(),sidebarService.close()},"onClick"),children:localeService.t("univer-watermark.close")})]})]})},"WatermarkPanelFooter");function WatermarkMenuItemFactory(accessor){return{id:OpenWatermarkPanelOperation.id,title:"univer-watermark.title",tooltip:"univer-watermark.title",icon:UNIVER_WATERMARK_MENU,type:ui.MenuItemType.BUTTON,hidden$:getWatermarkMenuHiddenObservable(accessor)}}__name(WatermarkMenuItemFactory,"WatermarkMenuItemFactory");function getWatermarkMenuHiddenObservable(accessor){return accessor.get(core.IUniverInstanceService).focused$.pipe(rxjs.switchMap(id=>id===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY?rxjs.of(!0):rxjs.of(!1)))}__name(getWatermarkMenuHiddenObservable,"getWatermarkMenuHiddenObservable");const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[OpenWatermarkPanelOperation.id]:{order:0,menuItemFactory:WatermarkMenuItemFactory}}};var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let UniverWatermarkMenuController=(_b=class extends core.Disposable{constructor(_menuManagerService,_componentManager){super(),this._menuManagerService=_menuManagerService,this._componentManager=_componentManager,this._initMenu(),this._initComponents()}_initComponents(){[[UNIVER_WATERMARK_MENU,WatermarkSingle],[WATERMARK_PANEL,WatermarkPanel],[WATERMARK_PANEL_FOOTER,WatermarkPanelFooter]].forEach(([key,component])=>{this.disposeWithMe(this._componentManager.register(key,component))})}_initMenu(){this._menuManagerService.mergeMenu(menuSchema)}},__name(_b,"UniverWatermarkMenuController"),_b);UniverWatermarkMenuController=__decorateClass$2([__decorateParam$2(0,ui.IMenuManagerService),__decorateParam$2(1,core.Inject(ui.ComponentManager))],UniverWatermarkMenuController);function renderWatermark(ctx,config,image,userInfo){const type=config.type,watermarkConfig=config.config;type===IWatermarkTypeEnum.UserInfo&&watermarkConfig.userInfo?renderUserInfoWatermark(ctx,watermarkConfig.userInfo,userInfo):type===IWatermarkTypeEnum.Image&&watermarkConfig.image?renderImageWatermark(ctx,watermarkConfig.image,image):type===IWatermarkTypeEnum.Text&&watermarkConfig.text&&renderTextWatermark(ctx,watermarkConfig.text)}__name(renderWatermark,"renderWatermark");function renderUserInfoWatermark(ctx,config,userInfo){const{x,y,repeat,spacingX,spacingY,rotate,opacity,name,fontSize,color,bold,italic,direction}=config;if(!userInfo)return;let watermarkContent="";if(name&&(watermarkContent+=`${userInfo.name} `),!watermarkContent)return;ctx.save(),ctx.globalAlpha=opacity,ctx.direction=direction;let fontStyle="";if(italic&&(fontStyle+="italic "),bold&&(fontStyle+="bold "),fontStyle+=`${fontSize}px Arial`,ctx.font=fontStyle,ctx.fillStyle=color,repeat){const canvasWidth=ctx.canvas.width,canvasHeight=ctx.canvas.height;for(let posY=y;posY<canvasHeight;posY+=fontSize+spacingY)for(let posX=x;posX<canvasWidth;posX+=ctx.measureText(watermarkContent).width+spacingX)ctx.save(),ctx.translate(posX,posY),ctx.rotate(Math.PI/180*rotate),ctx.fillText(watermarkContent,0,0),ctx.restore()}else ctx.save(),ctx.translate(x,y),ctx.rotate(Math.PI/180*rotate),ctx.fillText(watermarkContent,0,0),ctx.restore();ctx.restore()}__name(renderUserInfoWatermark,"renderUserInfoWatermark");function renderTextWatermark(ctx,config){const{x,y,repeat,spacingX,spacingY,rotate,opacity,content,fontSize,color,bold,italic,direction}=config;ctx.save(),ctx.globalAlpha=opacity,ctx.direction=direction;let fontStyle="";if(italic&&(fontStyle+="italic "),bold&&(fontStyle+="bold "),fontStyle+=`${fontSize}px Arial`,ctx.font=fontStyle,ctx.fillStyle=color,content)if(repeat){const canvasWidth=ctx.canvas.width,canvasHeight=ctx.canvas.height;for(let posY=y;posY<canvasHeight;posY+=fontSize+spacingY)for(let posX=x;posX<canvasWidth;posX+=ctx.measureText(content).width+spacingX)ctx.save(),ctx.translate(posX,posY),ctx.rotate(Math.PI/180*rotate),ctx.fillText(content,0,0),ctx.restore()}else ctx.save(),ctx.translate(x,y),ctx.rotate(Math.PI/180*rotate),ctx.fillText(content,0,0),ctx.restore();ctx.restore()}__name(renderTextWatermark,"renderTextWatermark");function renderImageWatermark(ctx,config,image){const{x,y,repeat,spacingX,spacingY,rotate,opacity,width,height,maintainAspectRatio,originRatio}=config;if(!(image!=null&&image.complete))return;ctx.save(),ctx.globalAlpha=opacity;const actualWidth=width,actualHeight=maintainAspectRatio?width/originRatio:height;if(repeat){const canvasWidth=ctx.canvas.width,canvasHeight=ctx.canvas.height;for(let posY=y;posY<canvasHeight;posY+=actualHeight+spacingY)for(let posX=x;posX<canvasWidth;posX+=actualWidth+spacingX)ctx.save(),ctx.translate(posX,posY),ctx.rotate(Math.PI/180*rotate),ctx.drawImage(image,0,0,actualWidth,actualHeight),ctx.restore()}else ctx.save(),ctx.translate(x,y),ctx.rotate(Math.PI/180*rotate),ctx.drawImage(image,0,0,actualWidth,actualHeight),ctx.restore();ctx.restore()}__name(renderImageWatermark,"renderImageWatermark");const _WatermarkLayer=class _WatermarkLayer extends engineRender.Layer{constructor(){super(...arguments);__publicField(this,"_config");__publicField(this,"_image");__publicField(this,"_user")}render(ctx,isMaxLayer=!1){var _a2;super.render(ctx,isMaxLayer);const mainCtx=ctx||((_a2=this.scene.getEngine())==null?void 0:_a2.getCanvas().getContext());return mainCtx&&mainCtx.getId()&&this._renderWatermark(mainCtx),this}updateConfig(config,user){var _a2;this._config=config,((_a2=this._config)==null?void 0:_a2.type)===IWatermarkTypeEnum.Image&&this._config.config.image&&(this._image=new Image,this._image.src=this._config.config.image.url),user&&(this._user=user)}_renderWatermark(ctx){this._config&&renderWatermark(ctx,this._config,this._image,this._user)}};__name(_WatermarkLayer,"WatermarkLayer");let WatermarkLayer=_WatermarkLayer;var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let WatermarkRenderController=(_c=class extends core.RxDisposable{constructor(_context,_watermarkService,_localStorageService,_userManagerService){super();__publicField(this,"_watermarkLayer");this._context=_context,this._watermarkService=_watermarkService,this._localStorageService=_localStorageService,this._userManagerService=_userManagerService,this._watermarkLayer=new WatermarkLayer(_context.scene,[],10),this._initAddRender(),this._initWatermarkUpdate(),this._initWatermarkConfig()}_initAddRender(){const{scene}=this._context;scene.addLayer(this._watermarkLayer)}async _initWatermarkConfig(){var _a2;const config=await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);config&&(this._watermarkService.updateWatermarkConfig(config),(_a2=this._context.mainComponent)==null||_a2.makeDirty())}_initWatermarkUpdate(){this.disposeWithMe(this._watermarkService.updateConfig$.subscribe(_config=>{var _a2,_b2;if(!_config){this._watermarkLayer.updateConfig(),(_a2=this._context.mainComponent)==null||_a2.makeDirty();return}_config.type===IWatermarkTypeEnum.UserInfo?this._watermarkLayer.updateConfig(_config,this._userManagerService.getCurrentUser()):this._watermarkLayer.updateConfig(_config),(_b2=this._context.mainComponent)==null||_b2.makeDirty()}))}},__name(_c,"WatermarkRenderController"),_c);WatermarkRenderController=__decorateClass$1([__decorateParam$1(1,core.Inject(exports2.WatermarkService)),__decorateParam$1(2,core.Inject(core.ILocalStorageService)),__decorateParam$1(3,core.Inject(core.UserManagerService))],WatermarkRenderController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");const PLUGIN_NAME="UNIVER_WATERMARK_PLUGIN";exports2.UniverWatermarkPlugin=(_d=class extends core.Plugin{constructor(_config={},_injector,_configService,_commandService,_renderManagerSrv,_localStorageService){super(),this._config=_config,this._injector=_injector,this._configService=_configService,this._commandService=_commandService,this._renderManagerSrv=_renderManagerSrv,this._localStorageService=_localStorageService;const{menu}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._initWatermarkStorage(),this._initDependencies(),this._initRegisterCommand()}async _initWatermarkStorage(){const{menu,...rest}=this._config;if(rest.userWatermarkSettings)this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY,{type:IWatermarkTypeEnum.UserInfo,config:{userInfo:{...WatermarkUserInfoBaseConfig,...rest.userWatermarkSettings}}});else if(rest.textWatermarkSettings)this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY,{type:IWatermarkTypeEnum.Text,config:{text:{...WatermarkTextBaseConfig,...rest.textWatermarkSettings}}});else if(rest.imageWatermarkSettings)this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY,{type:IWatermarkTypeEnum.Image,config:{image:{...WatermarkImageBaseConfig,...rest.imageWatermarkSettings}}});else{const config=await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);(config==null?void 0:config.type)===IWatermarkTypeEnum.UserInfo&&this._localStorageService.removeItem(UNIVER_WATERMARK_STORAGE_KEY)}}_initDependencies(){[[exports2.WatermarkService],[UniverWatermarkMenuController]].forEach(d=>{this._injector.add(d)})}_initRegisterCommand(){[OpenWatermarkPanelOperation].forEach(m2=>this._commandService.registerCommand(m2))}onRendered(){const injector=this._injector;injector.get(exports2.WatermarkService);const{userWatermarkSettings,textWatermarkSettings,imageWatermarkSettings,showMenu=!0}=this._config;!(userWatermarkSettings||textWatermarkSettings||imageWatermarkSettings)&&showMenu&&injector.get(UniverWatermarkMenuController),this._initRenderDependencies()}_initRenderDependencies(){[[WatermarkRenderController]].forEach(d=>{this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_SHEET,d),this._renderManagerSrv.registerRenderModule(core.UniverInstanceType.UNIVER_DOC,d)})}},__name(_d,"UniverWatermarkPlugin"),__publicField(_d,"pluginName",PLUGIN_NAME),_d),exports2.UniverWatermarkPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService),__decorateParam(3,core.Inject(core.ICommandService)),__decorateParam(4,engineRender.IRenderManagerService),__decorateParam(5,core.Inject(core.ILocalStorageService))],exports2.UniverWatermarkPlugin),exports2.IWatermarkTypeEnum=IWatermarkTypeEnum,exports2.WatermarkImageBaseConfig=WatermarkImageBaseConfig,exports2.WatermarkTextBaseConfig=WatermarkTextBaseConfig,exports2.WatermarkUserInfoBaseConfig=WatermarkUserInfoBaseConfig,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","rxjs"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.UniverWatermark={},n.UniverCore,n.UniverEngineRender,n.rxjs))})(this,function(n,s,S,T){"use strict";var x=Object.defineProperty;var ee=(n,s,S)=>s in n?x(n,s,{enumerable:!0,configurable:!0,writable:!0,value:S}):n[s]=S;var _=(n,s,S)=>ee(n,typeof s!="symbol"?s+"":s,S);var M;const g="UNIVER_WATERMARK_STORAGE_KEY",L=["image/png","image/jpeg","image/jpg","image/bmp"],P={content:"",fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},b={url:"",width:100,height:100,maintainAspectRatio:!0,originRatio:1,x:60,y:36,repeat:!0,spacingX:200,spacingY:100,rotate:0,opacity:.15},$={name:!0,email:!1,phone:!1,uid:!1,fontSize:16,color:"rgb(0,0,0)",bold:!1,italic:!1,direction:"ltr",x:60,y:60,repeat:!0,spacingX:200,spacingY:100,rotate:-30,opacity:.15};var l=(e=>(e.UserInfo="userInfo",e.Text="text",e.Image="image",e))(l||{}),O=Object.defineProperty,D=Object.getOwnPropertyDescriptor,N=(e,r,t,a)=>{for(var i=a>1?void 0:a?D(r,t):r,o=e.length-1,f;o>=0;o--)(f=e[o])&&(i=(a?f(r,t,i):f(i))||i);return a&&i&&O(r,t,i),i},Y=(e,r)=>(t,a)=>r(t,a,e);n.WatermarkService=class extends s.Disposable{constructor(t){super();_(this,"_updateConfig$",new T.Subject);_(this,"updateConfig$",this._updateConfig$.asObservable());_(this,"_refresh$",new T.Subject);_(this,"refresh$",this._refresh$.asObservable());this._localStorageService=t}async getWatermarkConfig(){return await this._localStorageService.getItem(g)}updateWatermarkConfig(t){this._localStorageService.setItem(g,t),this._updateConfig$.next(t)}deleteWatermarkConfig(){this._localStorageService.removeItem(g),this._updateConfig$.next(null)}refresh(){this._refresh$.next(Math.random())}dispose(){this._refresh$.complete(),this._updateConfig$.complete()}},n.WatermarkService=N([Y(0,s.Inject(s.ILocalStorageService))],n.WatermarkService);function K(e,r,t,a){const i=r.type,o=r.config;i===l.UserInfo&&o.userInfo?X(e,o.userInfo,a):i===l.Image&&o.image?V(e,o.image,t):i===l.Text&&o.text&&G(e,o.text)}function X(e,r,t){const{x:a,y:i,repeat:o,spacingX:f,spacingY:y,rotate:I,opacity:d,name:p,fontSize:R,color:k,bold:C,italic:W,direction:c}=r;if(!t)return;let h="";if(p&&(h+=`${t.name} `),!h)return;e.save(),e.globalAlpha=d,e.direction=c;let u="";if(W&&(u+="italic "),C&&(u+="bold "),u+=`${R}px Arial`,e.font=u,e.fillStyle=k,o){const m=e.canvas.width,v=e.canvas.height;for(let U=i;U<v;U+=R+y)for(let j=a;j<m;j+=e.measureText(h).width+f)e.save(),e.translate(j,U),e.rotate(Math.PI/180*I),e.fillText(h,0,0),e.restore()}else e.save(),e.translate(a,i),e.rotate(Math.PI/180*I),e.fillText(h,0,0),e.restore();e.restore()}function G(e,r){const{x:t,y:a,repeat:i,spacingX:o,spacingY:f,rotate:y,opacity:I,content:d,fontSize:p,color:R,bold:k,italic:C,direction:W}=r;e.save(),e.globalAlpha=I,e.direction=W;let c="";if(C&&(c+="italic "),k&&(c+="bold "),c+=`${p}px Arial`,e.font=c,e.fillStyle=R,d)if(i){const h=e.canvas.width,u=e.canvas.height;for(let m=a;m<u;m+=p+f)for(let v=t;v<h;v+=e.measureText(d).width+o)e.save(),e.translate(v,m),e.rotate(Math.PI/180*y),e.fillText(d,0,0),e.restore()}else e.save(),e.translate(t,a),e.rotate(Math.PI/180*y),e.fillText(d,0,0),e.restore();e.restore()}function V(e,r,t){const{x:a,y:i,repeat:o,spacingX:f,spacingY:y,rotate:I,opacity:d,width:p,height:R,maintainAspectRatio:k,originRatio:C}=r;if(!(t!=null&&t.complete))return;e.save(),e.globalAlpha=d;const W=p,c=k?p/C:R;if(o){const h=e.canvas.width,u=e.canvas.height;for(let m=i;m<u;m+=c+y)for(let v=a;v<h;v+=W+f)e.save(),e.translate(v,m),e.rotate(Math.PI/180*I),e.drawImage(t,0,0,W,c),e.restore()}else e.save(),e.translate(a,i),e.rotate(Math.PI/180*I),e.drawImage(t,0,0,W,c),e.restore();e.restore()}class B extends S.Layer{constructor(){super(...arguments);_(this,"_config");_(this,"_image");_(this,"_user")}render(t,a=!1){var o;super.render(t,a);const i=t||((o=this.scene.getEngine())==null?void 0:o.getCanvas().getContext());return i&&i.getId()&&this._renderWatermark(i),this}updateConfig(t,a){var i;this._config=t,((i=this._config)==null?void 0:i.type)===l.Image&&this._config.config.image&&(this._image=new Image,this._image.src=this._config.config.image.url),a&&(this._user=a)}_renderWatermark(t){this._config&&K(t,this._config,this._image,this._user)}}var H=Object.defineProperty,z=Object.getOwnPropertyDescriptor,q=(e,r,t,a)=>{for(var i=a>1?void 0:a?z(r,t):r,o=e.length-1,f;o>=0;o--)(f=e[o])&&(i=(a?f(r,t,i):f(i))||i);return a&&i&&H(r,t,i),i},E=(e,r)=>(t,a)=>r(t,a,e);let w=class extends s.RxDisposable{constructor(r,t,a,i){super();_(this,"_watermarkLayer");this._context=r,this._watermarkService=t,this._localStorageService=a,this._userManagerService=i,this._watermarkLayer=new B(r.scene,[],10),this._initAddRender(),this._initWatermarkUpdate(),this._initWatermarkConfig()}_initAddRender(){const{scene:r}=this._context;r.addLayer(this._watermarkLayer)}async _initWatermarkConfig(){var t;const r=await this._localStorageService.getItem(g);r&&(this._watermarkService.updateWatermarkConfig(r),(t=this._context.mainComponent)==null||t.makeDirty())}_initWatermarkUpdate(){this.disposeWithMe(this._watermarkService.updateConfig$.subscribe(r=>{var t,a;if(!r){this._watermarkLayer.updateConfig(),(t=this._context.mainComponent)==null||t.makeDirty();return}r.type===l.UserInfo?this._watermarkLayer.updateConfig(r,this._userManagerService.getCurrentUser()):this._watermarkLayer.updateConfig(r),(a=this._context.mainComponent)==null||a.makeDirty()}))}};w=q([E(1,s.Inject(n.WatermarkService)),E(2,s.Inject(s.ILocalStorageService)),E(3,s.Inject(s.UserManagerService))],w);var F=Object.defineProperty,J=Object.getOwnPropertyDescriptor,Q=(e,r,t,a)=>{for(var i=a>1?void 0:a?J(r,t):r,o=e.length-1,f;o>=0;o--)(f=e[o])&&(i=(a?f(r,t,i):f(i))||i);return a&&i&&F(r,t,i),i},A=(e,r)=>(t,a)=>r(t,a,e);const Z="UNIVER_WATERMARK_PLUGIN";n.UniverWatermarkPlugin=(M=class extends s.Plugin{constructor(r={},t,a,i,o){super(),this._config=r,this._injector=t,this._configService=a,this._renderManagerSrv=i,this._localStorageService=o;const{menu:f}=this._config;f&&this._configService.setConfig("menu",f,{merge:!0}),this._initWatermarkStorage(),this._initDependencies()}async _initWatermarkStorage(){const{menu:r,...t}=this._config;if(t.userWatermarkSettings)this._localStorageService.setItem(g,{type:l.UserInfo,config:{userInfo:{...$,...t.userWatermarkSettings}}});else if(t.textWatermarkSettings)this._localStorageService.setItem(g,{type:l.Text,config:{text:{...P,...t.textWatermarkSettings}}});else if(t.imageWatermarkSettings)this._localStorageService.setItem(g,{type:l.Image,config:{image:{...b,...t.imageWatermarkSettings}}});else{const a=await this._localStorageService.getItem(g);(a==null?void 0:a.type)===l.UserInfo&&this._localStorageService.removeItem(g)}}_initDependencies(){[[n.WatermarkService]].forEach(r=>{this._injector.add(r)})}onRendered(){this._injector.get(n.WatermarkService),this._initRenderDependencies()}_initRenderDependencies(){[[w]].forEach(r=>{this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_SHEET,r),this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_DOC,r)})}},_(M,"pluginName",Z),M),n.UniverWatermarkPlugin=Q([A(1,s.Inject(s.Injector)),A(2,s.IConfigService),A(3,S.IRenderManagerService),A(4,s.Inject(s.ILocalStorageService))],n.UniverWatermarkPlugin),n.IWatermarkTypeEnum=l,n.UNIVER_WATERMARK_STORAGE_KEY=g,n.WATERMARK_IMAGE_ALLOW_IMAGE_LIST=L,n.WatermarkImageBaseConfig=b,n.WatermarkTextBaseConfig=P,n.WatermarkUserInfoBaseConfig=$,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverWatermarkEnUS=t())})(this,function(){"use strict";return{"univer-watermark":{title:"Watermark",type:"Type",text:"Text",image:"Image",uploadImage:"Upload Image",replaceImage:"Replace Image",keepRatio:"Keep Ratio",width:"Width",height:"Height",style:"Style Settings",content:"Content",textPlaceholder:"Enter text",fontSize:"Font Size",direction:"Direction",ltr:"Left to Right",rtl:"Right to Left",inherits:"Inherit",opacity:"Opacity",layout:"Layout Settings",rotate:"Rotate",repeat:"Repeat",spacingX:"Horizontal Spacing",spacingY:"Vertical Spacing",startX:"Horizontal Start Position",startY:"Vertical Start Position",cancel:"Cancel Watermark",close:"Close Panel",copy:"Copy Config"}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverWatermarkFaIR=t())})(this,function(){"use strict";return{"univer-watermark":{title:"علامت آب",type:"نوع",text:"متن",image:"تصویر",uploadImage:"آپلود تصویر",replaceImage:"جایگزینی تصویر",keepRatio:"حفظ نسبت",width:"عرض",height:"ارتفاع",style:"تنظیمات سبک",content:"محتوا",textPlaceholder:"متن را وارد کنید",fontSize:"اندازه فونت",direction:"جهت",ltr:"چپ به راست",rtl:"راست به چپ",inherits:"ارث بردن",opacity:"شفافیت",layout:"تنظیمات چیدمان",rotate:"چرخاندن",repeat:"تکرار",spacingX:"فاصله افقی",spacingY:"فاصله عمودی",startX:"موقعیت شروع افقی",startY:"موقعیت شروع عمودی",cancel:"لغو علامت آب",close:"بستن پنل",copy:"کپی تنظیمات"}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverWatermarkRuRU=t())})(this,function(){"use strict";return{"univer-watermark":{title:"Водяной знак",type:"Тип",text:"Текст",image:"Изображение",uploadImage:"Загрузить изображение",replaceImage:"Заменить изображение",keepRatio:"Сохранить пропорции",width:"Ширина",height:"Высота",style:"Настройки стиля",content:"Содержание",textPlaceholder:"Введите текст",fontSize:"Размер шрифта",direction:"Направление",ltr:"Слева направо",rtl:"Справа налево",inherits:"Наследовать",opacity:"Прозрачность",layout:"Настройки макета",rotate:"Поворот",repeat:"Повтор",spacingX:"Горизонтальный интервал",spacingY:"Вертикальный интервал",startX:"Горизонтальная начальная позиция",startY:"Вертикальная начальная позиция",cancel:"Отменить водяной знак",close:"Закрыть панель",copy:"Копировать конфигурацию"}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n.UniverWatermarkViVN=e())})(this,function(){"use strict";return{"univer-watermark":{title:"Hình mờ",type:"Loại",text:"Văn bản",image:"Hình ảnh",uploadImage:"Tải lên hình ảnh",replaceImage:"Thay thế hình ảnh",keepRatio:"Giữ tỷ lệ",width:"Chiều rộng",height:"Chiều cao",style:"Cài đặt kiểu",content:"Nội dung",textPlaceholder:"Nhập văn bản",fontSize:"Kích thước phông chữ",direction:"Hướng",ltr:"Trái sang phải",rtl:"Phải sang trái",inherits:"Thừa kế",opacity:"Độ mờ",layout:"Cài đặt bố cục",rotate:"Xoay",repeat:"Lặp lại",spacingX:"Khoảng cách ngang",spacingY:"Khoảng cách dọc",startX:"Vị trí bắt đầu ngang",startY:"Vị trí bắt đầu dọc",cancel:"Hủy hình mờ",close:"Đóng bảng điều khiển",copy:"Sao chép cấu hình"}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverWatermarkZhCN=t())})(this,function(){"use strict";return{"univer-watermark":{title:"水印",type:"类型",text:"文本",image:"图片",uploadImage:"上传图片",replaceImage:"替换图片",keepRatio:"保持比例",width:"长度",height:"高度",style:"样式设置",content:"内容",textPlaceholder:"请输入文本",fontSize:"字体大小",direction:"方向",ltr:"从左到右",rtl:"从右到左",inherits:"继承",opacity:"透明度",layout:"布局设置",rotate:"旋转",repeat:"重复",spacingX:"水平间距",spacingY:"垂直间距",startX:"水平起始位置",startY:"垂直起始位置",cancel:"取消水印",close:"关闭面板",copy:"复制配置"}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverWatermarkZhTW=t())})(this,function(){"use strict";return{"univer-watermark":{title:"浮水印",type:"類型",text:"文字",image:"圖片",uploadImage:"上傳圖片",replaceImage:"替換圖片",keepRatio:"保持比例",width:"長度",height:"高度",style:"樣式設置",content:"內容",textPlaceholder:"請輸入文字",fontSize:"字體大小",direction:"方向",ltr:"從左到右",rtl:"從右到左",inherits:"繼承",opacity:"透明度",layout:"佈局設置",rotate:"旋轉",repeat:"重複",spacingX:"水平間距",spacingY:"垂直間距",startX:"水平起始位置",startY:"垂直起始位置",cancel:"取消浮水印",close:"關閉面板",copy:"複製配置"}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/watermark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "univer watermark plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -31,11 +31,19 @@
|
|
|
31
31
|
"require": "./lib/cjs/*",
|
|
32
32
|
"types": "./lib/types/index.d.ts"
|
|
33
33
|
},
|
|
34
|
-
"./
|
|
35
|
-
|
|
34
|
+
"./facade": {
|
|
35
|
+
"import": "./lib/es/facade.js",
|
|
36
|
+
"require": "./lib/cjs/facade.js",
|
|
37
|
+
"types": "./lib/types/facade/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./locale/*": {
|
|
40
|
+
"import": "./lib/es/locale/*.js",
|
|
41
|
+
"require": "./lib/cjs/locale/*.js",
|
|
42
|
+
"types": "./lib/types/locale/*.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./lib/*": "./lib/*"
|
|
36
45
|
},
|
|
37
|
-
"main": "./lib/
|
|
38
|
-
"module": "./lib/es/index.js",
|
|
46
|
+
"main": "./lib/es/index.js",
|
|
39
47
|
"types": "./lib/types/index.d.ts",
|
|
40
48
|
"publishConfig": {
|
|
41
49
|
"access": "public"
|
|
@@ -51,24 +59,23 @@
|
|
|
51
59
|
"rxjs": ">=7.0.0"
|
|
52
60
|
},
|
|
53
61
|
"dependencies": {
|
|
54
|
-
"@univerjs/icons": "^0.
|
|
62
|
+
"@univerjs/icons": "^0.2.5",
|
|
55
63
|
"clsx": "^2.1.1",
|
|
56
|
-
"@univerjs/core": "0.
|
|
57
|
-
"@univerjs/design": "0.
|
|
58
|
-
"@univerjs/engine-render": "0.
|
|
59
|
-
"@univerjs/ui": "0.
|
|
64
|
+
"@univerjs/core": "0.5.0-beta.0",
|
|
65
|
+
"@univerjs/design": "0.5.0-beta.0",
|
|
66
|
+
"@univerjs/engine-render": "0.5.0-beta.0",
|
|
67
|
+
"@univerjs/ui": "0.5.0-beta.0"
|
|
60
68
|
},
|
|
61
69
|
"devDependencies": {
|
|
62
|
-
"@types/react": "^18.3.9",
|
|
63
70
|
"less": "^4.2.0",
|
|
64
71
|
"react": "18.3.1",
|
|
65
72
|
"rxjs": "^7.8.1",
|
|
66
|
-
"typescript": "^5.6.
|
|
67
|
-
"vite": "^5.4.
|
|
68
|
-
"vitest": "^2.1.
|
|
69
|
-
"@univerjs-infra/shared": "0.
|
|
73
|
+
"typescript": "^5.6.3",
|
|
74
|
+
"vite": "^5.4.11",
|
|
75
|
+
"vitest": "^2.1.5",
|
|
76
|
+
"@univerjs-infra/shared": "0.5.0-beta.0"
|
|
70
77
|
},
|
|
71
|
-
"
|
|
78
|
+
"space": {
|
|
72
79
|
".": {
|
|
73
80
|
"import": "./lib/es/index.js",
|
|
74
81
|
"require": "./lib/cjs/index.js",
|
|
@@ -79,14 +86,24 @@
|
|
|
79
86
|
"require": "./lib/cjs/*",
|
|
80
87
|
"types": "./lib/types/index.d.ts"
|
|
81
88
|
},
|
|
82
|
-
"./
|
|
83
|
-
|
|
89
|
+
"./facade": {
|
|
90
|
+
"import": "./lib/es/facade.js",
|
|
91
|
+
"require": "./lib/cjs/facade.js",
|
|
92
|
+
"types": "./lib/types/facade/index.d.ts"
|
|
93
|
+
},
|
|
94
|
+
"./locale/*": {
|
|
95
|
+
"import": "./lib/es/locale/*.js",
|
|
96
|
+
"require": "./lib/cjs/locale/*.js",
|
|
97
|
+
"types": "./lib/types/locale/*.d.ts"
|
|
98
|
+
},
|
|
99
|
+
"./lib/*": "./lib/*"
|
|
84
100
|
},
|
|
85
101
|
"scripts": {
|
|
86
102
|
"test": "vitest run",
|
|
87
103
|
"test:watch": "vitest",
|
|
88
104
|
"coverage": "vitest run --coverage",
|
|
89
105
|
"lint:types": "tsc --noEmit",
|
|
90
|
-
"build": "
|
|
91
|
-
}
|
|
106
|
+
"build": "univer-cli build"
|
|
107
|
+
},
|
|
108
|
+
"module": "./lib/es/index.js"
|
|
92
109
|
}
|
package/lib/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.univer-watermark-panel{margin:16px 0}.univer-watermark-panel-type-title{font-size:15px;color:rgb(var(--text-color-secondary))}.univer-watermark-panel-type-select{width:100%;margin-top:16px}.univer-watermark-panel-setting{width:100%;min-height:100px;border-radius:8px}.univer-watermark-panel-footer{display:flex;justify-content:space-between;align-items:center;font-size:12px}.univer-watermark-panel-footer-button-wrapper{display:flex;align-items:center}.univer-watermark-panel-footer-reset{cursor:pointer;white-space:nowrap;color:rgb(var(--primary-color));border-bottom:1px solid rgb(var(--primary-color))}.univer-watermark-text-setting{font-size:14px}.univer-watermark-text-setting-header{font-size:15px;color:rgb(var(--text-color-secondary));margin:16px 0}.univer-watermark-text-setting-font-content{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.univer-watermark-text-setting-font-style-part{display:flex;justify-content:space-between;align-items:center;margin-top:16px}.univer-watermark-text-setting-font-style-part:first-child{margin-top:0}.univer-watermark-text-setting-layout-font-wrapper{width:calc(50% - 8px);align-self:flex-start;white-space:nowrap}.univer-watermark-image-setting{font-size:14px}.univer-watermark-input{height:28px;box-sizing:border-box}.univer-watermark-input-content{width:220px}.univer-watermark-icon{width:18px;height:18px;margin:2px}.univer-watermark-icon-wrapper{cursor:pointer;border-radius:4px;width:24px;height:24px}.univer-watermark-icon-wrapper-select,.univer-watermark-icon-wrapper:hover{background-color:rgb(var(--grey-100))}.univer-watermark-icon-wrapper:first-child{margin-left:28px}.univer-watermark-icon-wrapper:last-child{margin-right:28px}.univer-watermark-color-picker-wrapper{padding:16px;border-radius:8px;background-color:#fff;border:1px solid rgb(var(--grey-100))}
|
package/lib/locale/en-US.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"univer-watermark": {
|
|
3
|
-
"title": "Watermark",
|
|
4
|
-
"type": "Type",
|
|
5
|
-
"text": "Text",
|
|
6
|
-
"image": "Image",
|
|
7
|
-
"uploadImage": "Upload Image",
|
|
8
|
-
"replaceImage": "Replace Image",
|
|
9
|
-
"keepRatio": "Keep Ratio",
|
|
10
|
-
"width": "Width",
|
|
11
|
-
"height": "Height",
|
|
12
|
-
"style": "Style Settings",
|
|
13
|
-
"content": "Content",
|
|
14
|
-
"textPlaceholder": "Enter text",
|
|
15
|
-
"fontSize": "Font Size",
|
|
16
|
-
"direction": "Direction",
|
|
17
|
-
"ltr": "Left to Right",
|
|
18
|
-
"rtl": "Right to Left",
|
|
19
|
-
"inherits": "Inherit",
|
|
20
|
-
"opacity": "Opacity",
|
|
21
|
-
"layout": "Layout Settings",
|
|
22
|
-
"rotate": "Rotate",
|
|
23
|
-
"repeat": "Repeat",
|
|
24
|
-
"spacingX": "Horizontal Spacing",
|
|
25
|
-
"spacingY": "Vertical Spacing",
|
|
26
|
-
"startX": "Horizontal Start Position",
|
|
27
|
-
"startY": "Vertical Start Position",
|
|
28
|
-
"cancel": "Cancel Watermark",
|
|
29
|
-
"close": "Close Panel",
|
|
30
|
-
"copy": "Copy Config"
|
|
31
|
-
}
|
|
32
|
-
}
|