@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.js
CHANGED
|
@@ -1317,10 +1317,7 @@ var Presentation = class {
|
|
|
1317
1317
|
if (this.initialized)
|
|
1318
1318
|
return;
|
|
1319
1319
|
this.initialized = true;
|
|
1320
|
-
this.dispose.add(() =>
|
|
1321
|
-
var _a2;
|
|
1322
|
-
return (_a2 = this.previewLazyload) == null ? void 0 : _a2.destroy();
|
|
1323
|
-
});
|
|
1320
|
+
this.dispose.add(() => this.destroyPreviewLazyload());
|
|
1324
1321
|
this.contentDOM.classList.toggle(this.c("readonly"), this.readonly);
|
|
1325
1322
|
this.dom.appendChild(this.contentDOM);
|
|
1326
1323
|
const previewMask = this.contentDOM.appendChild(document.createElement("div"));
|
|
@@ -1473,6 +1470,17 @@ var Presentation = class {
|
|
|
1473
1470
|
}
|
|
1474
1471
|
}
|
|
1475
1472
|
}
|
|
1473
|
+
/** Release preview images while this presentation stays in the runtime cache. */
|
|
1474
|
+
suspendPreviewResources() {
|
|
1475
|
+
this.togglePreview(false);
|
|
1476
|
+
this.destroyPreviewLazyload();
|
|
1477
|
+
this.previewDOM.querySelectorAll("img").forEach((img) => {
|
|
1478
|
+
img.removeAttribute("src");
|
|
1479
|
+
img.removeAttribute("srcset");
|
|
1480
|
+
img.removeAttribute("sizes");
|
|
1481
|
+
LazyLoad.resetStatus(img);
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1476
1484
|
// [origin] means the cause:
|
|
1477
1485
|
// - navigation: user clicked on the left / right button on footer
|
|
1478
1486
|
// - input: user filled the bottom-right page number input box
|
|
@@ -1507,6 +1515,11 @@ var Presentation = class {
|
|
|
1507
1515
|
return src;
|
|
1508
1516
|
}
|
|
1509
1517
|
}
|
|
1518
|
+
destroyPreviewLazyload() {
|
|
1519
|
+
var _a;
|
|
1520
|
+
(_a = this.previewLazyload) == null ? void 0 : _a.destroy();
|
|
1521
|
+
this.previewLazyload = null;
|
|
1522
|
+
}
|
|
1510
1523
|
c(className) {
|
|
1511
1524
|
return `${this.namespace}-${className}`;
|
|
1512
1525
|
}
|
|
@@ -1519,7 +1532,7 @@ var Presentation = class {
|
|
|
1519
1532
|
};
|
|
1520
1533
|
|
|
1521
1534
|
// src/style.scss?inline
|
|
1522
|
-
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}";
|
|
1535
|
+
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}";
|
|
1523
1536
|
|
|
1524
1537
|
// src/store.ts
|
|
1525
1538
|
function noop() {
|
|
@@ -1965,6 +1978,23 @@ function cameraToSharedViewport(camera, viewSize, referenceSize) {
|
|
|
1965
1978
|
};
|
|
1966
1979
|
}
|
|
1967
1980
|
|
|
1981
|
+
// src/runtime-lifecycle.ts
|
|
1982
|
+
var createPresentationRuntimeTeardown = (box, dispose2) => {
|
|
1983
|
+
let tornDown = false;
|
|
1984
|
+
return () => {
|
|
1985
|
+
if (tornDown)
|
|
1986
|
+
return;
|
|
1987
|
+
tornDown = true;
|
|
1988
|
+
try {
|
|
1989
|
+
dispose2();
|
|
1990
|
+
} finally {
|
|
1991
|
+
box.unmountContent();
|
|
1992
|
+
box.unmountFooter();
|
|
1993
|
+
box.unmountStyles();
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1968
1998
|
// src/app-presentation.ts
|
|
1969
1999
|
var import_debounce2 = __toESM(require_debounce());
|
|
1970
2000
|
var emptySceneName = "$$empty$$";
|
|
@@ -1981,6 +2011,10 @@ var findBackgroundImage = (view) => {
|
|
|
1981
2011
|
return container.querySelector('img[alt="background"]');
|
|
1982
2012
|
};
|
|
1983
2013
|
var isBlurDegradationAllowed = (context) => {
|
|
2014
|
+
var _a;
|
|
2015
|
+
if (((_a = context.getWindowManager()) == null ? void 0 : _a.lazySetupInMaximizedMode) !== true) {
|
|
2016
|
+
return false;
|
|
2017
|
+
}
|
|
1984
2018
|
const boxStatus = context.getBoxStatus();
|
|
1985
2019
|
if (boxStatus) {
|
|
1986
2020
|
return boxStatus !== "normal";
|
|
@@ -2026,17 +2060,55 @@ var resolveImageUrl = (url) => {
|
|
|
2026
2060
|
return url;
|
|
2027
2061
|
}
|
|
2028
2062
|
};
|
|
2063
|
+
var TRANSPARENT_BACKGROUND = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
|
|
2064
|
+
var BACKGROUND_SUSPENDED_CLASS = "netless-app-presentation-background-suspended";
|
|
2065
|
+
var hasUsableThumbnail = (page) => {
|
|
2066
|
+
const thumbnailURL = page.thumbnail;
|
|
2067
|
+
if (!thumbnailURL)
|
|
2068
|
+
return false;
|
|
2069
|
+
try {
|
|
2070
|
+
const source = new URL(page.src, window.location.href);
|
|
2071
|
+
const thumbnail = new URL(thumbnailURL, window.location.href);
|
|
2072
|
+
const sameResourcePath = source.origin === thumbnail.origin && source.pathname === thumbnail.pathname;
|
|
2073
|
+
if (/\.gif$/i.test(source.pathname) && sameResourcePath)
|
|
2074
|
+
return false;
|
|
2075
|
+
} catch (e) {
|
|
2076
|
+
if (/\.gif(?:$|[?#])/i.test(page.src))
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2079
|
+
return resolveImageUrl(thumbnailURL) !== resolveImageUrl(page.src);
|
|
2080
|
+
};
|
|
2029
2081
|
var setupBlurThumbnailDegradation = (config) => {
|
|
2030
2082
|
const { context, view, pages, pageIndex$, app, dispose: dispose2 } = config;
|
|
2083
|
+
const box = context.getBox();
|
|
2084
|
+
const boxBlurClass = box.wrapClassName("blur");
|
|
2031
2085
|
let blurEpisode = false;
|
|
2032
2086
|
let reDegradeEnabled = false;
|
|
2087
|
+
let boxBlurred = box.$box.classList.contains(boxBlurClass);
|
|
2088
|
+
const setBackgroundSuspended = (suspended) => {
|
|
2089
|
+
app.whiteboardDOM.classList.toggle(
|
|
2090
|
+
BACKGROUND_SUSPENDED_CLASS,
|
|
2091
|
+
suspended
|
|
2092
|
+
);
|
|
2093
|
+
};
|
|
2033
2094
|
const degrade = () => {
|
|
2034
2095
|
const page = pages[pageIndex$.value];
|
|
2035
|
-
if (!
|
|
2096
|
+
if (!page)
|
|
2036
2097
|
return;
|
|
2098
|
+
const thumbnailURL = page.thumbnail;
|
|
2037
2099
|
const img = findBackgroundImage(view);
|
|
2038
|
-
if (
|
|
2039
|
-
|
|
2100
|
+
if (!thumbnailURL || !hasUsableThumbnail(page)) {
|
|
2101
|
+
if (boxBlurred) {
|
|
2102
|
+
setBackgroundSuspended(true);
|
|
2103
|
+
if (img && resolveImageUrl(img.src) !== resolveImageUrl(TRANSPARENT_BACKGROUND)) {
|
|
2104
|
+
img.src = TRANSPARENT_BACKGROUND;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
setBackgroundSuspended(false);
|
|
2110
|
+
if (img && resolveImageUrl(img.src) !== resolveImageUrl(thumbnailURL)) {
|
|
2111
|
+
img.src = thumbnailURL;
|
|
2040
2112
|
}
|
|
2041
2113
|
};
|
|
2042
2114
|
const restore2 = () => {
|
|
@@ -2045,6 +2117,24 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2045
2117
|
if (page && img && resolveImageUrl(img.src) !== resolveImageUrl(page.src)) {
|
|
2046
2118
|
img.src = page.src;
|
|
2047
2119
|
}
|
|
2120
|
+
setBackgroundSuspended(false);
|
|
2121
|
+
};
|
|
2122
|
+
const suspendCachedResources = () => {
|
|
2123
|
+
if (!blurEpisode || !boxBlurred)
|
|
2124
|
+
return;
|
|
2125
|
+
app.suspendPreviewResources();
|
|
2126
|
+
const page = pages[pageIndex$.value];
|
|
2127
|
+
if (!page || !hasUsableThumbnail(page) || reDegradeEnabled) {
|
|
2128
|
+
degrade();
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
const restoreFocusedResources = () => {
|
|
2132
|
+
if (!blurEpisode)
|
|
2133
|
+
return;
|
|
2134
|
+
blurEpisode = false;
|
|
2135
|
+
reDegradeEnabled = false;
|
|
2136
|
+
restore2();
|
|
2137
|
+
app.preload.resume(pageIndex$.value);
|
|
2048
2138
|
};
|
|
2049
2139
|
const isBackgroundImg = (target) => {
|
|
2050
2140
|
var _a;
|
|
@@ -2053,28 +2143,29 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2053
2143
|
el && el.tagName === "IMG" && ((_a = el.matches) == null ? void 0 : _a.call(el, 'img[alt="background"]'))
|
|
2054
2144
|
);
|
|
2055
2145
|
};
|
|
2146
|
+
const ownsTarget = (target) => {
|
|
2147
|
+
if (!isBackgroundImg(target))
|
|
2148
|
+
return false;
|
|
2149
|
+
const el = view.divElement;
|
|
2150
|
+
return !!(el && el.contains(target));
|
|
2151
|
+
};
|
|
2056
2152
|
const onImgLoad = (ev) => {
|
|
2057
2153
|
if (!blurEpisode || !reDegradeEnabled)
|
|
2058
2154
|
return;
|
|
2059
|
-
if (!
|
|
2155
|
+
if (!ownsTarget(ev.target))
|
|
2060
2156
|
return;
|
|
2061
2157
|
degrade();
|
|
2062
2158
|
};
|
|
2063
2159
|
const onImgError = (ev) => {
|
|
2064
2160
|
if (!blurEpisode || !reDegradeEnabled)
|
|
2065
2161
|
return;
|
|
2066
|
-
if (!
|
|
2162
|
+
if (!ownsTarget(ev.target))
|
|
2067
2163
|
return;
|
|
2068
2164
|
reDegradeEnabled = false;
|
|
2069
2165
|
};
|
|
2070
2166
|
const offFocus = context.emitter.on("focus", (isFocused) => {
|
|
2071
2167
|
if (isFocused) {
|
|
2072
|
-
|
|
2073
|
-
blurEpisode = false;
|
|
2074
|
-
reDegradeEnabled = false;
|
|
2075
|
-
restore2();
|
|
2076
|
-
app.preload.resume(pageIndex$.value);
|
|
2077
|
-
}
|
|
2168
|
+
restoreFocusedResources();
|
|
2078
2169
|
} else {
|
|
2079
2170
|
if (!isBlurDegradationAllowed(context))
|
|
2080
2171
|
return;
|
|
@@ -2082,29 +2173,41 @@ var setupBlurThumbnailDegradation = (config) => {
|
|
|
2082
2173
|
reDegradeEnabled = true;
|
|
2083
2174
|
degrade();
|
|
2084
2175
|
app.preload.pause();
|
|
2176
|
+
suspendCachedResources();
|
|
2085
2177
|
}
|
|
2086
2178
|
});
|
|
2087
2179
|
dispose2.add(offFocus);
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
}
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
);
|
|
2180
|
+
const updateBoxBlurred = (blurred) => {
|
|
2181
|
+
if (boxBlurred === blurred)
|
|
2182
|
+
return;
|
|
2183
|
+
boxBlurred = blurred;
|
|
2184
|
+
if (blurred)
|
|
2185
|
+
suspendCachedResources();
|
|
2186
|
+
else
|
|
2187
|
+
restoreFocusedResources();
|
|
2188
|
+
};
|
|
2189
|
+
const onBoxBlur = () => updateBoxBlurred(true);
|
|
2190
|
+
const onBoxFocus = () => updateBoxBlurred(false);
|
|
2191
|
+
box.events.on("blur", onBoxBlur);
|
|
2192
|
+
box.events.on("focus", onBoxFocus);
|
|
2193
|
+
dispose2.add(() => {
|
|
2194
|
+
box.events.off("blur", onBoxBlur);
|
|
2195
|
+
box.events.off("focus", onBoxFocus);
|
|
2196
|
+
});
|
|
2197
|
+
const boxClassObserver = new MutationObserver(() => {
|
|
2198
|
+
updateBoxBlurred(box.$box.classList.contains(boxBlurClass));
|
|
2199
|
+
});
|
|
2200
|
+
boxClassObserver.observe(box.$box, {
|
|
2201
|
+
attributes: true,
|
|
2202
|
+
attributeFilter: ["class"]
|
|
2203
|
+
});
|
|
2204
|
+
dispose2.add(() => boxClassObserver.disconnect());
|
|
2205
|
+
document.addEventListener("load", onImgLoad, true);
|
|
2206
|
+
document.addEventListener("error", onImgError, true);
|
|
2207
|
+
dispose2.add(() => {
|
|
2208
|
+
document.removeEventListener("load", onImgLoad, true);
|
|
2209
|
+
document.removeEventListener("error", onImgError, true);
|
|
2210
|
+
});
|
|
2108
2211
|
};
|
|
2109
2212
|
var createLogger = (room) => {
|
|
2110
2213
|
if (room && room.logger) {
|
|
@@ -2527,7 +2630,7 @@ var NetlessAppPresentation = {
|
|
|
2527
2630
|
options.useClipView
|
|
2528
2631
|
)
|
|
2529
2632
|
);
|
|
2530
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.13-beta.
|
|
2633
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.13-beta.2";
|
|
2531
2634
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
2532
2635
|
app.log = log;
|
|
2533
2636
|
app.warn = warn;
|
|
@@ -2769,6 +2872,10 @@ var NetlessAppPresentation = {
|
|
|
2769
2872
|
};
|
|
2770
2873
|
let disposed = false;
|
|
2771
2874
|
let offDestroy;
|
|
2875
|
+
const teardownRuntime = createPresentationRuntimeTeardown(
|
|
2876
|
+
box,
|
|
2877
|
+
dispose2
|
|
2878
|
+
);
|
|
2772
2879
|
const teardown = () => {
|
|
2773
2880
|
if (disposed)
|
|
2774
2881
|
return;
|
|
@@ -2776,7 +2883,7 @@ var NetlessAppPresentation = {
|
|
|
2776
2883
|
const removeDestroy = offDestroy;
|
|
2777
2884
|
offDestroy = void 0;
|
|
2778
2885
|
removeDestroy == null ? void 0 : removeDestroy();
|
|
2779
|
-
|
|
2886
|
+
teardownRuntime();
|
|
2780
2887
|
};
|
|
2781
2888
|
offDestroy = context.emitter.on("destroy", teardown);
|
|
2782
2889
|
teardownByContext.set(context, teardown);
|
|
@@ -2993,7 +3100,7 @@ var NetlessAppPresentation = {
|
|
|
2993
3100
|
const setupReadyTimeout = (_d = options.setupReadyTimeout) != null ? _d : DEFAULT_SETUP_READY_TIMEOUT;
|
|
2994
3101
|
return prepareScenesPromise.then(async () => {
|
|
2995
3102
|
const loaded = await waitForCurrentPageImage(view, setupReadyTimeout, () => disposed);
|
|
2996
|
-
if (!loaded) {
|
|
3103
|
+
if (!loaded && !disposed) {
|
|
2997
3104
|
warn(`[Presentation] setup ready wait timed out after ${setupReadyTimeout}ms`);
|
|
2998
3105
|
}
|
|
2999
3106
|
return controller;
|
|
@@ -3083,12 +3190,13 @@ var install = (register, options = {}) => {
|
|
|
3083
3190
|
};
|
|
3084
3191
|
|
|
3085
3192
|
// src/index.ts
|
|
3086
|
-
var version = "0.1.13-beta.
|
|
3193
|
+
var version = "0.1.13-beta.2";
|
|
3087
3194
|
|
|
3088
3195
|
exports.NetlessAppPresentation = NetlessAppPresentation;
|
|
3089
3196
|
exports.Presentation = Presentation;
|
|
3090
3197
|
exports.Scrollbar = Scrollbar;
|
|
3091
3198
|
exports.default = NetlessAppPresentation;
|
|
3092
3199
|
exports.install = install;
|
|
3200
|
+
exports.setupBlurThumbnailDegradation = setupBlurThumbnailDegradation;
|
|
3093
3201
|
exports.version = version;
|
|
3094
3202
|
//# sourceMappingURL=index.js.map
|