Comparing version 4.25.0 to 4.27.0
## Changelog | ||
### 4.26.0 | ||
- Add exports for ESM bare module, keep compatible exports for current dist paths | ||
### 4.2.0 | ||
@@ -4,0 +8,0 @@ |
@@ -8,4 +8,9 @@ /******/ (() => { // webpackBootstrap | ||
\******************************/ | ||
/***/ ((module) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* eslint no-var: off */ | ||
@@ -19,3 +24,3 @@ | ||
module.exports = function (options) { | ||
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(options) { | ||
var forEach = [].forEach | ||
@@ -125,3 +130,3 @@ var some = [].some | ||
if (isCollapsed) { | ||
// No plus/equals here fixes compilcation issue. | ||
// No plus/equals here fixes compilation issue. | ||
classes = classes + SPACE_CHAR + options.collapsibleClass | ||
@@ -323,5 +328,10 @@ classes = classes + SPACE_CHAR + options.isCollapsedClass | ||
\***********************************/ | ||
/***/ ((module) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
module.exports = { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
/* harmony export */ }); | ||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ | ||
// Where to render the table of contents. | ||
@@ -426,3 +436,3 @@ tocSelector: '.js-toc', | ||
tocScrollOffset: 0 | ||
} | ||
}); | ||
@@ -432,22 +442,11 @@ | ||
/***/ "./src/js/index.js": | ||
/*!*************************!*\ | ||
!*** ./src/js/index.js ***! | ||
\*************************/ | ||
/***/ "./src/js/index-dist.js": | ||
/*!******************************!*\ | ||
!*** ./src/js/index-dist.js ***! | ||
\******************************/ | ||
/***/ ((module, exports, __webpack_require__) => { | ||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint no-var: off */ | ||
/** | ||
* Tocbot | ||
* Tocbot creates a table of contents based on HTML headings on a page, | ||
* this allows users to easily jump to different sections of the document. | ||
* Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/). | ||
* The main differences are that it works natively without any need for jquery or jquery UI). | ||
* | ||
* @author Tim Scanlin | ||
*/ | ||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* globals define */ | ||
/* globals define */ | ||
(function (root, factory) { | ||
;(function (root, factory) { | ||
if (true) { | ||
@@ -462,234 +461,295 @@ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)), | ||
// Default options. | ||
var defaultOptions = __webpack_require__(/*! ./default-options.js */ "./src/js/default-options.js") | ||
// Object to store current options. | ||
var options = {} | ||
// Object for public APIs. | ||
var tocbot = {} | ||
var BuildHtml = __webpack_require__(/*! ./build-html.js */ "./src/js/build-html.js") | ||
var ParseContent = __webpack_require__(/*! ./parse-content.js */ "./src/js/parse-content.js") | ||
var updateTocScroll = __webpack_require__(/*! ./update-toc-scroll.js */ "./src/js/update-toc-scroll.js") | ||
// Keep these variables at top scope once options are passed in. | ||
var buildHtml | ||
var parseContent | ||
// Just return if its not a browser. | ||
var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener // Feature test | ||
const supports = | ||
!!root && | ||
!!root.document && | ||
!!root.document.querySelector && | ||
!!root.addEventListener // Feature test | ||
if (typeof window === 'undefined' && !supports) { | ||
return | ||
} | ||
var headingsArray | ||
// From: https://github.com/Raynos/xtend | ||
var hasOwnProperty = Object.prototype.hasOwnProperty | ||
function extend () { | ||
var target = {} | ||
for (var i = 0; i < arguments.length; i++) { | ||
var source = arguments[i] | ||
for (var key in source) { | ||
if (hasOwnProperty.call(source, key)) { | ||
target[key] = source[key] | ||
} | ||
} | ||
} | ||
return target | ||
const tocbot = __webpack_require__(/*! ./index-esm.js */ "./src/js/index-esm.js") | ||
// Make tocbot available globally. | ||
root.tocbot = tocbot | ||
return tocbot | ||
}) | ||
/***/ }), | ||
/***/ "./src/js/index-esm.js": | ||
/*!*****************************!*\ | ||
!*** ./src/js/index-esm.js ***! | ||
\*****************************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ _buildHtml: () => (/* binding */ _buildHtml), | ||
/* harmony export */ _headingsArray: () => (/* binding */ _headingsArray), | ||
/* harmony export */ _options: () => (/* binding */ _options), | ||
/* harmony export */ _parseContent: () => (/* binding */ _parseContent), | ||
/* harmony export */ _scrollListener: () => (/* binding */ _scrollListener), | ||
/* harmony export */ destroy: () => (/* binding */ destroy), | ||
/* harmony export */ init: () => (/* binding */ init), | ||
/* harmony export */ refresh: () => (/* binding */ refresh) | ||
/* harmony export */ }); | ||
/* harmony import */ var _build_html_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./build-html.js */ "./src/js/build-html.js"); | ||
/* harmony import */ var _default_options_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./default-options.js */ "./src/js/default-options.js"); | ||
/* harmony import */ var _parse_content_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parse-content.js */ "./src/js/parse-content.js"); | ||
/* harmony import */ var _scroll_smooth_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scroll-smooth/index.js */ "./src/js/scroll-smooth/index.js"); | ||
/* harmony import */ var _update_toc_scroll_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./update-toc-scroll.js */ "./src/js/update-toc-scroll.js"); | ||
/* eslint no-var: off */ | ||
/** | ||
* Tocbot | ||
* Tocbot creates a table of contents based on HTML headings on a page, | ||
* this allows users to easily jump to different sections of the document. | ||
* Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/). | ||
* The main differences are that it works natively without any need for jquery or jquery UI). | ||
* | ||
* @author Tim Scanlin | ||
*/ | ||
// For testing purposes. | ||
let _options = {} // Object to store current options. | ||
let _buildHtml | ||
let _parseContent | ||
let _headingsArray | ||
let _scrollListener | ||
let clickListener | ||
/** | ||
* Initialize tocbot. | ||
* @param {object} customOptions | ||
*/ | ||
function init (customOptions) { | ||
// Merge defaults with user options. | ||
// Set to options variable at the top. | ||
_options = extend(_default_options_js__WEBPACK_IMPORTED_MODULE_1__["default"], customOptions || {}) | ||
// Init smooth scroll if enabled (default). | ||
if (_options.scrollSmooth) { | ||
_options.duration = _options.scrollSmoothDuration | ||
_options.offset = _options.scrollSmoothOffset | ||
;(0,_scroll_smooth_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(_options) | ||
} | ||
// From: https://remysharp.com/2010/07/21/throttling-function-calls | ||
function throttle (fn, threshold, scope) { | ||
threshold || (threshold = 250) | ||
var last | ||
var deferTimer | ||
return function () { | ||
var context = scope || this | ||
var now = +new Date() | ||
var args = arguments | ||
if (last && now < last + threshold) { | ||
// hold on to it | ||
clearTimeout(deferTimer) | ||
deferTimer = setTimeout(function () { | ||
last = now | ||
fn.apply(context, args) | ||
}, threshold) | ||
} else { | ||
last = now | ||
fn.apply(context, args) | ||
} | ||
} | ||
// Pass options to these modules. | ||
_buildHtml = (0,_build_html_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_options) | ||
_parseContent = (0,_parse_content_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_options) | ||
// Destroy it if it exists first. | ||
destroy() | ||
const contentElement = getContentElement(_options) | ||
if (contentElement === null) { | ||
return | ||
} | ||
function getContentElement (options) { | ||
try { | ||
return options.contentElement || document.querySelector(options.contentSelector) | ||
} catch (e) { | ||
console.warn('Contents element not found: ' + options.contentSelector) // eslint-disable-line | ||
return null | ||
} | ||
const tocElement = getTocElement(_options) | ||
if (tocElement === null) { | ||
return | ||
} | ||
function getTocElement (options) { | ||
try { | ||
return options.tocElement || document.querySelector(options.tocSelector) | ||
} catch (e) { | ||
console.warn('TOC element not found: ' + options.tocSelector) // eslint-disable-line | ||
return null | ||
} | ||
// Get headings array. | ||
_headingsArray = _parseContent.selectHeadings( | ||
contentElement, | ||
_options.headingSelector | ||
) | ||
// Return if no headings are found. | ||
if (_headingsArray === null) { | ||
return | ||
} | ||
/** | ||
* Destroy tocbot. | ||
*/ | ||
tocbot.destroy = function () { | ||
var tocElement = getTocElement(options) | ||
if (tocElement === null) { | ||
return | ||
} | ||
// Build nested headings array. | ||
const nestedHeadingsObj = _parseContent.nestHeadingsArray(_headingsArray) | ||
const nestedHeadings = nestedHeadingsObj.nest | ||
if (!options.skipRendering) { | ||
// Clear HTML. | ||
if (tocElement) { | ||
tocElement.innerHTML = '' | ||
} | ||
} | ||
// Render. | ||
if (!_options.skipRendering) { | ||
_buildHtml.render(tocElement, nestedHeadings) | ||
} else { | ||
// No need to attach listeners if skipRendering is true, this was causing errors. | ||
return this | ||
} | ||
// Remove event listeners. | ||
if (options.scrollContainer && document.querySelector(options.scrollContainer)) { | ||
document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false) | ||
document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false) | ||
if (buildHtml) { | ||
document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false) | ||
// Update Sidebar and bind listeners. | ||
_scrollListener = throttle(function (e) { | ||
_buildHtml.updateToc(_headingsArray) | ||
!_options.disableTocScrollSync && (0,_update_toc_scroll_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_options) | ||
const isTop = | ||
e && | ||
e.target && | ||
e.target.scrollingElement && | ||
e.target.scrollingElement.scrollTop === 0 | ||
if ((e && (e.eventPhase === 0 || e.currentTarget === null)) || isTop) { | ||
_buildHtml.updateToc(_headingsArray) | ||
if (_options.scrollEndCallback) { | ||
_options.scrollEndCallback(e) | ||
} | ||
} else { | ||
document.removeEventListener('scroll', this._scrollListener, false) | ||
document.removeEventListener('resize', this._scrollListener, false) | ||
if (buildHtml) { | ||
document.removeEventListener('click', this._clickListener, false) | ||
} | ||
} | ||
}, _options.throttleTimeout) | ||
_scrollListener() | ||
if ( | ||
_options.scrollContainer && | ||
document.querySelector(_options.scrollContainer) | ||
) { | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.addEventListener('scroll', _scrollListener, false) | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.addEventListener('resize', _scrollListener, false) | ||
} else { | ||
document.addEventListener('scroll', _scrollListener, false) | ||
document.addEventListener('resize', _scrollListener, false) | ||
} | ||
/** | ||
* Initialize tocbot. | ||
* @param {object} customOptions | ||
*/ | ||
tocbot.init = function (customOptions) { | ||
// feature test | ||
if (!supports) { | ||
return | ||
// Bind click listeners to disable animation. | ||
let timeout = null | ||
clickListener = throttle(function (event) { | ||
if (_options.scrollSmooth) { | ||
_buildHtml.disableTocAnimation(event) | ||
} | ||
_buildHtml.updateToc(_headingsArray) | ||
// Timeout to re-enable the animation. | ||
timeout && clearTimeout(timeout) | ||
timeout = setTimeout(function () { | ||
_buildHtml.enableTocAnimation() | ||
}, _options.scrollSmoothDuration) | ||
}, _options.throttleTimeout) | ||
// Merge defaults with user options. | ||
// Set to options variable at the top. | ||
options = extend(defaultOptions, customOptions || {}) | ||
this.options = options | ||
this.state = {} | ||
if ( | ||
_options.scrollContainer && | ||
document.querySelector(_options.scrollContainer) | ||
) { | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.addEventListener('click', clickListener, false) | ||
} else { | ||
document.addEventListener('click', clickListener, false) | ||
} | ||
} | ||
// Init smooth scroll if enabled (default). | ||
if (options.scrollSmooth) { | ||
options.duration = options.scrollSmoothDuration | ||
options.offset = options.scrollSmoothOffset | ||
tocbot.scrollSmooth = (__webpack_require__(/*! ./scroll-smooth */ "./src/js/scroll-smooth/index.js").initSmoothScrolling)(options) | ||
} | ||
/** | ||
* Destroy tocbot. | ||
*/ | ||
function destroy () { | ||
const tocElement = getTocElement(_options) | ||
if (tocElement === null) { | ||
return | ||
} | ||
// Pass options to these modules. | ||
buildHtml = BuildHtml(options) | ||
parseContent = ParseContent(options) | ||
// For testing purposes. | ||
this._buildHtml = buildHtml | ||
this._parseContent = parseContent | ||
this._headingsArray = headingsArray | ||
// Destroy it if it exists first. | ||
tocbot.destroy() | ||
var contentElement = getContentElement(options) | ||
if (contentElement === null) { | ||
return | ||
if (!_options.skipRendering) { | ||
// Clear HTML. | ||
if (tocElement) { | ||
tocElement.innerHTML = '' | ||
} | ||
} | ||
var tocElement = getTocElement(options) | ||
if (tocElement === null) { | ||
return | ||
// Remove event listeners. | ||
if ( | ||
_options.scrollContainer && | ||
document.querySelector(_options.scrollContainer) | ||
) { | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.removeEventListener('scroll', _scrollListener, false) | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.removeEventListener('resize', _scrollListener, false) | ||
if (_buildHtml) { | ||
document | ||
.querySelector(_options.scrollContainer) | ||
.removeEventListener('click', clickListener, false) | ||
} | ||
// Get headings array. | ||
headingsArray = parseContent.selectHeadings(contentElement, options.headingSelector) | ||
// Return if no headings are found. | ||
if (headingsArray === null) { | ||
return | ||
} else { | ||
document.removeEventListener('scroll', _scrollListener, false) | ||
document.removeEventListener('resize', _scrollListener, false) | ||
if (_buildHtml) { | ||
document.removeEventListener('click', clickListener, false) | ||
} | ||
} | ||
} | ||
// Build nested headings array. | ||
var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray) | ||
var nestedHeadings = nestedHeadingsObj.nest | ||
/** | ||
* Refresh tocbot. | ||
*/ | ||
function refresh (customOptions) { | ||
destroy() | ||
init(customOptions || _options) | ||
} | ||
// Render. | ||
if (!options.skipRendering) { | ||
buildHtml.render(tocElement, nestedHeadings) | ||
} else { | ||
// No need to attach listeners if skipRendering is true, this was causing errors. | ||
return this | ||
} | ||
// Update Sidebar and bind listeners. | ||
this._scrollListener = throttle(function (e) { | ||
buildHtml.updateToc(headingsArray) | ||
!options.disableTocScrollSync && updateTocScroll(options) | ||
var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0 | ||
if ((e && (e.eventPhase === 0 || e.currentTarget === null)) || isTop) { | ||
buildHtml.updateToc(headingsArray) | ||
if (options.scrollEndCallback) { | ||
options.scrollEndCallback(e) | ||
} | ||
// From: https://github.com/Raynos/xtend | ||
const hasOwnProperty = Object.prototype.hasOwnProperty | ||
function extend () { | ||
const target = {} | ||
for (let i = 0; i < arguments.length; i++) { | ||
const source = arguments[i] | ||
for (const key in source) { | ||
if (hasOwnProperty.call(source, key)) { | ||
target[key] = source[key] | ||
} | ||
}, options.throttleTimeout) | ||
this._scrollListener() | ||
if (options.scrollContainer && document.querySelector(options.scrollContainer)) { | ||
document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false) | ||
document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false) | ||
} else { | ||
document.addEventListener('scroll', this._scrollListener, false) | ||
document.addEventListener('resize', this._scrollListener, false) | ||
} | ||
} | ||
return target | ||
} | ||
// Bind click listeners to disable animation. | ||
var timeout = null | ||
this._clickListener = throttle(function (event) { | ||
if (options.scrollSmooth) { | ||
buildHtml.disableTocAnimation(event) | ||
} | ||
buildHtml.updateToc(headingsArray) | ||
// Timeout to re-enable the animation. | ||
timeout && clearTimeout(timeout) | ||
timeout = setTimeout(function () { | ||
buildHtml.enableTocAnimation() | ||
}, options.scrollSmoothDuration) | ||
}, options.throttleTimeout) | ||
if (options.scrollContainer && document.querySelector(options.scrollContainer)) { | ||
document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false) | ||
// From: https://remysharp.com/2010/07/21/throttling-function-calls | ||
function throttle (fn, threshold, scope) { | ||
threshold || (threshold = 250) | ||
let last | ||
let deferTimer | ||
return function () { | ||
const context = scope || this | ||
const now = +new Date() | ||
const args = arguments | ||
if (last && now < last + threshold) { | ||
// hold on to it | ||
clearTimeout(deferTimer) | ||
deferTimer = setTimeout(function () { | ||
last = now | ||
fn.apply(context, args) | ||
}, threshold) | ||
} else { | ||
document.addEventListener('click', this._clickListener, false) | ||
last = now | ||
fn.apply(context, args) | ||
} | ||
} | ||
} | ||
return this | ||
function getContentElement (options) { | ||
try { | ||
return ( | ||
options.contentElement || document.querySelector(options.contentSelector) | ||
) | ||
} catch (e) { | ||
console.warn('Contents element not found: ' + options.contentSelector) // eslint-disable-line | ||
return null | ||
} | ||
} | ||
/** | ||
* Refresh tocbot. | ||
*/ | ||
tocbot.refresh = function (customOptions) { | ||
tocbot.destroy() | ||
tocbot.init(customOptions || this.options) | ||
function getTocElement (options) { | ||
try { | ||
return options.tocElement || document.querySelector(options.tocSelector) | ||
} catch (e) { | ||
console.warn('TOC element not found: ' + options.tocSelector) // eslint-disable-line | ||
return null | ||
} | ||
} | ||
// Make tocbot available globally. | ||
root.tocbot = tocbot | ||
return tocbot | ||
}) | ||
/***/ }), | ||
@@ -701,4 +761,9 @@ | ||
\*********************************/ | ||
/***/ ((module) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (/* binding */ parseContent) | ||
/* harmony export */ }); | ||
/* eslint no-var: off */ | ||
@@ -712,3 +777,3 @@ /** | ||
module.exports = function parseContent (options) { | ||
function parseContent (options) { | ||
var reduce = [].reduce | ||
@@ -874,9 +939,12 @@ | ||
\***************************************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (/* binding */ initSmoothScrolling) | ||
/* harmony export */ }); | ||
/* eslint no-var: off */ | ||
/* globals location, requestAnimationFrame */ | ||
exports.initSmoothScrolling = initSmoothScrolling | ||
function initSmoothScrolling (options) { | ||
@@ -1006,8 +1074,13 @@ // if (isCssSmoothSCrollSupported()) { return } | ||
\*************************************/ | ||
/***/ ((module) => { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (/* binding */ updateTocScroll) | ||
/* harmony export */ }); | ||
/* eslint no-var: off */ | ||
const SCROLL_LEEWAY = 30 | ||
module.exports = function updateTocScroll (options) { | ||
function updateTocScroll (options) { | ||
var toc = options.tocElement || document.querySelector(options.tocSelector) | ||
@@ -1067,2 +1140,14 @@ if (toc && toc.scrollHeight > toc.clientHeight) { | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/global */ | ||
@@ -1080,2 +1165,18 @@ /******/ (() => { | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
@@ -1086,3 +1187,3 @@ /******/ | ||
/******/ // This entry module used 'module' so it can't be inlined | ||
/******/ var __webpack_exports__ = __webpack_require__("./src/js/index.js"); | ||
/******/ var __webpack_exports__ = __webpack_require__("./src/js/index-dist.js"); | ||
/******/ | ||
@@ -1089,0 +1190,0 @@ /******/ })() |
@@ -1,1 +0,1 @@ | ||
(()=>{var e={163:e=>{e.exports=function(e){var t,n=[].forEach,l=[].some,o=document.body,r=!0,i=" ";function s(t,l){var o,r,a,d=l.appendChild((o=t,r=document.createElement("li"),a=document.createElement("a"),e.listItemClass&&r.setAttribute("class",e.listItemClass),e.onClick&&(a.onclick=e.onClick),e.includeTitleTags&&a.setAttribute("title",o.textContent),e.includeHtml&&o.childNodes.length?n.call(o.childNodes,(function(e){a.appendChild(e.cloneNode(!0))})):a.textContent=o.textContent,a.setAttribute("href",e.basePath+"#"+o.id),a.setAttribute("class",e.linkClass+i+"node-name--"+o.nodeName+i+e.extraLinkClasses),r.appendChild(a),r));if(t.children.length){var u=c(t.isCollapsed);t.children.forEach((function(e){s(e,u)})),d.appendChild(u)}}function c(t){var n=e.orderedList?"ol":"ul",l=document.createElement(n),o=e.listClass+i+e.extraListClasses;return t&&(o=(o=o+i+e.collapsibleClass)+i+e.isCollapsedClass),l.setAttribute("class",o),l}function a(t){var n=0;return null!==t&&(n=t.offsetTop,e.hasInnerContainers&&(n+=a(t.offsetParent))),n}function d(e,t){return e&&e.className!==t&&(e.className=t),e}function u(t){return t&&-1!==t.className.indexOf(e.collapsibleClass)&&-1!==t.className.indexOf(e.isCollapsedClass)?(d(t,t.className.replace(i+e.isCollapsedClass,"")),u(t.parentNode.parentNode)):t}return{enableTocAnimation:function(){r=!0},disableTocAnimation:function(t){var n=t.target||t.srcElement;"string"==typeof n.className&&-1!==n.className.indexOf(e.linkClass)&&(r=!1)},render:function(e,n){var l=c(!1);if(n.forEach((function(e){s(e,l)})),null!==(t=e||t))return t.firstChild&&t.removeChild(t.firstChild),0===n.length?t:t.appendChild(l)},updateToc:function(s){var c;c=e.scrollContainer&&document.querySelector(e.scrollContainer)?document.querySelector(e.scrollContainer).scrollTop:document.documentElement.scrollTop||o.scrollTop,e.positionFixedSelector&&function(){var n;n=e.scrollContainer&&document.querySelector(e.scrollContainer)?document.querySelector(e.scrollContainer).scrollTop:document.documentElement.scrollTop||o.scrollTop;var l=document.querySelector(e.positionFixedSelector);"auto"===e.fixedSidebarOffset&&(e.fixedSidebarOffset=t.offsetTop),n>e.fixedSidebarOffset?-1===l.className.indexOf(e.positionFixedClass)&&(l.className+=i+e.positionFixedClass):l.className=l.className.replace(i+e.positionFixedClass,"")}();var f,m=s;if(r&&null!==t&&m.length>0){l.call(m,(function(t,n){return a(t)>c+e.headingsOffset+10?(f=m[0===n?n:n-1],!0):n===m.length-1?(f=m[m.length-1],!0):void 0}));var h=t.querySelector("."+e.activeLinkClass),p=t.querySelector("."+e.linkClass+".node-name--"+f.nodeName+'[href="'+e.basePath+"#"+f.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g,"\\$1")+'"]');if(h===p)return;var C=t.querySelectorAll("."+e.linkClass);n.call(C,(function(t){d(t,t.className.replace(i+e.activeLinkClass,""))}));var g=t.querySelectorAll("."+e.listItemClass);n.call(g,(function(t){d(t,t.className.replace(i+e.activeListItemClass,""))})),p&&-1===p.className.indexOf(e.activeLinkClass)&&(p.className+=i+e.activeLinkClass);var v=p&&p.parentNode;v&&-1===v.className.indexOf(e.activeListItemClass)&&(v.className+=i+e.activeListItemClass);var S=t.querySelectorAll("."+e.listClass+"."+e.collapsibleClass);n.call(S,(function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=i+e.isCollapsedClass)})),p&&p.nextSibling&&-1!==p.nextSibling.className.indexOf(e.isCollapsedClass)&&d(p.nextSibling,p.nextSibling.className.replace(i+e.isCollapsedClass,"")),u(p&&p.parentNode.parentNode)}}}}},547:e=>{e.exports={tocSelector:".js-toc",contentSelector:".js-toc-content",headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",hasInnerContainers:!1,linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",activeListItemClass:"is-active-li",collapseDepth:0,scrollSmooth:!0,scrollSmoothDuration:420,scrollSmoothOffset:0,scrollEndCallback:function(e){},headingsOffset:1,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1,includeTitleTags:!1,onClick:function(e){},orderedList:!0,scrollContainer:null,skipRendering:!1,headingLabelCallback:!1,ignoreHiddenElements:!1,headingObjectCallback:null,basePath:"",disableTocScrollSync:!1,tocScrollOffset:0}},971:(e,t,n)=>{var l,o,r;o=[],void 0===(r="function"==typeof(l=function(e){"use strict";var t,l,o,r=n(547),i={},s={},c=n(163),a=n(279),d=n(938),u=!!(e&&e.document&&e.document.querySelector&&e.addEventListener);if("undefined"!=typeof window||u){var f=Object.prototype.hasOwnProperty;return s.destroy=function(){var e=h(i);null!==e&&(i.skipRendering||e&&(e.innerHTML=""),i.scrollContainer&&document.querySelector(i.scrollContainer)?(document.querySelector(i.scrollContainer).removeEventListener("scroll",this._scrollListener,!1),document.querySelector(i.scrollContainer).removeEventListener("resize",this._scrollListener,!1),t&&document.querySelector(i.scrollContainer).removeEventListener("click",this._clickListener,!1)):(document.removeEventListener("scroll",this._scrollListener,!1),document.removeEventListener("resize",this._scrollListener,!1),t&&document.removeEventListener("click",this._clickListener,!1)))},s.init=function(e){if(u){i=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var l in n)f.call(n,l)&&(e[l]=n[l])}return e}(r,e||{}),this.options=i,this.state={},i.scrollSmooth&&(i.duration=i.scrollSmoothDuration,i.offset=i.scrollSmoothOffset,s.scrollSmooth=n(374).initSmoothScrolling(i)),t=c(i),l=a(i),this._buildHtml=t,this._parseContent=l,this._headingsArray=o,s.destroy();var p=function(e){try{return e.contentElement||document.querySelector(e.contentSelector)}catch(t){return console.warn("Contents element not found: "+e.contentSelector),null}}(i);if(null!==p){var C=h(i);if(null!==C&&null!==(o=l.selectHeadings(p,i.headingSelector))){var g=l.nestHeadingsArray(o).nest;if(i.skipRendering)return this;t.render(C,g),this._scrollListener=m((function(e){t.updateToc(o),!i.disableTocScrollSync&&d(i);var n=e&&e.target&&e.target.scrollingElement&&0===e.target.scrollingElement.scrollTop;(e&&(0===e.eventPhase||null===e.currentTarget)||n)&&(t.updateToc(o),i.scrollEndCallback&&i.scrollEndCallback(e))}),i.throttleTimeout),this._scrollListener(),i.scrollContainer&&document.querySelector(i.scrollContainer)?(document.querySelector(i.scrollContainer).addEventListener("scroll",this._scrollListener,!1),document.querySelector(i.scrollContainer).addEventListener("resize",this._scrollListener,!1)):(document.addEventListener("scroll",this._scrollListener,!1),document.addEventListener("resize",this._scrollListener,!1));var v=null;return this._clickListener=m((function(e){i.scrollSmooth&&t.disableTocAnimation(e),t.updateToc(o),v&&clearTimeout(v),v=setTimeout((function(){t.enableTocAnimation()}),i.scrollSmoothDuration)}),i.throttleTimeout),i.scrollContainer&&document.querySelector(i.scrollContainer)?document.querySelector(i.scrollContainer).addEventListener("click",this._clickListener,!1):document.addEventListener("click",this._clickListener,!1),this}}}},s.refresh=function(e){s.destroy(),s.init(e||this.options)},e.tocbot=s,s}function m(e,t,n){var l,o;return t||(t=250),function(){var r=n||this,i=+new Date,s=arguments;l&&i<l+t?(clearTimeout(o),o=setTimeout((function(){l=i,e.apply(r,s)}),t)):(l=i,e.apply(r,s))}}function h(e){try{return e.tocElement||document.querySelector(e.tocSelector)}catch(t){return console.warn("TOC element not found: "+e.tocSelector),null}}}(void 0!==n.g?n.g:window||n.g))?l.apply(t,o):l)||(e.exports=r)},279:e=>{e.exports=function(e){var t=[].reduce;function n(e){return e[e.length-1]}function l(e){return+e.nodeName.toUpperCase().replace("H","")}function o(t){if(!function(e){try{return e instanceof window.HTMLElement||e instanceof window.parent.HTMLElement}catch(t){return e instanceof window.HTMLElement}}(t))return t;if(e.ignoreHiddenElements&&(!t.offsetHeight||!t.offsetParent))return null;const n=t.getAttribute("data-heading-label")||(e.headingLabelCallback?String(e.headingLabelCallback(t.innerText)):(t.innerText||t.textContent).trim());var o={id:t.id,children:[],nodeName:t.nodeName,headingLevel:l(t),textContent:n};return e.includeHtml&&(o.childNodes=t.childNodes),e.headingObjectCallback?e.headingObjectCallback(o,t):o}return{nestHeadingsArray:function(l){return t.call(l,(function(t,l){var r=o(l);return r&&function(t,l){for(var r=o(t),i=r.headingLevel,s=l,c=n(s),a=i-(c?c.headingLevel:0);a>0&&(!(c=n(s))||i!==c.headingLevel);)c&&void 0!==c.children&&(s=c.children),a--;i>=e.collapseDepth&&(r.isCollapsed=!0),s.push(r)}(r,t.nest),t}),{nest:[]})},selectHeadings:function(t,n){var l=n;e.ignoreSelector&&(l=n.split(",").map((function(t){return t.trim()+":not("+e.ignoreSelector+")"})));try{return t.querySelectorAll(l)}catch(e){return console.warn("Headers not found with selector: "+l),null}}}}},374:(e,t)=>{t.initSmoothScrolling=function(e){var t=e.duration,n=e.offset,l=location.hash?o(location.href):location.href;function o(e){return e.slice(0,e.lastIndexOf("#"))}document.body.addEventListener("click",(function(r){var i;"a"!==(i=r.target).tagName.toLowerCase()||!(i.hash.length>0||"#"===i.href.charAt(i.href.length-1))||o(i.href)!==l&&o(i.href)+"#"!==l||r.target.className.indexOf("no-smooth-scroll")>-1||"#"===r.target.href.charAt(r.target.href.length-2)&&"!"===r.target.href.charAt(r.target.href.length-1)||-1===r.target.className.indexOf(e.linkClass)||function(e,t){var n,l,o=window.pageYOffset,r={duration:t.duration,offset:t.offset||0,callback:t.callback,easing:t.easing||function(e,t,n,l){return(e/=l/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}},i=document.querySelector('[id="'+decodeURI(e).split("#").join("")+'"]')||document.querySelector('[id="'+e.split("#").join("")+'"]'),s="string"==typeof e?r.offset+(e?i&&i.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):e,c="function"==typeof r.duration?r.duration(s):r.duration;function a(e){l=e-n,window.scrollTo(0,r.easing(l,o,s,c)),l<c?requestAnimationFrame(a):(window.scrollTo(0,o+s),"function"==typeof r.callback&&r.callback())}requestAnimationFrame((function(e){n=e,a(e)}))}(r.target.hash,{duration:t,offset:n,callback:function(){var e,t;e=r.target.hash,(t=document.getElementById(e.substring(1)))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}})}),!1)}},938:e=>{e.exports=function(e){var t=e.tocElement||document.querySelector(e.tocSelector);if(t&&t.scrollHeight>t.clientHeight){var n=t.querySelector("."+e.activeListItemClass);if(n){var l=t.scrollTop,o=l+t.clientHeight,r=n.offsetTop,i=r+n.clientHeight;r<l+e.tocScrollOffset?t.scrollTop-=l-r+e.tocScrollOffset:i>o-e.tocScrollOffset-30&&(t.scrollTop+=i-o+e.tocScrollOffset+60)}}}}},t={};function n(l){var o=t[l];if(void 0!==o)return o.exports;var r=t[l]={exports:{}};return e[l](r,r.exports,n),r.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(971)})(); | ||
(()=>{var e={539:(e,t,n)=>{var o,l,r;l=[],void 0===(r="function"==typeof(o=function(e){"use strict";const t=!!(e&&e.document&&e.document.querySelector&&e.addEventListener);if("undefined"==typeof window&&!t)return;const o=n(496);return e.tocbot=o,o}(void 0!==n.g?n.g:window||n.g))?o.apply(t,l):o)||(e.exports=r)},496:(e,t,n)=>{"use strict";function o(e){var t,n=[].forEach,o=[].some,l=document.body,r=!0,i=" ";function s(t,o){var l,r,a,u=o.appendChild((l=t,r=document.createElement("li"),a=document.createElement("a"),e.listItemClass&&r.setAttribute("class",e.listItemClass),e.onClick&&(a.onclick=e.onClick),e.includeTitleTags&&a.setAttribute("title",l.textContent),e.includeHtml&&l.childNodes.length?n.call(l.childNodes,(function(e){a.appendChild(e.cloneNode(!0))})):a.textContent=l.textContent,a.setAttribute("href",e.basePath+"#"+l.id),a.setAttribute("class",e.linkClass+i+"node-name--"+l.nodeName+i+e.extraLinkClasses),r.appendChild(a),r));if(t.children.length){var d=c(t.isCollapsed);t.children.forEach((function(e){s(e,d)})),u.appendChild(d)}}function c(t){var n=e.orderedList?"ol":"ul",o=document.createElement(n),l=e.listClass+i+e.extraListClasses;return t&&(l=(l=l+i+e.collapsibleClass)+i+e.isCollapsedClass),o.setAttribute("class",l),o}function a(t){var n=0;return null!==t&&(n=t.offsetTop,e.hasInnerContainers&&(n+=a(t.offsetParent))),n}function u(e,t){return e&&e.className!==t&&(e.className=t),e}function d(t){return t&&-1!==t.className.indexOf(e.collapsibleClass)&&-1!==t.className.indexOf(e.isCollapsedClass)?(u(t,t.className.replace(i+e.isCollapsedClass,"")),d(t.parentNode.parentNode)):t}return{enableTocAnimation:function(){r=!0},disableTocAnimation:function(t){var n=t.target||t.srcElement;"string"==typeof n.className&&-1!==n.className.indexOf(e.linkClass)&&(r=!1)},render:function(e,n){var o=c(!1);if(n.forEach((function(e){s(e,o)})),null!==(t=e||t))return t.firstChild&&t.removeChild(t.firstChild),0===n.length?t:t.appendChild(o)},updateToc:function(s){var c;c=e.scrollContainer&&document.querySelector(e.scrollContainer)?document.querySelector(e.scrollContainer).scrollTop:document.documentElement.scrollTop||l.scrollTop,e.positionFixedSelector&&function(){var n;n=e.scrollContainer&&document.querySelector(e.scrollContainer)?document.querySelector(e.scrollContainer).scrollTop:document.documentElement.scrollTop||l.scrollTop;var o=document.querySelector(e.positionFixedSelector);"auto"===e.fixedSidebarOffset&&(e.fixedSidebarOffset=t.offsetTop),n>e.fixedSidebarOffset?-1===o.className.indexOf(e.positionFixedClass)&&(o.className+=i+e.positionFixedClass):o.className=o.className.replace(i+e.positionFixedClass,"")}();var f,m=s;if(r&&null!==t&&m.length>0){o.call(m,(function(t,n){return a(t)>c+e.headingsOffset+10?(f=m[0===n?n:n-1],!0):n===m.length-1?(f=m[m.length-1],!0):void 0}));var h=t.querySelector("."+e.activeLinkClass),p=t.querySelector("."+e.linkClass+".node-name--"+f.nodeName+'[href="'+e.basePath+"#"+f.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g,"\\$1")+'"]');if(h===p)return;var C=t.querySelectorAll("."+e.linkClass);n.call(C,(function(t){u(t,t.className.replace(i+e.activeLinkClass,""))}));var g=t.querySelectorAll("."+e.listItemClass);n.call(g,(function(t){u(t,t.className.replace(i+e.activeListItemClass,""))})),p&&-1===p.className.indexOf(e.activeLinkClass)&&(p.className+=i+e.activeLinkClass);var v=p&&p.parentNode;v&&-1===v.className.indexOf(e.activeListItemClass)&&(v.className+=i+e.activeListItemClass);var S=t.querySelectorAll("."+e.listClass+"."+e.collapsibleClass);n.call(S,(function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=i+e.isCollapsedClass)})),p&&p.nextSibling&&-1!==p.nextSibling.className.indexOf(e.isCollapsedClass)&&u(p.nextSibling,p.nextSibling.className.replace(i+e.isCollapsedClass,"")),d(p&&p.parentNode.parentNode)}}}}n.r(t),n.d(t,{_buildHtml:()=>s,_headingsArray:()=>a,_options:()=>f,_parseContent:()=>c,_scrollListener:()=>u,destroy:()=>h,init:()=>m,refresh:()=>p});const l={tocSelector:".js-toc",contentSelector:".js-toc-content",headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",hasInnerContainers:!1,linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",activeListItemClass:"is-active-li",collapseDepth:0,scrollSmooth:!0,scrollSmoothDuration:420,scrollSmoothOffset:0,scrollEndCallback:function(e){},headingsOffset:1,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1,includeTitleTags:!1,onClick:function(e){},orderedList:!0,scrollContainer:null,skipRendering:!1,headingLabelCallback:!1,ignoreHiddenElements:!1,headingObjectCallback:null,basePath:"",disableTocScrollSync:!1,tocScrollOffset:0};function r(e){var t=e.duration,n=e.offset,o=location.hash?l(location.href):location.href;function l(e){return e.slice(0,e.lastIndexOf("#"))}document.body.addEventListener("click",(function(r){var i;"a"!==(i=r.target).tagName.toLowerCase()||!(i.hash.length>0||"#"===i.href.charAt(i.href.length-1))||l(i.href)!==o&&l(i.href)+"#"!==o||r.target.className.indexOf("no-smooth-scroll")>-1||"#"===r.target.href.charAt(r.target.href.length-2)&&"!"===r.target.href.charAt(r.target.href.length-1)||-1===r.target.className.indexOf(e.linkClass)||function(e,t){var n,o,l=window.pageYOffset,r={duration:t.duration,offset:t.offset||0,callback:t.callback,easing:t.easing||function(e,t,n,o){return(e/=o/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}},i=document.querySelector('[id="'+decodeURI(e).split("#").join("")+'"]')||document.querySelector('[id="'+e.split("#").join("")+'"]'),s="string"==typeof e?r.offset+(e?i&&i.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):e,c="function"==typeof r.duration?r.duration(s):r.duration;function a(e){o=e-n,window.scrollTo(0,r.easing(o,l,s,c)),o<c?requestAnimationFrame(a):(window.scrollTo(0,l+s),"function"==typeof r.callback&&r.callback())}requestAnimationFrame((function(e){n=e,a(e)}))}(r.target.hash,{duration:t,offset:n,callback:function(){var e,t;e=r.target.hash,(t=document.getElementById(e.substring(1)))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}})}),!1)}const i=30;let s,c,a,u,d,f={};function m(e){f=function(){const e={};for(let t=0;t<arguments.length;t++){const n=arguments[t];for(const t in n)C.call(n,t)&&(e[t]=n[t])}return e}(l,e||{}),f.scrollSmooth&&(f.duration=f.scrollSmoothDuration,f.offset=f.scrollSmoothOffset,r(f)),s=o(f),c=function(e){var t=[].reduce;function n(e){return e[e.length-1]}function o(e){return+e.nodeName.toUpperCase().replace("H","")}function l(t){if(!function(e){try{return e instanceof window.HTMLElement||e instanceof window.parent.HTMLElement}catch(t){return e instanceof window.HTMLElement}}(t))return t;if(e.ignoreHiddenElements&&(!t.offsetHeight||!t.offsetParent))return null;const n=t.getAttribute("data-heading-label")||(e.headingLabelCallback?String(e.headingLabelCallback(t.innerText)):(t.innerText||t.textContent).trim());var l={id:t.id,children:[],nodeName:t.nodeName,headingLevel:o(t),textContent:n};return e.includeHtml&&(l.childNodes=t.childNodes),e.headingObjectCallback?e.headingObjectCallback(l,t):l}return{nestHeadingsArray:function(o){return t.call(o,(function(t,o){var r=l(o);return r&&function(t,o){for(var r=l(t),i=r.headingLevel,s=o,c=n(s),a=i-(c?c.headingLevel:0);a>0&&(!(c=n(s))||i!==c.headingLevel);)c&&void 0!==c.children&&(s=c.children),a--;i>=e.collapseDepth&&(r.isCollapsed=!0),s.push(r)}(r,t.nest),t}),{nest:[]})},selectHeadings:function(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map((function(t){return t.trim()+":not("+e.ignoreSelector+")"})));try{return t.querySelectorAll(o)}catch(e){return console.warn("Headers not found with selector: "+o),null}}}}(f),h();const t=function(e){try{return e.contentElement||document.querySelector(e.contentSelector)}catch(t){return console.warn("Contents element not found: "+e.contentSelector),null}}(f);if(null===t)return;const n=v(f);if(null===n)return;if(a=c.selectHeadings(t,f.headingSelector),null===a)return;const m=c.nestHeadingsArray(a).nest;if(f.skipRendering)return this;s.render(n,m),u=g((function(e){s.updateToc(a),!f.disableTocScrollSync&&function(e){var t=e.tocElement||document.querySelector(e.tocSelector);if(t&&t.scrollHeight>t.clientHeight){var n=t.querySelector("."+e.activeListItemClass);if(n){var o=t.scrollTop,l=o+t.clientHeight,r=n.offsetTop,s=r+n.clientHeight;r<o+e.tocScrollOffset?t.scrollTop-=o-r+e.tocScrollOffset:s>l-e.tocScrollOffset-i&&(t.scrollTop+=s-l+e.tocScrollOffset+2*i)}}}(f);const t=e&&e.target&&e.target.scrollingElement&&0===e.target.scrollingElement.scrollTop;(e&&(0===e.eventPhase||null===e.currentTarget)||t)&&(s.updateToc(a),f.scrollEndCallback&&f.scrollEndCallback(e))}),f.throttleTimeout),u(),f.scrollContainer&&document.querySelector(f.scrollContainer)?(document.querySelector(f.scrollContainer).addEventListener("scroll",u,!1),document.querySelector(f.scrollContainer).addEventListener("resize",u,!1)):(document.addEventListener("scroll",u,!1),document.addEventListener("resize",u,!1));let p=null;d=g((function(e){f.scrollSmooth&&s.disableTocAnimation(e),s.updateToc(a),p&&clearTimeout(p),p=setTimeout((function(){s.enableTocAnimation()}),f.scrollSmoothDuration)}),f.throttleTimeout),f.scrollContainer&&document.querySelector(f.scrollContainer)?document.querySelector(f.scrollContainer).addEventListener("click",d,!1):document.addEventListener("click",d,!1)}function h(){const e=v(f);null!==e&&(f.skipRendering||e&&(e.innerHTML=""),f.scrollContainer&&document.querySelector(f.scrollContainer)?(document.querySelector(f.scrollContainer).removeEventListener("scroll",u,!1),document.querySelector(f.scrollContainer).removeEventListener("resize",u,!1),s&&document.querySelector(f.scrollContainer).removeEventListener("click",d,!1)):(document.removeEventListener("scroll",u,!1),document.removeEventListener("resize",u,!1),s&&document.removeEventListener("click",d,!1)))}function p(e){h(),m(e||f)}const C=Object.prototype.hasOwnProperty;function g(e,t,n){let o,l;return t||(t=250),function(){const r=n||this,i=+new Date,s=arguments;o&&i<o+t?(clearTimeout(l),l=setTimeout((function(){o=i,e.apply(r,s)}),t)):(o=i,e.apply(r,s))}}function v(e){try{return e.tocElement||document.querySelector(e.tocSelector)}catch(t){return console.warn("TOC element not found: "+e.tocSelector),null}}}},t={};function n(o){var l=t[o];if(void 0!==l)return l.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(539)})(); |
{ | ||
"name": "tocbot", | ||
"version": "4.25.0", | ||
"version": "4.27.0", | ||
"description": "Generate a table of contents based on the heading structure of a html document.", | ||
"main": "src/js/index.js", | ||
"main": "src/js/index-dist.js", | ||
"browser": "index.js", | ||
"exports": { | ||
".": { | ||
"import": "./index.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"./styles.css": "./dist/styles.css", | ||
"./tocbot.css": "./dist/tocbot.css", | ||
"./dist/tocbot.js": "./dist/tocbot.js", | ||
"./dist/tocbot.min.js": "./dist/tocbot.min.js", | ||
"./dist/styles.css": "./dist/styles.css", | ||
"./dist/tocbot.css": "./dist/tocbot.css" | ||
}, | ||
"scripts": { | ||
@@ -16,5 +29,5 @@ "clean": "rm -rf dist/", | ||
"build-dist": "cp static/js/tocbot.js ./dist/ && cp static/js/tocbot.min.js ./dist/ && cp static/css/tocbot.css ./dist/ && cp static/css/styles.css ./dist/", | ||
"build-js": "webpack-cli ./src/js/index.js -o static/js/ --mode=development --devtool=source-map && mv static/js/main.js static/js/tocbot.js", | ||
"build-js-watch": "webpack-cli --watch --mode=development ./src/js/index.js -o static/js/", | ||
"build-js-uglify": "webpack-cli ./src/js/index.js -o static/js/ --mode=production && mv static/js/main.js static/js/tocbot.min.js", | ||
"build-js": "webpack-cli ./src/js/index-dist.js -o static/js/ --mode=development --devtool=source-map && mv static/js/main.js static/js/tocbot.js", | ||
"build-js-watch": "webpack-cli --watch --mode=development ./src/js/index-dist.js -o static/js/", | ||
"build-js-uglify": "webpack-cli ./src/js/index-dist.js -o static/js/ --mode=production && mv static/js/main.js static/js/tocbot.min.js", | ||
"build-content": "processmd \"*.md\" --outputDir data --markdownOptions.html=true --headingIds", | ||
@@ -29,5 +42,7 @@ "estimate-js-size": "gzip -9 -c dist/tocbot.min.js | wc -c", | ||
"deploy:local": "mv out tocbot && mkdir out && mv tocbot out/tocbot", | ||
"test": "npm run lint && mocha test/index.js", | ||
"test:debug": "node-debug _mocha --timeout 0 test/index.js", | ||
"test:watch": "mocha --watch test/index.js", | ||
"test": "npm run lint && npm run test:esm && npm run test:dist", | ||
"test:esm": "wtr test/index-esm.mjs --node-resolve", | ||
"test:esm:watch": "npm run esm:dist -- --watch", | ||
"test:dist": "mocha test/index-dist.mjs", | ||
"test:dist:watch": "npm run test:dist -- --watch", | ||
"test:integration": "codeceptjs run --steps", | ||
@@ -73,2 +88,4 @@ "test:update-screenshots": "cp -R -v ./test/__screenshots-new__/* ./test/__screenshots__", | ||
"@babel/preset-react": "^7.18.6", | ||
"@esm-bundle/chai": "^4.3.4-fix.0", | ||
"@web/test-runner": "^0.18.1", | ||
"babel-loader": "^9.1.0", | ||
@@ -75,0 +92,0 @@ "chai": "^4.3.7", |
@@ -32,3 +32,3 @@ <h1 class="dn"> | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.18.2/tocbot.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.min.js"></script> | ||
``` | ||
@@ -42,3 +42,3 @@ | ||
```html | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.18.2/tocbot.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css"> | ||
``` | ||
@@ -97,3 +97,2 @@ | ||
- [Tocbot Homepage](https://tscanlin.github.io/tocbot/) | ||
- [Pagekit TOC](https://spqr.wtf/projects/toc) | ||
- [Optimizely's Developer Documentation](https://developers.optimizely.com/x/solutions/javascript/reference/index.html) | ||
@@ -269,4 +268,4 @@ | ||
- Try running this from the console: `tocbot.refresh({ ...tocbot.options, hasInnerContainers: true })`. If that works then one option (`hasInnerContainers: true`) to handle inner containers should be all you need to add. | ||
- If you have a really long TOC and are seeing headings getting truncated, then have a [look at this issue for a workaround to resolve it](https://github.com/tscanlin/tocbot/issues/330). | ||
## Contributing | ||
@@ -273,0 +272,0 @@ |
@@ -18,5 +18,4 @@ import React from 'react' | ||
// Only require tocbot if in browser. | ||
const tocbot = (typeof window !== 'undefined') | ||
? require('../../../js/index.js') | ||
: null | ||
const tocbot = | ||
typeof window !== 'undefined' ? require('../../../js/index-dist.js') : null | ||
@@ -23,0 +22,0 @@ export default class Tocbot extends React.Component { |
@@ -9,3 +9,3 @@ /* eslint no-var: off */ | ||
module.exports = function (options) { | ||
export default function (options) { | ||
var forEach = [].forEach | ||
@@ -115,3 +115,3 @@ var some = [].some | ||
if (isCollapsed) { | ||
// No plus/equals here fixes compilcation issue. | ||
// No plus/equals here fixes compilation issue. | ||
classes = classes + SPACE_CHAR + options.collapsibleClass | ||
@@ -118,0 +118,0 @@ classes = classes + SPACE_CHAR + options.isCollapsedClass |
@@ -1,2 +0,2 @@ | ||
module.exports = { | ||
export default { | ||
// Where to render the table of contents. | ||
@@ -3,0 +3,0 @@ tocSelector: '.js-toc', |
@@ -9,3 +9,3 @@ /* eslint no-var: off */ | ||
module.exports = function parseContent (options) { | ||
export default function parseContent (options) { | ||
var reduce = [].reduce | ||
@@ -12,0 +12,0 @@ |
/* eslint no-var: off */ | ||
/* globals location, requestAnimationFrame */ | ||
exports.initSmoothScrolling = initSmoothScrolling | ||
function initSmoothScrolling (options) { | ||
export default function initSmoothScrolling (options) { | ||
// if (isCssSmoothSCrollSupported()) { return } | ||
@@ -8,0 +6,0 @@ |
/* eslint no-var: off */ | ||
const SCROLL_LEEWAY = 30 | ||
module.exports = function updateTocScroll (options) { | ||
export default function updateTocScroll (options) { | ||
var toc = options.tocElement || document.querySelector(options.tocSelector) | ||
@@ -6,0 +6,0 @@ if (toc && toc.scrollHeight > toc.clientHeight) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128983
38
2423
29
294