react-pdf
Advanced tools
Comparing version 7.7.1 to 8.0.0
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { EventProps } from 'make-event-props'; | ||
@@ -155,3 +155,3 @@ import type { ClassName, DocumentCallback, ExternalLinkRel, ExternalLinkTarget, File, ImageResourcesPath, NodeOrRenderer, OnDocumentLoadError, OnDocumentLoadProgress, OnDocumentLoadSuccess, OnError, OnItemClickArgs, OnPasswordCallback, Options, PasswordResponse, RenderMode } from './shared/types.js'; | ||
*/ | ||
declare const Document: React.ForwardRefExoticComponent<{ | ||
declare const Document: import("react").ForwardRefExoticComponent<{ | ||
children?: React.ReactNode; | ||
@@ -210,3 +210,3 @@ /** | ||
*/ | ||
inputRef?: React.Ref<HTMLDivElement> | undefined; | ||
inputRef?: import("react").Ref<HTMLDivElement> | undefined; | ||
/** | ||
@@ -284,34 +284,3 @@ * What the component should display while loading. | ||
*/ | ||
options?: { | ||
httpHeaders?: Object | null | undefined; | ||
withCredentials?: boolean | null | undefined; | ||
password?: string | null | undefined; | ||
length?: number | null | undefined; | ||
rangeChunkSize?: number | null | undefined; | ||
worker?: import("pdfjs-dist").PDFWorker | null | undefined; | ||
verbosity?: number | null | undefined; | ||
docBaseUrl?: string | null | undefined; | ||
cMapUrl?: string | null | undefined; | ||
cMapPacked?: boolean | null | undefined; | ||
CMapReaderFactory?: Object | null | undefined; | ||
useSystemFonts?: boolean | null | undefined; | ||
standardFontDataUrl?: string | null | undefined; | ||
StandardFontDataFactory?: Object | null | undefined; | ||
useWorkerFetch?: boolean | null | undefined; | ||
stopAtErrors?: boolean | null | undefined; | ||
maxImageSize?: number | null | undefined; | ||
isEvalSupported?: boolean | null | undefined; | ||
isOffscreenCanvasSupported?: boolean | null | undefined; | ||
canvasMaxAreaInBytes?: number | null | undefined; | ||
disableFontFace?: boolean | null | undefined; | ||
fontExtraProperties?: boolean | null | undefined; | ||
enableXfa?: boolean | null | undefined; | ||
ownerDocument?: HTMLDocument | null | undefined; | ||
disableRange?: boolean | null | undefined; | ||
disableStream?: boolean | null | undefined; | ||
disableAutoFetch?: boolean | null | undefined; | ||
pdfBug?: boolean | null | undefined; | ||
canvasFactory?: Object | null | undefined; | ||
filterFactory?: Object | null | undefined; | ||
} | undefined; | ||
options?: import("./shared/types.js").Options<Omit<import("pdfjs-dist/types/src/display/api.js").DocumentInitParameters, "data" | "range" | "url">> | undefined; | ||
/** | ||
@@ -332,3 +301,3 @@ * Rendering mode of the document. Can be `"canvas"`, `"custom"`, `"none"` or `"svg"`. If set to `"custom"`, `customRenderer` must also be provided. | ||
rotate?: number | null | undefined; | ||
} & EventProps<false | import("pdfjs-dist/types/src/display/api.js").PDFDocumentProxy | undefined> & React.RefAttributes<unknown>>; | ||
} & EventProps<false | import("pdfjs-dist/types/src/display/api.js").PDFDocumentProxy | undefined> & import("react").RefAttributes<unknown>>; | ||
export default Document; |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -50,4 +27,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const prop_types_1 = __importDefault(require("prop-types")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_event_props_1 = __importDefault(require("make-event-props")); | ||
@@ -66,3 +43,2 @@ const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
const useResolver_js_1 = __importDefault(require("./shared/hooks/useResolver.js")); | ||
const propTypes_js_1 = require("./shared/propTypes.js"); | ||
const { PDFDataRangeTransport } = pdfjs_js_1.default; | ||
@@ -102,4 +78,4 @@ const defaultOnPassword = (callback, reason) => { | ||
const pages = (0, react_1.useRef)([]); | ||
const prevFile = (0, react_1.useRef)(); | ||
const prevOptions = (0, react_1.useRef)(); | ||
const prevFile = (0, react_1.useRef)(undefined); | ||
const prevOptions = (0, react_1.useRef)(undefined); | ||
(0, react_1.useEffect)(() => { | ||
@@ -339,53 +315,20 @@ if (file && file !== prevFile.current && isParameterObject(file)) { | ||
function renderChildren() { | ||
return react_1.default.createElement(DocumentContext_js_1.default.Provider, { value: childContext }, children); | ||
return (0, jsx_runtime_1.jsx)(DocumentContext_js_1.default.Provider, { value: childContext, children: children }); | ||
} | ||
function renderContent() { | ||
if (!file) { | ||
return react_1.default.createElement(Message_js_1.default, { type: "no-data" }, typeof noData === 'function' ? noData() : noData); | ||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "no-data", children: typeof noData === 'function' ? noData() : noData }); | ||
} | ||
if (pdf === undefined || pdf === null) { | ||
return (react_1.default.createElement(Message_js_1.default, { type: "loading" }, typeof loading === 'function' ? loading() : loading)); | ||
return ((0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "loading", children: typeof loading === 'function' ? loading() : loading })); | ||
} | ||
if (pdf === false) { | ||
return react_1.default.createElement(Message_js_1.default, { type: "error" }, typeof error === 'function' ? error() : error); | ||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "error", children: typeof error === 'function' ? error() : error }); | ||
} | ||
return renderChildren(); | ||
} | ||
return (react_1.default.createElement("div", Object.assign({ className: (0, clsx_1.default)('react-pdf__Document', className), ref: inputRef, style: { | ||
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, clsx_1.default)('react-pdf__Document', className), ref: inputRef, style: { | ||
['--scale-factor']: '1', | ||
} }, eventProps), renderContent())); | ||
} }, eventProps, { children: renderContent() }))); | ||
}); | ||
const isFunctionOrNode = prop_types_1.default.oneOfType([prop_types_1.default.func, prop_types_1.default.node]); | ||
Document.propTypes = Object.assign(Object.assign({}, propTypes_js_1.eventProps), { children: prop_types_1.default.node, className: propTypes_js_1.isClassName, error: isFunctionOrNode, externalLinkRel: prop_types_1.default.string, externalLinkTarget: prop_types_1.default.oneOf(['_self', '_blank', '_parent', '_top']), file: propTypes_js_1.isFile, imageResourcesPath: prop_types_1.default.string, inputRef: propTypes_js_1.isRef, loading: isFunctionOrNode, noData: isFunctionOrNode, onItemClick: prop_types_1.default.func, onLoadError: prop_types_1.default.func, onLoadProgress: prop_types_1.default.func, onLoadSuccess: prop_types_1.default.func, onPassword: prop_types_1.default.func, onSourceError: prop_types_1.default.func, onSourceSuccess: prop_types_1.default.func, options: prop_types_1.default.shape({ | ||
canvasFactory: prop_types_1.default.any, | ||
canvasMaxAreaInBytes: prop_types_1.default.number, | ||
cMapPacked: prop_types_1.default.bool, | ||
CMapReaderFactory: prop_types_1.default.any, | ||
cMapUrl: prop_types_1.default.string, | ||
disableAutoFetch: prop_types_1.default.bool, | ||
disableFontFace: prop_types_1.default.bool, | ||
disableRange: prop_types_1.default.bool, | ||
disableStream: prop_types_1.default.bool, | ||
docBaseUrl: prop_types_1.default.string, | ||
enableXfa: prop_types_1.default.bool, | ||
filterFactory: prop_types_1.default.any, | ||
fontExtraProperties: prop_types_1.default.bool, | ||
httpHeaders: prop_types_1.default.object, | ||
isEvalSupported: prop_types_1.default.bool, | ||
isOffscreenCanvasSupported: prop_types_1.default.bool, | ||
length: prop_types_1.default.number, | ||
maxImageSize: prop_types_1.default.number, | ||
ownerDocument: prop_types_1.default.any, | ||
password: prop_types_1.default.string, | ||
pdfBug: prop_types_1.default.bool, | ||
rangeChunkSize: prop_types_1.default.number, | ||
StandardFontDataFactory: prop_types_1.default.any, | ||
standardFontDataUrl: prop_types_1.default.string, | ||
stopAtErrors: prop_types_1.default.bool, | ||
useSystemFonts: prop_types_1.default.bool, | ||
useWorkerFetch: prop_types_1.default.bool, | ||
verbosity: prop_types_1.default.number, | ||
withCredentials: prop_types_1.default.bool, | ||
worker: prop_types_1.default.any, | ||
}), rotate: prop_types_1.default.number }); | ||
exports.default = Document; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
type MessageProps = { | ||
@@ -3,0 +3,0 @@ children?: React.ReactNode; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
function Message({ children, type }) { | ||
return react_1.default.createElement("div", { className: `react-pdf__message react-pdf__message--${type}` }, children); | ||
return (0, jsx_runtime_1.jsx)("div", { className: `react-pdf__message react-pdf__message--${type}`, children: children }); | ||
} | ||
exports.default = Message; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PDFDocumentProxy } from 'pdfjs-dist'; | ||
@@ -47,3 +47,3 @@ import type { EventProps } from 'make-event-props'; | ||
*/ | ||
declare const Outline: React.FC<OutlineProps>; | ||
export default Outline; | ||
export default function Outline(props: OutlineProps): JSX.Element | null; | ||
export {}; |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -41,4 +18,4 @@ var t = {}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const prop_types_1 = __importDefault(require("prop-types")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -54,3 +31,2 @@ const make_event_props_1 = __importDefault(require("make-event-props")); | ||
const useResolver_js_1 = __importDefault(require("./shared/hooks/useResolver.js")); | ||
const propTypes_js_1 = require("./shared/propTypes.js"); | ||
/** | ||
@@ -61,3 +37,3 @@ * Displays an outline (table of contents). | ||
*/ | ||
const Outline = function Outline(props) { | ||
function Outline(props) { | ||
const documentContext = (0, useDocumentContext_js_1.default)(); | ||
@@ -138,8 +114,6 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
} | ||
return (react_1.default.createElement("ul", null, outline.map((item, itemIndex) => (react_1.default.createElement(OutlineItem_js_1.default, { key: typeof item.dest === 'string' ? item.dest : itemIndex, item: item, pdf: pdf }))))); | ||
return ((0, jsx_runtime_1.jsx)("ul", { children: outline.map((item, itemIndex) => ((0, jsx_runtime_1.jsx)(OutlineItem_js_1.default, { item: item, pdf: pdf }, typeof item.dest === 'string' ? item.dest : itemIndex))) })); | ||
} | ||
return (react_1.default.createElement("div", Object.assign({ className: (0, clsx_1.default)('react-pdf__Outline', className), ref: inputRef }, eventProps), | ||
react_1.default.createElement(OutlineContext_js_1.default.Provider, { value: childContext }, renderOutline()))); | ||
}; | ||
Outline.propTypes = Object.assign(Object.assign({}, propTypes_js_1.eventProps), { className: propTypes_js_1.isClassName, inputRef: propTypes_js_1.isRef, onItemClick: prop_types_1.default.func, onLoadError: prop_types_1.default.func, onLoadSuccess: prop_types_1.default.func, pdf: propTypes_js_1.isPdf }); | ||
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, clsx_1.default)('react-pdf__Outline', className), ref: inputRef }, eventProps, { children: (0, jsx_runtime_1.jsx)(OutlineContext_js_1.default.Provider, { value: childContext, children: renderOutline() }) }))); | ||
} | ||
exports.default = Outline; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
@@ -79,8 +79,6 @@ const Ref_js_1 = __importDefault(require("./Ref.js")); | ||
const { items: subitems } = item; | ||
return (react_1.default.createElement("ul", null, subitems.map((subitem, subitemIndex) => (react_1.default.createElement(OutlineItem, Object.assign({ key: typeof subitem.dest === 'string' ? subitem.dest : subitemIndex, item: subitem, pdf: pdf }, otherProps)))))); | ||
return ((0, jsx_runtime_1.jsx)("ul", { children: subitems.map((subitem, subitemIndex) => ((0, jsx_runtime_1.jsx)(OutlineItem, Object.assign({ item: subitem, pdf: pdf }, otherProps), typeof subitem.dest === 'string' ? subitem.dest : subitemIndex))) })); | ||
} | ||
return (react_1.default.createElement("li", null, | ||
react_1.default.createElement("a", { href: "#", onClick: onClick }, item.title), | ||
renderSubitems())); | ||
return ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("a", { href: "#", onClick: onClick, children: item.title }), renderSubitems()] })); | ||
} | ||
exports.default = OutlineItem; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PDFDocumentProxy } from 'pdfjs-dist'; | ||
@@ -259,3 +259,2 @@ import type { EventProps } from 'make-event-props'; | ||
*/ | ||
declare const Page: React.FC<PageProps>; | ||
export default Page; | ||
export default function Page(props: PageProps): JSX.Element; |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -41,4 +18,4 @@ var t = {}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const prop_types_1 = __importDefault(require("prop-types")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -59,3 +36,2 @@ const make_event_props_1 = __importDefault(require("make-event-props")); | ||
const useResolver_js_1 = __importDefault(require("./shared/hooks/useResolver.js")); | ||
const propTypes_js_1 = require("./shared/propTypes.js"); | ||
const defaultScale = 1; | ||
@@ -67,3 +43,3 @@ /** | ||
*/ | ||
const Page = function Page(props) { | ||
function Page(props) { | ||
const documentContext = (0, useDocumentContext_js_1.default)(); | ||
@@ -236,3 +212,3 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
(0, tiny_invariant_1.default)(CustomRenderer, `renderMode was set to "custom", but no customRenderer was passed.`); | ||
return react_1.default.createElement(CustomRenderer, { key: `${pageKey}_custom` }); | ||
return (0, jsx_runtime_1.jsx)(CustomRenderer, {}, `${pageKey}_custom`); | ||
} | ||
@@ -242,6 +218,6 @@ case 'none': | ||
case 'svg': | ||
return react_1.default.createElement(PageSVG_js_1.default, { key: `${pageKeyNoScale}_svg` }); | ||
return (0, jsx_runtime_1.jsx)(PageSVG_js_1.default, {}, `${pageKeyNoScale}_svg`); | ||
case 'canvas': | ||
default: | ||
return react_1.default.createElement(PageCanvas_js_1.default, { key: `${pageKey}_canvas`, canvasRef: canvasRef }); | ||
return (0, jsx_runtime_1.jsx)(PageCanvas_js_1.default, { canvasRef: canvasRef }, `${pageKey}_canvas`); | ||
} | ||
@@ -253,3 +229,3 @@ } | ||
} | ||
return react_1.default.createElement(TextLayer_js_1.default, { key: `${pageKey}_text` }); | ||
return (0, jsx_runtime_1.jsx)(TextLayer_js_1.default, {}, `${pageKey}_text`); | ||
} | ||
@@ -264,24 +240,20 @@ function renderAnnotationLayer() { | ||
*/ | ||
return react_1.default.createElement(AnnotationLayer_js_1.default, { key: `${pageKey}_annotations` }); | ||
return (0, jsx_runtime_1.jsx)(AnnotationLayer_js_1.default, {}, `${pageKey}_annotations`); | ||
} | ||
function renderChildren() { | ||
return (react_1.default.createElement(PageContext_js_1.default.Provider, { value: childContext }, | ||
renderMainLayer(), | ||
renderTextLayer(), | ||
renderAnnotationLayer(), | ||
children)); | ||
return ((0, jsx_runtime_1.jsxs)(PageContext_js_1.default.Provider, { value: childContext, children: [renderMainLayer(), renderTextLayer(), renderAnnotationLayer(), children] })); | ||
} | ||
function renderContent() { | ||
if (!pageNumber) { | ||
return react_1.default.createElement(Message_js_1.default, { type: "no-data" }, typeof noData === 'function' ? noData() : noData); | ||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "no-data", children: typeof noData === 'function' ? noData() : noData }); | ||
} | ||
if (pdf === null || page === undefined || page === null) { | ||
return (react_1.default.createElement(Message_js_1.default, { type: "loading" }, typeof loading === 'function' ? loading() : loading)); | ||
return ((0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "loading", children: typeof loading === 'function' ? loading() : loading })); | ||
} | ||
if (pdf === false || page === false) { | ||
return react_1.default.createElement(Message_js_1.default, { type: "error" }, typeof error === 'function' ? error() : error); | ||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "error", children: typeof error === 'function' ? error() : error }); | ||
} | ||
return renderChildren(); | ||
} | ||
return (react_1.default.createElement("div", Object.assign({ className: (0, clsx_1.default)(_className, className), "data-page-number": pageNumber, ref: (0, merge_refs_1.default)(inputRef, pageElement), style: { | ||
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, clsx_1.default)(_className, className), "data-page-number": pageNumber, ref: (0, merge_refs_1.default)(inputRef, pageElement), style: { | ||
['--scale-factor']: `${scale}`, | ||
@@ -292,6 +264,4 @@ backgroundColor: canvasBackground || 'white', | ||
minHeight: 'min-content', | ||
} }, eventProps), renderContent())); | ||
}; | ||
const isFunctionOrNode = prop_types_1.default.oneOfType([prop_types_1.default.func, prop_types_1.default.node]); | ||
Page.propTypes = Object.assign(Object.assign({}, propTypes_js_1.eventProps), { canvasBackground: prop_types_1.default.string, canvasRef: propTypes_js_1.isRef, children: prop_types_1.default.node, className: propTypes_js_1.isClassName, customRenderer: prop_types_1.default.func, customTextRenderer: prop_types_1.default.func, devicePixelRatio: prop_types_1.default.number, error: isFunctionOrNode, height: prop_types_1.default.number, imageResourcesPath: prop_types_1.default.string, inputRef: propTypes_js_1.isRef, loading: isFunctionOrNode, noData: isFunctionOrNode, onGetTextError: prop_types_1.default.func, onGetTextSuccess: prop_types_1.default.func, onLoadError: prop_types_1.default.func, onLoadSuccess: prop_types_1.default.func, onRenderError: prop_types_1.default.func, onRenderSuccess: prop_types_1.default.func, onRenderTextLayerError: prop_types_1.default.func, onRenderTextLayerSuccess: prop_types_1.default.func, pageIndex: propTypes_js_1.isPageIndex, pageNumber: propTypes_js_1.isPageNumber, pdf: propTypes_js_1.isPdf, renderAnnotationLayer: prop_types_1.default.bool, renderForms: prop_types_1.default.bool, renderMode: propTypes_js_1.isRenderMode, renderTextLayer: prop_types_1.default.bool, rotate: propTypes_js_1.isRotate, scale: prop_types_1.default.number, width: prop_types_1.default.number }); | ||
} }, eventProps, { children: renderContent() }))); | ||
} | ||
exports.default = Page; |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -30,3 +7,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -166,4 +144,4 @@ const clsx_1 = __importDefault(require("clsx")); | ||
[annotations, imageResourcesPath, linkService, page, renderForms, viewport]); | ||
return (react_1.default.createElement("div", { className: (0, clsx_1.default)('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement })); | ||
return ((0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement })); | ||
} | ||
exports.default = AnnotationLayer; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
type PageCanvasProps = { | ||
@@ -3,0 +3,0 @@ canvasRef?: React.Ref<HTMLCanvasElement>; |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -30,3 +7,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const merge_refs_1 = __importDefault(require("merge-refs")); | ||
@@ -131,7 +109,7 @@ const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
(0, react_1.useEffect)(() => cleanup, [cleanup]); | ||
return (react_1.default.createElement("canvas", { className: `${_className}__canvas`, dir: "ltr", ref: (0, merge_refs_1.default)(canvasRef, canvasElement), style: { | ||
return ((0, jsx_runtime_1.jsx)("canvas", { className: `${_className}__canvas`, dir: "ltr", ref: (0, merge_refs_1.default)(canvasRef, canvasElement), style: { | ||
display: 'block', | ||
userSelect: 'none', | ||
} }, renderTextLayer ? react_1.default.createElement(StructTree_js_1.default, null) : null)); | ||
}, children: renderTextLayer ? (0, jsx_runtime_1.jsx)(StructTree_js_1.default, {}) : null })); | ||
} | ||
exports.default = PageCanvas; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,3 +6,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -131,3 +109,3 @@ const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
const { width, height } = viewport; | ||
return (react_1.default.createElement("div", { className: `${_className}__svg`, | ||
return ((0, jsx_runtime_1.jsx)("div", { className: `${_className}__svg`, | ||
// Note: This cannot be shortened, as we need this function to be called with each render. | ||
@@ -134,0 +112,0 @@ ref: (ref) => drawPageOnContainer(ref), style: { |
"use strict"; | ||
'use client'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -30,3 +7,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -51,3 +29,3 @@ const clsx_1 = __importDefault(require("clsx")); | ||
const layerElement = (0, react_1.useRef)(null); | ||
const endElement = (0, react_1.useRef)(); | ||
const endElement = (0, react_1.useRef)(undefined); | ||
(0, warning_1.default)(parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-text-layer'), 10) === 1, 'TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer'); | ||
@@ -203,4 +181,4 @@ /** | ||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions | ||
react_1.default.createElement("div", { className: (0, clsx_1.default)('react-pdf__Page__textContent', 'textLayer'), onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: layerElement })); | ||
(0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('react-pdf__Page__textContent', 'textLayer'), onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: layerElement })); | ||
} | ||
exports.default = TextLayer; |
@@ -7,3 +7,3 @@ "use strict"; | ||
function useCachedValue(getter) { | ||
const ref = (0, react_1.useRef)(); | ||
const ref = (0, react_1.useRef)(undefined); | ||
const currentValue = ref.current; | ||
@@ -10,0 +10,0 @@ if ((0, utils_js_1.isDefined)(currentValue)) { |
@@ -20,3 +20,3 @@ /// <reference types="react" /> | ||
className?: string | undefined; | ||
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined; | ||
contentEditable?: "inherit" | (boolean | "true" | "false") | undefined; | ||
contextMenu?: string | undefined; | ||
@@ -69,3 +69,3 @@ dir?: string | undefined; | ||
'aria-controls'?: string | undefined; | ||
'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined; | ||
'aria-current'?: boolean | "time" | "page" | "step" | "location" | "date" | "true" | "false" | undefined; | ||
'aria-describedby'?: string | undefined; | ||
@@ -79,3 +79,3 @@ 'aria-details'?: string | undefined; | ||
'aria-grabbed'?: (boolean | "true" | "false") | undefined; | ||
'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined; | ||
'aria-haspopup'?: boolean | "grid" | "listbox" | "menu" | "tree" | "dialog" | "true" | "false" | undefined; | ||
'aria-hidden'?: (boolean | "true" | "false") | undefined; | ||
@@ -82,0 +82,0 @@ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,3 +6,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise")); | ||
@@ -104,4 +82,4 @@ const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
} | ||
return react_1.default.createElement(StructTreeItem_js_1.default, { className: "react-pdf__Page__structTree structTree", node: structTree }); | ||
return (0, jsx_runtime_1.jsx)(StructTreeItem_js_1.default, { className: "react-pdf__Page__structTree structTree", node: structTree }); | ||
} | ||
exports.default = StructTree; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const react_1 = require("react"); | ||
const structTreeUtils_js_1 = require("./shared/structTreeUtils.js"); | ||
@@ -40,7 +18,7 @@ function StructTreeItem({ className, node }) { | ||
// eslint-disable-next-line react/no-array-index-key | ||
react_1.default.createElement(StructTreeItem, { key: index, node: child })); | ||
(0, jsx_runtime_1.jsx)(StructTreeItem, { node: child }, index)); | ||
}); | ||
}, [node]); | ||
return (react_1.default.createElement("span", Object.assign({ className: className }, attributes), children)); | ||
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: className }, attributes, { children: children }))); | ||
} | ||
exports.default = StructTreeItem; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PageProps } from './Page.js'; | ||
@@ -24,3 +24,2 @@ import type { ClassName, OnItemClickArgs } from './shared/types.js'; | ||
*/ | ||
declare const Thumbnail: React.FC<ThumbnailProps>; | ||
export default Thumbnail; | ||
export default function Thumbnail(props: ThumbnailProps): JSX.Element; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
const clsx_1 = __importDefault(require("clsx")); | ||
@@ -30,3 +30,3 @@ const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
*/ | ||
const Thumbnail = function Thumbnail(props) { | ||
function Thumbnail(props) { | ||
const documentContext = (0, useDocumentContext_js_1.default)(); | ||
@@ -54,8 +54,8 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
} | ||
// eslint-disable-next-line react/prop-types | ||
const { className: classNameProps, onItemClick: onItemClickProps } = props, pageProps = __rest(props, ["className", "onItemClick"]); | ||
return ( | ||
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */ | ||
react_1.default.createElement("a", { className: (0, clsx_1.default)('react-pdf__Thumbnail', className), href: pageNumber ? '#' : undefined, onClick: onClick }, | ||
react_1.default.createElement(Page_js_1.default, Object.assign({}, pageProps, { _className: "react-pdf__Thumbnail__page", _enableRegisterUnregisterPage: false, renderAnnotationLayer: false, renderTextLayer: false })))); | ||
}; | ||
(0, jsx_runtime_1.jsx)("a", { className: (0, clsx_1.default)('react-pdf__Thumbnail', className), href: pageNumber ? '#' : undefined, onClick: onClick, children: (0, jsx_runtime_1.jsx)(Page_js_1.default, Object.assign({}, pageProps, { _className: "react-pdf__Thumbnail__page", _enableRegisterUnregisterPage: false, renderAnnotationLayer: false, renderTextLayer: false })) })); | ||
} | ||
exports.default = Thumbnail; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { EventProps } from 'make-event-props'; | ||
@@ -155,3 +155,3 @@ import type { ClassName, DocumentCallback, ExternalLinkRel, ExternalLinkTarget, File, ImageResourcesPath, NodeOrRenderer, OnDocumentLoadError, OnDocumentLoadProgress, OnDocumentLoadSuccess, OnError, OnItemClickArgs, OnPasswordCallback, Options, PasswordResponse, RenderMode } from './shared/types.js'; | ||
*/ | ||
declare const Document: React.ForwardRefExoticComponent<{ | ||
declare const Document: import("react").ForwardRefExoticComponent<{ | ||
children?: React.ReactNode; | ||
@@ -210,3 +210,3 @@ /** | ||
*/ | ||
inputRef?: React.Ref<HTMLDivElement> | undefined; | ||
inputRef?: import("react").Ref<HTMLDivElement> | undefined; | ||
/** | ||
@@ -284,34 +284,3 @@ * What the component should display while loading. | ||
*/ | ||
options?: { | ||
httpHeaders?: Object | null | undefined; | ||
withCredentials?: boolean | null | undefined; | ||
password?: string | null | undefined; | ||
length?: number | null | undefined; | ||
rangeChunkSize?: number | null | undefined; | ||
worker?: import("pdfjs-dist").PDFWorker | null | undefined; | ||
verbosity?: number | null | undefined; | ||
docBaseUrl?: string | null | undefined; | ||
cMapUrl?: string | null | undefined; | ||
cMapPacked?: boolean | null | undefined; | ||
CMapReaderFactory?: Object | null | undefined; | ||
useSystemFonts?: boolean | null | undefined; | ||
standardFontDataUrl?: string | null | undefined; | ||
StandardFontDataFactory?: Object | null | undefined; | ||
useWorkerFetch?: boolean | null | undefined; | ||
stopAtErrors?: boolean | null | undefined; | ||
maxImageSize?: number | null | undefined; | ||
isEvalSupported?: boolean | null | undefined; | ||
isOffscreenCanvasSupported?: boolean | null | undefined; | ||
canvasMaxAreaInBytes?: number | null | undefined; | ||
disableFontFace?: boolean | null | undefined; | ||
fontExtraProperties?: boolean | null | undefined; | ||
enableXfa?: boolean | null | undefined; | ||
ownerDocument?: HTMLDocument | null | undefined; | ||
disableRange?: boolean | null | undefined; | ||
disableStream?: boolean | null | undefined; | ||
disableAutoFetch?: boolean | null | undefined; | ||
pdfBug?: boolean | null | undefined; | ||
canvasFactory?: Object | null | undefined; | ||
filterFactory?: Object | null | undefined; | ||
} | undefined; | ||
options?: import("./shared/types.js").Options<Omit<import("pdfjs-dist/types/src/display/api.js").DocumentInitParameters, "data" | "range" | "url">> | undefined; | ||
/** | ||
@@ -332,3 +301,3 @@ * Rendering mode of the document. Can be `"canvas"`, `"custom"`, `"none"` or `"svg"`. If set to `"custom"`, `customRenderer` must also be provided. | ||
rotate?: number | null | undefined; | ||
} & EventProps<false | import("pdfjs-dist/types/src/display/api.js").PDFDocumentProxy | undefined> & React.RefAttributes<unknown>>; | ||
} & EventProps<false | import("pdfjs-dist/types/src/display/api.js").PDFDocumentProxy | undefined> & import("react").RefAttributes<unknown>>; | ||
export default Document; |
@@ -22,4 +22,4 @@ 'use client'; | ||
}; | ||
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react'; | ||
import makeEventProps from 'make-event-props'; | ||
@@ -38,3 +38,2 @@ import makeCancellable from 'make-cancellable-promise'; | ||
import useResolver from './shared/hooks/useResolver.js'; | ||
import { eventProps, isClassName, isFile, isRef } from './shared/propTypes.js'; | ||
const { PDFDataRangeTransport } = pdfjs; | ||
@@ -74,4 +73,4 @@ const defaultOnPassword = (callback, reason) => { | ||
const pages = useRef([]); | ||
const prevFile = useRef(); | ||
const prevOptions = useRef(); | ||
const prevFile = useRef(undefined); | ||
const prevOptions = useRef(undefined); | ||
useEffect(() => { | ||
@@ -311,53 +310,20 @@ if (file && file !== prevFile.current && isParameterObject(file)) { | ||
function renderChildren() { | ||
return React.createElement(DocumentContext.Provider, { value: childContext }, children); | ||
return _jsx(DocumentContext.Provider, { value: childContext, children: children }); | ||
} | ||
function renderContent() { | ||
if (!file) { | ||
return React.createElement(Message, { type: "no-data" }, typeof noData === 'function' ? noData() : noData); | ||
return _jsx(Message, { type: "no-data", children: typeof noData === 'function' ? noData() : noData }); | ||
} | ||
if (pdf === undefined || pdf === null) { | ||
return (React.createElement(Message, { type: "loading" }, typeof loading === 'function' ? loading() : loading)); | ||
return (_jsx(Message, { type: "loading", children: typeof loading === 'function' ? loading() : loading })); | ||
} | ||
if (pdf === false) { | ||
return React.createElement(Message, { type: "error" }, typeof error === 'function' ? error() : error); | ||
return _jsx(Message, { type: "error", children: typeof error === 'function' ? error() : error }); | ||
} | ||
return renderChildren(); | ||
} | ||
return (React.createElement("div", Object.assign({ className: clsx('react-pdf__Document', className), ref: inputRef, style: { | ||
return (_jsx("div", Object.assign({ className: clsx('react-pdf__Document', className), ref: inputRef, style: { | ||
['--scale-factor']: '1', | ||
} }, eventProps), renderContent())); | ||
} }, eventProps, { children: renderContent() }))); | ||
}); | ||
const isFunctionOrNode = PropTypes.oneOfType([PropTypes.func, PropTypes.node]); | ||
Document.propTypes = Object.assign(Object.assign({}, eventProps), { children: PropTypes.node, className: isClassName, error: isFunctionOrNode, externalLinkRel: PropTypes.string, externalLinkTarget: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']), file: isFile, imageResourcesPath: PropTypes.string, inputRef: isRef, loading: isFunctionOrNode, noData: isFunctionOrNode, onItemClick: PropTypes.func, onLoadError: PropTypes.func, onLoadProgress: PropTypes.func, onLoadSuccess: PropTypes.func, onPassword: PropTypes.func, onSourceError: PropTypes.func, onSourceSuccess: PropTypes.func, options: PropTypes.shape({ | ||
canvasFactory: PropTypes.any, | ||
canvasMaxAreaInBytes: PropTypes.number, | ||
cMapPacked: PropTypes.bool, | ||
CMapReaderFactory: PropTypes.any, | ||
cMapUrl: PropTypes.string, | ||
disableAutoFetch: PropTypes.bool, | ||
disableFontFace: PropTypes.bool, | ||
disableRange: PropTypes.bool, | ||
disableStream: PropTypes.bool, | ||
docBaseUrl: PropTypes.string, | ||
enableXfa: PropTypes.bool, | ||
filterFactory: PropTypes.any, | ||
fontExtraProperties: PropTypes.bool, | ||
httpHeaders: PropTypes.object, | ||
isEvalSupported: PropTypes.bool, | ||
isOffscreenCanvasSupported: PropTypes.bool, | ||
length: PropTypes.number, | ||
maxImageSize: PropTypes.number, | ||
ownerDocument: PropTypes.any, | ||
password: PropTypes.string, | ||
pdfBug: PropTypes.bool, | ||
rangeChunkSize: PropTypes.number, | ||
StandardFontDataFactory: PropTypes.any, | ||
standardFontDataUrl: PropTypes.string, | ||
stopAtErrors: PropTypes.bool, | ||
useSystemFonts: PropTypes.bool, | ||
useWorkerFetch: PropTypes.bool, | ||
verbosity: PropTypes.number, | ||
withCredentials: PropTypes.bool, | ||
worker: PropTypes.any, | ||
}), rotate: PropTypes.number }); | ||
export default Document; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
type MessageProps = { | ||
@@ -3,0 +3,0 @@ children?: React.ReactNode; |
@@ -1,4 +0,4 @@ | ||
import React from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
export default function Message({ children, type }) { | ||
return React.createElement("div", { className: `react-pdf__message react-pdf__message--${type}` }, children); | ||
return _jsx("div", { className: `react-pdf__message react-pdf__message--${type}`, children: children }); | ||
} |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PDFDocumentProxy } from 'pdfjs-dist'; | ||
@@ -47,3 +47,3 @@ import type { EventProps } from 'make-event-props'; | ||
*/ | ||
declare const Outline: React.FC<OutlineProps>; | ||
export default Outline; | ||
export default function Outline(props: OutlineProps): JSX.Element | null; | ||
export {}; |
@@ -13,4 +13,4 @@ 'use client'; | ||
}; | ||
import React, { useEffect, useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useEffect, useMemo } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -26,3 +26,2 @@ import makeEventProps from 'make-event-props'; | ||
import useResolver from './shared/hooks/useResolver.js'; | ||
import { eventProps, isClassName, isPdf, isRef } from './shared/propTypes.js'; | ||
/** | ||
@@ -33,3 +32,3 @@ * Displays an outline (table of contents). | ||
*/ | ||
const Outline = function Outline(props) { | ||
export default function Outline(props) { | ||
const documentContext = useDocumentContext(); | ||
@@ -110,8 +109,5 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
} | ||
return (React.createElement("ul", null, outline.map((item, itemIndex) => (React.createElement(OutlineItem, { key: typeof item.dest === 'string' ? item.dest : itemIndex, item: item, pdf: pdf }))))); | ||
return (_jsx("ul", { children: outline.map((item, itemIndex) => (_jsx(OutlineItem, { item: item, pdf: pdf }, typeof item.dest === 'string' ? item.dest : itemIndex))) })); | ||
} | ||
return (React.createElement("div", Object.assign({ className: clsx('react-pdf__Outline', className), ref: inputRef }, eventProps), | ||
React.createElement(OutlineContext.Provider, { value: childContext }, renderOutline()))); | ||
}; | ||
Outline.propTypes = Object.assign(Object.assign({}, eventProps), { className: isClassName, inputRef: isRef, onItemClick: PropTypes.func, onLoadError: PropTypes.func, onLoadSuccess: PropTypes.func, pdf: isPdf }); | ||
export default Outline; | ||
return (_jsx("div", Object.assign({ className: clsx('react-pdf__Outline', className), ref: inputRef }, eventProps, { children: _jsx(OutlineContext.Provider, { value: childContext, children: renderOutline() }) }))); | ||
} |
@@ -21,3 +21,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import React from 'react'; | ||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import invariant from 'tiny-invariant'; | ||
@@ -74,7 +74,5 @@ import Ref from './Ref.js'; | ||
const { items: subitems } = item; | ||
return (React.createElement("ul", null, subitems.map((subitem, subitemIndex) => (React.createElement(OutlineItem, Object.assign({ key: typeof subitem.dest === 'string' ? subitem.dest : subitemIndex, item: subitem, pdf: pdf }, otherProps)))))); | ||
return (_jsx("ul", { children: subitems.map((subitem, subitemIndex) => (_jsx(OutlineItem, Object.assign({ item: subitem, pdf: pdf }, otherProps), typeof subitem.dest === 'string' ? subitem.dest : subitemIndex))) })); | ||
} | ||
return (React.createElement("li", null, | ||
React.createElement("a", { href: "#", onClick: onClick }, item.title), | ||
renderSubitems())); | ||
return (_jsxs("li", { children: [_jsx("a", { href: "#", onClick: onClick, children: item.title }), renderSubitems()] })); | ||
} |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PDFDocumentProxy } from 'pdfjs-dist'; | ||
@@ -259,3 +259,2 @@ import type { EventProps } from 'make-event-props'; | ||
*/ | ||
declare const Page: React.FC<PageProps>; | ||
export default Page; | ||
export default function Page(props: PageProps): JSX.Element; |
@@ -13,4 +13,4 @@ 'use client'; | ||
}; | ||
import React, { useEffect, useMemo, useRef } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import { useEffect, useMemo, useRef } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -31,3 +31,2 @@ import makeEventProps from 'make-event-props'; | ||
import useResolver from './shared/hooks/useResolver.js'; | ||
import { eventProps, isClassName, isPageIndex, isPageNumber, isPdf, isRef, isRenderMode, isRotate, } from './shared/propTypes.js'; | ||
const defaultScale = 1; | ||
@@ -39,3 +38,3 @@ /** | ||
*/ | ||
const Page = function Page(props) { | ||
export default function Page(props) { | ||
const documentContext = useDocumentContext(); | ||
@@ -208,3 +207,3 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
invariant(CustomRenderer, `renderMode was set to "custom", but no customRenderer was passed.`); | ||
return React.createElement(CustomRenderer, { key: `${pageKey}_custom` }); | ||
return _jsx(CustomRenderer, {}, `${pageKey}_custom`); | ||
} | ||
@@ -214,6 +213,6 @@ case 'none': | ||
case 'svg': | ||
return React.createElement(PageSVG, { key: `${pageKeyNoScale}_svg` }); | ||
return _jsx(PageSVG, {}, `${pageKeyNoScale}_svg`); | ||
case 'canvas': | ||
default: | ||
return React.createElement(PageCanvas, { key: `${pageKey}_canvas`, canvasRef: canvasRef }); | ||
return _jsx(PageCanvas, { canvasRef: canvasRef }, `${pageKey}_canvas`); | ||
} | ||
@@ -225,3 +224,3 @@ } | ||
} | ||
return React.createElement(TextLayer, { key: `${pageKey}_text` }); | ||
return _jsx(TextLayer, {}, `${pageKey}_text`); | ||
} | ||
@@ -236,24 +235,20 @@ function renderAnnotationLayer() { | ||
*/ | ||
return React.createElement(AnnotationLayer, { key: `${pageKey}_annotations` }); | ||
return _jsx(AnnotationLayer, {}, `${pageKey}_annotations`); | ||
} | ||
function renderChildren() { | ||
return (React.createElement(PageContext.Provider, { value: childContext }, | ||
renderMainLayer(), | ||
renderTextLayer(), | ||
renderAnnotationLayer(), | ||
children)); | ||
return (_jsxs(PageContext.Provider, { value: childContext, children: [renderMainLayer(), renderTextLayer(), renderAnnotationLayer(), children] })); | ||
} | ||
function renderContent() { | ||
if (!pageNumber) { | ||
return React.createElement(Message, { type: "no-data" }, typeof noData === 'function' ? noData() : noData); | ||
return _jsx(Message, { type: "no-data", children: typeof noData === 'function' ? noData() : noData }); | ||
} | ||
if (pdf === null || page === undefined || page === null) { | ||
return (React.createElement(Message, { type: "loading" }, typeof loading === 'function' ? loading() : loading)); | ||
return (_jsx(Message, { type: "loading", children: typeof loading === 'function' ? loading() : loading })); | ||
} | ||
if (pdf === false || page === false) { | ||
return React.createElement(Message, { type: "error" }, typeof error === 'function' ? error() : error); | ||
return _jsx(Message, { type: "error", children: typeof error === 'function' ? error() : error }); | ||
} | ||
return renderChildren(); | ||
} | ||
return (React.createElement("div", Object.assign({ className: clsx(_className, className), "data-page-number": pageNumber, ref: mergeRefs(inputRef, pageElement), style: { | ||
return (_jsx("div", Object.assign({ className: clsx(_className, className), "data-page-number": pageNumber, ref: mergeRefs(inputRef, pageElement), style: { | ||
['--scale-factor']: `${scale}`, | ||
@@ -264,6 +259,3 @@ backgroundColor: canvasBackground || 'white', | ||
minHeight: 'min-content', | ||
} }, eventProps), renderContent())); | ||
}; | ||
const isFunctionOrNode = PropTypes.oneOfType([PropTypes.func, PropTypes.node]); | ||
Page.propTypes = Object.assign(Object.assign({}, eventProps), { canvasBackground: PropTypes.string, canvasRef: isRef, children: PropTypes.node, className: isClassName, customRenderer: PropTypes.func, customTextRenderer: PropTypes.func, devicePixelRatio: PropTypes.number, error: isFunctionOrNode, height: PropTypes.number, imageResourcesPath: PropTypes.string, inputRef: isRef, loading: isFunctionOrNode, noData: isFunctionOrNode, onGetTextError: PropTypes.func, onGetTextSuccess: PropTypes.func, onLoadError: PropTypes.func, onLoadSuccess: PropTypes.func, onRenderError: PropTypes.func, onRenderSuccess: PropTypes.func, onRenderTextLayerError: PropTypes.func, onRenderTextLayerSuccess: PropTypes.func, pageIndex: isPageIndex, pageNumber: isPageNumber, pdf: isPdf, renderAnnotationLayer: PropTypes.bool, renderForms: PropTypes.bool, renderMode: isRenderMode, renderTextLayer: PropTypes.bool, rotate: isRotate, scale: PropTypes.number, width: PropTypes.number }); | ||
export default Page; | ||
} }, eventProps, { children: renderContent() }))); | ||
} |
'use client'; | ||
import React, { useEffect, useMemo, useRef } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useEffect, useMemo, useRef } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -137,3 +138,3 @@ import clsx from 'clsx'; | ||
[annotations, imageResourcesPath, linkService, page, renderForms, viewport]); | ||
return (React.createElement("div", { className: clsx('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement })); | ||
return (_jsx("div", { className: clsx('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement })); | ||
} |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
type PageCanvasProps = { | ||
@@ -3,0 +3,0 @@ canvasRef?: React.Ref<HTMLCanvasElement>; |
'use client'; | ||
import React, { useCallback, useEffect, useMemo, useRef } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useCallback, useEffect, useMemo, useRef } from 'react'; | ||
import mergeRefs from 'merge-refs'; | ||
@@ -102,6 +103,6 @@ import invariant from 'tiny-invariant'; | ||
useEffect(() => cleanup, [cleanup]); | ||
return (React.createElement("canvas", { className: `${_className}__canvas`, dir: "ltr", ref: mergeRefs(canvasRef, canvasElement), style: { | ||
return (_jsx("canvas", { className: `${_className}__canvas`, dir: "ltr", ref: mergeRefs(canvasRef, canvasElement), style: { | ||
display: 'block', | ||
userSelect: 'none', | ||
} }, renderTextLayer ? React.createElement(StructTree, null) : null)); | ||
}, children: renderTextLayer ? _jsx(StructTree, {}) : null })); | ||
} |
@@ -1,2 +0,3 @@ | ||
import React, { useEffect, useMemo } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useEffect, useMemo } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -102,3 +103,3 @@ import invariant from 'tiny-invariant'; | ||
const { width, height } = viewport; | ||
return (React.createElement("div", { className: `${_className}__svg`, | ||
return (_jsx("div", { className: `${_className}__svg`, | ||
// Note: This cannot be shortened, as we need this function to be called with each render. | ||
@@ -105,0 +106,0 @@ ref: (ref) => drawPageOnContainer(ref), style: { |
'use client'; | ||
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -22,3 +23,3 @@ import clsx from 'clsx'; | ||
const layerElement = useRef(null); | ||
const endElement = useRef(); | ||
const endElement = useRef(undefined); | ||
warning(parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-text-layer'), 10) === 1, 'TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer'); | ||
@@ -174,3 +175,3 @@ /** | ||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions | ||
React.createElement("div", { className: clsx('react-pdf__Page__textContent', 'textLayer'), onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: layerElement })); | ||
_jsx("div", { className: clsx('react-pdf__Page__textContent', 'textLayer'), onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: layerElement })); | ||
} |
@@ -5,3 +5,3 @@ 'use client'; | ||
export default function useCachedValue(getter) { | ||
const ref = useRef(); | ||
const ref = useRef(undefined); | ||
const currentValue = ref.current; | ||
@@ -8,0 +8,0 @@ if (isDefined(currentValue)) { |
@@ -20,3 +20,3 @@ /// <reference types="react" /> | ||
className?: string | undefined; | ||
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined; | ||
contentEditable?: "inherit" | (boolean | "true" | "false") | undefined; | ||
contextMenu?: string | undefined; | ||
@@ -69,3 +69,3 @@ dir?: string | undefined; | ||
'aria-controls'?: string | undefined; | ||
'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined; | ||
'aria-current'?: boolean | "time" | "page" | "step" | "location" | "date" | "true" | "false" | undefined; | ||
'aria-describedby'?: string | undefined; | ||
@@ -79,3 +79,3 @@ 'aria-details'?: string | undefined; | ||
'aria-grabbed'?: (boolean | "true" | "false") | undefined; | ||
'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined; | ||
'aria-haspopup'?: boolean | "grid" | "listbox" | "menu" | "tree" | "dialog" | "true" | "false" | undefined; | ||
'aria-hidden'?: (boolean | "true" | "false") | undefined; | ||
@@ -82,0 +82,0 @@ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined; |
@@ -1,2 +0,3 @@ | ||
import React, { useEffect } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useEffect } from 'react'; | ||
import makeCancellable from 'make-cancellable-promise'; | ||
@@ -75,3 +76,3 @@ import invariant from 'tiny-invariant'; | ||
} | ||
return React.createElement(StructTreeItem, { className: "react-pdf__Page__structTree structTree", node: structTree }); | ||
return _jsx(StructTreeItem, { className: "react-pdf__Page__structTree structTree", node: structTree }); | ||
} |
@@ -1,2 +0,3 @@ | ||
import React, { useMemo } from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useMemo } from 'react'; | ||
import { getAttributes, isStructTreeNode, isStructTreeNodeWithOnlyContentChild, } from './shared/structTreeUtils.js'; | ||
@@ -15,6 +16,6 @@ export default function StructTreeItem({ className, node }) { | ||
// eslint-disable-next-line react/no-array-index-key | ||
React.createElement(StructTreeItem, { key: index, node: child })); | ||
_jsx(StructTreeItem, { node: child }, index)); | ||
}); | ||
}, [node]); | ||
return (React.createElement("span", Object.assign({ className: className }, attributes), children)); | ||
return (_jsx("span", Object.assign({ className: className }, attributes, { children: children }))); | ||
} |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import type { PageProps } from './Page.js'; | ||
@@ -24,3 +24,2 @@ import type { ClassName, OnItemClickArgs } from './shared/types.js'; | ||
*/ | ||
declare const Thumbnail: React.FC<ThumbnailProps>; | ||
export default Thumbnail; | ||
export default function Thumbnail(props: ThumbnailProps): JSX.Element; |
@@ -13,3 +13,3 @@ 'use client'; | ||
}; | ||
import React from 'react'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import clsx from 'clsx'; | ||
@@ -25,3 +25,3 @@ import invariant from 'tiny-invariant'; | ||
*/ | ||
const Thumbnail = function Thumbnail(props) { | ||
export default function Thumbnail(props) { | ||
const documentContext = useDocumentContext(); | ||
@@ -49,8 +49,7 @@ const mergedProps = Object.assign(Object.assign({}, documentContext), props); | ||
} | ||
// eslint-disable-next-line react/prop-types | ||
const { className: classNameProps, onItemClick: onItemClickProps } = props, pageProps = __rest(props, ["className", "onItemClick"]); | ||
return ( | ||
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */ | ||
React.createElement("a", { className: clsx('react-pdf__Thumbnail', className), href: pageNumber ? '#' : undefined, onClick: onClick }, | ||
React.createElement(Page, Object.assign({}, pageProps, { _className: "react-pdf__Thumbnail__page", _enableRegisterUnregisterPage: false, renderAnnotationLayer: false, renderTextLayer: false })))); | ||
}; | ||
export default Thumbnail; | ||
_jsx("a", { className: clsx('react-pdf__Thumbnail', className), href: pageNumber ? '#' : undefined, onClick: onClick, children: _jsx(Page, Object.assign({}, pageProps, { _className: "react-pdf__Thumbnail__page", _enableRegisterUnregisterPage: false, renderAnnotationLayer: false, renderTextLayer: false })) })); | ||
} |
{ | ||
"name": "react-pdf", | ||
"version": "7.7.1", | ||
"version": "8.0.0", | ||
"description": "Display PDFs in your React app as easily as if they were images.", | ||
@@ -39,6 +39,6 @@ "type": "module", | ||
"copy-styles": "cpy 'src/**/*.css' dist/esm && cpy 'src/**/*.css' dist/cjs", | ||
"format": "prettier --check . --cache", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"prepack": "yarn clean && yarn build", | ||
"prettier": "prettier --check . --cache", | ||
"test": "yarn lint && yarn tsc && yarn prettier && yarn unit", | ||
"test": "yarn lint && yarn tsc && yarn format && yarn unit", | ||
"tsc": "tsc", | ||
@@ -65,3 +65,2 @@ "unit": "vitest", | ||
"pdfjs-dist": "3.11.174", | ||
"prop-types": "^15.6.2", | ||
"tiny-invariant": "^1.0.0", | ||
@@ -71,5 +70,5 @@ "warning": "^4.0.0" | ||
"devDependencies": { | ||
"@testing-library/dom": "^9.0.0", | ||
"@testing-library/dom": "^10.0.0", | ||
"@testing-library/jest-dom": "^6.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/react": "^15.0.0", | ||
"@types/node": "*", | ||
@@ -81,16 +80,16 @@ "@types/react": "*", | ||
"eslint": "^8.56.0", | ||
"eslint-config-wojtekmaj": "^0.11.0", | ||
"eslint-config-wojtekmaj": "^1.0.0", | ||
"jsdom": "^24.0.0", | ||
"nodemon": "^3.0.0", | ||
"prettier": "^3.0.0", | ||
"prettier": "^3.2.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^3.0.0", | ||
"typescript": "^5.3.2", | ||
"typescript": "^5.4.2", | ||
"vitest": "^1.0.2" | ||
}, | ||
"peerDependencies": { | ||
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -97,0 +96,0 @@ "peerDependenciesMeta": { |
@@ -8,3 +8,3 @@ 'use client'; | ||
export default function useCachedValue<T>(getter: () => T): () => T { | ||
const ref = useRef<T>(); | ||
const ref = useRef<T | undefined>(undefined); | ||
@@ -11,0 +11,0 @@ const currentValue = ref.current; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11
609529
178
13596
- Removedprop-types@^15.6.2
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)