Merge pull request #8203 from Snuffleupagus/es6-modules-web

Convert the files in the `/web` folder to ES6 modules
This commit is contained in:
Yury Delendik 2017-04-13 11:16:27 -05:00 committed by GitHub
commit 74b31ab18f
33 changed files with 1671 additions and 2115 deletions

View File

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { AnnotationLayer } from 'pdfjs-web/pdfjs';
import { mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/annotation_layer_builder', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_link_service',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_link_service.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebAnnotationLayerBuilder = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfLinkService, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var SimpleLinkService = pdfLinkService.SimpleLinkService;
/** /**
* @typedef {Object} AnnotationLayerBuilderOptions * @typedef {Object} AnnotationLayerBuilderOptions
@ -87,7 +72,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
if (self.div) { if (self.div) {
// If an annotationLayer already exists, refresh its children's // If an annotationLayer already exists, refresh its children's
// transformation matrices. // transformation matrices.
pdfjsLib.AnnotationLayer.update(parameters); AnnotationLayer.update(parameters);
} else { } else {
// Create an annotation layer div and render the annotations // Create an annotation layer div and render the annotations
// if there is at least one annotation. // if there is at least one annotation.
@ -100,7 +85,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
self.pageDiv.appendChild(self.div); self.pageDiv.appendChild(self.div);
parameters.div = self.div; parameters.div = self.div;
pdfjsLib.AnnotationLayer.render(parameters); AnnotationLayer.render(parameters);
if (typeof mozL10n !== 'undefined') { if (typeof mozL10n !== 'undefined') {
mozL10n.translate(self.div); mozL10n.translate(self.div);
} }
@ -142,6 +127,7 @@ DefaultAnnotationLayerFactory.prototype = {
} }
}; };
exports.AnnotationLayerBuilder = AnnotationLayerBuilder; export {
exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; AnnotationLayerBuilder,
})); DefaultAnnotationLayerFactory,
};

View File

@ -14,95 +14,38 @@
*/ */
/* globals PDFBug, Stats */ /* globals PDFBug, Stats */
'use strict'; import {
animationStarted, DEFAULT_SCALE_VALUE, getPDFFileNameFromURL, localized,
(function (root, factory) { MAX_SCALE, MIN_SCALE, mozL10n, noContextMenuHandler, normalizeWheelEventDelta,
if (typeof define === 'function' && define.amd) { parseQueryString, ProgressBar, RendererType, UNKNOWN_SCALE
define('pdfjs-web/app', ['exports', 'pdfjs-web/ui_utils', } from 'pdfjs-web/ui_utils';
'pdfjs-web/download_manager', 'pdfjs-web/pdf_history', import {
'pdfjs-web/preferences', 'pdfjs-web/pdf_sidebar', build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException,
'pdfjs-web/view_history', 'pdfjs-web/pdf_thumbnail_viewer', MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException,
'pdfjs-web/toolbar', 'pdfjs-web/secondary_toolbar', UNSUPPORTED_FEATURES, version,
'pdfjs-web/password_prompt', 'pdfjs-web/pdf_presentation_mode', } from 'pdfjs-web/pdfjs';
'pdfjs-web/pdf_document_properties', 'pdfjs-web/hand_tool', import {
'pdfjs-web/pdf_viewer', 'pdfjs-web/pdf_rendering_queue', PDFRenderingQueue, RenderingStates
'pdfjs-web/pdf_link_service', 'pdfjs-web/pdf_outline_viewer', } from 'pdfjs-web/pdf_rendering_queue';
'pdfjs-web/overlay_manager', 'pdfjs-web/pdf_attachment_viewer', import { PDFSidebar, SidebarView } from 'pdfjs-web/pdf_sidebar';
'pdfjs-web/pdf_find_controller', 'pdfjs-web/pdf_find_bar', import { PDFViewer, PresentationModeState } from 'pdfjs-web/pdf_viewer';
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], import { getGlobalEventBus } from 'pdfjs-web/dom_events';
factory); import { HandTool } from 'pdfjs-web/hand_tool';
} else if (typeof exports !== 'undefined') { import { OverlayManager } from 'pdfjs-web/overlay_manager';
factory(exports, require('./ui_utils.js'), require('./download_manager.js'), import { PasswordPrompt } from 'pdfjs-web/password_prompt';
require('./pdf_history.js'), require('./preferences.js'), import { PDFAttachmentViewer } from 'pdfjs-web/pdf_attachment_viewer';
require('./pdf_sidebar.js'), require('./view_history.js'), import { PDFDocumentProperties } from 'pdfjs-web/pdf_document_properties';
require('./pdf_thumbnail_viewer.js'), require('./toolbar.js'), import { PDFFindBar } from 'pdfjs-web/pdf_find_bar';
require('./secondary_toolbar.js'), require('./password_prompt.js'), import { PDFFindController } from 'pdfjs-web/pdf_find_controller';
require('./pdf_presentation_mode.js'), import { PDFHistory } from 'pdfjs-web/pdf_history';
require('./pdf_document_properties.js'), require('./hand_tool.js'), import { PDFLinkService } from 'pdfjs-web/pdf_link_service';
require('./pdf_viewer.js'), require('./pdf_rendering_queue.js'), import { PDFOutlineViewer } from 'pdfjs-web/pdf_outline_viewer';
require('./pdf_link_service.js'), require('./pdf_outline_viewer.js'), import { PDFPresentationMode } from 'pdfjs-web/pdf_presentation_mode';
require('./overlay_manager.js'), require('./pdf_attachment_viewer.js'), import { PDFThumbnailViewer } from 'pdfjs-web/pdf_thumbnail_viewer';
require('./pdf_find_controller.js'), require('./pdf_find_bar.js'), import { Preferences } from 'pdfjs-web/preferences';
require('./dom_events.js'), require('./pdfjs.js')); import { SecondaryToolbar } from 'pdfjs-web/secondary_toolbar';
} else { import { Toolbar } from 'pdfjs-web/toolbar';
factory((root.pdfjsWebApp = {}), root.pdfjsWebUIUtils, import { ViewHistory } from 'pdfjs-web/view_history';
root.pdfjsWebDownloadManager, root.pdfjsWebPDFHistory,
root.pdfjsWebPreferences, root.pdfjsWebPDFSidebar,
root.pdfjsWebViewHistory, root.pdfjsWebPDFThumbnailViewer,
root.pdfjsWebToolbar, root.pdfjsWebSecondaryToolbar,
root.pdfjsWebPasswordPrompt, root.pdfjsWebPDFPresentationMode,
root.pdfjsWebPDFDocumentProperties, root.pdfjsWebHandTool,
root.pdfjsWebPDFViewer, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFOutlineViewer,
root.pdfjsWebOverlayManager, root.pdfjsWebPDFAttachmentViewer,
root.pdfjsWebPDFFindController, root.pdfjsWebPDFFindBar,
root.pdfjsWebDOMEvents, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtilsLib, downloadManagerLib, pdfHistoryLib,
preferencesLib, pdfSidebarLib, viewHistoryLib,
pdfThumbnailViewerLib, toolbarLib, secondaryToolbarLib,
passwordPromptLib, pdfPresentationModeLib,
pdfDocumentPropertiesLib, handToolLib, pdfViewerLib,
pdfRenderingQueueLib, pdfLinkServiceLib, pdfOutlineViewerLib,
overlayManagerLib, pdfAttachmentViewerLib,
pdfFindControllerLib, pdfFindBarLib, domEventsLib, pdfjsLib) {
var UNKNOWN_SCALE = uiUtilsLib.UNKNOWN_SCALE;
var DEFAULT_SCALE_VALUE = uiUtilsLib.DEFAULT_SCALE_VALUE;
var MIN_SCALE = uiUtilsLib.MIN_SCALE;
var MAX_SCALE = uiUtilsLib.MAX_SCALE;
var ProgressBar = uiUtilsLib.ProgressBar;
var getPDFFileNameFromURL = uiUtilsLib.getPDFFileNameFromURL;
var noContextMenuHandler = uiUtilsLib.noContextMenuHandler;
var mozL10n = uiUtilsLib.mozL10n;
var parseQueryString = uiUtilsLib.parseQueryString;
var PDFHistory = pdfHistoryLib.PDFHistory;
var Preferences = preferencesLib.Preferences;
var SidebarView = pdfSidebarLib.SidebarView;
var PDFSidebar = pdfSidebarLib.PDFSidebar;
var ViewHistory = viewHistoryLib.ViewHistory;
var PDFThumbnailViewer = pdfThumbnailViewerLib.PDFThumbnailViewer;
var Toolbar = toolbarLib.Toolbar;
var SecondaryToolbar = secondaryToolbarLib.SecondaryToolbar;
var PasswordPrompt = passwordPromptLib.PasswordPrompt;
var PDFPresentationMode = pdfPresentationModeLib.PDFPresentationMode;
var PDFDocumentProperties = pdfDocumentPropertiesLib.PDFDocumentProperties;
var HandTool = handToolLib.HandTool;
var PresentationModeState = pdfViewerLib.PresentationModeState;
var PDFViewer = pdfViewerLib.PDFViewer;
var RenderingStates = pdfRenderingQueueLib.RenderingStates;
var PDFRenderingQueue = pdfRenderingQueueLib.PDFRenderingQueue;
var PDFLinkService = pdfLinkServiceLib.PDFLinkService;
var PDFOutlineViewer = pdfOutlineViewerLib.PDFOutlineViewer;
var OverlayManager = overlayManagerLib.OverlayManager;
var PDFAttachmentViewer = pdfAttachmentViewerLib.PDFAttachmentViewer;
var PDFFindController = pdfFindControllerLib.PDFFindController;
var PDFFindBar = pdfFindBarLib.PDFFindBar;
var getGlobalEventBus = domEventsLib.getGlobalEventBus;
var normalizeWheelEventDelta = uiUtilsLib.normalizeWheelEventDelta;
var animationStarted = uiUtilsLib.animationStarted;
var localized = uiUtilsLib.localized;
var RendererType = uiUtilsLib.RendererType;
var DEFAULT_SCALE_DELTA = 1.1; var DEFAULT_SCALE_DELTA = 1.1;
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
@ -124,13 +67,13 @@ function configure(PDFJS) {
} }
} }
var DefaultExernalServices = { var DefaultExternalServices = {
updateFindControlState: function (data) {}, updateFindControlState: function (data) {},
initPassiveLoading: function (callbacks) {}, initPassiveLoading: function (callbacks) {},
fallback: function (data, callback) {}, fallback: function (data, callback) {},
reportTelemetry: function (data) {}, reportTelemetry: function (data) {},
createDownloadManager: function () { createDownloadManager: function () {
return new downloadManagerLib.DownloadManager(); throw new Error('Not implemented: createDownloadManager');
}, },
supportsIntegratedFind: false, supportsIntegratedFind: false,
supportsDocumentFonts: true, supportsDocumentFonts: true,
@ -196,12 +139,11 @@ var PDFViewerApplication = {
isViewerEmbedded: (window.parent !== window), isViewerEmbedded: (window.parent !== window),
url: '', url: '',
baseUrl: '', baseUrl: '',
externalServices: DefaultExernalServices, externalServices: DefaultExternalServices,
// called once when the document is loaded // called once when the document is loaded
initialize: function pdfViewInitialize(appConfig) { initialize: function pdfViewInitialize(appConfig) {
var self = this; var self = this;
var PDFJS = pdfjsLib.PDFJS;
Preferences.initialize(); Preferences.initialize();
this.preferences = Preferences; this.preferences = Preferences;
@ -240,7 +182,6 @@ var PDFViewerApplication = {
*/ */
_readPreferences: function () { _readPreferences: function () {
var self = this; var self = this;
var PDFJS = pdfjsLib.PDFJS;
return Promise.all([ return Promise.all([
Preferences.get('enableWebGL').then(function resolved(value) { Preferences.get('enableWebGL').then(function resolved(value) {
@ -506,11 +447,11 @@ var PDFViewerApplication = {
support = false; support = false;
} }
} }
if (support && pdfjsLib.PDFJS.disableFullscreen === true) { if (support && PDFJS.disableFullscreen === true) {
support = false; support = false;
} }
return pdfjsLib.shadow(this, 'supportsFullscreen', support); return shadow(this, 'supportsFullscreen', support);
}, },
get supportsIntegratedFind() { get supportsIntegratedFind() {
@ -528,7 +469,7 @@ var PDFViewerApplication = {
get loadingBar() { get loadingBar() {
var bar = new ProgressBar('#loadingBar', {}); var bar = new ProgressBar('#loadingBar', {});
return pdfjsLib.shadow(this, 'loadingBar', bar); return shadow(this, 'loadingBar', bar);
}, },
get supportedMouseWheelZoomModifierKeys() { get supportedMouseWheelZoomModifierKeys() {
@ -578,7 +519,7 @@ var PDFViewerApplication = {
var title = getPDFFileNameFromURL(url, ''); var title = getPDFFileNameFromURL(url, '');
if (!title) { if (!title) {
try { try {
title = decodeURIComponent(pdfjsLib.getFilenameFromUrl(url)) || url; title = decodeURIComponent(getFilenameFromUrl(url)) || url;
} catch (e) { } catch (e) {
// decodeURIComponent may throw URIError, // decodeURIComponent may throw URIError,
// fall back to using the unprocessed url in that case // fall back to using the unprocessed url in that case
@ -693,7 +634,7 @@ var PDFViewerApplication = {
var self = this; var self = this;
self.downloadComplete = false; self.downloadComplete = false;
var loadingTask = pdfjsLib.getDocument(parameters); var loadingTask = getDocument(parameters);
this.pdfLoadingTask = loadingTask; this.pdfLoadingTask = loadingTask;
loadingTask.onPassword = function passwordNeeded(updateCallback, reason) { loadingTask.onPassword = function passwordNeeded(updateCallback, reason) {
@ -717,15 +658,15 @@ var PDFViewerApplication = {
var loadingErrorMessage = mozL10n.get('loading_error', null, var loadingErrorMessage = mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.'); 'An error occurred while loading the PDF.');
if (exception instanceof pdfjsLib.InvalidPDFException) { if (exception instanceof InvalidPDFException) {
// change error message also for other builds // change error message also for other builds
loadingErrorMessage = mozL10n.get('invalid_file_error', null, loadingErrorMessage = mozL10n.get('invalid_file_error', null,
'Invalid or corrupted PDF file.'); 'Invalid or corrupted PDF file.');
} else if (exception instanceof pdfjsLib.MissingPDFException) { } else if (exception instanceof MissingPDFException) {
// special message for missing PDF's // special message for missing PDF's
loadingErrorMessage = mozL10n.get('missing_file_error', null, loadingErrorMessage = mozL10n.get('missing_file_error', null,
'Missing PDF file.'); 'Missing PDF file.');
} else if (exception instanceof pdfjsLib.UnexpectedResponseException) { } else if (exception instanceof UnexpectedResponseException) {
loadingErrorMessage = mozL10n.get('unexpected_response_error', null, loadingErrorMessage = mozL10n.get('unexpected_response_error', null,
'Unexpected server response.'); 'Unexpected server response.');
} }
@ -768,7 +709,7 @@ var PDFViewerApplication = {
this.pdfDocument.getData().then( this.pdfDocument.getData().then(
function getDataSuccess(data) { function getDataSuccess(data) {
var blob = pdfjsLib.createBlob(data, 'application/pdf'); var blob = createBlob(data, 'application/pdf');
downloadManager.download(blob, url, filename); downloadManager.download(blob, url, filename);
}, },
downloadByUrl // Error occurred try downloading with just the url. downloadByUrl // Error occurred try downloading with just the url.
@ -805,7 +746,7 @@ var PDFViewerApplication = {
*/ */
error: function pdfViewError(message, moreInfo) { error: function pdfViewError(message, moreInfo) {
var moreInfoText = mozL10n.get('error_version_info', var moreInfoText = mozL10n.get('error_version_info',
{version: pdfjsLib.version || '?', build: pdfjsLib.build || '?'}, {version: version || '?', build: build || '?'},
'PDF.js v{{version}} (build: {{build}})') + '\n'; 'PDF.js v{{version}} (build: {{build}})') + '\n';
if (moreInfo) { if (moreInfo) {
moreInfoText += moreInfoText +=
@ -883,7 +824,7 @@ var PDFViewerApplication = {
// the loading bar will not be completely filled, nor will it be hidden. // the loading bar will not be completely filled, nor will it be hidden.
// To prevent displaying a partially filled loading bar permanently, we // To prevent displaying a partially filled loading bar permanently, we
// hide it when no data has been loaded during a certain amount of time. // hide it when no data has been loaded during a certain amount of time.
if (pdfjsLib.PDFJS.disableAutoFetch && percent) { if (PDFJS.disableAutoFetch && percent) {
if (this.disableAutoFetchLoadingBarTimeout) { if (this.disableAutoFetchLoadingBarTimeout) {
clearTimeout(this.disableAutoFetchLoadingBarTimeout); clearTimeout(this.disableAutoFetchLoadingBarTimeout);
this.disableAutoFetchLoadingBarTimeout = null; this.disableAutoFetchLoadingBarTimeout = null;
@ -946,7 +887,7 @@ var PDFViewerApplication = {
self.loadingBar.setWidth(self.appConfig.viewerContainer); self.loadingBar.setWidth(self.appConfig.viewerContainer);
if (!pdfjsLib.PDFJS.disableHistory && !self.isViewerEmbedded) { if (!PDFJS.disableHistory && !self.isViewerEmbedded) {
// The browsing history is only enabled when the viewer is standalone, // The browsing history is only enabled when the viewer is standalone,
// i.e. not when it is embedded in a web page. // i.e. not when it is embedded in a web page.
if (!self.viewerPrefs['showPreviousViewOnLoad']) { if (!self.viewerPrefs['showPreviousViewOnLoad']) {
@ -1050,7 +991,7 @@ var PDFViewerApplication = {
pdfDocument.getJavaScript().then(function(javaScript) { pdfDocument.getJavaScript().then(function(javaScript) {
if (javaScript.length) { if (javaScript.length) {
console.warn('Warning: JavaScript is not supported'); console.warn('Warning: JavaScript is not supported');
self.fallback(pdfjsLib.UNSUPPORTED_FEATURES.javaScript); self.fallback(UNSUPPORTED_FEATURES.javaScript);
} }
// Hack to support auto printing. // Hack to support auto printing.
var regex = /\bprint\s*\(/; var regex = /\bprint\s*\(/;
@ -1085,8 +1026,8 @@ var PDFViewerApplication = {
console.log('PDF ' + pdfDocument.fingerprint + ' [' + console.log('PDF ' + pdfDocument.fingerprint + ' [' +
info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() +
' / ' + (info.Creator || '-').trim() + ']' + ' / ' + (info.Creator || '-').trim() + ']' +
' (PDF.js: ' + (pdfjsLib.version || '-') + ' (PDF.js: ' + (version || '-') +
(!pdfjsLib.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); (!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');
var pdfTitle; var pdfTitle;
if (metadata && metadata.has('dc:title')) { if (metadata && metadata.has('dc:title')) {
@ -1107,7 +1048,7 @@ var PDFViewerApplication = {
if (info.IsAcroFormPresent) { if (info.IsAcroFormPresent) {
console.warn('Warning: AcroForm/XFA is not supported'); console.warn('Warning: AcroForm/XFA is not supported');
self.fallback(pdfjsLib.UNSUPPORTED_FEATURES.forms); self.fallback(UNSUPPORTED_FEATURES.forms);
} }
if (typeof PDFJSDev !== 'undefined' && if (typeof PDFJSDev !== 'undefined' &&
@ -1390,7 +1331,10 @@ function loadAndEnablePDFBug(enabledTabs) {
script.src = appConfig.debuggerScriptPath; script.src = appConfig.debuggerScriptPath;
script.onload = function () { script.onload = function () {
PDFBug.enable(enabledTabs); PDFBug.enable(enabledTabs);
PDFBug.init(pdfjsLib, appConfig.mainContainer); PDFBug.init({
PDFJS,
OPS,
}, appConfig.mainContainer);
resolve(); resolve();
}; };
script.onerror = function () { script.onerror = function () {
@ -1436,8 +1380,6 @@ function webViewerInitialized() {
appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true'); appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
} }
var PDFJS = pdfjsLib.PDFJS;
if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) || if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) ||
PDFViewerApplication.viewerPrefs['pdfBugEnabled']) { PDFViewerApplication.viewerPrefs['pdfBugEnabled']) {
// Special debugging flags in the hash section of the URL. // Special debugging flags in the hash section of the URL.
@ -1616,7 +1558,7 @@ function webViewerPageRendered(e) {
thumbnailView.setImage(pageView); thumbnailView.setImage(pageView);
} }
if (pdfjsLib.PDFJS.pdfBug && Stats.enabled && pageView.stats) { if (PDFJS.pdfBug && Stats.enabled && pageView.stats) {
Stats.add(pageNumber, pageView.stats); Stats.add(pageNumber, pageView.stats);
} }
@ -1781,7 +1723,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
webViewerFileInputChange = function webViewerFileInputChange(e) { webViewerFileInputChange = function webViewerFileInputChange(e) {
var file = e.fileInput.files[0]; var file = e.fileInput.files[0];
if (!pdfjsLib.PDFJS.disableCreateObjectURL && if (!PDFJS.disableCreateObjectURL &&
typeof URL !== 'undefined' && URL.createObjectURL) { typeof URL !== 'undefined' && URL.createObjectURL) {
PDFViewerApplication.open(URL.createObjectURL(file)); PDFViewerApplication.open(URL.createObjectURL(file));
} else { } else {
@ -1904,7 +1846,7 @@ function webViewerPageChanging(e) {
} }
// we need to update stats // we need to update stats
if (pdfjsLib.PDFJS.pdfBug && Stats.enabled) { if (PDFJS.pdfBug && Stats.enabled) {
var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);
if (pageView.stats) { if (pageView.stats) {
Stats.add(page, pageView.stats); Stats.add(page, pageView.stats);
@ -2269,7 +2211,8 @@ var PDFPrintServiceFactory = {
} }
}; };
exports.PDFViewerApplication = PDFViewerApplication; export {
exports.DefaultExernalServices = DefaultExernalServices; PDFViewerApplication,
exports.PDFPrintServiceFactory = PDFPrintServiceFactory; DefaultExternalServices,
})); PDFPrintServiceFactory,
};

View File

@ -14,32 +14,16 @@
*/ */
/* globals chrome */ /* globals chrome */
'use strict'; import { DefaultExternalServices, PDFViewerApplication } from 'pdfjs-web/app';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
import { PDFJS } from 'pdfjs-web/pdfjs';
import { Preferences } from 'pdfjs-web/preferences';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/chromecom', ['exports', 'pdfjs-web/app',
'pdfjs-web/overlay_manager', 'pdfjs-web/preferences', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./app.js'), require('./overlay_manager.js'),
require('./preferences.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebChromeCom = {}), root.pdfjsWebApp,
root.pdfjsWebOverlayManager, root.pdfjsWebPreferences,
root.pdfjsWebPDFJS);
}
}(this, function (exports, app, overlayManager, preferences, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) { if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' + throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' +
'CHROME build.'); 'CHROME build.');
} }
var PDFViewerApplication = app.PDFViewerApplication;
var DefaultExernalServices = app.DefaultExernalServices;
var OverlayManager = overlayManager.OverlayManager;
var Preferences = preferences.Preferences;
var ChromeCom = {}; var ChromeCom = {};
/** /**
* Creates an event that the extension is listening for and will * Creates an event that the extension is listening for and will
@ -79,7 +63,7 @@
file = file.replace(/^drive:/i, file = file.replace(/^drive:/i,
'filesystem:' + location.origin + '/external/'); 'filesystem:' + location.origin + '/external/');
if (/^filesystem:/.test(file) && !pdfjsLib.PDFJS.disableWorker) { if (/^filesystem:/.test(file) && !PDFJS.disableWorker) {
// The security origin of filesystem:-URLs are not preserved when the // The security origin of filesystem:-URLs are not preserved when the
// URL is passed to a Web worker, (http://crbug.com/362061), so we have // URL is passed to a Web worker, (http://crbug.com/362061), so we have
// to create an intermediate blob:-URL as a work-around. // to create an intermediate blob:-URL as a work-around.
@ -349,7 +333,7 @@
}); });
}; };
var ChromeExternalServices = Object.create(DefaultExernalServices); var ChromeExternalServices = Object.create(DefaultExternalServices);
ChromeExternalServices.initPassiveLoading = function (callbacks) { ChromeExternalServices.initPassiveLoading = function (callbacks) {
var appConfig = PDFViewerApplication.appConfig; var appConfig = PDFViewerApplication.appConfig;
ChromeCom.resolvePDFFile(appConfig.defaultUrl, ChromeCom.resolvePDFFile(appConfig.defaultUrl,
@ -359,5 +343,6 @@
}; };
PDFViewerApplication.externalServices = ChromeExternalServices; PDFViewerApplication.externalServices = ChromeExternalServices;
exports.ChromeCom = ChromeCom; export {
})); ChromeCom,
};

View File

@ -13,18 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { EventBus } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/dom_events', ['exports', 'pdfjs-web/ui_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebDOMEvents = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var EventBus = uiUtils.EventBus;
// Attaching to the application event bus to dispatch events to the DOM for // Attaching to the application event bus to dispatch events to the DOM for
// backwards viewer API compatibility. // backwards viewer API compatibility.
@ -149,6 +138,7 @@
return globalEventBus; return globalEventBus;
} }
exports.attachDOMEventsToEventBus = attachDOMEventsToEventBus; export {
exports.getGlobalEventBus = getGlobalEventBus; attachDOMEventsToEventBus,
})); getGlobalEventBus,
};

View File

@ -13,20 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
createObjectURL, createValidAbsoluteUrl, PDFJS
} from 'pdfjs-web/pdfjs';
import { DefaultExternalServices, PDFViewerApplication } from 'pdfjs-web/app';
(function (root, factory) { if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) {
if (typeof define === 'function' && define.amd) { throw new Error('Module "pdfjs-web/download_manager" shall not be used ' +
define('pdfjs-web/download_manager', ['exports', 'pdfjs-web/pdfjs'], 'outside CHROME and GENERIC builds.');
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebDownloadManager = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
return;
} }
function download(blobUrl, filename) { function download(blobUrl, filename) {
@ -69,7 +63,7 @@ function DownloadManager() {}
DownloadManager.prototype = { DownloadManager.prototype = {
downloadUrl: function DownloadManager_downloadUrl(url, filename) { downloadUrl: function DownloadManager_downloadUrl(url, filename) {
if (!pdfjsLib.createValidAbsoluteUrl(url, 'http://example.com')) { if (!createValidAbsoluteUrl(url, 'http://example.com')) {
return; // restricted/invalid URL return; // restricted/invalid URL
} }
download(url + '#pdfjs.action=download', filename); download(url + '#pdfjs.action=download', filename);
@ -82,8 +76,8 @@ DownloadManager.prototype = {
filename); filename);
} }
var blobUrl = pdfjsLib.createObjectURL(data, contentType, var blobUrl = createObjectURL(data, contentType,
pdfjsLib.PDFJS.disableCreateObjectURL); PDFJS.disableCreateObjectURL);
download(blobUrl, filename); download(blobUrl, filename);
}, },
@ -96,7 +90,7 @@ DownloadManager.prototype = {
return; return;
} }
if (pdfjsLib.PDFJS.disableCreateObjectURL) { if (PDFJS.disableCreateObjectURL) {
// URL.createObjectURL is not supported // URL.createObjectURL is not supported
this.downloadUrl(url, filename); this.downloadUrl(url, filename);
return; return;
@ -107,5 +101,12 @@ DownloadManager.prototype = {
} }
}; };
exports.DownloadManager = DownloadManager; var GenericExternalServices = Object.create(DefaultExternalServices);
})); GenericExternalServices.createDownloadManager = function () {
return new DownloadManager();
};
PDFViewerApplication.externalServices = GenericExternalServices;
export {
DownloadManager,
};

View File

@ -13,22 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { CSS_UNITS } from 'pdfjs-web/ui_utils';
import { PDFPrintServiceFactory } from 'pdfjs-web/app';
(function (root, factory) { import { shadow } from 'pdfjs-web/pdfjs';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefox_print_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/app', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./app.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxPrintService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, app, pdfjsLib) {
var CSS_UNITS = uiUtils.CSS_UNITS;
var PDFPrintServiceFactory = app.PDFPrintServiceFactory;
// Creates a placeholder with div and canvas with right size for the page. // Creates a placeholder with div and canvas with right size for the page.
function composePage(pdfDocument, pageNumber, size, printContainer) { function composePage(pdfDocument, pageNumber, size, printContainer) {
@ -109,7 +96,7 @@
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas; var value = 'mozPrintCallback' in canvas;
return pdfjsLib.shadow(this, 'supportsPrinting', value); return shadow(this, 'supportsPrinting', value);
}, },
createPrintService: function (pdfDocument, pagesOverview, printContainer) { createPrintService: function (pdfDocument, pagesOverview, printContainer) {
@ -118,5 +105,6 @@
} }
}; };
exports.FirefoxPrintService = FirefoxPrintService; export {
})); FirefoxPrintService,
};

View File

@ -13,29 +13,18 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
createObjectURL, PDFDataRangeTransport, shadow
} from 'pdfjs-web/pdfjs';
import { PDFViewerApplication } from 'pdfjs-web/app';
import { Preferences } from 'pdfjs-web/preferences';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences',
'pdfjs-web/app', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./preferences.js'), require('./app.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences,
root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, preferences, app, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' || if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) { !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' + throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' +
'FIREFOX and MOZCENTRAL builds.'); 'FIREFOX and MOZCENTRAL builds.');
} }
var Preferences = preferences.Preferences;
var PDFViewerApplication = app.PDFViewerApplication;
var FirefoxCom = (function FirefoxComClosure() { var FirefoxCom = (function FirefoxComClosure() {
return { return {
/** /**
@ -107,7 +96,7 @@ var DownloadManager = (function DownloadManagerClosure() {
downloadData: function DownloadManager_downloadData(data, filename, downloadData: function DownloadManager_downloadData(data, filename,
contentType) { contentType) {
var blobUrl = pdfjsLib.createObjectURL(data, contentType, false); var blobUrl = createObjectURL(data, contentType, false);
FirefoxCom.request('download', { FirefoxCom.request('download', {
blobUrl: blobUrl, blobUrl: blobUrl,
@ -181,10 +170,10 @@ Preferences._readFromStorage = function (prefObj) {
})(); })();
function FirefoxComDataRangeTransport(length, initialData) { function FirefoxComDataRangeTransport(length, initialData) {
pdfjsLib.PDFDataRangeTransport.call(this, length, initialData); PDFDataRangeTransport.call(this, length, initialData);
} }
FirefoxComDataRangeTransport.prototype = FirefoxComDataRangeTransport.prototype =
Object.create(pdfjsLib.PDFDataRangeTransport.prototype); Object.create(PDFDataRangeTransport.prototype);
FirefoxComDataRangeTransport.prototype.requestDataRange = FirefoxComDataRangeTransport.prototype.requestDataRange =
function FirefoxComDataRangeTransport_requestDataRange(begin, end) { function FirefoxComDataRangeTransport_requestDataRange(begin, end) {
FirefoxCom.request('requestDataRange', { begin: begin, end: end }); FirefoxCom.request('requestDataRange', { begin: begin, end: end });
@ -260,23 +249,22 @@ PDFViewerApplication.externalServices = {
get supportsIntegratedFind() { get supportsIntegratedFind() {
var support = FirefoxCom.requestSync('supportsIntegratedFind'); var support = FirefoxCom.requestSync('supportsIntegratedFind');
return pdfjsLib.shadow(this, 'supportsIntegratedFind', support); return shadow(this, 'supportsIntegratedFind', support);
}, },
get supportsDocumentFonts() { get supportsDocumentFonts() {
var support = FirefoxCom.requestSync('supportsDocumentFonts'); var support = FirefoxCom.requestSync('supportsDocumentFonts');
return pdfjsLib.shadow(this, 'supportsDocumentFonts', support); return shadow(this, 'supportsDocumentFonts', support);
}, },
get supportsDocumentColors() { get supportsDocumentColors() {
var support = FirefoxCom.requestSync('supportsDocumentColors'); var support = FirefoxCom.requestSync('supportsDocumentColors');
return pdfjsLib.shadow(this, 'supportsDocumentColors', support); return shadow(this, 'supportsDocumentColors', support);
}, },
get supportedMouseWheelZoomModifierKeys() { get supportedMouseWheelZoomModifierKeys() {
var support = FirefoxCom.requestSync('supportedMouseWheelZoomModifierKeys'); var support = FirefoxCom.requestSync('supportedMouseWheelZoomModifierKeys');
return pdfjsLib.shadow(this, 'supportedMouseWheelZoomModifierKeys', return shadow(this, 'supportedMouseWheelZoomModifierKeys', support);
support);
}, },
}; };
@ -291,6 +279,7 @@ document.mozL10n.setExternalLocalizerServices({
} }
}); });
exports.DownloadManager = DownloadManager; export {
exports.FirefoxCom = FirefoxCom; DownloadManager,
})); FirefoxCom,
};

View File

@ -14,17 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/grab_to_pan', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebGrabToPan = {}));
}
}(this, function (exports) {
/** /**
* Construct a GrabToPan instance for a given HTML element. * Construct a GrabToPan instance for a given HTML element.
* @param options.element {Element} * @param options.element {Element}
@ -233,5 +222,6 @@
} }
} }
exports.GrabToPan = GrabToPan; export {
})); GrabToPan,
};

View File

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { GrabToPan } from 'pdfjs-web/grab_to_pan';
import { localized } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { Preferences } from 'pdfjs-web/preferences';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/hand_tool', ['exports', 'pdfjs-web/grab_to_pan',
'pdfjs-web/preferences', 'pdfjs-web/ui_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./grab_to_pan.js'), require('./preferences.js'),
require('./ui_utils.js'));
} else {
factory((root.pdfjsWebHandTool = {}), root.pdfjsWebGrabToPan,
root.pdfjsWebPreferences, root.pdfjsWebUIUtils);
}
}(this, function (exports, grabToPan, preferences, uiUtils) {
var GrabToPan = grabToPan.GrabToPan;
var Preferences = preferences.Preferences;
var localized = uiUtils.localized;
/** /**
* @typedef {Object} HandToolOptions * @typedef {Object} HandToolOptions
@ -110,5 +95,6 @@ var HandTool = (function HandToolClosure() {
return HandTool; return HandTool;
})(); })();
exports.HandTool = HandTool; export {
})); HandTool,
};

View File

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/overlay_manager', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebOverlayManager = {}));
}
}(this, function (exports) {
var OverlayManager = { var OverlayManager = {
overlays: {}, overlays: {},
active: null, active: null,
@ -151,5 +139,6 @@ var OverlayManager = {
} }
}; };
exports.OverlayManager = OverlayManager; export {
})); OverlayManager,
};

View File

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { mozL10n } from 'pdfjs-web/ui_utils';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
(function (root, factory) { import { PasswordResponses } from 'pdfjs-web/pdfjs';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/password_prompt', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPasswordPrompt = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, overlayManager, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var OverlayManager = overlayManager.OverlayManager;
/** /**
* @typedef {Object} PasswordPromptOptions * @typedef {Object} PasswordPromptOptions
@ -86,7 +71,7 @@ var PasswordPrompt = (function PasswordPromptClosure() {
var promptString = mozL10n.get('password_label', null, var promptString = mozL10n.get('password_label', null,
'Enter the password to open this PDF file.'); 'Enter the password to open this PDF file.');
if (this.reason === pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) { if (this.reason === PasswordResponses.INCORRECT_PASSWORD) {
promptString = mozL10n.get('password_invalid', null, promptString = mozL10n.get('password_invalid', null,
'Invalid password. Please try again.'); 'Invalid password. Please try again.');
} }
@ -120,5 +105,6 @@ var PasswordPrompt = (function PasswordPromptClosure() {
return PasswordPrompt; return PasswordPrompt;
})(); })();
exports.PasswordPrompt = PasswordPrompt; export {
})); PasswordPrompt,
};

View File

@ -13,18 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
createObjectURL, createPromiseCapability, getFilenameFromUrl, PDFJS,
(function (root, factory) { removeNullCharacters
if (typeof define === 'function' && define.amd) { } from 'pdfjs-web/pdfjs';
define('pdfjs-web/pdf_attachment_viewer', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFAttachmentViewer = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
/** /**
* @typedef {Object} PDFAttachmentViewerOptions * @typedef {Object} PDFAttachmentViewerOptions
@ -52,7 +44,7 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
this.eventBus = options.eventBus; this.eventBus = options.eventBus;
this.downloadManager = options.downloadManager; this.downloadManager = options.downloadManager;
this._renderedCapability = pdfjsLib.createPromiseCapability(); this._renderedCapability = createPromiseCapability();
this.eventBus.on('fileattachmentannotation', this.eventBus.on('fileattachmentannotation',
this._appendAttachment.bind(this)); this._appendAttachment.bind(this));
} }
@ -67,7 +59,7 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
if (!keepRenderedCapability) { if (!keepRenderedCapability) {
// NOTE: The *only* situation in which the `_renderedCapability` should // NOTE: The *only* situation in which the `_renderedCapability` should
// not be replaced is when appending file attachment annotations. // not be replaced is when appending file attachment annotations.
this._renderedCapability = pdfjsLib.createPromiseCapability(); this._renderedCapability = createPromiseCapability();
} }
}, },
@ -92,8 +84,8 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
var blobUrl; var blobUrl;
button.onclick = function() { button.onclick = function() {
if (!blobUrl) { if (!blobUrl) {
blobUrl = pdfjsLib.createObjectURL( blobUrl = createObjectURL(
content, 'application/pdf', pdfjsLib.PDFJS.disableCreateObjectURL); content, 'application/pdf', PDFJS.disableCreateObjectURL);
} }
var viewerUrl; var viewerUrl;
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
@ -153,8 +145,7 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
for (var i = 0; i < attachmentsCount; i++) { for (var i = 0; i < attachmentsCount; i++) {
var item = attachments[names[i]]; var item = attachments[names[i]];
var filename = pdfjsLib.getFilenameFromUrl(item.filename); var filename = removeNullCharacters(getFilenameFromUrl(item.filename));
filename = pdfjsLib.removeNullCharacters(filename);
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'attachmentsItem'; div.className = 'attachmentsItem';
@ -205,5 +196,6 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
return PDFAttachmentViewer; return PDFAttachmentViewer;
})(); })();
exports.PDFAttachmentViewer = PDFAttachmentViewer; export {
})); PDFAttachmentViewer,
};

View File

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { getPDFFileNameFromURL, mozL10n } from 'pdfjs-web/ui_utils';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_document_properties', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'));
} else {
factory((root.pdfjsWebPDFDocumentProperties = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager);
}
}(this, function (exports, uiUtils, overlayManager) {
var getPDFFileNameFromURL = uiUtils.getPDFFileNameFromURL;
var mozL10n = uiUtils.mozL10n;
var OverlayManager = overlayManager.OverlayManager;
/** /**
* @typedef {Object} PDFDocumentPropertiesOptions * @typedef {Object} PDFDocumentPropertiesOptions
@ -239,5 +224,6 @@ var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() {
return PDFDocumentProperties; return PDFDocumentProperties;
})(); })();
exports.PDFDocumentProperties = PDFDocumentProperties; export {
})); PDFDocumentProperties,
};

View File

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { FindStates } from 'pdfjs-web/pdf_find_controller';
import { mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_find_bar', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_find_controller'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_find_controller.js'));
} else {
factory((root.pdfjsWebPDFFindBar = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFFindController);
}
}(this, function (exports, uiUtils, pdfFindController) {
var mozL10n = uiUtils.mozL10n;
var FindStates = pdfFindController.FindStates;
/** /**
* Creates a "search bar" given a set of DOM elements that act as controls * Creates a "search bar" given a set of DOM elements that act as controls
@ -236,5 +221,6 @@ var PDFFindBar = (function PDFFindBarClosure() {
return PDFFindBar; return PDFFindBar;
})(); })();
exports.PDFFindBar = PDFFindBar; export {
})); PDFFindBar,
};

View File

@ -13,20 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { scrollIntoView } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_find_controller', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFFindController = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var scrollIntoView = uiUtils.scrollIntoView;
var FindStates = { var FindStates = {
FIND_FOUND: 0, FIND_FOUND: 0,
@ -505,6 +492,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
return PDFFindController; return PDFFindController;
})(); })();
exports.FindStates = FindStates; export {
exports.PDFFindController = PDFFindController; FindStates,
})); PDFFindController,
};

View File

@ -14,18 +14,7 @@
*/ */
/* globals chrome */ /* globals chrome */
'use strict'; import { domEvents } from 'pdfjs-web/dom_events';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_history', ['exports', 'pdfjs-web/dom_events'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./dom_events.js'));
} else {
factory((root.pdfjsWebPDFHistory = {}), root.pdfjsWebDOMEvents);
}
}(this, function (exports, domEvents) {
function PDFHistory(options) { function PDFHistory(options) {
this.linkService = options.linkService; this.linkService = options.linkService;
@ -432,5 +421,6 @@
} }
}; };
exports.PDFHistory = PDFHistory; export {
})); PDFHistory,
};

View File

@ -13,21 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { domEvents } from 'pdfjs-web/dom_events';
import { parseQueryString } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_link_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/dom_events'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./dom_events.js'));
} else {
factory((root.pdfjsWebPDFLinkService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebDOMEvents);
}
}(this, function (exports, uiUtils, domEvents) {
var parseQueryString = uiUtils.parseQueryString;
var PageNumberRegExp = /^\d+$/; var PageNumberRegExp = /^\d+$/;
function isPageNumber(str) { function isPageNumber(str) {
@ -487,6 +474,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
return SimpleLinkService; return SimpleLinkService;
})(); })();
exports.PDFLinkService = PDFLinkService; export {
exports.SimpleLinkService = SimpleLinkService; PDFLinkService,
})); SimpleLinkService,
};

View File

@ -13,20 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
addLinkAttributes, PDFJS, removeNullCharacters
(function (root, factory) { } from 'pdfjs-web/pdfjs';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_outline_viewer', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFOutlineViewer = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
var PDFJS = pdfjsLib.PDFJS;
var DEFAULT_TITLE = '\u2013'; var DEFAULT_TITLE = '\u2013';
@ -85,7 +74,7 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
*/ */
_bindLink: function PDFOutlineViewer_bindLink(element, item) { _bindLink: function PDFOutlineViewer_bindLink(element, item) {
if (item.url) { if (item.url) {
pdfjsLib.addLinkAttributes(element, { addLinkAttributes(element, {
url: item.url, url: item.url,
target: (item.newWindow ? PDFJS.LinkTarget.BLANK : undefined), target: (item.newWindow ? PDFJS.LinkTarget.BLANK : undefined),
}); });
@ -200,7 +189,7 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
this._bindLink(element, item); this._bindLink(element, item);
this._setStyles(element, item); this._setStyles(element, item);
element.textContent = element.textContent =
pdfjsLib.removeNullCharacters(item.title) || DEFAULT_TITLE; removeNullCharacters(item.title) || DEFAULT_TITLE;
div.appendChild(element); div.appendChild(element);
@ -231,5 +220,6 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
return PDFOutlineViewer; return PDFOutlineViewer;
})(); })();
exports.PDFOutlineViewer = PDFOutlineViewer; export {
})); PDFOutlineViewer,
};

View File

@ -13,31 +13,15 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
approximateFraction, CSS_UNITS, DEFAULT_SCALE, getOutputScale, RendererType,
(function (root, factory) { roundToDivide
if (typeof define === 'function' && define.amd) { } from 'pdfjs-web/ui_utils';
define('pdfjs-web/pdf_page_view', ['exports', import {
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue', CustomStyle, PDFJS, RenderingCancelledException, SVGGraphics
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], factory); } from 'pdfjs-web/pdfjs';
} else if (typeof exports !== 'undefined') { import { domEvents } from 'pdfjs-web/dom_events';
factory(exports, require('./ui_utils.js'), import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
require('./pdf_rendering_queue.js'), require('./dom_events.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFPageView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue, root.pdfjsWebDOMEvents,
root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfRenderingQueue, domEvents, pdfjsLib) {
var CSS_UNITS = uiUtils.CSS_UNITS;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var getOutputScale = uiUtils.getOutputScale;
var approximateFraction = uiUtils.approximateFraction;
var roundToDivide = uiUtils.roundToDivide;
var RendererType = uiUtils.RendererType;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var TEXT_LAYER_RENDER_DELAY = 200; // ms var TEXT_LAYER_RENDER_DELAY = 200; // ms
@ -234,17 +218,17 @@ var PDFPageView = (function PDFPageViewClosure() {
} }
var isScalingRestricted = false; var isScalingRestricted = false;
if (this.canvas && pdfjsLib.PDFJS.maxCanvasPixels > 0) { if (this.canvas && PDFJS.maxCanvasPixels > 0) {
var outputScale = this.outputScale; var outputScale = this.outputScale;
if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) * if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *
((Math.floor(this.viewport.height) * outputScale.sy) | 0) > ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >
pdfjsLib.PDFJS.maxCanvasPixels) { PDFJS.maxCanvasPixels) {
isScalingRestricted = true; isScalingRestricted = true;
} }
} }
if (this.canvas) { if (this.canvas) {
if (pdfjsLib.PDFJS.useOnlyCssZoom || if (PDFJS.useOnlyCssZoom ||
(this.hasRestrictedScaling && isScalingRestricted)) { (this.hasRestrictedScaling && isScalingRestricted)) {
this.cssTransform(this.canvas, true); this.cssTransform(this.canvas, true);
@ -290,8 +274,6 @@ var PDFPageView = (function PDFPageViewClosure() {
}, },
cssTransform: function PDFPageView_transform(target, redrawAnnotations) { cssTransform: function PDFPageView_transform(target, redrawAnnotations) {
var CustomStyle = pdfjsLib.CustomStyle;
// Scale target (canvas or svg), its wrapper, and page container. // Scale target (canvas or svg), its wrapper, and page container.
var width = this.viewport.width; var width = this.viewport.width;
var height = this.viewport.height; var height = this.viewport.height;
@ -443,7 +425,7 @@ var PDFPageView = (function PDFPageViewClosure() {
if (((typeof PDFJSDev === 'undefined' || if (((typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') || !PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||
error instanceof pdfjsLib.RenderingCancelledException) { error instanceof RenderingCancelledException) {
self.error = null; self.error = null;
return Promise.resolve(undefined); return Promise.resolve(undefined);
} }
@ -553,7 +535,7 @@ var PDFPageView = (function PDFPageViewClosure() {
var outputScale = getOutputScale(ctx); var outputScale = getOutputScale(ctx);
this.outputScale = outputScale; this.outputScale = outputScale;
if (pdfjsLib.PDFJS.useOnlyCssZoom) { if (PDFJS.useOnlyCssZoom) {
var actualSizeViewport = viewport.clone({scale: CSS_UNITS}); var actualSizeViewport = viewport.clone({scale: CSS_UNITS});
// Use a scale that will make the canvas be the original intended size // Use a scale that will make the canvas be the original intended size
// of the page. // of the page.
@ -562,10 +544,9 @@ var PDFPageView = (function PDFPageViewClosure() {
outputScale.scaled = true; outputScale.scaled = true;
} }
if (pdfjsLib.PDFJS.maxCanvasPixels > 0) { if (PDFJS.maxCanvasPixels > 0) {
var pixelsInViewport = viewport.width * viewport.height; var pixelsInViewport = viewport.width * viewport.height;
var maxScale = var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);
Math.sqrt(pdfjsLib.PDFJS.maxCanvasPixels / pixelsInViewport);
if (outputScale.sx > maxScale || outputScale.sy > maxScale) { if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
outputScale.sx = maxScale; outputScale.sx = maxScale;
outputScale.sy = maxScale; outputScale.sy = maxScale;
@ -635,8 +616,8 @@ var PDFPageView = (function PDFPageViewClosure() {
var ensureNotCancelled = function () { var ensureNotCancelled = function () {
if (cancelled) { if (cancelled) {
if ((typeof PDFJSDev !== 'undefined' && if ((typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('PDFJS_NEXT')) || pdfjsLib.PDFJS.pdfjsNext) { PDFJSDev.test('PDFJS_NEXT')) || PDFJS.pdfjsNext) {
throw new pdfjsLib.RenderingCancelledException( throw new RenderingCancelledException(
'Rendering cancelled, page ' + self.id, 'svg'); 'Rendering cancelled, page ' + self.id, 'svg');
} else { } else {
throw 'cancelled'; // eslint-disable-line no-throw-literal throw 'cancelled'; // eslint-disable-line no-throw-literal
@ -646,7 +627,6 @@ var PDFPageView = (function PDFPageViewClosure() {
var self = this; var self = this;
var pdfPage = this.pdfPage; var pdfPage = this.pdfPage;
var SVGGraphics = pdfjsLib.SVGGraphics;
var actualSizeViewport = this.viewport.clone({scale: CSS_UNITS}); var actualSizeViewport = this.viewport.clone({scale: CSS_UNITS});
var promise = pdfPage.getOperatorList().then(function (opList) { var promise = pdfPage.getOperatorList().then(function (opList) {
ensureNotCancelled(); ensureNotCancelled();
@ -691,5 +671,6 @@ var PDFPageView = (function PDFPageViewClosure() {
return PDFPageView; return PDFPageView;
})(); })();
exports.PDFPageView = PDFPageView; export {
})); PDFPageView,
};

View File

@ -13,19 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { normalizeWheelEventDelta } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_presentation_mode', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFPresentationMode = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var normalizeWheelEventDelta = uiUtils.normalizeWheelEventDelta;
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
@ -517,5 +505,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
return PDFPresentationMode; return PDFPresentationMode;
})(); })();
exports.PDFPresentationMode = PDFPresentationMode; export {
})); PDFPresentationMode,
};

View File

@ -13,25 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { CSS_UNITS, mozL10n } from 'pdfjs-web/ui_utils';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
(function (root, factory) { import { PDFJS } from 'pdfjs-web/pdfjs';
if (typeof define === 'function' && define.amd) { import { PDFPrintServiceFactory } from 'pdfjs-web/app';
define('pdfjs-web/pdf_print_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/overlay_manager', 'pdfjs-web/app', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'),
require('./app.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFPrintService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager, root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, overlayManager, app, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var CSS_UNITS = uiUtils.CSS_UNITS;
var PDFPrintServiceFactory = app.PDFPrintServiceFactory;
var OverlayManager = overlayManager.OverlayManager;
var activeService = null; var activeService = null;
@ -167,8 +152,7 @@
img.style.height = printItem.height; img.style.height = printItem.height;
var scratchCanvas = this.scratchCanvas; var scratchCanvas = this.scratchCanvas;
if (('toBlob' in scratchCanvas) && if (('toBlob' in scratchCanvas) && !PDFJS.disableCreateObjectURL) {
!pdfjsLib.PDFJS.disableCreateObjectURL) {
scratchCanvas.toBlob(function (blob) { scratchCanvas.toBlob(function (blob) {
img.src = URL.createObjectURL(blob); img.src = URL.createObjectURL(blob);
}); });
@ -346,5 +330,6 @@
} }
}; };
exports.PDFPrintService = PDFPrintService; export {
})); PDFPrintService,
};

View File

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_rendering_queue', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFRenderingQueue = {}));
}
}(this, function (exports) {
var CLEANUP_TIMEOUT = 30000; var CLEANUP_TIMEOUT = 30000;
var RenderingStates = { var RenderingStates = {
@ -186,6 +174,7 @@ var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
return PDFRenderingQueue; return PDFRenderingQueue;
})(); })();
exports.RenderingStates = RenderingStates; export {
exports.PDFRenderingQueue = PDFRenderingQueue; RenderingStates,
})); PDFRenderingQueue,
};

View File

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { mozL10n } from 'pdfjs-web/ui_utils';
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_sidebar', ['exports',
'pdfjs-web/pdf_rendering_queue', 'pdfjs-web/ui_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdf_rendering_queue.js'),
require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFSidebar = {}), root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebUIUtils);
}
}(this, function (exports, pdfRenderingQueue, uiUtils) {
var RenderingStates = pdfRenderingQueue.RenderingStates;
var mozL10n = uiUtils.mozL10n;
var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification'; var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';
@ -460,6 +445,7 @@ var PDFSidebar = (function PDFSidebarClosure() {
return PDFSidebar; return PDFSidebar;
})(); })();
exports.SidebarView = SidebarView; export {
exports.PDFSidebar = PDFSidebar; SidebarView,
})); PDFSidebar,
};

View File

@ -13,24 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { getOutputScale, mozL10n } from 'pdfjs-web/ui_utils';
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_thumbnail_view', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_rendering_queue.js'));
} else {
factory((root.pdfjsWebPDFThumbnailView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue);
}
}(this, function (exports, uiUtils, pdfRenderingQueue) {
var mozL10n = uiUtils.mozL10n;
var getOutputScale = uiUtils.getOutputScale;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var THUMBNAIL_WIDTH = 98; // px var THUMBNAIL_WIDTH = 98; // px
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px
@ -430,5 +414,6 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
PDFThumbnailView.tempImageCache = null; PDFThumbnailView.tempImageCache = null;
exports.PDFThumbnailView = PDFThumbnailView; export {
})); PDFThumbnailView,
};

View File

@ -13,25 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
getVisibleElements, scrollIntoView, watchScroll
(function (root, factory) { } from 'pdfjs-web/ui_utils';
if (typeof define === 'function' && define.amd) { import { PDFThumbnailView } from 'pdfjs-web/pdf_thumbnail_view';
define('pdfjs-web/pdf_thumbnail_viewer', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_thumbnail_view'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_thumbnail_view.js'));
} else {
factory((root.pdfjsWebPDFThumbnailViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFThumbnailView);
}
}(this, function (exports, uiUtils, pdfThumbnailView) {
var watchScroll = uiUtils.watchScroll;
var getVisibleElements = uiUtils.getVisibleElements;
var scrollIntoView = uiUtils.scrollIntoView;
var PDFThumbnailView = pdfThumbnailView.PDFThumbnailView;
var THUMBNAIL_SCROLL_MARGIN = -19; var THUMBNAIL_SCROLL_MARGIN = -19;
@ -247,5 +232,6 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
return PDFThumbnailViewer; return PDFThumbnailViewer;
})(); })();
exports.PDFThumbnailViewer = PDFThumbnailViewer; export {
})); PDFThumbnailViewer,
};

View File

@ -13,48 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,
(function (root, factory) { MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,
if (typeof define === 'function' && define.amd) { UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll
define('pdfjs-web/pdf_viewer', ['exports', 'pdfjs-web/ui_utils', } from 'pdfjs-web/ui_utils';
'pdfjs-web/pdf_page_view', 'pdfjs-web/pdf_rendering_queue', import {
'pdfjs-web/text_layer_builder', 'pdfjs-web/annotation_layer_builder', PDFRenderingQueue, RenderingStates,
'pdfjs-web/pdf_link_service', 'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], } from 'pdfjs-web/pdf_rendering_queue';
factory); import { AnnotationLayerBuilder } from 'pdfjs-web/annotation_layer_builder';
} else if (typeof exports !== 'undefined') { import { domEvents } from 'pdfjs-web/dom_events';
factory(exports, require('./ui_utils.js'), require('./pdf_page_view.js'), import { PDFJS } from 'pdfjs-web/pdfjs';
require('./pdf_rendering_queue.js'), require('./text_layer_builder.js'), import { PDFPageView } from 'pdfjs-web/pdf_page_view';
require('./annotation_layer_builder.js'), import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
require('./pdf_link_service.js'), require('./dom_events.js'), import { TextLayerBuilder } from 'pdfjs-web/text_layer_builder';
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFPageView, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebTextLayerBuilder, root.pdfjsWebAnnotationLayerBuilder,
root.pdfjsWebPDFLinkService, root.pdfjsWebDOMEvents, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfPageView, pdfRenderingQueue,
textLayerBuilder, annotationLayerBuilder, pdfLinkService,
domEvents, pdfjsLib) {
var UNKNOWN_SCALE = uiUtils.UNKNOWN_SCALE;
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
var VERTICAL_PADDING = uiUtils.VERTICAL_PADDING;
var MAX_AUTO_SCALE = uiUtils.MAX_AUTO_SCALE;
var CSS_UNITS = uiUtils.CSS_UNITS;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var DEFAULT_SCALE_VALUE = uiUtils.DEFAULT_SCALE_VALUE;
var RendererType = uiUtils.RendererType;
var scrollIntoView = uiUtils.scrollIntoView;
var watchScroll = uiUtils.watchScroll;
var getVisibleElements = uiUtils.getVisibleElements;
var PDFPageView = pdfPageView.PDFPageView;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var PDFRenderingQueue = pdfRenderingQueue.PDFRenderingQueue;
var TextLayerBuilder = textLayerBuilder.TextLayerBuilder;
var AnnotationLayerBuilder = annotationLayerBuilder.AnnotationLayerBuilder;
var SimpleLinkService = pdfLinkService.SimpleLinkService;
var PresentationModeState = { var PresentationModeState = {
UNKNOWN: 0, UNKNOWN: 0,
@ -390,7 +362,7 @@ var PDFViewer = (function pdfViewer() {
var viewport = pdfPage.getViewport(scale * CSS_UNITS); var viewport = pdfPage.getViewport(scale * CSS_UNITS);
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
var textLayerFactory = null; var textLayerFactory = null;
if (!pdfjsLib.PDFJS.disableTextLayer) { if (!PDFJS.disableTextLayer) {
textLayerFactory = this; textLayerFactory = this;
} }
var pageView = new PDFPageView({ var pageView = new PDFPageView({
@ -416,7 +388,7 @@ var PDFViewer = (function pdfViewer() {
// starts to create the correct size canvas. Wait until one page is // starts to create the correct size canvas. Wait until one page is
// rendered so we don't tie up too many resources early on. // rendered so we don't tie up too many resources early on.
onePageRendered.then(function () { onePageRendered.then(function () {
if (!pdfjsLib.PDFJS.disableAutoFetch) { if (!PDFJS.disableAutoFetch) {
var getPagesLeft = pagesCount; var getPagesLeft = pagesCount;
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) { pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {
@ -528,7 +500,7 @@ var PDFViewer = (function pdfViewer() {
if (!noScroll) { if (!noScroll) {
var page = this._currentPageNumber, dest; var page = this._currentPageNumber, dest;
if (this._location && !pdfjsLib.PDFJS.ignoreCurrentPositionOnZoom && if (this._location && !PDFJS.ignoreCurrentPositionOnZoom &&
!(this.isInPresentationMode || this.isChangingPresentationMode)) { !(this.isInPresentationMode || this.isChangingPresentationMode)) {
page = this._location.pageNumber; page = this._location.pageNumber;
dest = [null, { name: 'XYZ' }, this._location.left, dest = [null, { name: 'XYZ' }, this._location.left,
@ -988,6 +960,7 @@ var PDFViewer = (function pdfViewer() {
return PDFViewer; return PDFViewer;
})(); })();
exports.PresentationModeState = PresentationModeState; export {
exports.PDFViewer = PDFViewer; PresentationModeState,
})); PDFViewer,
};

View File

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/preferences', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPreferences = {}));
}
}(this, function (exports) {
var defaultPreferences = null; var defaultPreferences = null;
function getDefaultPreferences() { function getDefaultPreferences() {
if (!defaultPreferences) { if (!defaultPreferences) {
@ -221,5 +209,6 @@ if (typeof PDFJSDev === 'undefined' ||
}; };
} }
exports.Preferences = Preferences; export {
})); Preferences,
};

View File

@ -13,21 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { mozL10n, SCROLLBAR_PADDING } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/secondary_toolbar', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebSecondaryToolbar = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
var mozL10n = uiUtils.mozL10n;
/** /**
* @typedef {Object} SecondaryToolbarOptions * @typedef {Object} SecondaryToolbarOptions
@ -241,5 +227,6 @@ var SecondaryToolbar = (function SecondaryToolbarClosure() {
return SecondaryToolbar; return SecondaryToolbar;
})(); })();
exports.SecondaryToolbar = SecondaryToolbar; export {
})); SecondaryToolbar,
};

View File

@ -13,19 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { domEvents } from 'pdfjs-web/dom_events';
import { renderTextLayer } from 'pdfjs-web/pdfjs';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/text_layer_builder', ['exports', 'pdfjs-web/dom_events',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./dom_events.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebTextLayerBuilder = {}), root.pdfjsWebDOMEvents,
root.pdfjsWebPDFJS);
}
}(this, function (exports, domEvents, pdfjsLib) {
var EXPAND_DIVS_TIMEOUT = 300; // ms var EXPAND_DIVS_TIMEOUT = 300; // ms
@ -97,7 +86,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.textDivs = []; this.textDivs = [];
var textLayerFrag = document.createDocumentFragment(); var textLayerFrag = document.createDocumentFragment();
this.textLayerRenderTask = pdfjsLib.renderTextLayer({ this.textLayerRenderTask = renderTextLayer({
textContent: this.textContent, textContent: this.textContent,
container: textLayerFrag, container: textLayerFrag,
viewport: this.viewport, viewport: this.viewport,
@ -419,6 +408,7 @@ DefaultTextLayerFactory.prototype = {
} }
}; };
exports.TextLayerBuilder = TextLayerBuilder; export {
exports.DefaultTextLayerFactory = DefaultTextLayerFactory; TextLayerBuilder,
})); DefaultTextLayerFactory,
};

View File

@ -13,28 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
animationStarted, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, localized, MAX_SCALE,
(function (root, factory) { MIN_SCALE, mozL10n, noContextMenuHandler
if (typeof define === 'function' && define.amd) { } from 'pdfjs-web/ui_utils';
define('pdfjs-web/toolbar', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebToolbar = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var mozL10n = uiUtils.mozL10n;
var noContextMenuHandler = uiUtils.noContextMenuHandler;
var animationStarted = uiUtils.animationStarted;
var localized = uiUtils.localized;
var DEFAULT_SCALE_VALUE = uiUtils.DEFAULT_SCALE_VALUE;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var MIN_SCALE = uiUtils.MIN_SCALE;
var MAX_SCALE = uiUtils.MAX_SCALE;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var SCALE_SELECT_CONTAINER_PADDING = 8; var SCALE_SELECT_CONTAINER_PADDING = 8;
@ -286,5 +268,6 @@ var Toolbar = (function ToolbarClosure() {
return Toolbar; return Toolbar;
})(); })();
exports.Toolbar = Toolbar; export {
})); Toolbar,
};

View File

@ -13,17 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { PDFJS } from 'pdfjs-web/pdfjs';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/ui_utils', ['exports', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebUIUtils = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
var CSS_UNITS = 96.0 / 72.0; var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto'; var DEFAULT_SCALE_VALUE = 'auto';
@ -42,8 +32,6 @@ var RendererType = {
var mozL10n = document.mozL10n || document.webL10n; var mozL10n = document.mozL10n || document.webL10n;
var PDFJS = pdfjsLib.PDFJS;
/** /**
* Disables fullscreen support, and by extension Presentation Mode, * Disables fullscreen support, and by extension Presentation Mode,
* in browsers which support the fullscreen API. * in browsers which support the fullscreen API.
@ -571,30 +559,31 @@ var ProgressBar = (function ProgressBarClosure() {
return ProgressBar; return ProgressBar;
})(); })();
exports.CSS_UNITS = CSS_UNITS; export {
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; CSS_UNITS,
exports.DEFAULT_SCALE = DEFAULT_SCALE; DEFAULT_SCALE_VALUE,
exports.MIN_SCALE = MIN_SCALE; DEFAULT_SCALE,
exports.MAX_SCALE = MAX_SCALE; MIN_SCALE,
exports.UNKNOWN_SCALE = UNKNOWN_SCALE; MAX_SCALE,
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; UNKNOWN_SCALE,
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; MAX_AUTO_SCALE,
exports.VERTICAL_PADDING = VERTICAL_PADDING; SCROLLBAR_PADDING,
exports.RendererType = RendererType; VERTICAL_PADDING,
exports.mozL10n = mozL10n; RendererType,
exports.EventBus = EventBus; mozL10n,
exports.ProgressBar = ProgressBar; EventBus,
exports.getPDFFileNameFromURL = getPDFFileNameFromURL; ProgressBar,
exports.noContextMenuHandler = noContextMenuHandler; getPDFFileNameFromURL,
exports.parseQueryString = parseQueryString; noContextMenuHandler,
exports.getVisibleElements = getVisibleElements; parseQueryString,
exports.roundToDivide = roundToDivide; getVisibleElements,
exports.approximateFraction = approximateFraction; roundToDivide,
exports.getOutputScale = getOutputScale; approximateFraction,
exports.scrollIntoView = scrollIntoView; getOutputScale,
exports.watchScroll = watchScroll; scrollIntoView,
exports.binarySearchFirstItem = binarySearchFirstItem; watchScroll,
exports.normalizeWheelEventDelta = normalizeWheelEventDelta; binarySearchFirstItem,
exports.animationStarted = animationStarted; normalizeWheelEventDelta,
exports.localized = localized; animationStarted,
})); localized,
};

View File

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/view_history', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebViewHistory = {}));
}
}(this, function (exports) {
var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
/** /**
@ -142,5 +130,6 @@ var ViewHistory = (function ViewHistoryClosure() {
return ViewHistory; return ViewHistory;
})(); })();
exports.ViewHistory = ViewHistory; export {
})); ViewHistory,
};

View File

@ -50,6 +50,7 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
} }
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME || GENERIC')) { if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME || GENERIC')) {
require('./pdf_print_service.js'); require('./pdf_print_service.js');
require('./download_manager.js');
} }
function getViewerConfiguration() { function getViewerConfiguration() {
@ -172,7 +173,8 @@ function webViewerLoad() {
var config = getViewerConfiguration(); var config = getViewerConfiguration();
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) { if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
Promise.all([SystemJS.import('pdfjs-web/app'), Promise.all([SystemJS.import('pdfjs-web/app'),
SystemJS.import('pdfjs-web/pdf_print_service')]) SystemJS.import('pdfjs-web/pdf_print_service'),
SystemJS.import('pdfjs-web/download_manager')])
.then(function (modules) { .then(function (modules) {
var app = modules[0]; var app = modules[0];
window.PDFViewerApplication = app.PDFViewerApplication; window.PDFViewerApplication = app.PDFViewerApplication;