@d-i-t-a/reader 1.11.0-beta.4 → 1.11.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ export declare const IS_DEV: boolean;
2
+ export interface GlossaryItem {
3
+ word: string;
4
+ definition: string;
5
+ }
@@ -1 +1,3 @@
1
- var Glossary;Glossary={};
1
+ /*! For license information please see glossary.js.LICENSE.txt */
2
+ var Glossary;(()=>{var e={813:function(e){e.exports=function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(n){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=o,this.iframesTimeout=i}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(t){var n=e.filter((function(e){return e.contains(t)})).length>0;-1!==e.indexOf(t)||n||e.push(t)})),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var o=e.contentWindow;if(r=o.document,!o||!r)throw new Error("iframe inaccessible")}catch(e){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,o=!1,i=null,a=function a(){if(!o){o=!0,clearTimeout(i);try{r.isIframeBlank(e)||(e.removeEventListener("load",a),r.getIframeContents(e,t,n))}catch(e){n()}}};e.addEventListener("load",a),i=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(e){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,(function(){return!0}),(function(e){r++,n.waitForIframes(e.querySelector("html"),(function(){--r||t()}))}),(function(e){e||t()}))}},{key:"forEachIframe",value:function(t,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=t.querySelectorAll("iframe"),s=a.length,c=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&i(c)};s||u(),a.forEach((function(t){e.matches(t,o.exclude)?u():o.onIframeReady(t,(function(e){n(t)&&(c++,r(e)),u()}),u)}))}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var o=!1,i=!1;return r.forEach((function(e,t){e.val===n&&(o=t,i=e.handled)})),this.compareNodeIframe(e,t,n)?(!1!==o||i?!1===o||i||(r[o].handled=!0):r.push({val:n,handled:!0}),!0):(!1===o&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var o=this;e.forEach((function(e){e.handled||o.getIframeContents(e.val,(function(e){o.createInstanceOnIframe(e).forEachNode(t,n,r)}))}))}},{key:"iterateThroughNodes",value:function(e,t,n,r,o){for(var i=this,a=this.createIterator(t,e,r),s=[],c=[],u=void 0,l=void 0;h=void 0,h=i.getIteratorNode(a),l=h.prevNode,u=h.node;)this.iframes&&this.forEachIframe(t,(function(e){return i.checkIframeFilter(u,l,e,s)}),(function(t){i.createInstanceOnIframe(t).forEachNode(e,(function(e){return c.push(e)}),r)})),c.push(u);var h;c.forEach((function(e){n(e)})),this.iframes&&this.handleOpenIframes(s,e,n,r),o()}},{key:"forEachNode",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},i=this.getContexts(),a=i.length;a||o(),i.forEach((function(i){var s=function(){r.iterateThroughNodes(e,i,t,n,(function(){--a<=0&&o()}))};r.iframes?r.waitForIframes(i,s):s()}))}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var o=!1;return n.every((function(t){return!r.call(e,t)||(o=!0,!1)})),o}return!1}}]),e}(),i=function(){function i(e){t(this,i),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(i,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var o in t)if(t.hasOwnProperty(o)){var i=t[o],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i);""!==a&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,(function(e){return"\\"===e.charAt(0)?"?":""}))).replace(/(?:\\)*\*/g,(function(e){return"\\"===e.charAt(0)?"*":""}))}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,(function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"}))}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],r=[];return e.split("").forEach((function(o){n.every((function(n){if(-1!==n.indexOf(o)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0}))})),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n=this.opt.accuracy,r="string"==typeof n?n:n.value,o="string"==typeof n?[]:n.limiters,i="";switch(o.forEach((function(e){i+="|"+t.escapeStr(e)})),r){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+(i||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+e+"[^"+i+"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach((function(e){t.opt.separateWordSearch?e.split(" ").forEach((function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)})):e.trim()&&-1===n.indexOf(e)&&n.push(e)})),{keywords:n.sort((function(e,t){return t.length-e.length})),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort((function(e,t){return e.start-t.start})).forEach((function(e){var o=t.callNoMatchOnInvalidRanges(e,r),i=o.start,a=o.end;o.valid&&(e.start=i,e.length=a-i,n.push(e),r=a)})),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,o=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?o=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:o}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,o=!0,i=n.length,a=t-i,s=parseInt(e.start,10)-a;return(r=(s=s>i?i:s)+parseInt(e.length,10))>i&&(r=i,this.log("End range automatically set to the max value of "+i)),s<0||r-s<0||s>i||r>i?(o=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(o=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:o}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,(function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})}),(function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),(function(){e({value:n,nodes:r})}))}},{key:"matchesExclude",value:function(e){return o.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",o=e.splitText(t),i=o.splitText(n-t),a=document.createElement(r);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=o.textContent,o.parentNode.replaceChild(a,o),i}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,o){var i=this;e.nodes.every((function(a,s){var c=e.nodes[s+1];if(void 0===c||c.start>t){if(!r(a.node))return!1;var u=t-a.start,l=(n>a.end?a.end:n)-a.start,h=e.value.substr(0,a.start),f=e.value.substr(l+a.start);if(a.node=i.wrapRangeInTextNode(a.node,u,l),e.value=h+f,e.nodes.forEach((function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[n].start-=l),e.nodes[n].end-=l)})),n-=l,o(a.node.previousSibling,a.start),!(n>a.end))return!1;t=a.end}return!0}))}},{key:"wrapMatches",value:function(e,t,n,r,o){var i=this,a=0===t?0:t+1;this.getTextNodes((function(t){t.nodes.forEach((function(t){t=t.node;for(var o=void 0;null!==(o=e.exec(t.textContent))&&""!==o[a];)if(n(o[a],t)){var s=o.index;if(0!==a)for(var c=1;c<a;c++)s+=o[c].length;t=i.wrapRangeInTextNode(t,s,s+o[a].length),r(t.previousSibling),e.lastIndex=0}})),o()}))}},{key:"wrapMatchesAcrossElements",value:function(e,t,n,r,o){var i=this,a=0===t?0:t+1;this.getTextNodes((function(t){for(var s=void 0;null!==(s=e.exec(t.value))&&""!==s[a];){var c=s.index;if(0!==a)for(var u=1;u<a;u++)c+=s[u].length;var l=c+s[a].length;i.wrapRangeInMappedTextNode(t,c,l,(function(e){return n(s[a],e)}),(function(t,n){e.lastIndex=n,r(t)}))}o()}))}},{key:"wrapRangeFromIndex",value:function(e,t,n,r){var o=this;this.getTextNodes((function(i){var a=i.value.length;e.forEach((function(e,r){var s=o.checkWhitespaceRanges(e,a,i.value),c=s.start,u=s.end;s.valid&&o.wrapRangeInMappedTextNode(i,c,u,(function(n){return t(n,e,i.value.substring(c,u),r)}),(function(t){n(t,e)}))})),r()}))}},{key:"unwrapMatches",value:function(e){for(var t=e.parentNode,n=document.createDocumentFragment();e.firstChild;)n.appendChild(e.removeChild(e.firstChild));t.replaceChild(n,e),this.ie?this.normalizeTextNode(t):t.normalize()}},{key:"normalizeTextNode",value:function(e){if(e){if(3===e.nodeType)for(;e.nextSibling&&3===e.nextSibling.nodeType;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}},{key:"markRegExp",value:function(e,t){var n=this;this.opt=t,this.log('Searching with expression "'+e+'"');var r=0,o="wrapMatches";this.opt.acrossElements&&(o="wrapMatchesAcrossElements"),this[o](e,this.opt.ignoreGroups,(function(e,t){return n.opt.filter(t,e,r)}),(function(e){r++,n.opt.each(e)}),(function(){0===r&&n.opt.noMatch(e),n.opt.done(r)}))}},{key:"mark",value:function(e,t){var n=this;this.opt=t;var r=0,o="wrapMatches",i=this.getSeparatedKeywords("string"==typeof e?[e]:e),a=i.keywords,s=i.length,c=this.opt.caseSensitive?"":"i";this.opt.acrossElements&&(o="wrapMatchesAcrossElements"),0===s?this.opt.done(r):function e(t){var i=new RegExp(n.createRegExp(t),"gm"+c),u=0;n.log('Searching with expression "'+i+'"'),n[o](i,1,(function(e,o){return n.opt.filter(o,t,r,u)}),(function(e){u++,r++,n.opt.each(e)}),(function(){0===u&&n.opt.noMatch(t),a[s-1]===t?n.opt.done(r):e(a[a.indexOf(t)+1])}))}(a[0])}},{key:"markRanges",value:function(e,t){var n=this;this.opt=t;var r=0,o=this.checkRanges(e);o&&o.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(o)),this.wrapRangeFromIndex(o,(function(e,t,r,o){return n.opt.filter(e,t,r,o)}),(function(e,t){r++,n.opt.each(e,t)}),(function(){n.opt.done(r)}))):this.opt.done(r)}},{key:"unmark",value:function(e){var t=this;this.opt=e;var n=this.opt.element?this.opt.element:"*";n+="[data-markjs]",this.opt.className&&(n+="."+this.opt.className),this.log('Removal selector "'+n+'"'),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,(function(e){t.unwrapMatches(e)}),(function(e){var r=o.matches(e,n),i=t.matchesExclude(e);return!r||i?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),this.opt.done)}},{key:"opt",set:function(e){this._opt=r({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:function(){},noMatch:function(){},filter:function(){return!0},done:function(){},debug:!1,log:window.console},e)},get:function(){return this._opt}},{key:"iterator",get:function(){return new o(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}}]),i}();return function(e){var t=this,n=new i(e);return this.mark=function(e,r){return n.mark(e,r),t},this.markRegExp=function(e,r){return n.markRegExp(e,r),t},this.markRanges=function(e,r){return n.markRanges(e,r),t},this.unmark=function(e){return n.unmark(e),t},this}}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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})};var r={};(()=>{"use strict";n.r(r),n.d(r,{IS_DEV:()=>o});var e=n(813),t=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const o=!1;!function(n){t(this,void 0,void 0,(function*(){o&&console.log("glossary mark words "+n),n.forEach((function(n){return t(this,void 0,void 0,(function*(){o&&console.log(n);var r=new e(document.body);yield r.mark(n.word,{accuracy:{value:"exactly",limiters:[".",",",";",":",")"]},separateWordSearch:!1,acrossElements:!0,exclude:["h1","h2","h3","h4","h5","h6","figure"],element:"a",className:"gloss",each:function(e){e.addEventListener("click",(r=>t(this,void 0,void 0,(function*(){var t=e;o&&console.log("Mark Node Click Handler"),r.preventDefault(),r.stopPropagation();var i=document.createElement("div");i.className="modal",i.innerHTML='<div class="modal-content"><span class="close">x</span>'+n.definition+"</div>",i.style.display="block",document.body.appendChild(i);var a=i.getElementsByClassName("modal-content")[0],s=t.offsetTop;t.offsetTop>100&&(s=t.offsetTop-20),a.style.top=s+"px",i.getElementsByClassName("close")[0].onclick=function(){i.style.display="none",i.parentElement.removeChild(i)},window.onclick=function(e){e.target===i&&(i.style.display="none",i.parentElement.removeChild(i))}}))),!0)}})}))}))}))}([{word:"frankenstein",definition:"who is frankenstein"},{word:"Mary Shelley",definition:"who is Mary Shelley?"}])})(),Glossary=r})();
3
+ //# sourceMappingURL=glossary.js.map
@@ -0,0 +1,37 @@
1
+ import { Publication } from "../../model/Publication";
2
+ import IFrameNavigator from "../../navigator/IFrameNavigator";
3
+ import ReaderModule from "../ReaderModule";
4
+ export declare enum CitationStyle {
5
+ Chicago = 0,
6
+ MLA = 1,
7
+ APA = 2
8
+ }
9
+ export declare enum ContributorType {
10
+ Author = "Author",
11
+ Editor = "Editor",
12
+ Translator = "Translator",
13
+ Compiler = "Compiler"
14
+ }
15
+ export interface CitationModuleProperties {
16
+ characters: number;
17
+ appName: string;
18
+ appLink: string;
19
+ library: string;
20
+ styles: string[];
21
+ }
22
+ export interface CitationModuleConfig extends CitationModuleProperties {
23
+ publication: Publication;
24
+ delegate: IFrameNavigator;
25
+ }
26
+ export default class CitationModule implements ReaderModule {
27
+ private publication;
28
+ private delegate;
29
+ private properties;
30
+ static create(config: CitationModuleConfig): Promise<CitationModule>;
31
+ private constructor();
32
+ stop(): Promise<void>;
33
+ protected start(): Promise<void>;
34
+ copyToClipboard(textToClipboard: any): void;
35
+ createElementForExecCommand(textToClipboard: any): HTMLDivElement;
36
+ selectContent(element: any): void;
37
+ }
@@ -1,10 +1,8 @@
1
1
  import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionMenuItem } from "./common/highlight";
