fuc-new/doc/node_modules/@vuepress/plugin-watermark/lib/node/index.d.ts
hellcat 6adbc04d4b 1
2025-10-03 17:17:08 +08:00

74 lines
1.9 KiB
TypeScript

import { Page } from 'vuepress';
import { PageFrontmatter } from 'vuepress/shared';
import { WatermarkOptions } from 'watermark-js-plus';
import { Plugin } from 'vuepress/core';
type WatermarkPureOptions = Omit<Partial<WatermarkOptions>, 'extraDrawFunc' | 'onBeforeDestroy' | 'onDestroyed' | 'onObserveError' | 'onSuccess' | 'parent'> & {
/**
* Watermark parent selector
*
* 水印父元素选择器
*
* @default 'body'
*/
parent?: 'body' | (string & {
__z_ignore?: never;
});
};
interface WatermarkPluginFrontmatter extends PageFrontmatter {
watermark?: WatermarkPureOptions | boolean;
}
interface WatermarkPluginOptions {
/**
* Specify which pages need to have watermarks added.
*
* Pages with `true` value will have watermarks added.
*
* 指定哪些页面需要添加水印。
*
* 拥有 `true` 值的页面将会被添加水印。
*
* @default true
*/
enabled?: boolean | ((page: Page) => boolean);
/**
* Watermark options
*
* 水印配置选项
*
* @see [watermark-js-plus](https://zhensherlock.github.io/watermark-js-plus/config/)
*/
watermarkOptions?: WatermarkPureOptions;
}
/**
* VuePress watermark plugin
*
* VuePress 水印插件
*
* @param options - Plugin options / 插件选项
*
* @example
* ```ts
* import { watermarkPlugin } from '@vuepress/plugin-watermark'
*
* export default {
* plugins: [
* watermarkPlugin({
* enabled: true,
* watermarkOptions: {
* content: 'My Site',
* fontColor: '#666',
* opacity: 0.3,
* },
* }),
* ],
* }
* ```
*/
declare const watermarkPlugin: ({ enabled, ...options }?: WatermarkPluginOptions) => Plugin;
export { watermarkPlugin };
export type { WatermarkPluginFrontmatter, WatermarkPluginOptions, WatermarkPureOptions };