{"_id":"@cailiao/watermark","_rev":"2-4bc55528c0936a37297d759987783ec0","name":"@cailiao/watermark","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@cailiao/watermark","version":"0.1.0","description":"一个水印插件。(A watermark plugin.)","type":"module","module":"dist/watermark.esm.browser.min.js","main":"dist/watermark.cjs.browser.min.js","entry":["index.ts"],"outfile":"watermark","keywords":["watermark"],"author":{"name":"cailiao","url":"Eleg-i"},"repository":{"type":"git","url":"git+https://github.com/Eleg-i/watermark.git"},"bugs":{"url":"https://github.com/Eleg-i/watermark/issues"},"homepage":"https://github.com/Eleg-i/watermark/#readme","license":"ISC","scripts":{"build-watch":"node ./script/esbuild.watch.js","build":"node ./script/esbuild.js","lint":"prettier --check src test script & eslint --ext .js,.vue src test script","lint:fix":"prettier --write src test script & eslint --fix --ext .js,.vue src test script","prepare":"husky install","prepublishOnly":"npm run build -s","patch":"npm version patch && npm i","minor":"npm version minor && npm i","major":"npm version major && npm i","publish":"npm publish","postpublish":"git push origin master --follow-tags"},"devDependencies":{"@babel/core":"latest","@babel/eslint-parser":"latest","@babel/plugin-syntax-import-assertions":"latest","@babel/preset-env":"latest","@babel/preset-typescript":"^7.21.5","@typescript-eslint/eslint-plugin":"^5.59.6","@typescript-eslint/parser":"^5.59.6","esbuild":"^0.16.17","eslint":"^8.40.0","eslint-config-standard":"latest","eslint-plugin-html":"latest","husky":"latest","lint-staged":"latest"},"dependencies":{"@cailiao/watch-dom":"^0.1.4"},"workspaces":["packages/*"],"gitHead":"2546c209f1da5ee629ad8d615614eb21d824a325","_id":"@cailiao/watermark@0.1.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-tRni3Rsnj/tmOZ7dFirYHx/yhRC0P5YHCu9a91bvUSL1cc7C/S9n3oHeWpEyzjAxIuqSD69Zm70S1Z9lpbTp5w==","shasum":"0e8108c564745054158e4460e09742b579685efb","tarball":"https://registry.npmjs.org/@cailiao/watermark/-/watermark-0.1.0.tgz","fileCount":8,"unpackedSize":68011,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgh8PgBnSKZ0W0WHQKBCmz+MjmInATe2gq2sNJhTkG+gIhAO3N9x+svub/U8YFl8/S3d2VN78j4J/vwN2i3p0c736u"}]},"_npmUser":{"name":"cailiao","email":"chenyu.personal@foxmail.com"},"directories":{},"maintainers":[{"name":"cailiao","email":"chenyu.personal@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/watermark_0.1.0_1686636593775_0.877729138776923"},"_hasShrinkwrap":false,"deprecated":"这个版本无法缺省图片水印参数。(This version cannot default image watermark parameters.)"},"0.1.1":{"name":"@cailiao/watermark","version":"0.1.1","description":"一个水印插件。(A watermark plugin.)","type":"module","module":"dist/watermark.esm.browser.min.js","main":"dist/watermark.cjs.browser.min.js","entry":["index.ts"],"outfile":"watermark","keywords":["watermark"],"author":{"name":"cailiao","url":"Eleg-i"},"repository":{"type":"git","url":"git+https://github.com/Eleg-i/watermark.git"},"bugs":{"url":"https://github.com/Eleg-i/watermark/issues"},"homepage":"https://github.com/Eleg-i/watermark/#readme","license":"ISC","scripts":{"build-watch":"node ./script/esbuild.watch.js","build":"node ./script/esbuild.js","lint":"prettier --check src test script & eslint --ext .js,.vue src test script","lint:fix":"prettier --write src test script & eslint --fix --ext .js,.vue src test script","prepare":"husky install","prepublishOnly":"npm run build -s","patch":"npm version patch && npm i","minor":"npm version minor && npm i","major":"npm version major && npm i","publish":"npm publish","postpublish":"git push origin master --follow-tags"},"devDependencies":{"@babel/core":"latest","@babel/eslint-parser":"latest","@babel/plugin-syntax-import-assertions":"latest","@babel/preset-env":"latest","@babel/preset-typescript":"^7.21.5","@typescript-eslint/eslint-plugin":"^5.59.6","@typescript-eslint/parser":"^5.59.6","esbuild":"^0.16.17","eslint":"^8.40.0","eslint-config-standard":"latest","eslint-plugin-html":"latest","husky":"latest","lint-staged":"latest"},"dependencies":{"@cailiao/watch-dom":"^0.1.4"},"workspaces":["packages/*"],"gitHead":"f7279fbbca689b80a971bd1fbaa2eccb184ac779","_id":"@cailiao/watermark@0.1.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Xd0RBOgTgOZdGjMh/RHkntfVCWkL9NAJz0hi3Ll/N9kVurvtSrEBLsf5+uLD/xnar6+CsddViZMMn0UXxgIxHw==","shasum":"01ab81cd2492b29c1b1a92334b9ecdbffa0ed5e7","tarball":"https://registry.npmjs.org/@cailiao/watermark/-/watermark-0.1.1.tgz","fileCount":8,"unpackedSize":68019,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHjWULYgvFb/HaN8bykzZQJ+1AYgkR5S1gZxZ8p5vHUCAiAttAGj4XEwRh6s5pOuoj7LF1KAeBx1SnOT/KNtlXID/A=="}]},"_npmUser":{"name":"cailiao","email":"chenyu.personal@foxmail.com"},"directories":{},"maintainers":[{"name":"cailiao","email":"chenyu.personal@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/watermark_0.1.1_1686639064574_0.8062833698290193"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-13T06:09:53.701Z","0.1.0":"2023-06-13T06:09:53.955Z","modified":"2023-06-13T08:21:26.685Z","0.1.1":"2023-06-13T06:51:04.782Z"},"maintainers":[{"name":"cailiao","email":"chenyu.personal@foxmail.com"}],"description":"一个水印插件。(A watermark plugin.)","homepage":"https://github.com/Eleg-i/watermark/#readme","keywords":["watermark"],"repository":{"type":"git","url":"git+https://github.com/Eleg-i/watermark.git"},"author":{"name":"cailiao","url":"Eleg-i"},"bugs":{"url":"https://github.com/Eleg-i/watermark/issues"},"license":"ISC","readme":"# watermark\n\n[简体中文](readme/README-zh-cn.md) | English\n\n## Description\n\nA watermark plugin that does not depend on any frameworks and has a certain degree of tampering ability.\n\n## Getting Started\n\nInstall dependencies\n\n```bash\nnpm i @cailiao/watermark\n```\n\n#### Import\n\n```javascript\nimport Watermark from '@cailiao/watermark'\n```\n\n#### Usage\n\n```javascript\nconst watermark = new Watermark({\n    content: 'Watermark Text'\n  })\nconst container = document.querySelector('#container') // The target element to add the watermark\n  \nconst destroy = await watermark.mount(container)\n```\n\n\n\n## Documentation\n\n#### `Watermark` `Class`\n\n##### Parameters\n\n- `options`: `Object`, optional. The properties of `options` are as follows:\n\n  - **`content`**: `String` | `Array`, optional.\n\n    The text of the watermark. Supports line breaks and can be an array, with each array member treated as a separate line.\n\n  - **`font`**: `Object`, optional. The font properties are as follows:\n\n    - **`color`**: `String`, optional. The font color, which must be a valid CSS color string. The default value is `hsla(0, 0%, 50%, 0.5)`.\n\n    - **`fontFamily`**: `String`, optional. The font family, which must be a valid CSS font string and available locally. The default value is `sans-serif`.\n\n    - **`fontSize`**: `Number`, optional. The font size in pixels. The default value is `16`.\n\n    - **`fontStyle`**: `Enum<String>`, optional. The font style, which must be a valid CSS font-style string. The default value is `normal`.\n\n    - **`fontWeight`**: `Enum<String>|Number`, optional. The font weight, which can be a valid CSS font-weight string or a number. The default value is `normal`.\n\n  - **`gap`**: `Number`, optional. The column gap between watermarks in pixels. The default value is `100`.\n\n  - **`image`**: `String|Object` type, optional, image URL, supports DataURL. When it is an object type, the attributes are as follows:\n\n       - **`alpha`**: `Number` type, optional, transparency, default is 1.\n\n       - **`src`**: `String` type, optional, image URL, supports DataURL.\n\n       - **`offset`**: `Arrary<Number>` type, optional, the offset of the image relative to the default position, in pixels. The first member is the X-axis offset, the second member is the Y-axis offset, and the default is [0, 0].\n\n  - **`lineHeight`**: `String` | `Number`, optional. The line height of the text, which must be a valid CSS line-height string or number. The default value is `1.5`.\n\n  - **`offset`**: `Array<Number>`, optional. The offset between adjacent rows of watermarks in pixels. The first member represents the X-axis offset, and the second member represents the Y-axis offset. Default value is `[100, 100]`.\n\n  - **`rotate`**: `Number`, optional. The rotation angle in degrees. The default value is `-37` or `323`.\n\n  - **`zIndex`**: `Number`, optional. The z-index value for positioning, which must be a valid CSS z-index number. The default value is `Number.MAX_SAFE_INTEGER`.\n\n##### Return Value of Instantiation [`watermark`](#watermark) Type\n\n\n\n#### watermark\n\n##### Instance Methods\n\n**`mount`**\nMounts the watermark on the specified element. Multiple mounts can be called on the same instance, and each mounted watermark is independent.\n\n- **Parameters**:\n\n  The first parameter accepts a `DOM` `Element` object where the watermark will be mounted. The element must have a positioning property. If not, relative positioning will be forcibly set. Please ensure that the type of the element is properly encapsulated beforehand.\n\n- **Return Value**:\n\n  Return a `Promise<Function>` type where the function `destroy` is used to cancel the current mounting.\n\n\n\n#### Others\n\n##### destroy `Function`\n\nUnmounting associated watermarks. No parameters required, no returns, simply call the function.\n","readmeFilename":"README.md"}