2
2
  import { ISelectionInfo } from "./common/selection";
3
3
  import { IRectSimple } from "./common/rect-utils";
4
- import { IReadiumIFrameWindow } from "./renderer/iframe/state";
5
4
  import { AnnotationMarker } from "../../model/Locator";
6
5
  import IFrameNavigator from "../../navigator/IFrameNavigator";
7
- import { Definition } from "../search/DefinitionsModule";
8
6
  export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
9
7
  export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
10
8
  export declare const ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER";
@@ -14,9 +12,15 @@ export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
14
12
  export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
15
13
  export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
16
14
  export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
15
+ export declare const DEFAULT_BACKGROUND_COLOR: {
16
+ blue: number;
17
+ green: number;
18
+ red: number;
19
+ };
17
20
  export interface TextSelectorAPI {
18
21
  selectionMenuOpen: any;
19
22
  selectionMenuClose: any;
23
+ selection: any;
20
24
  }
21
25
  export declare const _highlights: IHighlight[];
22
26
  interface IWithRect {
@@ -145,6 +149,9 @@ export default class TextHighlighter {
145
149
  selectionMenuClosed: (() => void) & {
146
150
  clear(): void;
147
151
  };
152
+ selection: ((text: any, selection: any) => void) & {
153
+ clear(): void;
154
+ };
148
155
  toolboxPlacement(): void;
149
156
  toolboxHandler(): void;
150
157
  /**
@@ -196,20 +203,6 @@ export default class TextHighlighter {
196
203
  * @memberof TextHighlighter
197
204
  */
198
205
  getColor(): string;
199
- /**
200
- * Returns highlights from given container.
201
- * @param params
202
- * @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
203
- * highlighter is applied to.
204
- * @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
205
- * returned results. Default: true.
206
- * @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
207
- * in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
208
- * property. Default: false.
209
- * @returns {Array} - array of highlights.
210
- * @memberof TextHighlighter
211
- */
212
- getHighlights(params?: any): Array<any>;
213
206
  /**
214
207
  * Returns true if element is a highlight.
215
208
  * All highlights have 'data-highlighted' attribute.
@@ -218,20 +211,6 @@ export default class TextHighlighter {
218
211
  * @memberof TextHighlighter
219
212
  */
220
213
  isHighlight(el: any): boolean;
221
- /**
222
- * Serializes all highlights in the element the highlighter is applied to.
223
- * @returns {string} - stringified JSON with highlights definition
224
- * @memberof TextHighlighter
225
- */
226
- serializeHighlights(): string;
227
- /**
228
- * Deserializes highlights.
229
- * @throws exception when can't parse JSON or JSON has invalid structure.
230
- * @param {object} json - JSON object with highlights definition.
231
- * @returns {Array} - array of deserialized highlights.
232
- * @memberof TextHighlighter
233
- */
234
- deserializeHighlights(json: any): Array<any>;
235
214
  /**
236
215
  * Creates wrapper for highlights.
237
216
  * TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
@@ -250,28 +229,20 @@ export default class TextHighlighter {
250
229
  };
251
230
  static hexToRgbA(hex: string): string;
252
231
  static hexToRgbAWithOpacity(hex: string, opacity: number): string;
253
- resetHighlightBoundingStyle(_win: IReadiumIFrameWindow, highlightBounding: HTMLElement): void;
254
- resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement, id_container: string): void;
255
- setHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
232
+ resetHighlightBoundingStyle(_win: any, highlightBounding: HTMLElement): void;
233
+ resetHighlightAreaStyle(_win: any, highlightArea: HTMLElement, id_container: string): void;
234
+ setHighlightAreaStyle(_win: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
256
235
  setAndResetSearchHighlight(highlight: any, highlights: any): void;
257
236
  isIOS(): boolean;
258
237
  isAndroid(): boolean;
259
238
  getScrollingElement: (documant: Document) => Element;
260
- processMouseEvent(win: IReadiumIFrameWindow, ev: MouseEvent): Promise<void>;
261
- ensureHighlightsContainer(win: IReadiumIFrameWindow, id: string): HTMLElement;
239
+ processMouseEvent(win: any, ev: MouseEvent): Promise<void>;
240
+ ensureHighlightsContainer(win: any, id: string): HTMLElement;
262
241
  hideAllhighlights(_documant: Document): void;
263
242
  destroyAllhighlights(documant: Document): void;
264
243
  destroyHighlights(type: HighlightType): void;
265
244
  destroyHighlight(documant: Document, id: string): void;
266
- recreateAllHighlightsRaw(win: IReadiumIFrameWindow): void;
267
- recreateAllHighlightsDebounced: ((win: IReadiumIFrameWindow) => void) & {
268
- clear(): void;
269
- };
270
- recreateAllHighlights(win: IReadiumIFrameWindow): void;
271
- createPopupHighlight(selectionInfo: ISelectionInfo, item: Definition): IHighlight;
272
- createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
273
- createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
274
- createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
275
- createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
245
+ createHighlight(win: any, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
246
+ createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
276
247
  }
277
248
  export {};
@@ -0,0 +1,278 @@
1
+ import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionMenuItem } from "./common/highlight";
2
+ import { ISelectionInfo } from "./common/selection";
3
+ import { IRectSimple } from "./common/rect-utils";
4
+ import { IReadiumIFrameWindow } from "./renderer/iframe/state";
5
+ import { AnnotationMarker } from "../../model/Locator";
6
+ import IFrameNavigator from "../../navigator/IFrameNavigator";
7
+ import { Definition } from "../search/DefinitionsModule";
8
+ export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
9
+ export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
10
+ export declare const ID_POPUP_CONTAINER = "R2_ID_POPUP_CONTAINER";
11
+ export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
12
+ export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
13
+ export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
14
+ export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
15
+ export declare const _highlights: IHighlight[];
16
+ interface IWithRect {
17
+ rect: IRectSimple;
18
+ scale: number;
19
+ }
20
+ export interface TextSelectorAPI {
21
+ selectionMenuOpen: any;
22
+ selectionMenuClose: any;
23
+ selection: any;
24
+ }
25
+ export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
26
+ }
27
+ export interface HTMLElementRect {
28
+ node: Element;
29
+ height: number;
30
+ top: number;
31
+ width: number;
32
+ left: number;
33
+ textContent: string;
34
+ }
35
+ export interface TextHighlighterProperties {
36
+ selectionMenuItems: Array<SelectionMenuItem>;
37
+ }
38
+ export interface TextHighlighterConfig extends TextHighlighterProperties {
39
+ delegate: IFrameNavigator;
40
+ api: TextSelectorAPI;
41
+ }
42
+ export default class TextHighlighterFXL {
43
+ private options;
44
+ private readonly delegate;
45
+ private lastSelectedHighlight;
46
+ properties: TextHighlighterProperties;
47
+ private api;
48
+ private hasEventListener;
49
+ activeAnnotationMarkerId?: string;
50
+ static create(config: TextHighlighterConfig): Promise<any>;
51
+ private constructor();
52
+ initialize(): Promise<void>;
53
+ /**
54
+ * Returns true if elements a i b have the same color.
55
+ * @param {Node} a
56
+ * @param {Node} b
57
+ * @returns {boolean}
58
+ */
59
+ haveSameColor(a: any, b: any): boolean;
60
+ /**
61
+ * Fills undefined values in obj with default properties with the same name from source object.
62
+ * @param {object} obj - target object
63
+ * @param {object} source - source object with default values
64
+ * @returns {object}
65
+ */
66
+ defaults(obj: {
67
+ [x: string]: any;
68
+ }, source: {
69
+ [x: string]: any;
70
+ color?: string;
71
+ highlightedClass?: string;
72
+ contextClass?: string;
73
+ onBeforeHighlight?: () => boolean;
74
+ onAfterHighlight?: () => void;
75
+ container?: any;
76
+ andSelf?: boolean;
77
+ grouped?: boolean;
78
+ hasOwnProperty?: any;
79
+ }): object;
80
+ /**
81
+ * Returns array without duplicated values.
82
+ * @param {Array} arr
83
+ * @returns {Array}
84
+ */
85
+ unique(arr: {
86
+ filter: (arg0: (value: any, idx: any, self: any) => boolean) => void;
87
+ }): void;
88
+ /**
89
+ * Takes range object as parameter and refines it boundaries
90
+ * @param range
91
+ * @returns {object} refined boundaries and initial state of highlighting algorithm.
92
+ */
93
+ refineRangeBoundaries(range: {
94
+ startContainer: any;
95
+ endContainer: any;
96
+ commonAncestorContainer: any;
97
+ endOffset: number;
98
+ startOffset: number;
99
+ }): object;
100
+ /**
101
+ * Sorts array of DOM elements by its depth in DOM tree.
102
+ * @param {HTMLElement[]} arr - array to sort.
103
+ * @param {boolean} descending - order of sort.
104
+ */
105
+ sortByDepth(arr: {
106
+ sort: (arg0: (a: any, b: any) => number) => void;
107
+ }, descending: boolean): void;
108
+ /**
109
+ * Groups given highlights by timestamp.
110
+ * @param {Array} highlights
111
+ * @returns {Array} Grouped highlights.
112
+ */
113
+ groupHighlights(highlights: {
114
+ forEach: (arg0: (hl: any) => void) => void;
115
+ }): Array<any>;
116
+ /**
117
+ * Utility functions to make DOM manipulation easier.
118
+ * @param {Node|HTMLElement} [el] - base DOM element to manipulate
119
+ * @returns {object}
120
+ */
121
+ dom(el?: any): any;
122
+ disableContext(e: {
123
+ preventDefault: () => void;
124
+ stopPropagation: () => void;
125
+ }): boolean;
126
+ bindEvents(el: any, _scope: any, hasEventListener: boolean): void;
127
+ unbindEvents(el: any, _scope: any): void;
128
+ /**
129
+ * Permanently disables highlighting.
130
+ * Unbinds events and remove context element class.
131
+ * @memberof TextHighlighter
132
+ */
133
+ destroy(): void;
134
+ initializeToolbox(): void;
135
+ toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
136
+ toolboxHide(): void;
137
+ toolboxShowDelayed(): void;
138
+ snapSelectionToWord(): any;
139
+ toolboxShow(): void;
140
+ isSelectionMenuOpen: boolean;
141
+ selectionMenuOpened: (() => void) & {
142
+ clear(): void;
143
+ };
144
+ selectionMenuClosed: (() => void) & {
145
+ clear(): void;
146
+ };
147
+ selection: ((text: any, selection: any) => void) & {
148
+ clear(): void;
149
+ };
150
+ toolboxPlacement(): void;
151
+ toolboxHandler(): void;
152
+ /**
153
+ * Highlights current range.
154
+ * @param {boolean} keepRange - Don't remove range after highlighting. Default: false.
155
+ * @param marker
156
+ * @memberof TextHighlighter
157
+ */
158
+ doHighlight(iframe: any, keepRange?: boolean, marker?: AnnotationMarker): void;
159
+ speak(iframe: any): void;
160
+ stopReadAloud(): void;
161
+ speakAll(iframe: any): void;
162
+ callbackComplete(): void;
163
+ visibleTextRects(iframe: any): HTMLElementRect[];
164
+ doneSpeaking(reload?: boolean): void;
165
+ /**
166
+ * Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
167
+ * wrapping HTML elements.
168
+ * Flattens highlights structure and merges sibling highlights. Normalizes text nodes within highlights.
169
+ * @param {Array} highlights - highlights to normalize.
170
+ * @returns {Array} - array of normalized highlights. Order and number of returned highlights may be different than
171
+ * input highlights.
172
+ * @memberof TextHighlighter
173
+ */
174
+ normalizeHighlights(highlights: any): any;
175
+ /**
176
+ * Flattens highlights structure.
177
+ * Note: this method changes input highlights - their order and number after calling this method may change.
178
+ * @param {Array} highlights - highlights to flatten.
179
+ * @memberof TextHighlighter
180
+ */
181
+ flattenNestedHighlights(highlights: any): void;
182
+ /**
183
+ * Merges sibling highlights and normalizes descendant text nodes.
184
+ * Note: this method changes input highlights - their order and number after calling this method may change.
185
+ * @param highlights
186
+ * @memberof TextHighlighter
187
+ */
188
+ mergeSiblingHighlights(highlights: any): void;
189
+ /**
190
+ * Sets highlighting color.
191
+ * @param {string} color - valid CSS color.
192
+ * @memberof TextHighlighter
193
+ */
194
+ setColor(color: any): void;
195
+ /**
196
+ * Returns highlighting color.
197
+ * @returns {string}
198
+ * @memberof TextHighlighter
199
+ */
200
+ getColor(): string;
201
+ /**
202
+ * Returns highlights from given container.
203
+ * @param params
204
+ * @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
205
+ * highlighter is applied to.
206
+ * @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
207
+ * returned results. Default: true.
208
+ * @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
209
+ * in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
210
+ * property. Default: false.
211
+ * @returns {Array} - array of highlights.
212
+ * @memberof TextHighlighter
213
+ */
214
+ getHighlights(iframe: any, params?: any): Array<any>;
215
+ /**
216
+ * Returns true if element is a highlight.
217
+ * All highlights have 'data-highlighted' attribute.
218
+ * @param el - element to check.
219
+ * @returns {boolean}
220
+ * @memberof TextHighlighter
221
+ */
222
+ isHighlight(el: any): boolean;
223
+ /**
224
+ * Serializes all highlights in the element the highlighter is applied to.
225
+ * @returns {string} - stringified JSON with highlights definition
226
+ * @memberof TextHighlighter
227
+ */
228
+ serializeHighlights(iframe: any): string;
229
+ /**
230
+ * Deserializes highlights.
231
+ * @throws exception when can't parse JSON or JSON has invalid structure.
232
+ * @param {object} json - JSON object with highlights definition.
233
+ * @returns {Array} - array of deserialized highlights.
234
+ * @memberof TextHighlighter
235
+ */
236
+ deserializeHighlights(iframe: any, json: any): Array<any>;
237
+ /**
238
+ * Creates wrapper for highlights.
239
+ * TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
240
+ * in constructor.
241
+ * @returns {HTMLElement}
242
+ * @memberof TextHighlighter
243
+ * @static
244
+ */
245
+ createWrapper(): HTMLElement;
246
+ static isHexColor(hex: string): boolean;
247
+ static hexToRgbString(hex: string): any;
248
+ static hexToRgbChannels(hex: string): {
249
+ red: number;
250
+ green: number;
251
+ blue: number;
252
+ };
253
+ static hexToRgbA(hex: string): string;
254
+ static hexToRgbAWithOpacity(hex: string, opacity: number): string;
255
+ resetHighlightBoundingStyle(_win: IReadiumIFrameWindow, highlightBounding: HTMLElement): void;
256
+ resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement, id_container: string): void;
257
+ setHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
258
+ isIOS(): boolean;
259
+ isAndroid(): boolean;
260
+ getScrollingElement: (documant: Document) => Element;
261
+ processMouseEvent(win: IReadiumIFrameWindow, ev: MouseEvent): Promise<void>;
262
+ ensureHighlightsContainer(win: IReadiumIFrameWindow, id: string): HTMLElement;
263
+ hideAllhighlights(_documant: Document): void;
264
+ destroyAllhighlights(documant: Document): void;
265
+ destroyHighlights(type: HighlightType): void;
266
+ destroyHighlight(documant: Document, id: string): void;
267
+ recreateAllHighlightsRaw(win: IReadiumIFrameWindow): void;
268
+ recreateAllHighlightsDebounced: ((win: IReadiumIFrameWindow) => void) & {
269
+ clear(): void;
270
+ };
271
+ recreateAllHighlights(win: IReadiumIFrameWindow): void;
272
+ createPopupHighlight(iframe: any, selectionInfo: ISelectionInfo, item: Definition): IHighlight;
273
+ createSearchHighlight(iframe: any, selectionInfo: ISelectionInfo, color: string): IHighlight;
274
+ createPageBreakHighlight(iframe: any, selectionInfo: ISelectionInfo, title: string): IHighlight;
275
+ createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
276
+ createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
277
+ }
278
+ export {};
@@ -5,9 +5,6 @@ export interface IReadiumIFrameWindowState {
5
5
  locationHashOverride: Element | undefined;
6
6
  locationHashOverrideInfo: IEventPayload_R2_EVENT_READING_LOCATION | undefined;
7
7
  }
