Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@featherds/pdf-viewer

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featherds/pdf-viewer - npm Package Compare versions

Comparing version 0.10.2 to 0.10.3

src/components/__snapshots__/FeatherPdfViewer.spec.ts.snap

193

dist/app.es.js

@@ -30,7 +30,7 @@ var __defProp = Object.defineProperty;

import { useLabelProperty } from "@featherds/composables/LabelProperty";
import { resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode, createStaticVNode, ref, toRef, computed, watch, withDirectives, Transition, createBlock, createCommentVNode, renderSlot, withModifiers, vShow } from "vue";
import { defineComponent, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode, createStaticVNode, ref, toRef, computed, watch, withDirectives, Transition, createBlock, createCommentVNode, renderSlot, withModifiers, vShow } from "vue";
var ErrorPanel_vue_vue_type_style_index_0_scoped_true_lang = "";
var _export_sfc = (sfc, props) => {
var _export_sfc = (sfc, props2) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
for (const [key, val] of props2) {
target[key] = val;

@@ -40,3 +40,3 @@ }

};
const _sfc_main$1 = {
const _sfc_main$1 = defineComponent({
props: {

@@ -63,5 +63,5 @@ text: {

}
};
});
const _hoisted_1$1 = { class: "error-container" };
const _hoisted_2$1 = /* @__PURE__ */ createStaticVNode('<div class="error-icon" data-v-f4317c8a><svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="180" height="280" viewBox="0 0 180 280" data-v-f4317c8a><g data-v-f4317c8a><g opacity="0.18" data-v-f4317c8a><g data-v-f4317c8a><path d="M172.66,50.93,125.23,3.51h0a5.37,5.37,0,0,0-.51-.44l-.14-.1a4.15,4.15,0,0,0-.57-.35l0,0-.57-.25-.16-.05a3.58,3.58,0,0,0-.64-.18h0a4.81,4.81,0,0,0-.65-.08H11A5.15,5.15,0,0,0,5.87,7.15V228.64A5.14,5.14,0,0,0,11,233.79H169a5.14,5.14,0,0,0,5.15-5.15V55.14A5.13,5.13,0,0,0,172.66,50.93ZM126.74,19.6l29.78,29.82H126.74ZM16.17,223.49V12.3H116.44V54.58a5.16,5.16,0,0,0,5.15,5.15h42.24V223.49Z" data-v-f4317c8a></path><path d="M122.16,151.92H57.84A12.9,12.9,0,0,0,45,164.8v2.63a3.44,3.44,0,0,0,6.87,0V164.8a6,6,0,0,1,6-6h64.32a6,6,0,0,1,6,6v2.63a3.44,3.44,0,0,0,6.87,0V164.8A12.9,12.9,0,0,0,122.16,151.92Z" data-v-f4317c8a></path><circle cx="56.98" cy="115.94" r="10.54" data-v-f4317c8a></circle><circle cx="123.02" cy="115.94" r="10.54" data-v-f4317c8a></circle></g><ellipse cx="90" cy="264.96" rx="88.46" ry="13.04" data-v-f4317c8a></ellipse></g><rect width="180" height="280" fill="none" data-v-f4317c8a></rect></g></svg></div>', 1);
const _hoisted_2$1 = /* @__PURE__ */ createStaticVNode('<div class="error-icon" data-v-13af2494><svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="180" height="280" viewBox="0 0 180 280" data-v-13af2494><g data-v-13af2494><g opacity="0.18" data-v-13af2494><g data-v-13af2494><path d="M172.66,50.93,125.23,3.51h0a5.37,5.37,0,0,0-.51-.44l-.14-.1a4.15,4.15,0,0,0-.57-.35l0,0-.57-.25-.16-.05a3.58,3.58,0,0,0-.64-.18h0a4.81,4.81,0,0,0-.65-.08H11A5.15,5.15,0,0,0,5.87,7.15V228.64A5.14,5.14,0,0,0,11,233.79H169a5.14,5.14,0,0,0,5.15-5.15V55.14A5.13,5.13,0,0,0,172.66,50.93ZM126.74,19.6l29.78,29.82H126.74ZM16.17,223.49V12.3H116.44V54.58a5.16,5.16,0,0,0,5.15,5.15h42.24V223.49Z" data-v-13af2494></path><path d="M122.16,151.92H57.84A12.9,12.9,0,0,0,45,164.8v2.63a3.44,3.44,0,0,0,6.87,0V164.8a6,6,0,0,1,6-6h64.32a6,6,0,0,1,6,6v2.63a3.44,3.44,0,0,0,6.87,0V164.8A12.9,12.9,0,0,0,122.16,151.92Z" data-v-13af2494></path><circle cx="56.98" cy="115.94" r="10.54" data-v-13af2494></circle><circle cx="123.02" cy="115.94" r="10.54" data-v-13af2494></circle></g><ellipse cx="90" cy="264.96" rx="88.46" ry="13.04" data-v-13af2494></ellipse></g><rect width="180" height="280" fill="none" data-v-13af2494></rect></g></svg></div>', 1);
const _hoisted_3$1 = { class: "error-text" };

@@ -73,7 +73,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {

_hoisted_2$1,
createElementVNode("div", _hoisted_3$1, toDisplayString($props.text), 1),
createElementVNode("div", _hoisted_3$1, toDisplayString(_ctx.text), 1),
createVNode(_component_FeatherButton, {
"as-anchor": "",
primary: "",
href: $props.downloadUrl,
href: _ctx.downloadUrl,
download: "",

@@ -83,6 +83,6 @@ target: "_blank"

icon: withCtx(() => [
createVNode(_component_FeatherIcon, { icon: $options.icon }, null, 8, ["icon"])
createVNode(_component_FeatherIcon, { icon: _ctx.icon }, null, 8, ["icon"])
]),
default: withCtx(() => [
createTextVNode(" " + toDisplayString($props.downloadText), 1)
createTextVNode(" " + toDisplayString(_ctx.downloadText), 1)
]),

@@ -93,3 +93,3 @@ _: 1

}
var ErrorPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-f4317c8a"]]);
var ErrorPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-13af2494"]]);
var FeatherPdfViewer_vue_vue_type_style_index_0_scoped_true_lang = "";

@@ -104,3 +104,43 @@ const LABELS = {

};
const _sfc_main = {
const props = {
modelValue: {
type: Boolean,
default: false
},
forceError: {
type: Boolean,
default: false
},
hideActions: {
type: Boolean,
default: false
},
documentExtension: {
type: String,
required: true
},
documentUrl: {
type: String,
required: true
},
previewUrl: {
type: String
},
labels: {
type: Object,
default: () => {
return LABELS;
},
validator: (v) => {
return !!(v && v.title && v.title !== LABELS.title && v.viewerTitle && v.viewerTitle.length);
}
}
};
const emits = {
"update:modelValue": (v) => true,
shown: () => true,
hidden: () => true,
"check-request": (v) => true
};
const _sfc_main = defineComponent({
model: {

@@ -110,48 +150,19 @@ prop: "modelValue",

},
emits: ["update:modelValue", "shown", "hidden", "check-request"],
props: {
modelValue: {
type: Boolean
},
forceError: {
type: Boolean,
default: false
},
hideActions: {
type: Boolean,
default: false
},
documentExtension: {
type: String,
required: true
},
documentUrl: {
type: String,
required: true
},
previewUrl: {
type: String
},
labels: {
type: Object,
default() {
return LABELS;
},
validator(v) {
return v && v.title && v.title !== LABELS.title && v.viewerTitle && v.viewerTitle.length;
}
}
},
setup(props, context) {
const LOADING = 0;
const NOPREVIEW = 1;
const ERROR = 2;
const PREVIEW = 3;
const state = ref(LOADING);
const labels = useLabelProperty(toRef(props, "labels"), LABELS);
const visible = toRef(props, "modelValue");
const previewUrl = toRef(props, "previewUrl");
const ext = toRef(props, "documentExtension");
const docUrl = toRef(props, "documentUrl");
const forceError = toRef(props, "forceError");
emits,
props,
setup(props2, context) {
let STATE;
((STATE2) => {
STATE2[STATE2["LOADING"] = 0] = "LOADING";
STATE2[STATE2["NOPREVIEW"] = 1] = "NOPREVIEW";
STATE2[STATE2["ERROR"] = 2] = "ERROR";
STATE2[STATE2["PREVIEW"] = 3] = "PREVIEW";
})(STATE || (STATE = {}));
const state = ref(0);
const labels = useLabelProperty(toRef(props2, "labels"), LABELS);
const visible = toRef(props2, "modelValue");
const previewUrl = toRef(props2, "previewUrl");
const ext = toRef(props2, "documentExtension");
const docUrl = toRef(props2, "documentUrl");
const forceError = toRef(props2, "forceError");
const element = ref();

@@ -174,3 +185,3 @@ const close = () => {

if (ext.value.toLowerCase() === "pdf") {
return props.documentUrl;
return props2.documentUrl;
}

@@ -190,3 +201,3 @@ return previewUrl.value ? previewUrl.value : void 0;

if (forceError.value) {
state.value = ERROR;
state.value = 2;
} else {

@@ -198,3 +209,3 @@ state.value = incoming;

if (vis && (url && url.length || docUrl2 && docUrl2.length)) {
updateState(LOADING);
updateState(0);
var http = new window.XMLHttpRequest();

@@ -206,8 +217,8 @@ let requestUrl = url ? url : docUrl2;

if (http.status !== 200) {
updateState(ERROR);
updateState(2);
} else {
if (url === requestUrl && hasPreviewer) {
updateState(PREVIEW);
updateState(3);
} else {
updateState(NOPREVIEW);
updateState(1);
}

@@ -218,3 +229,3 @@ }

context.emit("check-request", http);
updateState(ERROR);
updateState(2);
};

@@ -224,3 +235,3 @@ http.send();

}, { immediate: true });
const shown = ref(props.modelValue);
const shown = ref(props2.modelValue);
watch(shown, (v) => {

@@ -235,3 +246,3 @@ if (v) {

if (labels.downloadLabel) {
return labels.downloadLabel.value.replace("${ext}", props.documentExtension);
return labels.downloadLabel.value.replace("${ext}", props2.documentExtension);
}

@@ -270,3 +281,3 @@ return "";

}
};
});
const _hoisted_1 = {

@@ -311,8 +322,8 @@ class: "feather-pdfviewer",

name: "fade",
onAfterEnter: _cache[0] || (_cache[0] = ($event) => $setup.shown = true),
onAfterLeave: _cache[1] || (_cache[1] = ($event) => $setup.shown = false)
onAfterEnter: _cache[0] || (_cache[0] = ($event) => _ctx.shown = true),
onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.shown = false)
}, {
default: withCtx(() => [
withDirectives(createVNode(_component_FocusTrap, {
enable: $setup.shown && $props.modelValue,
enable: _ctx.shown && _ctx.modelValue,
class: "trap"

@@ -325,3 +336,3 @@ }, {

"aria-modal": "true",
"aria-label": $setup.computedViewerTitle,
"aria-label": _ctx.computedViewerTitle,
"data-ref-id": "feather-pdfviewer"

@@ -332,3 +343,3 @@ }, [

createElementVNode("span", _hoisted_4, toDisplayString(_ctx.titleLabel), 1),
!$props.hideActions && $setup.downloadUrl ? (openBlock(), createBlock(_component_FeatherButton, {
!_ctx.hideActions && _ctx.downloadUrl ? (openBlock(), createBlock(_component_FeatherButton, {
key: 0,

@@ -338,3 +349,3 @@ "as-anchor": "",

"on-color": "",
href: $setup.downloadUrl,
href: _ctx.downloadUrl,
download: "",

@@ -346,3 +357,3 @@ target: "_blank",

createVNode(_component_FeatherIcon, {
icon: $setup.downloadIcon,
icon: _ctx.downloadIcon,
flex: ""

@@ -352,3 +363,3 @@ }, null, 8, ["icon"])

default: withCtx(() => [
createTextVNode(" " + toDisplayString($setup.computedDownloadLabel), 1)
createTextVNode(" " + toDisplayString(_ctx.computedDownloadLabel), 1)
]),

@@ -359,9 +370,9 @@ _: 1

createElementVNode("div", _hoisted_5, [
$setup.hasPanel ? (openBlock(), createElementBlock("div", _hoisted_6, [
_ctx.hasPanel ? (openBlock(), createElementBlock("div", _hoisted_6, [
renderSlot(_ctx.$slots, "panel", {}, void 0, true)
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_7, [
$setup.state === 3 ? (openBlock(), createElementBlock("iframe", {
_ctx.state === 3 ? (openBlock(), createElementBlock("iframe", {
key: 0,
src: $setup.preview,
src: _ctx.preview,
title: _ctx.titleLabel,

@@ -371,20 +382,20 @@ frameborder: "0",

}, null, 8, _hoisted_8)) : createCommentVNode("", true),
$setup.state === 0 ? (openBlock(), createElementBlock("div", _hoisted_9, [
_ctx.state === 0 ? (openBlock(), createElementBlock("div", _hoisted_9, [
createVNode(_component_FeatherSpinner)
])) : createCommentVNode("", true),
$setup.state === 2 ? (openBlock(), createElementBlock("div", _hoisted_10, [
_ctx.state === 2 ? (openBlock(), createElementBlock("div", _hoisted_10, [
renderSlot(_ctx.$slots, "error", {}, () => [
createVNode(_component_ErrorPanel, {
text: _ctx.errorPreviewFileLabel,
"download-text": $setup.computedDownloadLabel,
"download-url": $props.documentUrl
"download-text": _ctx.computedDownloadLabel,
"download-url": _ctx.documentUrl
}, null, 8, ["text", "download-text", "download-url"])
], true)
])) : createCommentVNode("", true),
$setup.state === 1 ? (openBlock(), createElementBlock("div", _hoisted_11, [
_ctx.state === 1 ? (openBlock(), createElementBlock("div", _hoisted_11, [
renderSlot(_ctx.$slots, "no-preview", {}, () => [
createVNode(_component_ErrorPanel, {
text: _ctx.noPreviewFileLabel,
"download-text": $setup.computedDownloadLabel,
"download-url": $props.documentUrl
"download-text": _ctx.computedDownloadLabel,
"download-url": _ctx.documentUrl
}, null, 8, ["text", "download-text", "download-url"])

@@ -401,7 +412,7 @@ ], true)

class: "close-icon",
onClick: withModifiers($setup.close, ["prevent"]),
onClick: withModifiers(_ctx.close, ["prevent"]),
"data-ref-id": "feather-pdfviewer-close"
}, {
default: withCtx(() => [
createVNode(_component_FeatherIcon, { icon: $setup.closeIcon }, null, 8, ["icon"])
createVNode(_component_FeatherIcon, { icon: _ctx.closeIcon }, null, 8, ["icon"])
]),

@@ -415,3 +426,3 @@ _: 1

}, 8, ["enable"]), [
[vShow, $props.modelValue]
[vShow, _ctx.modelValue]
])

@@ -422,6 +433,6 @@ ]),

], 512)), [
[vShow, $props.modelValue]
[vShow, _ctx.modelValue]
]);
}
var FeatherPdfViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7d947154"]]);
var FeatherPdfViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7aa3ea73"]]);
export { FeatherPdfViewer };
{
"name": "@featherds/pdf-viewer",
"version": "0.10.2",
"version": "0.10.3",
"publishConfig": {

@@ -12,8 +12,8 @@ "access": "public"

"dependencies": {
"@featherds/button": "^0.10.2",
"@featherds/composables": "^0.10.2",
"@featherds/dialog": "^0.10.2",
"@featherds/icon": "^0.10.2",
"@featherds/progress": "^0.10.2",
"@featherds/styles": "^0.10.2",
"@featherds/button": "^0.10.3",
"@featherds/composables": "^0.10.3",
"@featherds/dialog": "^0.10.3",
"@featherds/icon": "^0.10.3",
"@featherds/progress": "^0.10.3",
"@featherds/styles": "^0.10.3",
"vue": "^3.1.0-0"

@@ -26,3 +26,3 @@ },

"types": "./src/index.d.ts",
"gitHead": "962dcee415575770eb0bc2781bfd29288873176e"
"gitHead": "52cfa2d3253a4db3ec6c1b66bb77dc5b1faff3c2"
}

@@ -1,5 +0,11 @@

declare module "@featherds/pdf-viewer" {
import { defineComponent } from "vue";
const FeatherPdfViewer: ReturnType<typeof defineComponent>;
export { FeatherPdfViewer };
}
import { DefineComponent } from "vue";
export const FeatherPdfViewer: DefineComponent<
typeof import("./components/FeatherPdfViewer.vue").props,
{},
{},
{},
{},
{},
{},
typeof import("./components/FeatherPdfViewer.vue").emits
>;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc