@netless/app-presentation 0.1.13-beta.1 → 0.1.13-beta.2
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/index.d.ts +70 -1
- package/dist/index.global.js +148 -40
- package/dist/index.js +148 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/app-presentation.ts +138 -41
- package/src/presentation.ts +18 -1
- package/src/runtime-lifecycle.ts +24 -0
- package/src/style.scss +7 -1
package/dist/index.mjs
CHANGED
|
@@ -1313,10 +1313,7 @@ var Presentation = class {
|
|
|
1313
1313
|
if (this.initialized)
|
|
1314
1314
|
return;
|
|
1315
1315
|
this.initialized = true;
|
|
1316
|
-
this.dispose.add(() =>
|
|
1317
|
-
var _a2;
|
|
1318
|
-
return (_a2 = this.previewLazyload) == null ? void 0 : _a2.destroy();
|
|
1319
|
-
});
|
|
1316
|
+
this.dispose.add(() => this.destroyPreviewLazyload());
|
|
1320
1317
|
this.contentDOM.classList.toggle(this.c("readonly"), this.readonly);
|
|
1321
1318
|
this.dom.appendChild(this.contentDOM);
|
|
1322
1319
|
const previewMask = this.contentDOM.appendChild(document.createElement("div"));
|
|
@@ -1469,6 +1466,17 @@ var Presentation = class {
|
|
|
1469
1466
|
}
|
|
1470
1467
|
}
|
|
1471
1468
|
}
|
|
1469
|
+
/** Release preview images while this presentation stays in the runtime cache. */
|
|
1470
|
+
suspendPreviewResources() {
|
|
1471
|
+
this.togglePreview(false);
|
|
1472
|
+
this.destroyPreviewLazyload();
|
|
1473
|
+
this.previewDOM.querySelectorAll("img").forEach((img) => {
|
|
1474
|
+
img.removeAttribute("src");
|
|
1475
|
+
img.removeAttribute("srcset");
|
|
1476
|
+
img.removeAttribute("sizes");
|
|
1477
|
+
LazyLoad.resetStatus(img);
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1472
1480
|
// [origin] means the cause:
|
|
1473
1481
|
// - navigation: user clicked on the left / right button on footer
|
|
1474
1482
|
// - input: user filled the bottom-right page number input box
|
|
@@ -1503,6 +1511,11 @@ var Presentation = class {
|
|
|
1503
1511
|
return src;
|
|
1504
1512
|
}
|
|
1505
1513
|
}
|
|
1514
|
+
destroyPreviewLazyload() {
|
|
1515
|
+
var _a;
|
|
1516
|
+
(_a = this.previewLazyload) == null ? void 0 : _a.destroy();
|
|
1517
|
+
this.previewLazyload = null;
|
|
1518
|
+
}
|
|
1506
1519
|
c(className) {
|
|
1507
1520
|
return `${this.namespace}-${className}`;
|
|
1508
1521
|
}
|
|
@@ -1515,7 +1528,7 @@ var Presentation = class {
|
|
|
1515
1528
|
};
|
|
1516
1529
|
|
|
1517
1530
|
// src/style.scss?inline
|
|
1518
|
-
var style_default = ".netless-app-presentation{height:100%;display:flex;flex-flow:column nowrap}.netless-app-presentation-content{position:relative;height:100%;overflow:hidden}.netless-app-presentation-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-presentation-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:#ededf0e6;box-shadow:inset -1px 0 #0000001c;transition:transform .4s;overflow:auto;overflow-y:scroll}.netless-app-presentation-preview-active .netless-app-presentation-preview-mask{display:block}.netless-app-presentation-preview-active .netless-app-presentation-preview{transform:translate(0)}.netless-app-presentation-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:#0000;outline:none;border:7px solid rgba(0,0,0,0);border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-presentation-preview-page:hover,.netless-app-presentation-preview-page.netless-app-presentation-preview-page-active{border-color:#444e601a}.netless-app-presentation-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-presentation-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-presentation-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-presentation-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:#f9f9fce6;transition:opacity .4s}.netless-app-presentation-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:#0000;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-footer-btn:hover{background:#ededf0e6}@media (hover: none){.netless-app-presentation-footer-btn:hover{background:#0000!important}}.netless-app-presentation-footer-btn>svg{width:100%;height:100%}.netless-app-presentation-footer-btn>svg:nth-of-type(2){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-presentation-footer-btn~.netless-app-presentation-footer-btn{margin-left:15px}.netless-app-presentation-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-presentation-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-presentation-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:#0000;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-page-number-input:hover,.netless-app-presentation-page-number-input:focus,.netless-app-presentation-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-presentation-readonly.netless-app-presentation-footer{display:none}.netless-app-presentation-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-presentation-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-presentation-image>img{max-width:100%;max-height:100%;object-fit:contain}.telebox-color-scheme-dark .netless-app-presentation-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-presentation-page-number-input:active,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:focus,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-presentation-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-presentation-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-presentation-preview{background:#323232e6}.netless-app-presentation-scrollbar-container{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:101}.netless-app-presentation-scrollbar-container-x,.netless-app-presentation-scrollbar-container-y{position:absolute;pointer-events:none;display:flex;justify-content:center;box-sizing:border-box;padding:0}.netless-app-presentation-scrollbar-container-x{bottom:0;left:0;height:6px;width:100%;padding-right:6px}.netless-app-presentation-scrollbar-container-y{top:0;right:0;width:6px;height:100%;flex-direction:column;padding-bottom:6px}.netless-app-presentation-scrollbar-x,.netless-app-presentation-scrollbar-y{border-radius:2px;background-color:#1b1f4d4d;pointer-events:auto;cursor:default}.netless-app-presentation-scrollbar-x{height:6px}.netless-app-presentation-scrollbar-y{width:6px}";
|
|
1531
|
+
var style_default = ".netless-app-presentation{height:100%;display:flex;flex-flow:column nowrap}.netless-app-presentation-content{position:relative;height:100%;overflow:hidden}.netless-app-presentation-background-suspended .background{display:none!important}.netless-app-presentation-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-presentation-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:#ededf0e6;box-shadow:inset -1px 0 #0000001c;transition:transform .4s;overflow:auto;overflow-y:scroll}.netless-app-presentation-preview-active .netless-app-presentation-preview-mask{display:block}.netless-app-presentation-preview-active .netless-app-presentation-preview{transform:translate(0)}.netless-app-presentation-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:#0000;outline:none;border:7px solid rgba(0,0,0,0);border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-presentation-preview-page:hover,.netless-app-presentation-preview-page.netless-app-presentation-preview-page-active{border-color:#444e601a}.netless-app-presentation-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-presentation-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-presentation-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-presentation-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:#f9f9fce6;transition:opacity .4s}.netless-app-presentation-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:#0000;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-footer-btn:hover{background:#ededf0e6}@media (hover: none){.netless-app-presentation-footer-btn:hover{background:#0000!important}}.netless-app-presentation-footer-btn>svg{width:100%;height:100%}.netless-app-presentation-footer-btn>svg:nth-of-type(2){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-presentation-footer-btn~.netless-app-presentation-footer-btn{margin-left:15px}.netless-app-presentation-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-presentation-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-presentation-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:#0000;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-page-number-input:hover,.netless-app-presentation-page-number-input:focus,.netless-app-presentation-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-presentation-readonly.netless-app-presentation-footer{display:none}.netless-app-presentation-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-presentation-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-presentation-image>img{max-width:100%;max-height:100%;object-fit:contain}.telebox-color-scheme-dark .netless-app-presentation-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-presentation-page-number-input:active,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:focus,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-presentation-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-presentation-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-presentation-preview{background:#323232e6}.netless-app-presentation-scrollbar-container{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:101}.netless-app-presentation-scrollbar-container-x,.netless-app-presentation-scrollbar-container-y{position:absolute;pointer-events:none;display:flex;justify-content:center;box-sizing:border-box;padding:0}.netless-app-presentation-scrollbar-container-x{bottom:0;left:0;height:6px;width:100%;padding-right:6px}.netless-app-presentation-scrollbar-container-y{top:0;right:0;width:6px;height:100%;flex-direction:column;padding-bottom:6px}.netless-app-presentation-scrollbar-x,.netless-app-presentation-scrollbar-y{border-radius:2px;background-color:#1b1f4d4d;pointer-events:auto;cursor:default}.netless-app-presentation-scrollbar-x{height:6px}.netless-app-presentation-scrollbar-y{width:6px}";
|
|
1519
1532
|
|
|
1520
1533
|
// src/store.ts
|
|
1521
1534
|
function noop() {
|
|
@@ -1961,6 +1974,23 @@ function cameraToSharedViewport(camera, viewSize, referenceSize) {
|
|
|
1961
1974
|
};
|
|
1962
1975
|
}
|
|
1963
1976
|
|
|
1977
|
+
// src/runtime-lifecycle.ts
|
|
1978
|
+
var createPresentationRuntimeTeardown = (box, dispose2) => {
|
|
1979
|
+
let tornDown = false;
|
|
1980
|
+
return () => {
|
|
1981
|
+
if (tornDown)
|
|
1982
|
+
return;
|
|
1983
|
+
tornDown = true;
|
|
1984
|
+
try {
|
|
1985
|
+
dispose2();
|
|
1986
|
+
} finally {
|
|
1987
|
+
box.unmountContent();
|
|
1988
|
+
box.unmountFooter();
|
|
1989
|
+
box.unmountStyles();
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
};
|
|
1993
|
+
|
|
1964
1994
|
// src/app-presentation.ts
|
|
1965
1995
|
var import_debounce2 = __toESM(require_debounce());
|
|
1966
1996
|
var emptySceneName = "$$empty$$";
|
|
@@ -1977,6 +2007,10 @@ var findBackgroundImage = (view) => {
|
|
|
1977
2007
|
return container.querySelector('img[alt="background"]');
|
|
1978
2008
|
};
|
|
1979
2009
|
var isBlurDegradationAllowed = (context) => {
|
|
2010
|
+
var _a;
|
|
2011
|
+
if (((_a = context.getWindowManager()) == null ? void 0 : _a.lazySetupInMaximizedMode) !== true) {
|
|
2012
|
+
return false;
|
|
2013
|
+
}
|
|
1980
2014
|
const boxStatus = context.getBoxStatus();
|
|
1981
2015
|
if (boxStatus) {
|
|
1982
2016
|
return boxStatus !== "normal";
|
|
@@ -2022,17 +2056,55 @@ var resolveImageUrl = (url) => {
|
|
|
2022
2056
|
return url;
|
|
2023
2057
|
}
|
|
2024
2058
|
};
|
|
2059
|
+
var TRANSPARENT_BACKGROUND = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
|
|
2060
|
+
var BACKGROUND_SUSPENDED_CLASS = "netless-app-presentation-background-suspended";
|
|
2061
|
+
var hasUsableThumbnail = (page) => {
|
|
2062
|
+
const thumbnailURL = page.thumbnail;
|
|
2063
|
+
if (!thumbnailURL)
|
|
2064
|
+
return false;
|
|
2065
|
+
try {
|
|
2066
|
+
const source = new URL(page.src, window.location.href);
|
|
2067
|
+
const thumbnail = new URL(thumbnailURL, window.location.href);
|
|
2068
|
+
const sameResourcePath = source.origin === thumbnail.origin && source.pathname === thumbnail.pathname;
|
|
2069
|
+
if (/\.gif$/i.test(source.pathname) && sameResourcePath)
|
|
2070
|
+
return false;
|
|
2071
|
+
} catch (e) {
|
|
2072
|
+
if (/\.gif(?:$|[?#])/i.test(page.src))
|
|
2073
|
+
return false;
|
|
2074
|
+
}
|
|
2075
|
+
return resolveImageUrl(thumbnailURL) !== resolveImageUrl(page.src);
|
|
2076
|
+
};
|
|
2025
2077
|
var setupBlurThumbnailDegradation = (config) => {
|
|
2026
2078
|
const { context, view, pages, pageIndex$, app, dispose: dispose2 } = config;
|
|
2079
|
+
const box = context.getBox();
|
|
2080
|
+
const boxBlurClass = box.wrapClassName("blur");
|
|
2027
2081
|
let blurEpisode = false;
|
|
2028
2082
|
let reDegradeEnabled = false;
|
|
2083
|
+
let boxBlurred = box.$box.classList.contains(boxBlurClass);
|
|
2084
|
+
const setBackgroundSuspended = (suspended) => {
|
|
2085
|
+
app.whiteboardDOM.classList.toggle(
|
|
2086
|
+
BACKGROUND_SUSPENDED_CLASS,
|
|
2087
|
+
suspended
|
|
2088
|
+
);
|
|
2089
|
+
};
|
|
2029
2090
|
const degrade = () => {
|
|
2030
2091
|
const page = pages[pageIndex$.value];
|
|
2031
|
-
if (!
|
|
2092
|
+
if (!page)
|
|
2032
2093
|
return;
|
|
2094
|
+
const thumbnailURL = page.thumbnail;
|
|
2033
2095
|
const img = findBackgroundImage(view);
|
|
2034
|
-
if (
|
|
2035
|
-
|
|
2096
|
+
if (!thumbnailURL || !hasUsableThumbnail(page)) {
|
|
2097
|
+
if (boxBlurred) {
|
|
2098
|
+
setBackgroundSuspended(true);
|
|
2099
|
+
if (img && resolveImageUrl(img.src) !== resolveImageUrl(TRANSPARENT_BACKGROUND)) {
|
|
2100
|
+
img.src = TRANSPARENT_BACKGROUND;
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
setBackgroundSuspended(false);
|
|
2106
|
+
if (img && resolveImageUrl(img.src) !== resolveImageUrl(thumbnailURL)) {
|
|
2107
|
+
img.src = thumbnailURL;
|
|
2036
2108
|
}
|
|
2037
2109
|
};
|
|
2038
2110
|
const restore2 = () => {
|
|
@@ -2041,6 +2113,24 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2041
2113
|
if (page && img && resolveImageUrl(img.src) !== resolveImageUrl(page.src)) {
|
|
2042
2114
|
img.src = page.src;
|
|
2043
2115
|
}
|
|
2116
|
+
setBackgroundSuspended(false);
|
|
2117
|
+
};
|
|
2118
|
+
const suspendCachedResources = () => {
|
|
2119
|
+
if (!blurEpisode || !boxBlurred)
|
|
2120
|
+
return;
|
|
2121
|
+
app.suspendPreviewResources();
|
|
2122
|
+
const page = pages[pageIndex$.value];
|
|
2123
|
+
if (!page || !hasUsableThumbnail(page) || reDegradeEnabled) {
|
|
2124
|
+
degrade();
|
|
2125
|
+
}
|
|
2126
|
+
};
|
|
2127
|
+
const restoreFocusedResources = () => {
|
|
2128
|
+
if (!blurEpisode)
|
|
2129
|
+
return;
|
|
2130
|
+
blurEpisode = false;
|
|
2131
|
+
reDegradeEnabled = false;
|
|
2132
|
+
restore2();
|
|
2133
|
+
app.preload.resume(pageIndex$.value);
|
|
2044
2134
|
};
|
|
2045
2135
|
const isBackgroundImg = (target) => {
|
|
2046
2136
|
var _a;
|
|
@@ -2049,28 +2139,29 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2049
2139
|
el && el.tagName === "IMG" && ((_a = el.matches) == null ? void 0 : _a.call(el, 'img[alt="background"]'))
|
|
2050
2140
|
);
|
|
2051
2141
|
};
|
|
2142
|
+
const ownsTarget = (target) => {
|
|
2143
|
+
if (!isBackgroundImg(target))
|
|
2144
|
+
return false;
|
|
2145
|
+
const el = view.divElement;
|
|
2146
|
+
return !!(el && el.contains(target));
|
|
2147
|
+
};
|
|
2052
2148
|
const onImgLoad = (ev) => {
|
|
2053
2149
|
if (!blurEpisode || !reDegradeEnabled)
|
|
2054
2150
|
return;
|
|
2055
|
-
if (!
|
|
2151
|
+
if (!ownsTarget(ev.target))
|
|
2056
2152
|
return;
|
|
2057
2153
|
degrade();
|
|
2058
2154
|
};
|
|
2059
2155
|
const onImgError = (ev) => {
|
|
2060
2156
|
if (!blurEpisode || !reDegradeEnabled)
|
|
2061
2157
|
return;
|
|
2062
|
-
if (!
|
|
2158
|
+
if (!ownsTarget(ev.target))
|
|
2063
2159
|
return;
|
|
2064
2160
|
reDegradeEnabled = false;
|
|
2065
2161
|
};
|
|
2066
2162
|
const offFocus = context.emitter.on("focus", (isFocused) => {
|
|
2067
2163
|
if (isFocused) {
|
|
2068
|
-
|
|
2069
|
-
blurEpisode = false;
|
|
2070
|
-
reDegradeEnabled = false;
|
|
2071
|
-
restore2();
|
|
2072
|
-
app.preload.resume(pageIndex$.value);
|
|
2073
|
-
}
|
|
2164
|
+
restoreFocusedResources();
|
|
2074
2165
|
} else {
|
|
2075
2166
|
if (!isBlurDegradationAllowed(context))
|
|
2076
2167
|
return;
|
|
@@ -2078,29 +2169,41 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2078
2169
|
reDegradeEnabled = true;
|
|
2079
2170
|
degrade();
|
|
2080
2171
|
app.preload.pause();
|
|
2172
|
+
suspendCachedResources();
|
|
2081
2173
|
}
|
|
2082
2174
|
});
|
|
2083
2175
|
dispose2.add(offFocus);
|
|
2084
|
-
const
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
);
|
|
2176
|
+
const updateBoxBlurred = (blurred) => {
|
|
2177
|
+
if (boxBlurred === blurred)
|
|
2178
|
+
return;
|
|
2179
|
+
boxBlurred = blurred;
|
|
2180
|
+
if (blurred)
|
|
2181
|
+
suspendCachedResources();
|
|
2182
|
+
else
|
|
2183
|
+
restoreFocusedResources();
|
|
2184
|
+
};
|
|
2185
|
+
const onBoxBlur = () => updateBoxBlurred(true);
|
|
2186
|
+
const onBoxFocus = () => updateBoxBlurred(false);
|
|
2187
|
+
box.events.on("blur", onBoxBlur);
|
|
2188
|
+
box.events.on("focus", onBoxFocus);
|
|
2189
|
+
dispose2.add(() => {
|
|
2190
|
+
box.events.off("blur", onBoxBlur);
|
|
2191
|
+
box.events.off("focus", onBoxFocus);
|
|
2192
|
+
});
|
|
2193
|
+
const boxClassObserver = new MutationObserver(() => {
|
|
2194
|
+
updateBoxBlurred(box.$box.classList.contains(boxBlurClass));
|
|
2195
|
+
});
|
|
2196
|
+
boxClassObserver.observe(box.$box, {
|
|
2197
|
+
attributes: true,
|
|
2198
|
+
attributeFilter: ["class"]
|
|
2199
|
+
});
|
|
2200
|
+
dispose2.add(() => boxClassObserver.disconnect());
|
|
2201
|
+
document.addEventListener("load", onImgLoad, true);
|
|
2202
|
+
document.addEventListener("error", onImgError, true);
|
|
2203
|
+
dispose2.add(() => {
|
|
2204
|
+
document.removeEventListener("load", onImgLoad, true);
|
|
2205
|
+
document.removeEventListener("error", onImgError, true);
|
|
2206
|
+
});
|
|
2104
2207
|
};
|
|
2105
2208
|
var createLogger = (room) => {
|
|
2106
2209
|
if (room && room.logger) {
|
|
@@ -2523,7 +2626,7 @@ var NetlessAppPresentation = {
|
|
|
2523
2626
|
options.useClipView
|
|
2524
2627
|
)
|
|
2525
2628
|
);
|
|
2526
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.13-beta.
|
|
2629
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.13-beta.2";
|
|
2527
2630
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
2528
2631
|
app.log = log;
|
|
2529
2632
|
app.warn = warn;
|
|
@@ -2765,6 +2868,10 @@ var NetlessAppPresentation = {
|
|
|
2765
2868
|
};
|
|
2766
2869
|
let disposed = false;
|
|
2767
2870
|
let offDestroy;
|
|
2871
|
+
const teardownRuntime = createPresentationRuntimeTeardown(
|
|
2872
|
+
box,
|
|
2873
|
+
dispose2
|
|
2874
|
+
);
|
|
2768
2875
|
const teardown = () => {
|
|
2769
2876
|
if (disposed)
|
|
2770
2877
|
return;
|
|
@@ -2772,7 +2879,7 @@ var NetlessAppPresentation = {
|
|
|
2772
2879
|
const removeDestroy = offDestroy;
|
|
2773
2880
|
offDestroy = void 0;
|
|
2774
2881
|
removeDestroy == null ? void 0 : removeDestroy();
|
|
2775
|
-
|
|
2882
|
+
teardownRuntime();
|
|
2776
2883
|
};
|
|
2777
2884
|
offDestroy = context.emitter.on("destroy", teardown);
|
|
2778
2885
|
teardownByContext.set(context, teardown);
|
|
@@ -2989,7 +3096,7 @@ var NetlessAppPresentation = {
|
|
|
2989
3096
|
const setupReadyTimeout = (_d = options.setupReadyTimeout) != null ? _d : DEFAULT_SETUP_READY_TIMEOUT;
|
|
2990
3097
|
return prepareScenesPromise.then(async () => {
|
|
2991
3098
|
const loaded = await waitForCurrentPageImage(view, setupReadyTimeout, () => disposed);
|
|
2992
|
-
if (!loaded) {
|
|
3099
|
+
if (!loaded && !disposed) {
|
|
2993
3100
|
warn(`[Presentation] setup ready wait timed out after ${setupReadyTimeout}ms`);
|
|
2994
3101
|
}
|
|
2995
3102
|
return controller;
|
|
@@ -3079,7 +3186,7 @@ var install = (register, options = {}) => {
|
|
|
3079
3186
|
};
|
|
3080
3187
|
|
|
3081
3188
|
// src/index.ts
|
|
3082
|
-
var version = "0.1.13-beta.
|
|
3189
|
+
var version = "0.1.13-beta.2";
|
|
3083
3190
|
|
|
3084
|
-
export { NetlessAppPresentation, Presentation, Scrollbar, NetlessAppPresentation as default, install, version };
|
|
3191
|
+
export { NetlessAppPresentation, Presentation, Scrollbar, NetlessAppPresentation as default, install, setupBlurThumbnailDegradation, version };
|
|
3085
3192
|
//# sourceMappingURL=index.mjs.map
|