8
- export interface IReadiumIFrameWindow extends Window {
9
- READIUM2: IReadiumIFrameWindowState;
10
- }
11
8
  export interface IReadiumIFrameState {
12
9
  id: number;
13
10
  link: Link | undefined;
@@ -0,0 +1,43 @@
1
+ import { Publication } from "../../model/Publication";
2
+ import IFrameNavigator from "../../navigator/IFrameNavigator";
3
+ import ReaderModule from "../ReaderModule";
4
+ import TextHighlighter from "../highlight/TextHighlighter";
5
+ export interface LineFocusModuleAPI {
6
+ }
7
+ export interface LineFocusModuleProperties {
8
+ api?: LineFocusModuleAPI;
9
+ factor: number;
10
+ startIndex: number;
11
+ currentIndex: number;
12
+ }
13
+ export interface LineFocusModuleConfig extends LineFocusModuleProperties {
14
+ api: LineFocusModuleAPI;
15
+ publication: Publication;
16
+ delegate: IFrameNavigator;
17
+ highlighter: TextHighlighter;
18
+ }
19
+ export default class LineFocusModule implements ReaderModule {
20
+ properties: LineFocusModuleProperties;
21
+ api: LineFocusModuleAPI;
22
+ private delegate;
23
+ private highlighter;
24
+ lines: Array<HTMLElement>;
25
+ index: number;
26
+ isActive: boolean;
27
+ isDebug: boolean;
28
+ static create(config: LineFocusModuleConfig): Promise<LineFocusModule>;
29
+ private constructor();
30
+ stop(): Promise<void>;
31
+ protected start(): Promise<void>;
32
+ handleResize(): void;
33
+ enableLineFocus(): void;
34
+ disableLineFocus(): void;
35
+ lineFocus(): void;
36
+ currentLine(): void;
37
+ lineDown(): void;
38
+ lineUp(): void;
39
+ almostEqual(a: number, b: number, tolerance: number): boolean;
40
+ findRects(parent: HTMLElement): any;
41
+ findTextNodes(parentElement: Element, nodes?: Array<Element>): Array<Element>;
42
+ measureTextNodes(node: Element): any;
43
+ }
@@ -1,5 +1,7 @@
1
1
  import IFrameNavigator from "../../navigator/IFrameNavigator";
2
2
  import ReaderModule from "../ReaderModule";
3
+ import { IHighlight } from "../highlight/common/highlight";
4
+ import { ISelectionInfo } from "../highlight/common/selection";
3
5
  import { Publication } from "../../model/Publication";
4
6
  export interface PageBreakModuleConfig {
5
7
  delegate: IFrameNavigator;
@@ -20,4 +22,5 @@ export default class PageBreakModule implements ReaderModule {
20
22
  private goToPageNumber;
21
23
  handleResize(): Promise<void>;
22
24
  drawPageBreaks(): Promise<void>;
25
+ createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
23
26
  }
@@ -2,6 +2,8 @@ import { Publication } from "../../model/Publication";
2
2
  import IFrameNavigator from "../../navigator/IFrameNavigator";
3
3
  import ReaderModule from "../ReaderModule";
4
4
  import TextHighlighter from "../highlight/TextHighlighter";
5
+ import { IHighlight } from "../highlight/common/highlight";
6
+ import { ISelectionInfo } from "../highlight/common/selection";
5
7
  export interface DefinitionsModuleAPI {
6
8
  success?: any;
7
9
  click?: any;
@@ -37,8 +39,11 @@ export default class DefinitionsModule implements ReaderModule {
37
39
  stop(): Promise<void>;
38
40
  protected start(): Promise<void>;
39
41
  searchAndPaint(item: Definition, callback: (result: any) => any): Promise<void>;
40
- definitions(): Promise<void>;
42
+ definitions: (() => Promise<void>) & {
43
+ clear(): void;
44
+ };
41
45
  define(item: Definition): Promise<void>;
42
46
  drawDefinitions(): void;
43
47
  handleResize(): Promise<void>;
48
+ createPopupHighlight(selectionInfo: ISelectionInfo, item: Definition): IHighlight;
44
49
  }
@@ -2,6 +2,8 @@ import { Publication } from "../../model/Publication";
2
2
  import IFrameNavigator from "../../navigator/IFrameNavigator";
3
3
  import ReaderModule from "../ReaderModule";
4
4
  import TextHighlighter from "../highlight/TextHighlighter";
5
+ import { IHighlight } from "../highlight/common/highlight";
6
+ import { ISelectionInfo } from "../highlight/common/selection";
5
7
  export interface SearchModuleAPI {
6
8
  }
7
9
  export interface SearchModuleProperties {
@@ -34,6 +36,7 @@ export default class SearchModule implements ReaderModule {
34
36
  private handleSearch;
35
37
  handleSearchChapter(index?: number): Promise<void>;
36
38
  searchAndPaintChapter(term: string, index: number, callback: (result: any) => any): Promise<void>;
39
+ createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
37
40
  clearSearch(): void;
38
41
  search(term: string, current: boolean): Promise<any>;
39
42
  goToSearchID(href: any, index: number, current: boolean): Promise<void>;