@readium/navigator 2.8.2 → 2.9.0
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.
- package/dist/epub/frame/FrameManager.js +1 -1
- package/dist/epub/fxl/FXLCoordinator.js +1 -1
- package/dist/epub/preferences/EpubDefaults.js +1 -1
- package/dist/epub/preferences/EpubSettings.js +1 -1
- package/dist/protection/DevToolsDetector.js +1 -1
- package/dist/webpub/WebPubFrameManager.js +1 -1
- package/dist/webpub/preferences/WebPubDefaults.js +1 -1
- package/dist/webpub/preferences/WebPubSettings.js +1 -1
- package/package.json +5 -5
- package/dist/helpers/dist/sML.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Loader as o}from"@readium/navigator-html-injectables";import{FrameComms as n}from"./FrameComms.js";import{sML as h}from"
|
|
1
|
+
import{Loader as o}from"@readium/navigator-html-injectables";import{FrameComms as n}from"./FrameComms.js";import{sML as h}from"@readium/helpers";import{KeyboardConditionBridge as m}from"../../peripherals/KeyboardConditionBridge.js";class y{constructor(t,i={},r=[],e=[]){this.timelineFragmentIds=e,this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.sandbox.value="allow-same-origin allow-scripts",this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.source=t,this.contentProtectionConfig={...i},this.keyboardPeripheralsConfig=[...r]}async load(t){return new Promise((i,r)=>{if(this.loader){const e=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...t].sort().join("|")){try{i(e)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new o(e,t),this.currModules=t,this.comms=void 0;try{i(e)}catch{}return}this.frame.onload=()=>{const e=this.frame.contentWindow;this.loader=new o(e,t),this.currModules=t;try{i(e)}catch{}},this.frame.onerror=e=>{try{r(e)}catch{}},this.frame.contentWindow.location.replace(this.source)})}applyContentProtection(){this.comms||this.comms.resume(),this.comms.send("peripherals_protection",this.contentProtectionConfig),this.keyboardPeripheralsConfig&&this.keyboardPeripheralsConfig.length>0&&(this.conditionBridge?.destroy(),this.conditionBridge=new m(this.keyboardPeripheralsConfig,t=>{t.length>0&&this.comms.send("keyboard_peripherals",t)}),this.conditionBridge.setup()),this.contentProtectionConfig.monitorScrollingExperimental&&this.comms.send("scroll_protection",{}),this.contentProtectionConfig.protectPrinting?.disable&&this.comms.send("print_protection",this.contentProtectionConfig.protectPrinting)}async destroy(){this.conditionBridge?.destroy(),await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.blur(),this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((t,i)=>{this.comms?.send("unfocus",void 0,r=>{this.comms?.halt(),t()})});this.comms?.halt()}}async show(t){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new n(this.frame.contentWindow,this.source),new Promise((i,r)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{this.applyContentProtection(),this.timelineFragmentIds.length>0&&this.comms?.send("timeline_entries",this.timelineFragmentIds);const e=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,h.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),i()};t!==void 0?this.comms?.send("go_progression",t,e):e()})})})}setCSSProperties(t){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new n(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",t),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get isDestroyed(){return this.destroyed}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get atLeft(){return this.window.scrollX<5}get atRight(){return this.window.scrollX>this.window.document.scrollingElement.scrollWidth-this.window.innerWidth-5}get msg(){return this.comms}get ldr(){return this.loader}}export{y as FrameManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sML as c}from"
|
|
1
|
+
import{sML as c}from"@readium/helpers";var l=(o=>(o[o.Left=0]="Left",o[o.Center=1]="Center",o[o.Right=2]="Right",o))(l||{}),g=(o=>(o[o.Top=0]="Top",o[o.Middle=1]="Middle",o[o.Bottom=2]="Bottom",o))(g||{});class X{constructor(){this.outerWidth=0,this.outerHeight=0,this.HTML=document.documentElement,this.Head=document.head,this.Body=document.body}refreshOuterPixels(t){c.OS.iOS||(this.outerHeight=window.outerHeight-window.innerHeight,c.OS.Android&&c.UA.Chrome&&window.screen.height>window.innerHeight&&(this.outerHeight=(window.screen.height-window.innerHeight)/1.5),this.outerWidth=window.outerWidth-window.innerWidth)}getBibiEventCoord(t,s=0){const e={X:0,Y:0};return/^touch/.test(t.type)?(e.X=t.touches[s].screenX,e.Y=t.touches[s].screenY):(e.X=t.screenX,e.Y=t.screenY),(t.target.ownerDocument?.documentElement||t.target.documentElement)===this.HTML&&(e.X-=this.HTML.scrollLeft+this.Body.scrollLeft,e.Y-=this.HTML.scrollTop+this.Body.scrollTop),e.X-=this.outerWidth,e.Y-=this.outerHeight,e}getTouchDistance(t){if(t.touches.length!==2)return 0;const s=t.touches[0].screenX-this.outerWidth,e=t.touches[0].screenY-this.outerHeight,i=t.touches[1].screenX-this.outerWidth,r=t.touches[1].screenY-this.outerHeight;return Math.sqrt(Math.pow(i-s,2)+Math.pow(r-e,2))}getTouchCenter(t){if(t.touches.length!==2)return null;const s=this.HTML.scrollLeft+this.Body.scrollLeft,e=this.HTML.scrollTop+this.Body.scrollTop,i=t.touches[0].screenX-this.outerWidth-s,r=t.touches[0].screenY-this.outerHeight-e,h=t.touches[1].screenX-this.outerWidth-s,u=t.touches[1].screenY-this.outerHeight-e;return{X:(i+h)/2,Y:(r+u)/2}}getBibiEvent(t){if(!t)return{Coord:null,Division:null,Ratio:null,Target:null};const s=this.getBibiEventCoord(t);let e=.3;const i={X:s.X/window.innerWidth,Y:s.Y/window.innerHeight};let r,h,u,d;u=r=e,d=h=1-e;const n={X:null,Y:null};return i.X<u?n.X=0:d<i.X?n.X=2:n.X=1,i.Y<r?n.Y=0:h<i.Y?n.Y=2:n.Y=1,{Target:t.target,Coord:s,Ratio:i,Division:n}}}export{X as FXLCoordinator,l as HorizontalThird,g as VerticalThird};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fontSizeRangeConfig as a,fontWeightRangeConfig as s,fontWidthRangeConfig as g,TextAlignment as c}from"../../preferences/Types.js";import{ensureString as e,ensureBoolean as t,ensureNonNegative as n,ensureFilter as o,ensureValueInRange as r,withFallback as h,ensureEnumValue as p,ensureMoreThanOrEqual as m,ensureLessThanOrEqual as S,ensureExperiment as u}from"../../preferences/guards.js";import{sMLWithRequest as l}from"
|
|
1
|
+
import{fontSizeRangeConfig as a,fontWeightRangeConfig as s,fontWidthRangeConfig as g,TextAlignment as c}from"../../preferences/Types.js";import{ensureString as e,ensureBoolean as t,ensureNonNegative as n,ensureFilter as o,ensureValueInRange as r,withFallback as h,ensureEnumValue as p,ensureMoreThanOrEqual as m,ensureLessThanOrEqual as S,ensureExperiment as u}from"../../preferences/guards.js";import{sMLWithRequest as l}from"@readium/helpers";class O{constructor(i){this.backgroundColor=e(i.backgroundColor)||null,this.blendFilter=t(i.blendFilter)??!1,this.constraint=n(i.constraint)||0,this.columnCount=n(i.columnCount)||null,this.darkenFilter=o(i.darkenFilter)??!1,this.deprecatedFontSize=t(i.deprecatedFontSize),(this.deprecatedFontSize===!1||this.deprecatedFontSize===null)&&(this.deprecatedFontSize=!CSS.supports("zoom","1")),this.fontFamily=e(i.fontFamily)||null,this.fontSize=r(i.fontSize,a.range)||1,this.fontSizeNormalize=t(i.fontSizeNormalize)??!1,this.fontOpticalSizing=t(i.fontOpticalSizing)??null,this.fontWeight=r(i.fontWeight,s.range)||null,this.fontWidth=r(i.fontWidth,g.range)||null,this.hyphens=t(i.hyphens)??null,this.invertFilter=o(i.invertFilter)??!1,this.invertGaijiFilter=o(i.invertGaijiFilter)??!1,this.iOSPatch=i.iOSPatch===!1?!1:(l.OS.iOS||l.OS.iPadOS)&&l.iOSRequest==="mobile",this.iPadOSPatch=i.iPadOSPatch===!1?!1:l.OS.iPadOS&&l.iOSRequest==="desktop",this.letterSpacing=n(i.letterSpacing)||null,this.ligatures=t(i.ligatures)??null,this.lineHeight=n(i.lineHeight)||null,this.linkColor=e(i.linkColor)||null,this.noRuby=t(i.noRuby)??!1,this.pageGutter=h(n(i.pageGutter),20),this.paragraphIndent=n(i.paragraphIndent)??null,this.paragraphSpacing=n(i.paragraphSpacing)??null,this.scroll=t(i.scroll)??!1,this.scrollPaddingTop=n(i.scrollPaddingTop)??null,this.scrollPaddingBottom=n(i.scrollPaddingBottom)??null,this.scrollPaddingLeft=n(i.scrollPaddingLeft)??null,this.scrollPaddingRight=n(i.scrollPaddingRight)??null,this.selectionBackgroundColor=e(i.selectionBackgroundColor)||null,this.selectionTextColor=e(i.selectionTextColor)||null,this.textAlign=p(i.textAlign,c)||null,this.textColor=e(i.textColor)||null,this.textNormalization=t(i.textNormalization)??!1,this.visitedColor=e(i.visitedColor)||null,this.wordSpacing=n(i.wordSpacing)||null,this.optimalLineLength=n(i.optimalLineLength)||65,this.maximalLineLength=h(m(i.maximalLineLength,this.optimalLineLength),80),this.minimalLineLength=h(S(i.minimalLineLength,this.optimalLineLength),40),this.experiments=u(i.experiments)||null}}export{O as EpubDefaults};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sMLWithRequest as t}from"
|
|
1
|
+
import{sMLWithRequest as t}from"@readium/helpers";class a{constructor(i,o){this.backgroundColor=i.backgroundColor||o.backgroundColor||null,this.blendFilter=typeof i.blendFilter=="boolean"?i.blendFilter:o.blendFilter??null,this.columnCount=i.columnCount!==void 0?i.columnCount:o.columnCount!==void 0?o.columnCount:null,this.constraint=i.constraint||o.constraint,this.darkenFilter=typeof i.darkenFilter=="boolean"?i.darkenFilter:o.darkenFilter??null,this.deprecatedFontSize=typeof i.deprecatedFontSize=="boolean"?i.deprecatedFontSize:o.deprecatedFontSize??null,this.fontFamily=i.fontFamily||o.fontFamily||null,this.fontSize=i.fontSize!==void 0?i.fontSize:o.fontSize!==void 0?o.fontSize:null,this.fontSizeNormalize=typeof i.fontSizeNormalize=="boolean"?i.fontSizeNormalize:o.fontSizeNormalize??null,this.fontOpticalSizing=typeof i.fontOpticalSizing=="boolean"?i.fontOpticalSizing:o.fontOpticalSizing??null,this.fontWeight=i.fontWeight!==void 0?i.fontWeight:o.fontWeight!==void 0?o.fontWeight:null,this.fontWidth=i.fontWidth!==void 0?i.fontWidth:o.fontWidth!==void 0?o.fontWidth:null,this.hyphens=typeof i.hyphens=="boolean"?i.hyphens:o.hyphens??null,this.invertFilter=typeof i.invertFilter=="boolean"?i.invertFilter:o.invertFilter??null,this.invertGaijiFilter=typeof i.invertGaijiFilter=="boolean"?i.invertGaijiFilter:o.invertGaijiFilter??null,this.iOSPatch=this.deprecatedFontSize||i.iOSPatch===!1?!1:i.iOSPatch===!0?(t.OS.iOS||t.OS.iPadOS)&&t.iOSRequest==="mobile":o.iOSPatch,this.iPadOSPatch=this.deprecatedFontSize||i.iPadOSPatch===!1?!1:i.iPadOSPatch===!0?t.OS.iPadOS&&t.iOSRequest==="desktop":o.iPadOSPatch,this.letterSpacing=i.letterSpacing!==void 0?i.letterSpacing:o.letterSpacing!==void 0?o.letterSpacing:null,this.ligatures=typeof i.ligatures=="boolean"?i.ligatures:o.ligatures??null,this.lineHeight=i.lineHeight!==void 0?i.lineHeight:o.lineHeight!==void 0?o.lineHeight:null,this.linkColor=i.linkColor||o.linkColor||null,this.maximalLineLength=i.maximalLineLength===null?null:i.maximalLineLength||o.maximalLineLength||null,this.minimalLineLength=i.minimalLineLength===null?null:i.minimalLineLength||o.minimalLineLength||null,this.noRuby=typeof i.noRuby=="boolean"?i.noRuby:o.noRuby??null,this.optimalLineLength=i.optimalLineLength||o.optimalLineLength,this.pageGutter=i.pageGutter!==void 0?i.pageGutter:o.pageGutter!==void 0?o.pageGutter:null,this.paragraphIndent=i.paragraphIndent!==void 0?i.paragraphIndent:o.paragraphIndent!==void 0?o.paragraphIndent:null,this.paragraphSpacing=i.paragraphSpacing!==void 0?i.paragraphSpacing:o.paragraphSpacing!==void 0?o.paragraphSpacing:null,this.scroll=typeof i.scroll=="boolean"?i.scroll:o.scroll??null,this.scrollPaddingTop=i.scrollPaddingTop!==void 0?i.scrollPaddingTop:o.scrollPaddingTop!==void 0?o.scrollPaddingTop:null,this.scrollPaddingBottom=i.scrollPaddingBottom!==void 0?i.scrollPaddingBottom:o.scrollPaddingBottom!==void 0?o.scrollPaddingBottom:null,this.scrollPaddingLeft=i.scrollPaddingLeft!==void 0?i.scrollPaddingLeft:o.scrollPaddingLeft!==void 0?o.scrollPaddingLeft:null,this.scrollPaddingRight=i.scrollPaddingRight!==void 0?i.scrollPaddingRight:o.scrollPaddingRight!==void 0?o.scrollPaddingRight:null,this.selectionBackgroundColor=i.selectionBackgroundColor||o.selectionBackgroundColor||null,this.selectionTextColor=i.selectionTextColor||o.selectionTextColor||null,this.textAlign=i.textAlign||o.textAlign||null,this.textColor=i.textColor||o.textColor||null,this.textNormalization=typeof i.textNormalization=="boolean"?i.textNormalization:o.textNormalization??null,this.visitedColor=i.visitedColor||o.visitedColor||null,this.wordSpacing=i.wordSpacing!==void 0?i.wordSpacing:o.wordSpacing!==void 0?o.wordSpacing:null,this.experiments=o.experiments||null}}export{a as EpubSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sML as i}from"
|
|
1
|
+
import{sML as i}from"@readium/helpers";import{WorkerConsole as s}from"./utils/WorkerConsole.js";import{table as o,log as c,clear as l}from"./utils/console.js";import{isBrave as n}from"./utils/platform.js";import{match as h}from"./utils/match.js";class d{constructor(e={}){if(this.isOpen=!1,this.checkCount=0,this.maxChecks=10,this.maxPrintTime=0,this.largeObjectArray=null,this.options={onDetected:e.onDetected||(()=>{}),onClosed:e.onClosed||(()=>{}),interval:e.interval||1e3,enableDebuggerDetection:e.enableDebuggerDetection||!1},!i.UA.Firefox)try{const t=new Blob([s.workerScript],{type:"application/javascript"}),r=URL.createObjectURL(t),a=new Worker(r);this.workerConsole=new s(a,r)}catch(t){console.warn("Failed to create Web Worker for DevTools detection:",t)}this.startDetection()}createLargeObjectArray(){const e={};for(let r=0;r<500;r++)e[`${r}`]=`${r}`;const t=[];for(let r=0;r<50;r++)t.push(e);return t}getLargeObjectArray(){return this.largeObjectArray===null&&(this.largeObjectArray=this.createLargeObjectArray()),this.largeObjectArray}async calcTablePrintTime(){const e=this.getLargeObjectArray();if(this.workerConsole)try{return(await this.workerConsole.table(e)).time}catch{const r=performance.now();return o(e),performance.now()-r}else{const t=performance.now();return o(e),performance.now()-t}}async calcLogPrintTime(){const e=this.getLargeObjectArray();if(this.workerConsole)return(await this.workerConsole.log(e)).time;{const t=performance.now();return c(e),performance.now()-t}}isPerformanceDetectionEnabled(){return h({includes:[()=>!!i.UA.Chrome,()=>!!i.UA.Chromium,()=>!!i.UA.Safari,()=>!!i.UA.Firefox],excludes:[]})}isDebuggerDetectionEnabled(){return this.options.enableDebuggerDetection}async checkPerformanceBased(){if(!this.isPerformanceDetectionEnabled())return!1;const e=await this.calcTablePrintTime(),t=Math.max(await this.calcLogPrintTime(),await this.calcLogPrintTime());return this.maxPrintTime=Math.max(this.maxPrintTime,t),this.workerConsole?await this.workerConsole.clear():l(),e===0?!1:this.maxPrintTime===0?!!await n():e>this.maxPrintTime*10}async checkDebuggerBased(){if(!this.isDebuggerDetectionEnabled()||await n())return!1;const e=performance.now();try{(()=>{}).constructor("debugger")()}catch{debugger}return performance.now()-e>100}async detectDevTools(){return await this.checkPerformanceBased()?!0:this.options.enableDebuggerDetection&&this.checkCount>=this.maxChecks?await this.checkDebuggerBased():!1}startDetection(){this.intervalId=window.setInterval(async()=>{this.checkCount++;const e=await this.detectDevTools();e!==this.isOpen&&(this.isOpen=e,e?this.options.onDetected():this.options.onClosed()),this.checkCount>this.maxChecks*2&&(this.checkCount=0)},this.options.interval),window.addEventListener("beforeunload",()=>this.destroy())}isDevToolsOpen(){return this.isOpen}async checkNow(){const e=this.isOpen;return this.isOpen=await this.detectDevTools(),this.isOpen!==e&&(this.isOpen?this.options.onDetected():this.options.onClosed()),this.isOpen}destroy(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.workerConsole&&(this.workerConsole.destroy(),this.workerConsole=void 0),this.isOpen=!1,this.checkCount=0}}export{d as DevToolsDetector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Loader as o}from"@readium/navigator-html-injectables";import{FrameComms as n}from"../epub/frame/FrameComms.js";import{sML as h}from"
|
|
1
|
+
import{Loader as o}from"@readium/navigator-html-injectables";import{FrameComms as n}from"../epub/frame/FrameComms.js";import{sML as h}from"@readium/helpers";import{KeyboardConditionBridge as m}from"../peripherals/KeyboardConditionBridge.js";class y{constructor(t,i={},r=[],e=[]){this.timelineFragmentIds=e,this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.frame.style.backgroundColor="#FFFFFF",this.source=t,this.contentProtectionConfig={...i},this.keyboardPeripheralsConfig=[...r]}async load(t=[]){return new Promise((i,r)=>{if(this.loader){const e=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...t].sort().join("|")){try{i(e)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new o(e,t),this.currModules=t,this.comms=void 0;try{i(e)}catch{}return}this.frame.onload=()=>{const e=this.frame.contentWindow;this.loader=new o(e,t),this.currModules=t;try{i(e)}catch{}},this.frame.onerror=e=>{try{r(e)}catch{}},this.frame.contentWindow.location.replace(this.source)})}applyContentProtection(){this.comms||this.comms.resume(),this.comms.send("peripherals_protection",this.contentProtectionConfig),this.keyboardPeripheralsConfig&&this.keyboardPeripheralsConfig.length>0&&(this.conditionBridge?.destroy(),this.conditionBridge=new m(this.keyboardPeripheralsConfig,t=>{t.length>0&&this.comms.send("keyboard_peripherals",t)}),this.conditionBridge.setup()),this.contentProtectionConfig.monitorScrollingExperimental&&this.comms.send("scroll_protection",{}),this.contentProtectionConfig.protectPrinting?.disable&&this.comms.send("print_protection",this.contentProtectionConfig.protectPrinting)}async destroy(){this.conditionBridge?.destroy(),await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((t,i)=>{this.comms?.send("unfocus",void 0,r=>{this.comms?.halt(),t()})});this.comms?.halt()}}async show(t){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new n(this.frame.contentWindow,this.source),new Promise((i,r)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{this.applyContentProtection(),this.timelineFragmentIds.length>0&&this.comms?.send("timeline_entries",this.timelineFragmentIds);const e=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,h.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),i()};t!==void 0?this.comms?.send("go_progression",t,e):e()})})})}setCSSProperties(t){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new n(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",t),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get msg(){return this.comms}get ldr(){return this.loader}}export{y as WebPubFrameManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fontWeightRangeConfig as
|
|
1
|
+
import{fontWeightRangeConfig as a,zoomRangeConfig as o,TextAlignment as h}from"../../preferences/Types.js";import{ensureString as l,ensureValueInRange as r,ensureBoolean as t,ensureNonNegative as n,ensureEnumValue as g,ensureExperiment as s}from"../../preferences/guards.js";import{sMLWithRequest as e}from"@readium/helpers";class c{constructor(i){this.fontFamily=l(i.fontFamily)||null,this.fontWeight=r(i.fontWeight,a.range)||null,this.hyphens=t(i.hyphens)??null,this.iOSPatch=i.iOSPatch===!1?!1:(e.OS.iOS||e.OS.iPadOS)&&e.iOSRequest==="mobile",this.iPadOSPatch=i.iPadOSPatch===!1?!1:e.OS.iPadOS&&e.iOSRequest==="desktop",this.letterSpacing=n(i.letterSpacing)||null,this.ligatures=t(i.ligatures)??null,this.lineHeight=n(i.lineHeight)||null,this.noRuby=t(i.noRuby)??!1,this.paragraphIndent=n(i.paragraphIndent)??null,this.paragraphSpacing=n(i.paragraphSpacing)??null,this.textAlign=g(i.textAlign,h)||null,this.textNormalization=t(i.textNormalization)??!1,this.wordSpacing=n(i.wordSpacing)||null,this.zoom=r(i.zoom,o.range)||1,this.experiments=s(i.experiments)??null}}export{c as WebPubDefaults};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sMLWithRequest as a}from"
|
|
1
|
+
import{sMLWithRequest as a}from"@readium/helpers";class o{constructor(i,t,h){this.fontFamily=null,this.fontWeight=null,this.hyphens=null,this.iOSPatch=null,this.iPadOSPatch=null,this.letterSpacing=null,this.ligatures=null,this.lineHeight=null,this.noRuby=null,this.paragraphIndent=null,this.paragraphSpacing=null,this.textAlign=null,this.textNormalization=null,this.wordSpacing=null,h&&(this.fontFamily=i.fontFamily||t.fontFamily||null,this.fontWeight=i.fontWeight!==void 0?i.fontWeight:t.fontWeight!==void 0?t.fontWeight:null,this.hyphens=typeof i.hyphens=="boolean"?i.hyphens:t.hyphens??null,this.iOSPatch=i.iOSPatch===!1?!1:i.iOSPatch===!0?(a.OS.iOS||a.OS.iPadOS)&&a.iOSRequest==="mobile":t.iOSPatch,this.iPadOSPatch=i.iPadOSPatch===!1?!1:i.iPadOSPatch===!0?a.OS.iPadOS&&a.iOSRequest==="desktop":t.iPadOSPatch,this.letterSpacing=i.letterSpacing!==void 0?i.letterSpacing:t.letterSpacing!==void 0?t.letterSpacing:null,this.ligatures=typeof i.ligatures=="boolean"?i.ligatures:t.ligatures??null,this.lineHeight=i.lineHeight!==void 0?i.lineHeight:t.lineHeight!==void 0?t.lineHeight:null,this.noRuby=typeof i.noRuby=="boolean"?i.noRuby:t.noRuby??null,this.paragraphIndent=i.paragraphIndent!==void 0?i.paragraphIndent:t.paragraphIndent!==void 0?t.paragraphIndent:null,this.paragraphSpacing=i.paragraphSpacing!==void 0?i.paragraphSpacing:t.paragraphSpacing!==void 0?t.paragraphSpacing:null,this.textAlign=i.textAlign||t.textAlign||null,this.textNormalization=typeof i.textNormalization=="boolean"?i.textNormalization:t.textNormalization??null,this.wordSpacing=i.wordSpacing!==void 0?i.wordSpacing:t.wordSpacing!==void 0?t.wordSpacing:null),this.zoom=i.zoom!==void 0?i.zoom:t.zoom!==void 0?t.zoom:null,this.experiments=t.experiments||null}}export{o as WebPubSettings};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readium/navigator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Next generation SDK for publications in Web Apps",
|
|
6
6
|
"author": "readium",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"node": ">=18"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@readium/
|
|
48
|
-
"@readium/navigator-html-injectables": "2.
|
|
49
|
-
"@readium/shared": "2.
|
|
50
|
-
"@readium/
|
|
47
|
+
"@readium/helpers": "1.1.0",
|
|
48
|
+
"@readium/navigator-html-injectables": "2.7.0",
|
|
49
|
+
"@readium/shared": "2.5.0",
|
|
50
|
+
"@readium/decorator": "1.1.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@readium/css": "^2.0.5",
|
package/dist/helpers/dist/sML.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const O=()=>typeof navigator>"u"?"":navigator.userAgent||"",S=()=>typeof navigator>"u"?void 0:navigator.userAgentData||void 0;class h{constructor(){const n=S(),o=O(),d=t=>(typeof t=="string"||typeof t=="number")&&t?String(t).replace(/_/g,".").split(".").map(s=>parseInt(s)||0):[],i=(t="")=>{if(!t)return[];const s=new RegExp("^.*"+t+"[ :\\/]?(\\d+([\\._]\\d+)*).*$");return s.test(o)?d(o.replace(s,"$1")):[]};this.OS=(t=>(/(macOS|Mac OS X)/.test(o)?(/\(iP(hone|od touch);/.test(o)&&(t.iOS=i("CPU (?:iPhone )?OS ")),/\(iPad;/.test(o)?t.iOS=t.iPadOS=i("CPU (?:iPhone )?OS "):/(macOS|Mac OS X) \d/.test(o)&&(document.ontouchend!==void 0?t.iOS=t.iPadOS=i():t.macOS=i("(?:macOS|Mac OS X) "))):/Windows( NT)? \d/.test(o)?t.Windows=(s=>s[0]!==6||!s[1]?s:s[1]===1?[7]:s[1]===2?[8]:[8,1])(i("Windows(?: NT)?")):/Android \d/.test(o)?t.Android=i("Android"):/CrOS/.test(o)?t.ChromeOS=i():/X11;/.test(o)&&(t.Linux=i()),t))({}),n&&n.getHighEntropyValues(["architecture","model","platform","platformVersion","uaFullVersion"]).then(t=>(s=>{const e=t.platform,r=t.platformVersion;if(!(!e||!r)){if(/^i(OS|P(hone|od touch))$/.test(e))s.iOS=d(r);else if(/^iPad(OS)?$/.test(e))s.iOS=s.iPadOS=d(r);else if(/^(macOS|(Mac )?OS X|Mac(Intel)?)$/.test(e))document.ontouchend!==void 0?s.iOS=s.iPadOS=d():s.macOS=d(r);else if(/^(Microsoft )?Windows$/.test(e))s.Windows=d(r);else if(/^(Google )?Android$/.test(e))s.Android=d(r);else if(/^((Google )?Chrome OS|CrOS)$/.test(e))s.ChromeOS=d(r);else if(/^(Linux|Ubuntu|X11)$/.test(e))s.Linux=d(r);else return;Object.keys(this.OS).forEach(a=>delete this.OS[a]),Object.assign(this.OS,s)}})({})),this.UA=(t=>{let s=!1;if(n&&Array.isArray(n.brands)){const e=n.brands.reduce((r,a)=>(r[a.brand]=[a.version*1],r),{});e["Google Chrome"]?(s=!0,t.Blink=t.Chromium=e.Chromium||[],t.Chrome=e["Google Chrome"]):e["Microsoft Edge"]?(s=!0,t.Blink=t.Chromium=e.Chromium||[],t.Edge=e["Microsoft Edge"]):e.Opera&&(s=!0,t.Blink=t.Chromium=e.Chromium||[],t.Opera=e.Opera)}return s||(/ Gecko\/\d/.test(o)?(t.Gecko=i("rv"),/ Waterfox\/\d/.test(o)?t.Waterfox=i("Waterfox"):/ Firefox\/\d/.test(o)&&(t.Firefox=i("Firefox"))):/ Edge\/\d/.test(o)?(t.EdgeHTML=i("Edge"),t.Edge=t.EdgeHTML):/ Chrom(ium|e)\/\d/.test(o)?(t.Blink=t.Chromium=(e=>e[0]?e:i("Chrome"))(i("Chromium")),/ EdgA?\/\d/.test(o)?t.Edge=(e=>e[0]?e:i("Edg"))(i("EdgA")):/ OPR\/\d/.test(o)?t.Opera=i("OPR"):/ Vivaldi\/\d/.test(o)?t.Vivaldi=i("Vivaldi"):/ Silk\/\d/.test(o)?t.Silk=i("Silk"):/ UCBrowser\/\d/.test(o)?t.UCBrowser=i("UCBrowser"):/ Phoebe\/\d/.test(o)?t.Phoebe=i("Phoebe"):t.Chrome=(e=>e[0]?e:t.Chromium)(i("Chrome"))):/ AppleWebKit\/\d/.test(o)?(t.WebKit=i("AppleWebKit"),/ CriOS \d/.test(o)?t.Chrome=i("CriOS"):/ FxiOS \d/.test(o)?t.Firefox=i("FxiOS"):/ EdgiOS\/\d/.test(o)?t.Edge=i("EdgiOS"):/ Version\/\d/.test(o)&&(t.Safari=i("Version"))):/ Trident\/\d/.test(o)&&(t.Trident=i("Trident"),t.InternetExplorer=(e=>e[0]?e:i("MSIE"))(i("rv")))),/[\[; ]FB(AN|_IAB)\//.test(o)&&(t.Facebook=i("FBAV")),/ Line\/\d/.test(o)&&(t.LINE=i("Line")),t})({}),this.Env={get:()=>[this.OS,this.UA].reduce((t,s)=>{for(const e in s)s[e]&&t.push(e);return t},[])}}}class u extends h{get iOSRequest(){const n=S(),o=O();if(this.OS.iOS&&!this.OS.iPadOS)return"mobile";if(this.OS.iPadOS)return/\(iPad;/.test(o)||n&&/^iPad(OS)?$/.test(n.platform)?"mobile":"desktop"}}const l=new h,c=new u;export{l as sML,c as sMLWithRequest};
|