watermark-js-plus 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +88 -1
  2. package/package.json +22 -10
  3. package/.editorconfig +0 -16
  4. package/.eslintignore +0 -7
  5. package/.eslintrc.cjs +0 -46
  6. package/.github/workflows/deploy.yml +0 -29
  7. package/.github/workflows/npm-publish.yml +0 -32
  8. package/.husky/commit-msg +0 -4
  9. package/.husky/pre-commit +0 -4
  10. package/.prettierrc +0 -10
  11. package/CHANGELOG.md +0 -18
  12. package/babel.config.cjs +0 -23
  13. package/changelog-option.cjs +0 -87
  14. package/commitlint.config.cjs +0 -26
  15. package/docs/.vitepress/config.ts +0 -103
  16. package/docs/.vitepress/locales/zh-CN.ts +0 -51
  17. package/docs/.vitepress/theme/index.ts +0 -12
  18. package/docs/config/blind-decode.md +0 -33
  19. package/docs/config/blind.md +0 -19
  20. package/docs/config/index.md +0 -178
  21. package/docs/guide/blind-watermark.md +0 -267
  22. package/docs/guide/getting-started.md +0 -73
  23. package/docs/guide/watermark.md +0 -213
  24. package/docs/guide/what-is-this.md +0 -19
  25. package/docs/index.md +0 -33
  26. package/docs/public/favicons/apple-touch-icon.png +0 -0
  27. package/docs/public/favicons/favicon-64x64.png +0 -0
  28. package/docs/public/hero-image.png +0 -0
  29. package/docs/public/logo.png +0 -0
  30. package/docs/zh/config/blind-decode.md +0 -33
  31. package/docs/zh/config/blind.md +0 -19
  32. package/docs/zh/config/index.md +0 -178
  33. package/docs/zh/guide/blink-watermark.md +0 -288
  34. package/docs/zh/guide/getting-started.md +0 -48
  35. package/docs/zh/guide/watermark.md +0 -213
  36. package/docs/zh/guide/what-is-this.md +0 -19
  37. package/docs/zh/index.md +0 -33
  38. package/rollup.config.mjs +0 -40
  39. package/src/blind.ts +0 -43
  40. package/src/index.ts +0 -7
  41. package/src/types/index.ts +0 -69
  42. package/src/utils/index.ts +0 -63
  43. package/src/watermark.ts +0 -300
  44. package/tools/terser.js +0 -19
  45. package/tsconfig.json +0 -15
@@ -1,213 +0,0 @@
1
- ---
2
- layout: doc
3
- ---
4
- # Watemark
5
-
6
- <script setup lang="ts">
7
- import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue';
8
- import { ref, getCurrentInstance } from 'vue';
9
- import wm from '../../src';
10
- import { useData } from 'vitepress';
11
-
12
- const { isDark } = useData();
13
- const decodeBlindImage = ref('');
14
- const app = getCurrentInstance();
15
-
16
- // text watermark
17
- const textWatermark = new wm.Watermark({
18
- content: 'hello my text watermark',
19
- width: 200,
20
- height: 200,
21
- onSuccess: () => {
22
- app.appContext.config.globalProperties.$message({
23
- message: 'The text watermark added successfully!',
24
- type: 'success'
25
- });
26
- }
27
- });
28
- const handleAddTextWatermark = () => {
29
- if (isDark.value) {
30
- textWatermark.options.fontColor = '#fff'
31
- }
32
- textWatermark.create();
33
- };
34
- const handleRemoveTextWatermark = () => {
35
- textWatermark.destroy();
36
- };
37
-
38
- // multiline text watermark
39
- const multiLineTextWatermark = new wm.Watermark({
40
- contentType: 'multi-line-text',
41
- content: 'hello my multi text watermark',
42
- fontSize: 30,
43
- width: 200,
44
- height: 200,
45
- onSuccess: () => {
46
- app.appContext.config.globalProperties.$message({
47
- message: 'The multi text watermark added successfully!',
48
- type: 'success'
49
- });
50
- }
51
- });
52
- const handleAddMultiLineTextWatermark = () => {
53
- if (isDark.value) {
54
- multiLineTextWatermark.options.fontColor = '#fff'
55
- }
56
- multiLineTextWatermark.create();
57
- };
58
- const handleRemoveMultiLineTextWatermark = () => {
59
- multiLineTextWatermark.destroy();
60
- };
61
-
62
- // image watermark
63
- const imageWatermark = new wm.Watermark({
64
- contentType: 'image',
65
- image: 'https://cdn.jsdelivr.net/gh/zhensherlock/oss@main/uPic/github-mkWBiK.png',
66
- imageWidth: 200,
67
- // imageHeight: 20,
68
- width: 300,
69
- height: 300,
70
- onSuccess: () => {
71
- app.appContext.config.globalProperties.$message({
72
- message: 'The image watermark added successfully!',
73
- type: 'success'
74
- });
75
- }
76
- });
77
- const handleAddImageWatermark = () => {
78
- imageWatermark.create();
79
- };
80
- const handleRemoveImageWatermark = () => {
81
- imageWatermark.destroy();
82
- };
83
-
84
- // rich text watermark
85
- const richTextWatermark = new wm.Watermark({
86
- contentType: 'rich-text',
87
- content: '<div style="background: #ccc;">The watermark is so <span style="color: #f00">nice</span>.</div>',
88
- width: 300,
89
- height: 300,
90
- onSuccess: () => {
91
- app.appContext.config.globalProperties.$message({
92
- message: 'The rich text watermark added successfully!',
93
- type: 'success'
94
- });
95
- }
96
- });
97
- const handleAddRichTextWatermark = () => {
98
- richTextWatermark.create();
99
- };
100
- const handleRemoveRichTextWatermark = () => {
101
- richTextWatermark.destroy();
102
- };
103
- </script>
104
-
105
- ## Text Watermark
106
-
107
- ```js
108
- import wm from 'watermark-js-plus' // import watermark plugin
109
-
110
- const watermark = new wm.Watermark({
111
- content: 'hello my watermark',
112
- width: 200,
113
- height: 200,
114
- onSuccess: () => {
115
- app.appContext.config.globalProperties.$message({
116
- message: 'The text watermark added successfully!',
117
- type: 'success'
118
- });
119
- }
120
- })
121
-
122
- watermark.create() // add watermark
123
-
124
- watermark.destroy() // remove watermark
125
- ```
126
- <el-space>
127
- <VPButton text="Add Text Watermark" @click="handleAddTextWatermark"></VPButton>
128
- <VPButton text="Remove Text Watermark" @click="handleRemoveTextWatermark"></VPButton>
129
- </el-space>
130
-
131
- ## Multiline Text Watermark
132
-
133
- ```js
134
- import wm from 'watermark-js-plus' // import watermark plugin
135
-
136
- const watermark = new wm.Watermark({
137
- contentType: 'multi-line-text',
138
- content: 'hello my watermark watermark',
139
- fontSize: 30,
140
- width: 200,
141
- height: 200,
142
- onSuccess: () => {
143
- app.appContext.config.globalProperties.$message({
144
- message: 'The multiline text watermark added successfully!',
145
- type: 'success'
146
- });
147
- }
148
- })
149
-
150
- watermark.create() // add watermark
151
-
152
- watermark.destroy() // remove watermark
153
- ```
154
- <el-space>
155
- <VPButton text="Add MultiLine Text Watermark" @click="handleAddMultiLineTextWatermark"></VPButton>
156
- <VPButton text="Remove MultiLine Text Watermark" @click="handleRemoveMultiLineTextWatermark"></VPButton>
157
- </el-space>
158
-
159
- ## Image Watermark
160
-
161
- ```js
162
- import wm from 'watermark-js-plus' // import watermark plugin
163
-
164
- const watermark = new wm.Watermark({
165
- contentType: 'image',
166
- content: 'http://upic-service.test.upcdn.net/uPic/github-JxMIKf.png',
167
- width: 300,
168
- height: 300,
169
- imageWidth: 100, // image width
170
- // imageHeight: 20, // image height
171
- onSuccess: () => {
172
- app.appContext.config.globalProperties.$message({
173
- message: 'The image watermark added successfully!',
174
- type: 'success'
175
- });
176
- }
177
- })
178
-
179
- watermark.create() // add watermark
180
-
181
- watermark.destroy() // remove watermark
182
- ```
183
- <el-space>
184
- <VPButton text="Add Image Watermark" @click="handleAddImageWatermark"></VPButton>
185
- <VPButton text="Remove Image Watermark" @click="handleRemoveImageWatermark"></VPButton>
186
- </el-space>
187
-
188
- ## Rich Text Watermark
189
-
190
- ```js
191
- import wm from 'watermark-js-plus' // import watermark plugin
192
-
193
- const watermark = new wm.Watermark({
194
- contentType: 'rich-text',
195
- content: '<div style="background: #ccc;">Rich text watermark is so <span style="color: #f00">nice</span></div>',
196
- width: 300,
197
- height: 300,
198
- onSuccess: () => {
199
- app.appContext.config.globalProperties.$message({
200
- message: 'The rich text watermark added successfully!',
201
- type: 'success'
202
- });
203
- }
204
- })
205
-
206
- watermark.create() // add watermark
207
-
208
- watermark.destroy() // remove watermark
209
- ```
210
- <el-space>
211
- <VPButton text="Add Rich Text Watermark" @click="handleAddRichTextWatermark"></VPButton>
212
- <VPButton text="Remove Rich Text Watermark" @click="handleRemoveRichTextWatermark"></VPButton>
213
- </el-space>
@@ -1,19 +0,0 @@
1
- ---
2
- layout: doc
3
- ---
4
-
5
- # What is this?
6
- This is a *canvas-based* watermark for browser.
7
-
8
- ## Features
9
- - Create watermark and blind watermark
10
- - Supports text, multi text, image, rich text
11
- - Watching for DOM changes
12
- - Supports typescript
13
- - Rich configuration
14
-
15
- ## Browser Support
16
-
17
- | ![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
18
- |:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------:|
19
- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
package/docs/index.md DELETED
@@ -1,33 +0,0 @@
1
- ---
2
- layout: home
3
- sidebar: false
4
- title: watermark-js-plus.js
5
- titleTemplate: Watermark
6
-
7
- hero:
8
- name: watermark-js-plus
9
- text: Advanced watermark plugin
10
- tagline: Simple, powerful, and performant.
11
- image:
12
- src: /hero-image.png
13
- alt: watermark-js-plus
14
- actions:
15
- - theme: brand
16
- text: Get Started 👆
17
- link: /guide/getting-started
18
- - theme: alt
19
- text: View on GitHub
20
- link: https://github.com/zhensherlock/watermark-js-plus
21
-
22
- features:
23
- - icon: 🛠️
24
- title: Rich Features
25
- details: Supports text, multi-line text, image and rich text.
26
- - icon: 🔑
27
- title: Fully Typed APIs
28
- details: Flexible programmatic APIs with full TypeScript typing..
29
- - icon: 📦
30
- title: Extremely light
31
- details: weighs ~2kb, you will forget it's even there!
32
- ---
33
-
Binary file
Binary file
@@ -1,33 +0,0 @@
1
- ---
2
- layout: doc
3
- ---
4
- # 解析暗水印
5
-
6
- ## url
7
-
8
- - **Type:** `string`
9
- - **Default:** `''`
10
-
11
- 解码暗水印图片路径。
12
-
13
- ## mode
14
-
15
- - **Type:** `string`
16
- - **Default:** `'canvas'`
17
- - **available values**: `'canvas'`
18
-
19
- 解码模式。
20
-
21
- ## fillColor
22
-
23
- - **Type:** `string`
24
- - **Default:** `'#000'`
25
-
26
- 解码 fill color.
27
-
28
- ## compositeOperation
29
-
30
- - **Type:** `string`
31
- - **Default:** `'color-burn'`
32
-
33
- 解码 composite operation.
@@ -1,19 +0,0 @@
1
- ---
2
- layout: doc
3
- ---
4
- # 暗水印
5
-
6
- ## globalAlpha
7
-
8
- - **Type:** `number`
9
- - **Default:** `0.005`
10
-
11
- 水印的透明度。
12
-
13
- ## mode
14
-
15
- - **Type:** `string`
16
- - **Default:** `'blind'`
17
- - **available values**: `'default' | 'blind'`
18
-
19
- 水印模式。
@@ -1,178 +0,0 @@
1
- ---
2
- layout: doc
3
- ---
4
- # 基础配置项
5
-
6
- ## width
7
-
8
- - **Type:** `number`
9
- - **Default:** `300`
10
-
11
- 单个水印的宽度。
12
-
13
- ## height
14
-
15
- - **Type:** `number`
16
- - **Default:** `300`
17
-
18
- 单个水印的高度。
19
-
20
- ## rotate
21
-
22
- - **Type:** `number`
23
- - **Default:** `45`
24
-
25
- 水印旋转角度
26
-
27
- 以文本的中心为原点旋转。
28
-
29
- ## contentType
30
-
31
- - **Type:** `string`
32
- - **Default:** `'text'`
33
- - **available values**: `'text' | 'image' | 'multi-line-text' | 'rich-text'`
34
-
35
- 水印内容类型。
36
-
37
- ## content
38
-
39
- - **Type:** `string`
40
- - **Default:** `'hello watermark-js-plus'`
41
-
42
- 水印内容。
43
-
44
- ## imageWidth
45
-
46
- - **Type:** `number`
47
- - **Default:** `0`
48
-
49
- 水印图像宽度。
50
-
51
- ## imageHeight
52
-
53
- - **Type:** `number`
54
- - **Default:** `0`
55
-
56
- 水印图像高度。
57
-
58
- ## lineHeight
59
-
60
- - **Type:** `number`
61
- - **Default:** `30`
62
-
63
- 水印内容行高。
64
-
65
- ## zIndex
66
-
67
- - **Type:** `number`
68
- - **Default:** `10000`
69
-
70
- z-index
71
-
72
- ## backgroundPosition
73
-
74
- - **Type:** `string`
75
- - **Default:** `'0 0, 0 0'`
76
-
77
- background-position
78
-
79
- ## fontSize
80
-
81
- - **Type:** `number`
82
- - **Default:** `20`
83
-
84
- 水印内容的字体大小。
85
-
86
- ## fontFamily
87
-
88
- - **Type:** `string`
89
- - **Default:** `'sans-serif'`
90
-
91
- 水印内容的字体。
92
-
93
- ## textAlign
94
-
95
- - **Type:** `string`
96
- - **Default:** `'center'`
97
- - **available values**: `'center' | 'left' | 'right'`
98
-
99
- 水印内容水平对齐方式。
100
-
101
- ## textBaseline
102
-
103
- - **Type:** `string`
104
- - **Default:** `'middle'`
105
- - **available values**: `'top' | 'bottom' | 'middle'`
106
-
107
- 水印内容基准线。
108
-
109
- ## fontColor
110
-
111
- - **Type:** `string`
112
- - **Default:** `'#000'`
113
-
114
- 水印内容字体颜色。
115
-
116
- ## globalAlpha
117
-
118
- - **Type:** `number`
119
- - **Default:** `0.5`
120
-
121
- 水印的透明度。
122
-
123
- ## fontWeight
124
-
125
- - **Type:** `string`
126
- - **Default:** `'normal'`
127
-
128
- 水印内容字体权重。
129
-
130
- ## mode
131
-
132
- - **Type:** `string`
133
- - **Default:** `'default'`
134
- - **available values**: `'default' | 'blind'`
135
-
136
- 水印模式。
137
-
138
- ## mutationObserve
139
-
140
- - **Type:** `boolean`
141
- - **Default:** `true`
142
-
143
- 启用侦听水印dom更改。
144
-
145
- ## unique
146
-
147
- - **Type:** `boolean`
148
- - **Default:** `true`
149
-
150
- 不能重复添加水印。
151
-
152
- ## parent
153
-
154
- - **Type:** `Element | string`
155
- - **Default:** `'body'`
156
-
157
- 水印的容器。
158
-
159
- ## onSuccess
160
-
161
- - **Type:** `Function`
162
- - **Default:** `() => {}`
163
-
164
- 水印添加成功的回调事件。
165
-
166
- ## onBeforeDestroy
167
-
168
- - **Type:** `Function`
169
- - **Default:** `() => {}`
170
-
171
- 水印删除前的回调事件。
172
-
173
- ## onDestroyed
174
-
175
- - **Type:** `Function`
176
- - **Default:** `() => {}`
177
-
178
- 水印删除后的回调事件。