import { Theme } from "tona"; //#region src/types.d.ts /** 页面类型(博客园页面判定) */ type Page = 'all' | 'post' | 'index'; /** 图标渲染方式 */ type IconType = 'html' | 'className'; /** 深色模式三态 */ type Mode = 'dark' | 'light' | 'system'; /** 头像链接 */ interface Link { name: string; link: string; } /** 音频列表项 */ interface AudioItem { name: string; artist: string; url: string; cover: string; lrc: string; } /** 歌词配置 */ interface Lrc { enable: boolean; type: 1 | 3; color: string; } interface BackgroundOptions { enable?: boolean; value?: string; opacity?: number; repeat?: boolean; /** 背景透明度作用的选择器 */ opacitySelector?: string; } interface BarrageOptions { enable?: boolean; opacity?: number; fontSize?: string; colors?: string[]; barrages?: string[]; indexBarrages?: string[]; postPageBarrages?: string[]; } interface CatalogOptions { enable?: boolean; position?: 'left' | 'right'; } interface CatalogPluginOptions { mountedNode?: string; /** 插入方式:after / append / before / prepend */ fn?: 'after' | 'append' | 'before' | 'prepend'; scrollContainer?: string; updateNavigation?: boolean; showTitle?: boolean; showScrollbar?: boolean; } interface ChartsOptions { enable?: boolean; labels?: string[]; datasets?: Array>; } interface ChartsPluginOptions { mountedNode?: string; } interface ClickEffectsOptions { enable?: boolean; colors?: string[]; size?: number; maxCount?: number; } interface CodeCopyOptions { enable?: boolean; } interface CodeHighlightOptions { dark?: 'atomOneDark' | 'atomOneLight' | 'github'; light?: 'atomOneDark' | 'atomOneLight' | 'github'; } interface CodeLangOptions { enable?: boolean; } interface CodeLinenumbersOptions { enable?: boolean; } interface CodeTrafficLightOptions { enable?: boolean; } interface ColorModeOptions { name?: string; color?: string; avatar?: string; headerBackground?: string; } interface DarkModeOptions { enable?: boolean; darkDefault?: boolean; followSystem?: boolean; /** 三态图标映射(深色/浅色/跟随系统) */ icons?: Partial>; /** 三态 tooltip 映射 */ tooltips?: Partial>; iconType?: IconType; } interface DonationOptions { enable?: boolean; qrcodes?: string[]; } interface EmojiOptions { enable?: boolean; buttonIcon?: string; emojiList?: string[]; } interface FooterOptions { enable?: boolean; value?: Link[]; } interface ImagePreviewOptions { enable?: boolean; } interface LicenseOptions { enable?: boolean; license?: boolean; licenseName?: string; licenseLink?: string; contents?: string[]; } interface Live2dOptions { enable?: boolean; page?: Page; agent?: 'pc' | 'phone' | 'all'; model?: string; width?: number; height?: number; position?: 'left' | 'right'; gap?: string; mute?: boolean; } interface LockOptions { enable?: boolean; background?: string; strings?: string[]; } interface MusicPlayerOptions { enable?: boolean; page?: Page; agent?: 'desktop' | 'pad' | 'phone'; autoplay?: boolean; volume?: number; lrc?: Lrc; audio?: AudioItem[]; } interface NotationOptions { enable?: boolean; } interface NoticeOptions { enable?: boolean; contents?: string[]; } interface PostBottomImageOptions { enable?: boolean; img?: string; height?: string; } interface PostTopImageOptions { enable?: boolean; fixed?: boolean; imgs?: string[]; } interface QrcodeOptions { enable?: boolean; img?: string; desc?: string; } interface SignatureOptions { enable?: boolean; contents?: string[]; } interface SignaturePluginOptions { selector?: string; } interface WebTagOptions { enable?: boolean; title?: string; favicon?: string; } interface ToolsOptions { enable?: boolean; initialOpen?: boolean; mobileAutoClose?: boolean; } /** tools 插件第三个参数(主题侧配置) */ interface ToolsPluginOptions { /** 滚动容器选择器(按钮滚动行为使用) */ scrollContainer?: string; menuIconType?: IconType; menuIcon?: string; menuActiveIcon?: string; toolbarItems?: ToolbarItem[]; } /** 工具栏按钮基础字段(按钮工厂 options 与产物共有形状) */ interface ToolbarButtonOptions { enable?: boolean; page?: Page; icon?: string; iconType?: IconType; tooltip?: string; className?: string; } /** 深色模式按钮工厂 options(额外支持三态映射与初始模式) */ interface DarkModeButtonOptions extends ToolbarButtonOptions { icons?: Partial>; tooltips?: Partial>; darkDefault?: boolean; followSystem?: boolean; } type BackTopButtonOptions = ToolbarButtonOptions; type LikeButtonOptions = ToolbarButtonOptions; type FollowButtonOptions = ToolbarButtonOptions; type FavoriteButtonOptions = ToolbarButtonOptions; type CommentButtonOptions = ToolbarButtonOptions; /** 工具栏按钮产物(createXxxButton 返回值) */ interface ToolbarItem { enable: boolean; page: Page; icon: string; iconType: IconType; tooltip: string; className?: string; /** 按钮渲染后初始化(tools 插件在 append 后调用) */ setup?: (theme: Theme, pluginOptions: ToolsPluginOptions) => void; /** 点击行为(tools 插件绑定,透传 jquery 事件) */ callback: (pluginOptions: ToolsPluginOptions, event?: JQuery.TriggeredEvent) => void; } //#endregion //#region src/plugins/background/index.d.ts declare function background(_: Theme, devOptions?: BackgroundOptions, pluginOptions?: BackgroundOptions): void; //#endregion //#region src/plugins/barrage/index.d.ts declare function barrage(_: Theme, devOptions?: BarrageOptions): void; //#endregion //#region src/plugins/catalog/index.d.ts declare function catalog(_: Theme, devOptions?: CatalogOptions, pluginOptions?: CatalogPluginOptions): void; //#endregion //#region src/plugins/charts/index.d.ts declare function charts(_: Theme, devOptions?: ChartsOptions, pluginOptions?: ChartsPluginOptions): void; //#endregion //#region src/plugins/clickEffects/index.d.ts declare function clickEffects(_: Theme, devOptions?: ClickEffectsOptions): void; //#endregion //#region src/plugins/codeCopy/index.d.ts declare function codeCopy(_: Theme, devOptions?: CodeCopyOptions): void; //#endregion //#region src/plugins/codeHighlight/index.d.ts declare function codeHighlight(_: Theme, devOptions?: CodeHighlightOptions): void; //#endregion //#region src/plugins/codeLang/index.d.ts declare function codeLang(_: Theme, devOptions?: CodeLangOptions): void; //#endregion //#region src/plugins/codeLinenumbers/index.d.ts declare function codeLinenumbers(_: Theme, devOptions?: CodeLinenumbersOptions): void; //#endregion //#region src/plugins/codeTrafficLight/index.d.ts declare function codeTrafficLight(_: Theme, devOptions?: CodeTrafficLightOptions): void; //#endregion //#region src/plugins/colorMode/index.d.ts declare function colorMode(_: Theme, devOptions?: ColorModeOptions): void; //#endregion //#region src/plugins/commentsAvatars/index.d.ts declare function commentsAvatars(): void; //#endregion //#region src/plugins/darkMode/index.d.ts declare const DEFAULT_ICONS: Record; declare const DEFAULT_TOOLTIPS: Record; /** * 应用深色/浅色皮肤,不写入 localStorage(由 setMode 统一持久化) * @param {string} mode 'dark' | 'light' * @param {boolean} withTransition */ declare function applyMode(mode: Mode, withTransition?: boolean): void; /** 模式按钮样式(darkMode 插件 devOptions 与按钮工厂共用入口) */ interface ModeButtonStyle { icons?: Partial>; tooltips?: Partial>; iconType?: IconType; } /** * 配置模式按钮的图标与 tooltip(darkMode 插件 devOptions 与按钮工厂共用入口) * @param {object} [style] { icons?, tooltips?, iconType? } */ declare function setModeButtonStyle(style?: ModeButtonStyle): void; /** * 更新工具栏按钮图标与 tooltip */ declare function updateModeButton(): void; /** * 设置模式(三态)并持久化到 localStorage * @param {string} mode 'dark' | 'light' | 'system' * @param {boolean} withTransition */ declare function setMode(mode: Mode, withTransition?: boolean): void; /** * 三态循环切换:dark → light → system → dark(按钮 callback 与插件委托事件共用) * @param {boolean} withTransition */ declare function cycleMode(withTransition?: boolean): void; /** * 初始化 * @param {boolean} darkDefault 无存储且非跟随系统时的默认深色 * @param {boolean} followSystem 无存储时默认跟随系统 */ declare function init(darkDefault: boolean, followSystem: boolean): void; declare function darkMode(_: Theme, devOptions?: DarkModeOptions): void; //#endregion //#region src/plugins/donation/index.d.ts declare function donation(_: Theme, devOptions?: DonationOptions): void; //#endregion //#region src/plugins/emoji/index.d.ts declare function emoji(_theme: Theme, devOptions?: EmojiOptions): void; //#endregion //#region src/plugins/footer/index.d.ts declare function footer(_: Theme, devOptions?: FooterOptions): void; //#endregion //#region src/plugins/imagePreview/index.d.ts declare function imagePreview(_: Theme, devOptions?: ImagePreviewOptions): void; //#endregion //#region src/plugins/license/index.d.ts declare function license(_: Theme, devOptions?: LicenseOptions): void; //#endregion //#region src/plugins/live2d/index.d.ts declare function live2d(_: Theme, devOptions?: Live2dOptions): void; //#endregion //#region src/plugins/lock/index.d.ts declare function lock(_: Theme, devOptions?: LockOptions): void; //#endregion //#region src/plugins/musicPlayer/index.d.ts declare function musicPlayer(_: Theme, devOptions?: MusicPlayerOptions): void; //#endregion //#region src/plugins/notation/index.d.ts /** 手绘标注项(notation 插件第三个参数) */ interface NotationItem { page: string; selector: string; config: Record; } declare function notation(_: Theme, devOptions?: NotationOptions, customList?: NotationItem[]): void; //#endregion //#region src/plugins/notice/index.d.ts declare function notice(_: Theme, devOptions?: NoticeOptions): void; //#endregion //#region src/plugins/postBottomImage/index.d.ts declare function postBottomImage(_: Theme, devOptions?: PostBottomImageOptions): void; //#endregion //#region src/plugins/postMessage/index.d.ts declare function postMessage(): void; //#endregion //#region src/plugins/postTopImage/index.d.ts declare function postTopImage(_: Theme, devOptions?: PostTopImageOptions): void; //#endregion //#region src/plugins/qrcode/index.d.ts declare function qrcode(_: Theme, devOptions?: QrcodeOptions): void; //#endregion //#region src/plugins/signature/index.d.ts declare function signature(_: Theme, devOptions?: SignatureOptions, pluginOptions?: SignaturePluginOptions): void; //#endregion //#region src/plugins/tools/index.d.ts declare function tools(theme: Theme, devOptions?: ToolsOptions, pluginOptions?: ToolsPluginOptions): void; //#endregion //#region src/plugins/tools/buttons/backTop.d.ts /** * 回顶按钮工厂 * 默认行为:滚动到顶部(滚动容器取 pluginOptions.scrollContainer,默认 'html') * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/className/page/enable 等);callback 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createBackTopButton(options?: BackTopButtonOptions): ToolbarItem; //#endregion //#region src/plugins/tools/buttons/comment.d.ts /** * 评论按钮工厂 * 默认行为:滚动到评论输入框(滚动容器取 pluginOptions.scrollContainer,默认 'html') * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/className/page/enable 等);callback 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createCommentButton(options?: CommentButtonOptions): ToolbarItem; //#endregion //#region src/plugins/tools/buttons/darkMode.d.ts /** * 深色模式按钮工厂 * * 自包含:不依赖 `.use(darkMode)` 插件或 `$(document).on('click', '.mode-change')` * 委托事件即可工作。setup 初始化模式状态,callback 三态循环切换,核心逻辑复用 * darkMode 插件(同一模块实例,状态共用)。 * * 图标语义(review fix):默认按模式切换图标/tooltip(深色 fa-moon/浅色 fa-sun/ * 跟随系统 fa-adjust,对应 DEFAULT_ICONS/DEFAULT_TOOLTIPS);传入单个 `icon`/ * `tooltip` 则三种模式共用该值;也可传 `icons`/`tooltips` 三态映射精确覆盖。 * * 与 darkMode 插件互斥:按钮自带 callback(点击经 tools 绑定,并 stopPropagation), * 若同时 `.use(darkMode)` 注册了 `.mode-change` 委托点击,一次物理点击会推进两态; * 使用本按钮的主题请勿同时注册 darkMode 插件。 * * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/page/enable 等); * icons/tooltips 为三态映射({dark, light, system});className 固定为 * 'mode-change'(darkMode 核心同步逻辑依赖该选择器,不可覆盖); * darkDefault/followSystem 控制无 localStorage 存储时的初始模式(默认 false); * callback/setup 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createDarkModeButton(options?: DarkModeButtonOptions): ToolbarItem; //#endregion //#region src/plugins/tools/buttons/favorite.d.ts /** * 收藏按钮工厂 * 默认行为:window.AddToWz() * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/className/page/enable 等);callback 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createFavoriteButton(options?: FavoriteButtonOptions): ToolbarItem; //#endregion //#region src/plugins/tools/buttons/follow.d.ts /** * 关注按钮工厂 * 默认行为:toast「关注成功」+ window.follow() * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/className/page/enable 等);callback 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createFollowButton(options?: FollowButtonOptions): ToolbarItem; //#endregion //#region src/plugins/tools/buttons/like.d.ts /** * 推荐按钮工厂 * 默认行为:toast「推荐成功」+ likePost() * @param {object} [options] 覆盖默认字段(icon/iconType/tooltip/className/page/enable 等);callback 由闭包绑定,不接受覆盖 * @returns {object} 按钮对象 */ declare function createLikeButton(options?: LikeButtonOptions): ToolbarItem; //#endregion //#region src/plugins/webTag/index.d.ts declare function webTag(_: Theme, devOptions?: WebTagOptions): void; //#endregion export { AudioItem, BackTopButtonOptions, BackgroundOptions, BarrageOptions, CatalogOptions, CatalogPluginOptions, ChartsOptions, ChartsPluginOptions, ClickEffectsOptions, CodeCopyOptions, CodeHighlightOptions, CodeLangOptions, CodeLinenumbersOptions, CodeTrafficLightOptions, ColorModeOptions, CommentButtonOptions, DEFAULT_ICONS, DEFAULT_TOOLTIPS, DarkModeButtonOptions, DarkModeOptions, DonationOptions, EmojiOptions, FavoriteButtonOptions, FollowButtonOptions, FooterOptions, IconType, ImagePreviewOptions, LicenseOptions, LikeButtonOptions, Link, Live2dOptions, LockOptions, Lrc, Mode, ModeButtonStyle, MusicPlayerOptions, NotationItem, NotationOptions, NoticeOptions, Page, PostBottomImageOptions, PostTopImageOptions, QrcodeOptions, SignatureOptions, SignaturePluginOptions, type Theme, ToolbarButtonOptions, ToolbarItem, ToolsOptions, ToolsPluginOptions, WebTagOptions, applyMode, background, barrage, catalog, charts, clickEffects, codeCopy, codeHighlight, codeLang, codeLinenumbers, codeTrafficLight, colorMode, commentsAvatars, createBackTopButton, createCommentButton, createDarkModeButton, createFavoriteButton, createFollowButton, createLikeButton, cycleMode, darkMode, donation, emoji, footer, imagePreview, init, license, live2d, lock, musicPlayer, notation, notice, postBottomImage, postMessage, postTopImage, qrcode, setMode, setModeButtonStyle, signature, tools, updateModeButton, webTag };