1 Star 0 Fork 34

River/outline.js

forked from Yaohaixiao/outline.js 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
chapters.min.js.map 70.54 KB
一键复制 编辑 原始数据 按行查看 历史
Yaohaixiao 提交于 2023-08-09 15:08 . refactor: 调整代码
{"version":3,"file":"chapters.min.js","sources":["src/utils/types/isString.js","src/utils/lang/hasOwn.js","src/utils/lang/toString.js","src/utils/types/isFunction.js","src/utils/types/isObject.js","src/base.js","src/utils/lang/extend.js","src/utils/types/isElement.js","src/utils/lang/later.js","src/utils/event/enum.js","src/utils/event/_off.js","src/utils/event/_delete.js","src/utils/event/purgeElement.js","src/utils/event/getListeners.js","src/utils/event/off.js","src/utils/event/at.js","src/utils/dom/matches.js","src/utils/dom/getParentOrHost.js","src/utils/event/on.js","src/utils/event/getTarget.js","src/utils/dom/resolveTextNode.js","src/utils/dom/closest.js","src/utils/types/isArray.js","src/utils/types/isDOM.js","src/utils/types/isHTMLCollection.js","src/utils/types/isFragment.js","src/utils/types/isTextNode.js","src/utils/dom/createElement.js","src/utils/dom/setAttribute.js","src/utils/lang/easeInQuad.js","src/utils/dom/_getScrollElement.js","src/utils/dom/hasClass.js","src/utils/dom/addClass.js","src/utils/dom/removeClass.js","src/utils/lang/trim.js","src/utils/dom/offsetTop.js","src/utils/dom/getStyle.js","src/utils/dom/setProperty.js","src/utils/observer/_subscribers.js","src/utils/observer/_hasDirectSubscribersFor.js","src/utils/observer/has.js","src/utils/observer/_hasSubscribers.js","src/utils/observer/emit.js","src/utils/types/isTypedArray.js","src/chapters.js","src/_paintChapters.js","src/utils/dom/scrollTo.js","src/utils/dom/intersection.js","src/utils/event/stop.js"],"sourcesContent":["/**\n * 检测数据是否为 String 类型\n * ========================================================================\n * @method isArray\n * @param {*} str\n * @returns {boolean}\n */\nconst isString = (str) => {\n return typeof str === 'string'\n}\n\nexport default isString\n","/**\n * 检测对象自身属性中是否具有指定的属性。\n * ========================================================================\n * @method hasOwn\n * @param {Object} obj - (必须)检测的目标对象\n * @param {String} prop - (必须)属性名\n * @returns {Boolean}\n */\nconst hasOwn = (obj, prop) => {\n const hasOwnProperty = Object.prototype.hasOwnProperty\n return obj && hasOwnProperty.call(obj, prop)\n}\n\nexport default hasOwn\n","/**\n * Object 对象原型上的 toString 方法\n * ========================================================================\n * @method toString\n * @param {*} val\n * @returns {string}\n */\nconst toString = (val) => {\n return Object.prototype.toString.apply(val)\n}\n\nexport default toString\n","import toString from '../lang/toString'\n\n/**\n * 检测测试数据是否为 Function 类型\n * ========================================================================\n * @method isFunction\n * @param {*} val - (必须)待检测的数据\n * @returns {boolean} 'val' 是 Function 类型返回 true,否则返回 false\n */\nconst isFunction = (val) => {\n return typeof val === 'function' || toString(val) === '[object Function]'\n}\n\nexport default isFunction\n","import toString from '../lang/toString'\nimport isFunction from '../types/isFunction'\n\n/**\n * 检测数据是否为 Object 类型\n * ========================================================================\n * @method isObject\n * @param {*} o\n * @returns {boolean}\n */\nconst isObject = (o) => {\n return (\n (toString(o) === '[object Object]' ||\n typeof o === 'object' ||\n isFunction(o)) &&\n o !== null\n )\n}\n\nexport default isObject\n","import isString from './utils/types/isString'\r\nimport hasOwn from './utils/lang/hasOwn'\r\nimport isObject from './utils/types/isObject'\r\nimport extend from './utils/lang/extend'\r\n\r\nclass Base {\r\n constructor(options) {\r\n this.attrs = {}\r\n\r\n if (options) {\r\n this.initialize(options)\r\n }\r\n }\r\n\r\n initialize(options) {\r\n this.attr(options).render().addListeners()\r\n return this\r\n }\r\n\r\n attr(prop, value) {\r\n const attrs = this.attrs\r\n\r\n if (isString(prop)) {\r\n // 只能扩展 attrs 中已有的属性\r\n if (value && hasOwn(attrs, prop)) {\r\n // 更新单个配置信息\r\n attrs[prop] = value\r\n return this\r\n }\r\n\r\n // 只传递 prop 参数,则返回对应的属性值\r\n return attrs[prop]\r\n } else if (isObject(prop)) {\r\n // 批量更新配置信息\r\n extend(attrs, prop)\r\n\r\n return this\r\n } else if (arguments.length === 0) {\r\n // 不传递参数,直接返回整个\r\n return attrs\r\n }\r\n\r\n return this\r\n }\r\n\r\n render() {\r\n return this\r\n }\r\n\r\n destroy() {\r\n this.removeListeners()\r\n return this\r\n }\r\n\r\n reload(options) {\r\n this.destroy().initialize(this.attr(options))\r\n return this\r\n }\r\n\r\n addListeners() {\r\n return this\r\n }\r\n\r\n removeListeners() {\r\n return this\r\n }\r\n}\r\n\r\nexport default Base\r\n","import hasOwn from './hasOwn'\n\n/**\n * 扩展对象\n * ========================================================================\n * @method extend\n * @param {Object} origin\n * @param {Object} source\n */\nconst extend = (origin, source) => {\n const keys = Object.keys(source)\n\n keys.forEach((prop) => {\n if (hasOwn(source, prop)) {\n origin[prop] = source[prop]\n }\n })\n}\n\nexport default extend\n","import isObject from './isObject'\n\n/**\n * 检测数据是否为 HTMLElement DOM 节点\n * ========================================================================\n * @method isElement\n * @param {*} o\n * @returns {boolean}\n */\nconst isElement = (o) => {\n return !!(isObject(o) && o.nodeName && o.tagName && o.nodeType === 1)\n}\n\nexport default isElement\n","import isFunction from '../types/isFunction'\n\n/**\n * later - 延迟执行方法\n * ========================================================================\n * @method later\n * @param {Function} fn\n * @param {Number} [delay]\n * @returns {number|boolean}\n */\nconst later = (fn, delay = 300) => {\n if (!isFunction(fn)) {\n return false\n }\n\n return setTimeout(() => {\n fn()\n }, delay)\n}\n\nexport default later\n","export const CAPTURE_EVENTS = [\n 'focusout',\n 'blur',\n 'focusin',\n 'focus',\n 'load',\n 'unload',\n 'mouseenter',\n 'mouseleave'\n]\n","import { CAPTURE_EVENTS } from './enum'\nimport _delete from './_delete'\n\n/**\n * (私有方法)取消 type 类型的代理事件绑定\n * ========================================================================\n * 如果没有设置 handler,则销毁 this.$options 绑定的所有符合 type 事件类型的事件绑定\n * ========================================================================\n * @method _off\n * @param {HTMLElement} el - (必须)取消事件绑定的 DOM 元素\n * @param {String} type - (必须)事件类型\n * @param {Function} fn - (必须)事件处理器回调函数\n * @private\n */\nconst _off = (el, type, fn) => {\n const capture = CAPTURE_EVENTS.indexOf(type) > -1\n\n /* istanbul ignore else */\n if (fn._delegateListener) {\n fn = fn._delegateListener\n delete fn._delegateListener\n }\n\n // 移除缓存的 _listeners 数据\n _delete(el, type, fn)\n\n el.removeEventListener(type, fn, capture)\n}\n\nexport default _off\n","/**\n * 删除 DOM 元素缓存的 _listeners 数据\n * ========================================================================\n * @method _delete\n * @param {HTMLElement} el - 要删除 listener 的 DOM 元素\n * @param {String} type - 事件类型(名称)\n * @param {Function} [fn] - 事件处理器回调函数\n */\nconst _delete = function (el, type, fn) {\n const listeners = el._listeners\n let index = -1\n\n if (listeners.length < 1) {\n return false\n }\n\n // 移除缓存的 _listeners 数据\n listeners.forEach((listener, i) => {\n const handler = listener.fn\n\n if (type === listener.type) {\n index = i\n\n if (handler === fn) {\n index = i\n }\n }\n })\n\n /* istanbul ignore else */\n if (index > -1) {\n listeners.splice(index, 1)\n }\n}\n\nexport default _delete\n","import isString from '../types/isString'\nimport isElement from '../types/isElement'\nimport getListeners from './getListeners'\nimport _off from './_off'\n\n/**\n * 销毁(type 类型的)代理事件绑定\n * ========================================================================\n * 1. 设置了事件类型 type,则销毁指定类型的事件绑定,否则清除所有代理事件绑定\n * 2. recurse 设置为 true,递归销毁子节点全部事件绑定\n * ========================================================================\n * @method purgeElement\n * @param {HTMLElement|String} el - (必须)DOM 元素或者其选择器\n * @param {String|Boolean} type - (必须)事件类型\n * @param {Boolean} [recurse] - (可选)是否递归销毁子节点所有事件绑定\n */\nconst purgeElement = function (el, type, recurse = false) {\n const $element = isString(el) ? document.querySelector(el) : el\n const $children = $element.childNodes\n const listeners = getListeners($element, type)\n\n listeners.forEach((listener) => {\n _off($element, listener.type, listener.fn)\n })\n\n if (\n (recurse || type === true || arguments.length === 1) &&\n $element &&\n $children\n ) {\n $children.forEach(($child) => {\n if (isElement($child)) {\n purgeElement($child, type, recurse)\n }\n })\n }\n}\n\nexport default purgeElement\n","import isString from '../types/isString'\n\n/**\n * 获取 DOM 元素(type 事件类型)事件绑定信息\n * ========================================================================\n * 如果设置了事件类型 type, 则返回指定类型的事件绑定信息,否则返回所有事件绑定信息\n * ========================================================================\n * @methods getListeners\n * @param {HTMLElement} el - (必须)要获取事件绑定信息的 DOM 元素\n * @param {String} [type] - (可选)事件类型\n * @returns {Array} - 已绑定的事件信息\n */\nconst getListeners = (el, type) => {\n let listeners = el._listeners || []\n\n if (isString(type) && type) {\n listeners = listeners.filter((listener) => {\n return listener.type === type\n })\n }\n\n return listeners\n}\n\nexport default getListeners\n","import purgeElement from './purgeElement'\nimport isFunction from '../types/isFunction'\nimport _off from './_off'\n\n/**\n * 取消 type 类型的代理事件绑定\n * ========================================================================\n * 如果没有设置 handler,则销毁 this.$options 绑定的所有符合 type 事件类型的事件绑定\n * ========================================================================\n * @method off\n * @param {HTMLElement} el - (必须)取消事件绑定的 DOM 元素\n * @param {String} type - (必须)事件类型\n * @param {Function} [fn] - (可选)事件处理器回调函数\n */\nconst off = (el, type, fn) => {\n // 如果不设置 fn 参数,默认清除 el 元素上绑定的所有事件处理器\n if (!isFunction(fn)) {\n return purgeElement(el, type)\n }\n\n _off(el, type, fn)\n}\n\nexport default off\n","import isFunction from '../types/isFunction'\nimport off from './off'\n\nimport { CAPTURE_EVENTS } from './enum'\n\n/**\n * 绑定事件\n * ========================================================================\n * @method at\n * @param {HTMLElement|String|Object} el - (必须)绑定代理事件的 DOM 节点\n * @param {String|Function} type - (必须)事件类型或者事件处理器回调函数\n * @param {Function|Object} fn - (必须) 事件处理器回调函数或者传递给事件处理器回调函数的数据对象\n * @param {Object|Boolean} [data] - (可选)传递给事件处理器回调函数的数据对象或者事件处理器回调函数的 this 上下文指向,\n * @param {Object|Boolean} [context] - (可选)事件处理器回调函数的 this 上下文指向,或者是否仅触发一次\n * 当设置为 true 时,则事件处理器回调函数的 this 上下文指向为 data 对象\n * @param {Boolean} once - (可选)是否仅触发一次\n */\nconst at = (el, type, fn, data, context, once = false) => {\n // CAPTURE_EVENTS 中的特殊事件,采用事件捕获模型\n const capture = CAPTURE_EVENTS.indexOf(type) > -1\n const listener = function (evt) {\n let overrideContext = context || el\n\n // 当设置为 true 时,则事件处理器回调函数的\n // this 上下文指向为 data 对象\n if (context === true) {\n overrideContext = data\n }\n\n // 仅触发一次\n /* istanbul ignore else */\n if (once === true) {\n off(el, type, listener)\n }\n\n fn.call(overrideContext, evt, data)\n }\n\n if (!isFunction(fn)) {\n return false\n }\n\n if (!el._listeners) {\n el._listeners = []\n }\n\n // 缓存 options 元素绑定的事件处理器\n el._listeners.push({\n el,\n type,\n fn: listener,\n data,\n context,\n capture\n })\n\n // 缓存包装后的事件处理器\n fn._delegateListener = listener\n\n el.addEventListener(type, listener, capture)\n}\n\nexport default at\n","/**\n * 获取 options 节点下匹配 selector 选择器的 DOM 节点\n * ========================================================================\n * Element.matches() 方法可以用来判断 DOM 元素是否与给定的选择器匹配,事件代理判断是\n * 否触发绑定的代理事件回调函数,关键就是使用 Element.matches() 辨别当前事件触发的目\n * 标 DOM 元素是否为事件代理所期望触发的目标。\n * ========================================================================\n * @method matches\n * @see https://developer.mozilla.org/en-US/docs/web/api/element/matches\n * @param {HTMLElement} el - (必须)DOM 元素\n * @param {String} selector - (必须)匹配 DOM 元素的选择器\n * @returns {Boolean}\n */\nconst matches = (el, selector = '') => {\n const sel = selector.replace(/^>/i, '')\n\n if (!selector || !sel || !el) {\n return false\n }\n\n /* istanbul ignore else */\n if (el.matches) {\n return el.matches(sel)\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(sel)\n } else {\n return false\n }\n}\n\nexport default matches\n","/**\n * 获取 DOM 元素的父节点\n * ========================================================================\n * @method getParentOrHost\n * @param {*|HTMLElement} el - (必须)要获取父节点的 DOM 元素\n * @returns {*|HTMLElement}\n */\nconst getParentOrHost = (el) => {\n return el.host && el !== document && el.host.nodeType\n ? el.host\n : el.parentNode\n}\n\nexport default getParentOrHost\n","import closest from '../dom/closest'\nimport off from './off'\nimport getTarget from './getTarget'\n\nimport { CAPTURE_EVENTS } from './enum'\n\n/**\n * 绑定代理事件\n * ========================================================================\n * @method on\n * @param {HTMLElement|String|Object} el - (必须)绑定代理事件的 DOM 节点\n * @param {String} selector - (必须)事件代理目标 DOM 元素的选择器\n * @param {String|Function} type - (必须)事件类型或者事件处理器回调函数\n * @param {Function|Object} fn - (可选) 事件处理器回调函数或者传递给事件处理器回调函数的数据对象\n * @param {Object|Boolean} [data] - (可选)传递给事件处理器回调函数的数据对象或者事件处理器回调函数的 this 上下文指向,\n * @param {Object|Boolean} [context] - (可选)事件处理器回调函数的 this 上下文指向,或者是否仅触发一次\n * 当设置为 true 时,则事件处理器回调函数的 this 上下文指向为 data 对象\n * @param {Boolean} once - (可选)是否仅触发一次\n */\nconst on = (el, selector, type, fn, data, context, once = false) => {\n // CAPTURE_EVENTS 中的特殊事件,采用事件捕获模型\n const capture = CAPTURE_EVENTS.indexOf(type) > -1\n\n const listener = function (evt) {\n const target = getTarget(evt)\n // 通过 Element.matches 方法获得点击的目标元素\n const delegateTarget = closest(target, selector, el)\n let overrideContext = context || el\n\n evt.delegateTarget = delegateTarget\n\n // 当设置为 true 时,则事件处理器回调函数的\n // this 上下文指向为 data 对象\n if (context === true) {\n overrideContext = data\n }\n\n /* istanbul ignore else */\n if (delegateTarget) {\n // 仅触发一次\n /* istanbul ignore else */\n if (once === true) {\n off(el, type, listener)\n }\n\n fn.call(overrideContext, evt, data)\n }\n }\n\n if (!el._listeners) {\n el._listeners = []\n }\n\n // 缓存 options 元素绑定的事件处理器\n el._listeners.push({\n el,\n selector,\n type,\n fn: listener,\n data,\n context,\n capture\n })\n\n // 缓存包装后的事件处理器\n fn._delegateListener = listener\n\n el.addEventListener(type, listener, capture)\n}\n\nexport default on\n","import resolveTextNode from '../dom/resolveTextNode'\n\n/**\n * 返回触发事件的 target DOM 元素\n * ========================================================================\n * @method getTarget\n * @param {Event} evt - Event 对象\n * @return {HTMLElement} - Event 对象的 target DOM 元素\n */\nconst getTarget = function (evt) {\n const target = evt.target\n\n return resolveTextNode(target)\n}\n\nexport default getTarget\n","/**\n * 在某些情况下,某些浏览器(例如:Safari 浏览器)会返回实际的目标元素内部的文本节点。\n * resolveTextNode() 方法则会返回实际的目标节点。\n * ========================================================================\n * @method resolveTextNode\n * @param {HTMLElement|Text} el - 要解析的节点\n * @return {*|HTMLElement} - 实际的目标 DOM 节点\n */\nconst resolveTextNode = function (el) {\n if (el && el.nodeType === 3) {\n return el.parentNode\n }\n\n return el\n}\n\nexport default resolveTextNode\n","import matches from './matches'\nimport getParentOrHost from './getParentOrHost'\n\n/**\n * 获取 options 元素父元素最近的包含 selector 选择器的元素\n * ========================================================================\n * @method closest\n * @param {HTMLElement} el - (必须)DOM 元素\n * @param {String} selector - (必须)DOM 元素的选择其\n * @param {HTMLElement} [ctx] - (必须)比对的 DOM 元素\n * @param {Boolean} [includeCTX] - (必须)是否包含 context DOM 元素\n * @returns {null|HTMLElement} - 返回最接近的 DOM 元素\n */\nconst closest = (el, selector, ctx, includeCTX) => {\n const context = ctx || document\n\n if (!el) {\n return null\n }\n\n do {\n /* istanbul ignore else */\n if (\n (selector != null &&\n (selector.startsWith('>')\n ? el.parentNode === context && matches(el, selector)\n : matches(el, selector))) ||\n (includeCTX && el === context)\n ) {\n return el\n }\n\n /* istanbul ignore else */\n if (el === context) {\n break\n }\n\n /* jshint boss:true */\n } while ((el = getParentOrHost(el)))\n}\n\nexport default closest\n","import toString from '../lang/toString'\n\n/**\n * 检测数据是否为 Array 类型\n * ========================================================================\n * @method isArray\n * @param {*} o\n * @returns {boolean}\n */\nconst isArray = (o) => {\n if (Array.isArray) {\n return Array.isArray(o)\n } else {\n return toString(o) === '[object Array]'\n }\n}\n\nexport default isArray\n","import isObject from './isObject'\r\nimport isElement from './isElement'\r\nimport isHTMLCollection from './isHTMLCollection'\r\nimport isFragment from './isFragment'\r\nimport isTextNode from './isTextNode'\r\n\r\nconst isDOM = (el) => {\r\n return !!(\r\n isObject(el) &&\r\n (isElement(el) || isHTMLCollection(el) || isFragment(el) || isTextNode(el))\r\n )\r\n}\r\n\r\nexport default isDOM\r\n","import toString from '../lang/toString'\r\nimport isObject from './isObject'\r\n\r\nconst isHTMLCollection = (el) => {\r\n return !!(isObject(el) && toString(el) === '[object NodeList]')\r\n}\r\n\r\nexport default isHTMLCollection\r\n","import toString from '../lang/toString'\nimport isObject from './isObject'\n\nconst isFragment = (fragment) => {\n return !!(\n isObject(fragment) && toString(fragment) === '[object DocumentFragment]'\n )\n}\n\nexport default isFragment\n","import toString from '../lang/toString'\r\nimport isObject from './isObject'\r\n\r\nconst isTextNode = (el) => {\r\n return !!(\r\n isObject(el) &&\r\n (toString(el) === '[object Text]' || (el.tagName && el.nodeType === 3))\r\n )\r\n}\r\n\r\nexport default isTextNode\r\n","import hasOwn from '../lang/hasOwn'\nimport isObject from '../types/isObject'\nimport isString from '../types/isString'\nimport isArray from '../types/isArray'\nimport isDOM from '../types/isDOM'\nimport setAttribute from './setAttribute'\n\n/**\n * 创建 DOM 节点,并添加属性和子节点\n * ========================================================================\n * @method createElement\n * @param {String} tagName - 标签名称\n * @param {Object|Array} attrs - 属性对象或者子节点\n * @param {Array} [children] - 子节点数组\n * @returns {HTMLElement}\n */\nconst createElement = (tagName, attrs, children) => {\n const $fragment = document.createDocumentFragment()\n const $el = document.createElement(tagName)\n const isValidChild = (child) => {\n return isDOM(child) || isString(child)\n }\n const append = (child) => {\n let $child\n\n if (!isValidChild(child)) {\n return false\n }\n\n if (isDOM(child)) {\n $child = child\n } else if (isString(child)) {\n $child = document.createTextNode(child)\n }\n\n $fragment.appendChild($child)\n }\n\n if (isObject(attrs)) {\n Object.keys(attrs).forEach((attr) => {\n if (hasOwn(attrs, attr)) {\n setAttribute($el, attr, attrs[attr])\n }\n })\n } else if (isArray(attrs) && attrs.every((attr) => isValidChild(attr))) {\n attrs.forEach((child) => {\n append(child)\n })\n }\n\n if (isArray(children)) {\n children.forEach((child) => {\n append(child)\n })\n } else {\n append(children)\n }\n\n $el.appendChild($fragment)\n\n return $el\n}\n\nexport default createElement\n","/**\n * 给 DOM 节点设置属性/值\n * ========================================================================\n * @method setAttribute\n * @param {HTMLElement} el - DOM 节点\n * @param {String} attr - 属性名称\n * @param {String|Number|Boolean} value - 属性值\n */\nconst setAttribute = (el, attr, value) => {\n let tagName = el.tagName.toLowerCase()\n\n switch (attr) {\n case 'style':\n el.style.cssText = value\n break\n case 'value':\n if (tagName === 'input' || tagName === 'textarea') {\n el.value = value\n } else {\n el.setAttribute(attr, value)\n }\n break\n case 'className':\n el.className = value\n break\n default:\n el.setAttribute(attr, value)\n break\n }\n}\n\nexport default setAttribute\n","/**\n * 返回给定值的平方值\n * ========================================================================\n * @method easeInQuad\n * @param {Number} x\n * @returns {number}\n */\nconst easeInQuad = (x) => {\n return x * x\n}\n\nexport default easeInQuad\n","import isString from '../types/isString'\nimport isElement from '../types/isElement'\n\n/**\n * 通过给的 scrollElement 参数,获取滚动 DOM 元素\n * ========================================================================\n * @method _getScrollElement\n * @param {String|HTMLElement} scrollElement\n * @returns {Element}\n * @private\n */\nconst _getScrollElement = (scrollElement = null) => {\n let $rootElements\n let $scrollElement\n\n if (!scrollElement) {\n $rootElements = document.querySelectorAll('html,body')\n $scrollElement =\n $rootElements[0].scrollTop - $rootElements[1].scrollTop >= 0\n ? $rootElements[0]\n : $rootElements[1]\n } else {\n if (isString(scrollElement)) {\n $scrollElement = document.querySelector(scrollElement)\n } else if (isElement(scrollElement)) {\n $scrollElement = scrollElement\n }\n }\n\n return $scrollElement\n}\n\nexport default _getScrollElement\n","import isElement from '../types/isElement'\n/**\n * 检测 DOM 节点是否包含名为 className 的样式\n * ========================================================================\n * @method hasClass\n * @param {HTMLElement} el - DOM 节点\n * @param {String} className - 样式名称\n * @returns {Boolean}\n */\nconst hasClass = (el, className) => {\n const pattern = new RegExp('(\\\\s|^)' + className + '(\\\\s|$)')\n let allClass\n let classList\n\n if (!isElement(el)) {\n return false\n }\n\n allClass = el.className\n\n if (!allClass) {\n return false\n }\n\n classList = el.classList\n\n if (classList?.contains) {\n return el.classList.contains(className)\n }\n\n return !!pattern.exec(allClass)\n}\n\nexport default hasClass\n","import hasClass from './hasClass'\n\n/**\n * 给 DOM 节点添加名为 className 的样式\n * ========================================================================\n * @method addClass\n * @param {HTMLElement} el - DOM 节点\n * @param {String} className - 样式名称\n * @returns {Boolean}\n */\nconst addClass = (el, className) => {\n let classList\n let allClass\n\n if (hasClass(el, className)) {\n return false\n }\n\n classList = el.classList\n\n if (classList?.add) {\n classList.add(className)\n } else {\n allClass = el.className\n allClass += allClass.length > 0 ? ' ' + className : className\n el.className = allClass\n }\n}\n\nexport default addClass\n","import trim from '../lang/trim'\nimport hasClass from './hasClass'\n\n/**\n * 移除 DOM 节点的 className 样式\n * ========================================================================\n * @method removeClass\n * @param {HTMLElement} el - DOM 节点\n * @param {String} className - 样式名称\n * @returns {Boolean}\n */\nconst removeClass = (el, className) => {\n let allClass = el.className\n let classList\n\n if (!allClass || !hasClass(el, className)) {\n return false\n }\n\n classList = el.classList\n\n if (classList?.remove) {\n classList.remove(className)\n } else {\n allClass = trim(allClass.replace(className, ''))\n el.className = allClass\n }\n}\n\nexport default removeClass\n","import isString from '../types/isString'\n\n/**\n * 清楚字符串起始位置所有的空格\n * ========================================================================\n * @method trim\n * @param {string} str\n * @returns {string|Boolean}\n */\nconst trim = (str) => {\n if (!isString(str)) {\n return false\n }\n return str.replace(/(^\\s+)|(\\s+$)/g, '')\n}\n\nexport default trim\n","/**\n * 获取 DOM 节点相对于窗口的 left (纵坐标)值\n * ========================================================================\n * @method offsetTop\n * @param {HTMLElement} el - DOM 节点\n * @returns {Number}\n */\nconst offsetTop = (el) => {\n let top = el.offsetTop\n\n if (el.offsetParent !== null) {\n top += offsetTop(el.offsetParent)\n }\n\n return top\n}\n\nexport default offsetTop\n","/**\r\n * 获取HTML元素的某个CSS样式值\r\n * ====================================================\r\n * @param el\r\n * @param ruleName\r\n * @returns {*}\r\n */\r\nconst getStyle = (el, ruleName) => {\r\n return getComputedStyle(el)[ruleName]\r\n}\r\n\r\nexport default getStyle\r\n","const setProperty = (prop, value) => {\r\n const documentElement = document.documentElement\r\n documentElement.style.setProperty(prop, value)\r\n}\r\n\r\nexport default setProperty\r\n","/**\n * 存储订阅者(主题和处理器的)私有对象\n * ========================================================================\n * @type {{}}\n * @private\n */\nconst _subscribers = {}\n\nexport default _subscribers\n","import _subscribers from './_subscribers'\nimport hasOwn from '../lang/hasOwn'\n\n/**\n * 判断是否存在与给定 topic 完全匹配的订阅者信息\n * ========================================================================\n * @method _hasDirectSubscribersFor\n * @param {String} topic - (必须)订阅主题字符串\n * @returns {Boolean}\n */\nconst _hasDirectSubscribersFor = (topic) => {\n return hasOwn(_subscribers, topic) && _subscribers[topic].length > 0\n}\n\nexport default _hasDirectSubscribersFor\n","import _hasDirectSubscribersFor from './_hasDirectSubscribersFor'\nimport _hasSubscribers from './_hasSubscribers'\n\n/**\n * 判断是否存在包含 topic 指定的订阅者信息\n * ========================================================================\n * @method has\n * @param {String} topic - (必须)主题名称\n * @param {Boolean} [isDirect] - (可选)是否为直接的主题,默认值:true\n * @returns {Boolean}\n */\nconst has = (topic, isDirect = true) => {\n return isDirect ? _hasDirectSubscribersFor(topic) : _hasSubscribers(topic)\n}\n\nexport default has\n","import _hasDirectSubscribersFor from './_hasDirectSubscribersFor'\n\n/**\n * 判断是否存在包含给定 topic 相关的订阅者信息\n * ========================================================================\n * @method _hasSubscribers\n * @param {String} topic - (必须)订阅主题字符串\n * @returns {Boolean}\n */\nconst _hasSubscribers = (topic) => {\n let found = _hasDirectSubscribersFor(topic)\n let position = topic.lastIndexOf('.')\n\n while (!found && position !== -1) {\n topic = topic.substring(0, position)\n position = topic.lastIndexOf('.')\n found = _hasDirectSubscribersFor(topic)\n }\n\n return found\n}\n\nexport default _hasSubscribers\n","import isTypedArray from '../types/isTypedArray'\nimport _subscribers from './_subscribers'\nimport has from './has'\nimport _hasDirectSubscribersFor from './_hasDirectSubscribersFor'\n\n/**\n * (异步)发布订阅主题信息\n * ========================================================================\n * 主题默认是异步发布的。确保在消费者处理主题时,主题的发起者不会被阻止。\n * ========================================================================\n * @method emit\n * @param {String} topic - (必须)主题名称\n * @param {Object} data - (必须)数据对象\n * @param {Boolean} async - (可选) 是否异步发布\n */\nconst emit = (topic, data, async = true) => {\n const execute = (topic) => {\n if (!_hasDirectSubscribersFor(topic)) {\n return false\n }\n\n _subscribers[topic].forEach((subscriber) => {\n // 针对 mqtt 消息服务返回的 Uint8Array 类似的 typed arrays 格式的数据\n // 采用 toString() 方法转化为普通(JSON)字符串\n const message = isTypedArray(data) ? data.toString() : data\n\n subscriber.callback.call(subscriber.context || subscriber, message)\n })\n }\n const deliver = () => {\n let subscriber = topic\n let position = topic.lastIndexOf('.')\n\n while (position !== -1) {\n subscriber = subscriber.substring(0, position)\n position = subscriber.lastIndexOf('.')\n\n execute(subscriber)\n }\n\n // 执行 topic 对应的处理器\n execute(topic)\n // 执行特殊 topic:'*'(监听全部消息的发布)\n execute('*')\n }\n\n if (!has(topic)) {\n return false\n }\n\n if (async) {\n setTimeout(deliver, 10)\n } else {\n deliver()\n }\n}\n\nexport default emit\n","import toString from '../lang/toString'\n/**\n * 判断检测数据是否为 Typed Arrays 类型的数据\n * ========================================================================\n * @param {*} val\n * @returns {boolean}\n */\nconst isTypedArray = (val) => {\n const TYPES = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]',\n '[object BigInt64Array]',\n '[object BigUint64Array]'\n ]\n\n return TYPES.indexOf(toString(val)) > -1\n}\n\nexport default isTypedArray\n","import Base from './base'\n\nimport isString from './utils/types/isString'\nimport isFunction from './utils/types/isFunction'\nimport isElement from './utils/types/isElement'\nimport later from './utils/lang/later'\nimport at from './utils/event/at'\nimport on from './utils/event/on'\nimport off from './utils/event/off'\nimport stop from './utils/event/stop'\nimport createElement from './utils/dom/createElement'\nimport scrollTo from './utils/dom/scrollTo'\nimport addClass from './utils/dom/addClass'\nimport intersection from './utils/dom/intersection'\nimport removeClass from './utils/dom/removeClass'\nimport offsetTop from './utils/dom/offsetTop'\nimport getStyle from './utils/dom/getStyle'\nimport setProperty from './utils/dom/setProperty'\nimport publish from './utils/observer/emit'\n\nimport _getScrollElement from './utils/dom/_getScrollElement'\nimport _paintChapters from './_paintChapters'\n\nclass Chapters extends Base {\n constructor(options) {\n super()\n\n this.attrs = Chapters.DEFAULTS\n this.$el = null\n this.$title = null\n this.$main = null\n this.$list = null\n this.$placeholder = null\n this.$parentElement = null\n this.$scrollElement = null\n this.chapters = []\n this.closed = false\n this.active = 0\n this.offsetTop = 0\n this.offsetWidth = 0\n this.$active = null\n this.scrollTimer = null\n this.resizeTimer = null\n this.playing = false\n this.Observer = null\n\n if (options) {\n this.initialize(options)\n }\n }\n\n initialize(options) {\n let created\n let parentElement\n let scrollElement\n let $parent\n\n this.attr(options)\n created = this.attr('created')\n parentElement = this.attr('parentElement')\n scrollElement = this.attr('scrollElement')\n\n if (isString(parentElement)) {\n $parent = document.querySelector(parentElement)\n } else if (isElement(parentElement)) {\n $parent = parentElement\n }\n this.$parentElement = $parent\n this.$scrollElement = _getScrollElement(scrollElement)\n\n this.chapters = this.attr('chapters')\n this.closed = this.attr('closed')\n this.active = this.attr('active')\n\n if (isFunction(created)) {\n created.call(this)\n }\n\n if (this.chapters.length < 1) {\n return this\n }\n\n this.render().addListeners()\n\n this.$active = document.querySelector(`#chapter-${this.active}`)\n\n return this\n }\n\n isClosed() {\n return this.closed\n }\n\n isSticky() {\n const position = this.attr('position')\n return position === 'sticky'\n }\n\n isFixed() {\n const position = this.attr('position')\n return position === 'fixed'\n }\n\n isInside() {\n return this.isFixed() || this.isSticky()\n }\n\n isOutside() {\n return !this.isInside()\n }\n\n _paintEdge() {\n const STICKY = 'outline-chapters_sticky'\n const FIXED = 'outline-chapters_fixed'\n const HIDDEN = 'outline-chapters_hidden'\n const title = this.attr('title')\n const customClass = this.attr('customClass')\n const $parentElement = this.$parentElement\n const contents = []\n let $title = null\n let $el\n let $main\n let $list\n let $placeholder\n\n if (!$parentElement) {\n return this\n }\n\n if (this.isInside()) {\n $title = createElement(\n 'h2',\n {\n className: 'outline-chapters__title'\n },\n [title]\n )\n this.$title = $title\n contents.push($title)\n }\n\n $list = createElement(\n 'ul',\n {\n // 为优化性能,添加了 _fixed 和 _hidden\n // fixed 为了让 $list 脱离流布局\n // hidden 让 $list 不可见\n className: `outline-chapters__list ${FIXED} ${HIDDEN}`\n },\n ['']\n )\n this.$list = $list\n\n $placeholder = createElement(\n 'div',\n {\n className: 'outline-chapters__placeholder'\n },\n ['']\n )\n this.$placeholder = $placeholder\n\n $main = createElement(\n 'div',\n {\n className: 'outline-chapters__main'\n },\n [$list, $placeholder]\n )\n this.$main = $main\n contents.push($main)\n\n $el = createElement(\n 'nav',\n {\n id: 'outline-chapters',\n className: 'outline-chapters'\n },\n contents\n )\n this.$el = $el\n\n if (this.isSticky()) {\n this.calculateStickyHeight()\n addClass($el, STICKY)\n }\n\n if (customClass) {\n addClass($el, customClass)\n }\n\n $parentElement.appendChild($el)\n\n return this\n }\n\n render() {\n const FIXED = 'outline-chapters_fixed'\n const HIDDEN = 'outline-chapters_hidden'\n const showCode = this.attr('showCode')\n const mounted = this.attr('mounted')\n const $parentElement = this.$parentElement\n let $el\n let $list\n\n if (!$parentElement) {\n return this\n }\n\n this._paintEdge()\n\n $list = this.$list\n _paintChapters($list, this.chapters, showCode)\n removeClass($list, FIXED)\n removeClass($list, HIDDEN)\n this.positionPlaceholder(this.active)\n\n $el = this.$el\n this.offsetTop = offsetTop($el)\n this.offsetWidth = $el.offsetWidth\n\n if (this.isFixed()) {\n this.sticky()\n setProperty('--outline-chapters-width', `${this.offsetWidth}px`)\n }\n\n if (isFunction(mounted)) {\n mounted.call(this)\n }\n\n this.onObserver()\n\n return this\n }\n\n positionPlaceholder(index) {\n const $main = this.$main\n const $list = this.$list\n const $placeholder = this.$placeholder\n const $anchor = $list.querySelector('.outline-chapters__anchor')\n const mainPaddingTop = parseInt(getStyle($main, 'padding-top'), 10)\n const mainBorderTop = parseInt(getStyle($main, 'border-top-width'), 10)\n const placeholderPaddingTop = parseInt(getStyle($list, 'padding-top'), 10)\n const placeholderMarginTop = parseInt(getStyle($list, 'margin-top'), 10)\n const placeholderBorderTop = parseInt(\n getStyle($list, 'border-top-width'),\n 10\n )\n let height = $anchor.offsetHeight\n let offsetTop = 0\n let top\n\n if (mainPaddingTop) {\n offsetTop += mainPaddingTop\n }\n\n if (placeholderPaddingTop) {\n offsetTop += placeholderPaddingTop\n }\n\n if (placeholderMarginTop) {\n offsetTop += placeholderMarginTop\n }\n\n if (mainBorderTop) {\n offsetTop += mainBorderTop\n }\n\n if (placeholderBorderTop) {\n offsetTop += placeholderBorderTop\n }\n\n top = height * index\n // top:calc(${offsetTop}px + ${top}px);\n $placeholder.style.cssText = `transform: translateY(${\n offsetTop + top\n }px);height:${height}px;`\n\n return this\n }\n\n highlight(id) {\n const $anchor = this.$el.querySelector(`#chapter__anchor-${id}`)\n const HIGHLIGHT = 'outline-chapters_active'\n\n if (!$anchor) {\n return this\n }\n\n if (this.$active) {\n removeClass(this.$active, HIGHLIGHT)\n }\n\n this.active = parseInt($anchor.getAttribute('data-id'), 10)\n this.$active = $anchor\n addClass(this.$active, HIGHLIGHT)\n\n this.positionPlaceholder(this.active)\n\n return this\n }\n\n sticky() {\n const afterSticky = this.attr('afterSticky')\n const FIXED = 'outline-chapters_fixed'\n const $el = this.$el\n const top = this.offsetTop\n const scrollTop = this.$scrollElement.scrollTop\n let isStickying\n\n if (!this.isFixed()) {\n return this\n }\n\n isStickying = scrollTop >= top\n\n if (isStickying) {\n addClass($el, FIXED)\n } else {\n removeClass($el, FIXED)\n }\n\n if (isFunction(afterSticky)) {\n afterSticky.call(this, this.isClosed(), isStickying)\n }\n\n return this\n }\n\n calculateStickyHeight() {\n const documentElement = document.documentElement\n const height = Math.max(\n documentElement.clientHeight || 0,\n window.innerHeight || 0\n )\n setProperty('--outline-sticky-height', `${height}px`)\n return this\n }\n\n scrollTo(top, after) {\n const el = this.$scrollElement\n\n scrollTo(el, top, after)\n\n return this\n }\n\n show() {\n const FOLDED = 'outline-chapters_folded'\n const HIDDEN = 'outline-chapters_hidden'\n const opened = this.attr('afterOpened')\n const $el = this.$el\n const $parent = this.$parentElement\n\n if (this.isInside()) {\n removeClass($parent, HIDDEN)\n removeClass($el, HIDDEN)\n later(() => {\n removeClass($parent, FOLDED)\n removeClass($el, FOLDED)\n }, 30)\n } else {\n removeClass($el, HIDDEN)\n }\n this.closed = false\n\n if (isFunction(opened)) {\n opened.call(this)\n }\n\n return this\n }\n\n hide() {\n const FOLDED = 'outline-chapters_folded'\n const HIDDEN = 'outline-chapters_hidden'\n const closed = this.attr('afterClosed')\n const $el = this.$el\n const $parent = this.$parentElement\n\n if (this.isInside()) {\n addClass($parent, FOLDED)\n addClass($el, FOLDED)\n later(() => {\n addClass($parent, HIDDEN)\n addClass($el, HIDDEN)\n })\n } else {\n addClass($el, HIDDEN)\n }\n this.closed = true\n\n if (isFunction(closed)) {\n closed.call(this)\n }\n\n return this\n }\n\n toggle() {\n const afterToggle = this.attr('afterToggle')\n const top = this.offsetTop\n const scrollTop = this.$scrollElement.scrollTop\n let isStickying\n\n if (this.isClosed()) {\n this.show()\n } else {\n this.hide()\n }\n\n if (isFunction(afterToggle)) {\n later(() => {\n isStickying = scrollTop >= top\n afterToggle.call(this, this.isClosed(), isStickying)\n })\n }\n\n return this\n }\n\n destroy() {\n const beforeDestroy = this.attr('beforeDestroy')\n const afterDestroy = this.attr('afterDestroy')\n\n if (isFunction(beforeDestroy)) {\n beforeDestroy.call(this)\n }\n\n this.removeListeners()\n this.$parentElement.removeChild(this.$el)\n\n this.attr(Chapters.DEFAULTS)\n this.$el = null\n this.$title = null\n this.$main = null\n this.$list = null\n this.$placeholder = null\n this.$parentElement = null\n this.$scrollElement = null\n this.chapters = []\n this.active = 0\n this.offsetTop = 0\n this.$active = null\n this.closed = false\n\n if (this.scrollTimer) {\n clearTimeout(this.scrollTimer)\n this.scrollTimer = null\n }\n\n if (this.resizeTimer) {\n clearTimeout(this.resizeTimer)\n this.resizeTimer = null\n }\n\n if (isFunction(afterDestroy)) {\n afterDestroy.call(this)\n }\n\n if (this.Observer) {\n this.Observer = null\n }\n\n return this\n }\n\n onObserver() {\n const selector = this.attr('selector')\n let timer = null\n\n this.Observer = intersection(\n ($heading) => {\n const id = $heading.getAttribute('data-id')\n\n if (this.playing) {\n return false\n }\n\n if (timer) {\n clearTimeout(timer)\n }\n\n timer = later(() => {\n this.highlight(id)\n }, 100)\n },\n {\n selector,\n context: this\n }\n )\n\n return this\n }\n\n onSelect(evt) {\n const stickyHeight = this.attr('stickyHeight')\n const $anchor = evt.delegateTarget\n const id = $anchor.getAttribute('data-id')\n const headingId = $anchor.href.split('#')[1]\n const $heading = document.querySelector(`#${headingId}`)\n const top = offsetTop($heading) - (stickyHeight + 10)\n const min = 0\n const max = this.$scrollElement.scrollHeight\n const afterScroll = this.attr('afterScroll')\n const after = () => {\n if (isFunction(afterScroll)) {\n afterScroll.call(this, 'chapter')\n }\n\n later(() => {\n this.playing = false\n publish('toolbar:update', {\n top,\n min,\n max\n })\n })\n }\n\n this.playing = true\n if (this.isFixed()) {\n this.sticky()\n later(() => {\n this.scrollTo(top, after)\n this.highlight(id)\n }, 10)\n } else {\n this.scrollTo(top, after)\n this.highlight(id)\n }\n\n stop(evt)\n\n return this\n }\n\n onScroll() {\n const $scrollElement = this.$scrollElement\n\n if (this.scrollTimer) {\n clearTimeout(this.scrollTimer)\n }\n\n this.scrollTimer = later(() => {\n const top = $scrollElement.scrollTop\n const min = 0\n const max = $scrollElement.scrollHeight - $scrollElement.clientHeight\n\n if (this.isFixed()) {\n this.sticky()\n }\n\n publish('toolbar:update', {\n top,\n min,\n max\n })\n }, 100)\n\n return this\n }\n\n onResize() {\n if (this.resizeTimer) {\n clearTimeout(this.resizeTimer)\n }\n\n this.resizeTimer = later(() => {\n this.calculateStickyHeight()\n })\n\n return this\n }\n\n addListeners() {\n const $el = this.$el\n const $scrollElement = this.$scrollElement\n const tagName = $scrollElement.tagName.toLowerCase()\n let $element = $scrollElement\n\n if (tagName === 'html' || tagName === 'body') {\n $element = window\n }\n\n on($el, '.outline-chapters__anchor', 'click', this.onSelect, this, true)\n at($element, 'scroll', this.onScroll, this, true)\n if (this.isSticky()) {\n at($element, 'resize', this.onResize, this, true)\n }\n\n return this\n }\n\n removeListeners() {\n const selector = this.attr('selector')\n const $el = this.$el\n const $scrollElement = this.$scrollElement\n const tagName = $scrollElement.tagName.toLowerCase()\n let $element = $scrollElement\n\n if (tagName === 'html' || tagName === 'body') {\n $element = window\n }\n\n off($el, 'click', this.onSelect)\n off($element, 'scroll', this.onScroll)\n\n if (this.isSticky()) {\n at($element, 'resize', this.onResize)\n }\n\n if (this.Observer) {\n document.querySelectorAll(selector).forEach((section) => {\n this.Observer.unobserve(section)\n })\n }\n\n return this\n }\n}\n\nChapters.DEFAULTS = {\n parentElement: '',\n scrollElement: '',\n selector: '.outline-heading',\n active: 0,\n closed: false,\n showCode: true,\n position: 'relative',\n stickyHeight: 0,\n chapters: [],\n created: null,\n mounted: null,\n afterClosed: null,\n afterOpened: null,\n afterScroll: null,\n beforeDestroy: null,\n afterDestroy: null,\n afterSticky: null\n}\n\nexport default Chapters\n","import createElement from './utils/dom/createElement'\n\nconst _paintChapters = ($list, chapters, showCode = false) => {\n const byId = (id) => document.getElementById(id)\n\n chapters.forEach((chapter) => {\n const pid = chapter.pid\n const id = chapter.id\n const rel = chapter.rel\n const $text = createElement(\n 'span',\n {\n className: 'outline-chapters__text'\n },\n [chapter.text]\n )\n const $link = createElement(\n 'a',\n {\n id: `chapter__anchor-${id}`,\n className: 'outline-chapters__anchor',\n href: '#' + rel,\n rel: rel,\n 'data-id': id\n },\n [$text]\n )\n let $code\n let $li\n let $ul\n let $parent\n\n if (showCode) {\n $code = createElement(\n 'span',\n {\n className: 'outline-chapters__code',\n 'data-id': id\n },\n [chapter.code]\n )\n\n $link.insertBefore($code, $link.firstChild)\n }\n\n $li = createElement(\n 'li',\n {\n id: `chapter-${id}`,\n className: 'outline-chapters__item',\n 'data-id': id\n },\n [$link]\n )\n\n if (pid === -1) {\n $list.appendChild($li)\n } else {\n $parent = byId(`chapter-${pid}`)\n $ul = byId(`subject-${pid}`)\n\n if (!$ul) {\n $ul = createElement(\n 'ul',\n {\n id: 'subject-' + pid,\n className: 'outline-chapters__subject'\n },\n [$li]\n )\n\n $parent.appendChild($ul)\n } else {\n $ul.appendChild($li)\n }\n }\n })\n}\n\nexport default _paintChapters\n","import easeInQuad from '../lang/easeInQuad'\nimport isFunction from '../types/isFunction'\nimport _getScrollElement from './_getScrollElement'\n\n/**\n * 指定 rootElement DOM 节点滚动到指定 top 位置\n * ========================================================================\n * @method scrollTo\n * @param {HTMLElement|Object} [scrollElement] - (必须)要滚动的 DOM 节点\n * @param {Number} top - (必须)滚动的 scrollTop 数值\n * @param {Function} [afterStop] - (可选)滚动完成的回调函数\n */\nconst scrollTo = (scrollElement, top, afterStop) => {\n const $scrollElement = _getScrollElement(scrollElement)\n let scrollTop = $scrollElement.scrollTop\n let step = 0\n const distance = top - scrollTop\n const MAX_HEIGHT = $scrollElement.scrollHeight\n const MAX_TOP = top - MAX_HEIGHT <= 0 ? top : MAX_HEIGHT\n const stop = (top) => {\n if (isFunction(afterStop)) {\n afterStop(top)\n }\n\n return false\n }\n const play = () => {\n step += 1\n\n // 向上滚动\n if (distance < 0) {\n scrollTop -= easeInQuad(step)\n $scrollElement.scrollTop = scrollTop\n\n if (scrollTop <= top) {\n $scrollElement.scrollTop = top\n return stop(top)\n }\n } else {\n scrollTop += easeInQuad(step)\n $scrollElement.scrollTop = scrollTop\n\n if (scrollTop >= MAX_TOP) {\n $scrollElement.scrollTop = MAX_TOP\n return stop(MAX_TOP)\n }\n }\n\n requestAnimationFrame(play)\n }\n\n requestAnimationFrame(play)\n}\n\nexport default scrollTo\n","import isFunction from '../types/isFunction'\nimport isElement from '../types/isElement'\n\n/**\n * 通用的 IntersectionObserver 观察者处理器\n * ========================================================================\n * @method intersection\n * @param {Function} fn\n * @param {Object} [props]\n * @param {Object|HTMLElement} [props.root]\n * @param {String} [props.selector]\n * @param {Object} [props.context]\n * @param {String} [props.attr]\n * @param {String} [props.rootMargin]\n */\nconst intersection = (fn, props = {}) => {\n const root = props.root || null\n const selector = props.selector || '.outline-heading'\n const context = props.context || null\n const rootMargin = props.rootMargin || '0px 0px -90% 0px'\n const options = {\n rootMargin: rootMargin\n }\n const Observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio > 0) {\n if (isFunction(fn)) {\n fn.call(context || entry.target, entry.target)\n }\n }\n })\n }, options)\n const $root = isElement(root) ? root : document\n\n if (root) {\n options.root = root\n }\n\n $root.querySelectorAll(selector).forEach((section) => {\n Observer.observe(section)\n })\n\n return Observer\n}\n\nexport default intersection\n","/**\n * 停止事件(阻止默认行为和阻止事件的捕获或冒泡)\n * ========================================================================\n * @method stop\n * @param {Event} evt - 事件对象\n *\n * @example\n * <div id=\"nav\" class=\"nav\">\n * <a id=\"service\" class=\"anchor\" href=\"https://www.yaohaixiao.com/serivce\">Service</a>\n * <a id=\"help\" class=\"anchor\" href=\"https://www.yaohaixiao.com/help\">Help</a>\n * </div>\n *\n * const $nav = document.querySelector('#nav')\n * const $service = document.querySelector('.anchor')\n *\n * on($nav, 'click', function(evt) {\n * console.log('你点击了导航栏')\n * })\n *\n * on($anchor, 'click', function(evt) {\n * console.log('tagName', this.tagName)\n *\n * // 工作台输出:'a'\n * // 不会触发事件冒泡,输出:'你点击了导航栏'\n * // 也不会切换到 href 属性的页面,阻止了点击链接的默认行为\n * stopEvent(evt)\n * })\n */\nconst stop = function (evt) {\n evt.stopPropagation()\n evt.preventDefault()\n}\n\nexport default stop\n"],"names":["isString","str","hasOwn","obj","prop","hasOwnProperty","Object","prototype","call","toString","val","apply","isFunction","isObject","o","Base","constructor","options","this","attrs","initialize","attr","render","addListeners","value","origin","source","keys","forEach","arguments","length","destroy","removeListeners","reload","isElement","nodeName","tagName","nodeType","later","fn","delay","setTimeout","CAPTURE_EVENTS","_off","el","type","capture","indexOf","_delegateListener","listeners","_listeners","index","listener","i","handler","splice","_delete","removeEventListener","purgeElement","recurse","$element","document","querySelector","$children","childNodes","filter","getListeners","$child","off","at","data","context","once","evt","overrideContext","push","addEventListener","matches","selector","sel","replace","msMatchesSelector","getParentOrHost","host","parentNode","on","target","getTarget","delegateTarget","ctx","includeCTX","startsWith","closest","isArray","Array","isDOM","isHTMLCollection","fragment","isTextNode","createElement","children","$fragment","createDocumentFragment","$el","isValidChild","child","append","createTextNode","appendChild","toLowerCase","style","cssText","setAttribute","className","every","easeInQuad","x","_getScrollElement","scrollElement","$rootElements","$scrollElement","querySelectorAll","scrollTop","hasClass","pattern","RegExp","allClass","classList","contains","exec","addClass","add","removeClass","remove","offsetTop","top","offsetParent","getStyle","ruleName","getComputedStyle","setProperty","documentElement","_subscribers","_hasDirectSubscribersFor","topic","has","isDirect","found","position","lastIndexOf","substring","_hasSubscribers","emit","async","execute","subscriber","message","callback","deliver","Chapters","super","DEFAULTS","$title","$main","$list","$placeholder","$parentElement","chapters","closed","active","offsetWidth","$active","scrollTimer","resizeTimer","playing","Observer","created","parentElement","$parent","isClosed","isSticky","isFixed","isInside","isOutside","_paintEdge","title","customClass","contents","id","calculateStickyHeight","showCode","mounted","byId","getElementById","chapter","pid","rel","$text","text","$link","href","$code","$li","$ul","code","insertBefore","firstChild","_paintChapters","positionPlaceholder","sticky","onObserver","$anchor","mainPaddingTop","parseInt","mainBorderTop","placeholderPaddingTop","placeholderMarginTop","placeholderBorderTop","height","offsetHeight","highlight","HIGHLIGHT","getAttribute","afterSticky","FIXED","isStickying","Math","max","clientHeight","window","innerHeight","scrollTo","after","afterStop","step","distance","MAX_HEIGHT","scrollHeight","MAX_TOP","stop","play","requestAnimationFrame","show","FOLDED","HIDDEN","opened","hide","toggle","afterToggle","beforeDestroy","afterDestroy","removeChild","clearTimeout","timer","props","root","rootMargin","IntersectionObserver","entries","entry","intersectionRatio","$root","section","observe","intersection","$heading","onSelect","stickyHeight","headingId","split","afterScroll","publish","min","stopPropagation","preventDefault","onScroll","onResize","unobserve","afterClosed","afterOpened"],"mappings":"yOAOA,MAAMA,EAAYC,GACM,iBAARA,ECAVC,EAAS,CAACC,EAAKC,KACnB,MAAMC,EAAiBC,OAAOC,UAAUF,eACxC,OAAOF,GAAOE,EAAeG,KAAKL,EAAKC,EAAI,ECHvCK,EAAYC,GACTJ,OAAOC,UAAUE,SAASE,MAAMD,GCCnCE,EAAcF,GACI,mBAARA,GAAwC,sBAAlBD,EAASC,GCAzCG,EAAYC,IAEG,oBAAhBL,EAASK,IACK,iBAANA,GACPF,EAAWE,KACP,OAANA,ECVJ,MAAMC,EACJC,YAAYC,GACVC,KAAKC,MAAQ,CAAE,EAEXF,GACFC,KAAKE,WAAWH,EAEnB,CAEDG,WAAWH,GAET,OADAC,KAAKG,KAAKJ,GAASK,SAASC,eACrBL,IACR,CAEDG,KAAKjB,EAAMoB,GACT,MAAML,EAAQD,KAAKC,MAEnB,OAAInB,EAASI,GAEPoB,GAAStB,EAAOiB,EAAOf,IAEzBe,EAAMf,GAAQoB,EACPN,MAIFC,EAAMf,GACJS,EAAST,ICvBRqB,EDyBHN,ECzBWO,EDyBJtB,ECxBLE,OAAOqB,KAAKD,GAEpBE,SAASxB,IACRF,EAAOwB,EAAQtB,KACjBqB,EAAOrB,GAAQsB,EAAOtB,GACvB,IDqBQc,MACuB,IAArBW,UAAUC,OAEZX,EAGFD,KCjCI,IAACO,EAAQC,CDkCrB,CAEDJ,SACE,OAAOJ,IACR,CAEDa,UAEE,OADAb,KAAKc,kBACEd,IACR,CAEDe,OAAOhB,GAEL,OADAC,KAAKa,UAAU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UAAU,EACV1C,SAAU,WACVuH,aAAc,EACdpG,SAAU,GACVS,QAAS,KACTe,QAAS,KACTuF,YAAa,KACbC,YAAa,KACbT,YAAa,KACbrB,cAAe,KACfC,aAAc,KACd3B,YAAa"}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/river666/outline.js.git
[email protected]:river666/outline.js.git
river666
outline.js
outline.js
master

搜索帮助