@prose-reader/shared 1.28.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Manifest.d.ts +34 -34
- package/dist/contentType.d.ts +6 -11
- package/dist/index.d.ts +4 -4
- package/dist/prose-shared.js +39 -45
- package/dist/prose-shared.umd.cjs +1 -67
- package/dist/resources.d.ts +1 -1
- package/dist/url.d.ts +2 -2
- package/package.json +2 -2
package/dist/Manifest.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
export type TocItem = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
title: string;
|
|
3
|
+
path: string;
|
|
4
|
+
contents: TocItem[];
|
|
5
|
+
href: string;
|
|
6
|
+
};
|
|
7
7
|
export type Manifest = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
8
|
+
filename: string;
|
|
9
|
+
nav?: {
|
|
10
|
+
toc: TocItem[];
|
|
11
|
+
};
|
|
12
|
+
title: string;
|
|
13
|
+
renditionLayout: `reflowable` | `pre-paginated` | undefined;
|
|
14
|
+
renditionFlow?: `scrolled-continuous` | `scrolled-doc` | `paginated` | `auto`;
|
|
15
|
+
renditionSpread: `none` | `landscape` | `portrait` | `both` | `auto` | undefined;
|
|
16
|
+
readingDirection: "ltr" | "rtl";
|
|
17
|
+
guide?: {
|
|
18
|
+
type: `cover` | `title-page` | `copyright-page` | `text`;
|
|
19
|
+
title: string;
|
|
20
|
+
href: string;
|
|
21
|
+
}[];
|
|
22
|
+
spineItems: {
|
|
23
|
+
id: string;
|
|
24
|
+
href: string;
|
|
25
|
+
renditionLayout: `reflowable` | `pre-paginated`;
|
|
26
|
+
progressionWeight: number;
|
|
27
|
+
pageSpreadLeft: true | undefined;
|
|
28
|
+
pageSpreadRight: true | undefined;
|
|
29
|
+
mediaType?: string;
|
|
30
|
+
}[];
|
|
31
|
+
items: {
|
|
32
|
+
id: string;
|
|
33
|
+
href: string;
|
|
34
|
+
mediaType?: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
package/dist/contentType.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
export declare const detectMimeTypeFromName: (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}: {
|
|
8
|
-
uri?: string | undefined
|
|
9
|
-
mimeType?: string | undefined
|
|
10
|
-
}) => boolean | undefined
|
|
11
|
-
export declare const parseContentType: (str: string) => string | undefined
|
|
1
|
+
export declare const detectMimeTypeFromName: (name: string) => "image/png" | "image/jpg" | "image/jpeg" | "text/plain" | "image/webp" | "application/xhtml+xml" | undefined;
|
|
2
|
+
export declare const isXmlBasedMimeType: ({ mimeType, uri }: {
|
|
3
|
+
uri?: string | undefined;
|
|
4
|
+
mimeType?: string | undefined;
|
|
5
|
+
}) => boolean | undefined;
|
|
6
|
+
export declare const parseContentType: (str: string) => string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Manifest, TocItem } from "./Manifest"
|
|
2
|
-
export * from "./contentType"
|
|
3
|
-
export * from "./url"
|
|
4
|
-
export * from "./resources"
|
|
1
|
+
export type { Manifest, TocItem } from "./Manifest";
|
|
2
|
+
export * from "./contentType";
|
|
3
|
+
export * from "./url";
|
|
4
|
+
export * from "./resources";
|
package/dist/prose-shared.js
CHANGED
|
@@ -1,60 +1,54 @@
|
|
|
1
1
|
const p = (e) => {
|
|
2
|
-
var n, t
|
|
3
|
-
return ((t = (n = e.split(/[#?]/)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : t.trim()) || ""
|
|
4
|
-
}
|
|
2
|
+
var n, t;
|
|
3
|
+
return ((t = (n = e.split(/[#?]/)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : t.trim()) || "";
|
|
4
|
+
};
|
|
5
5
|
function l(e) {
|
|
6
|
-
const n = []
|
|
7
|
-
if (e.length === 0)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
e[0]
|
|
11
|
-
|
|
12
|
-
: (e[0] = e[0].replace(/^([^/:]+):\/*/, "$1://"))
|
|
6
|
+
const n = [];
|
|
7
|
+
if (e.length === 0)
|
|
8
|
+
return "";
|
|
9
|
+
if (typeof e[0] != "string")
|
|
10
|
+
throw new TypeError("Url must be a string. Received " + e[0]);
|
|
11
|
+
e[0].match(/^[^/:]+:\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\/\/\//) ? e[0] = e[0].replace(/^([^/:]+):\/*/, "$1:///") : e[0] = e[0].replace(/^([^/:]+):\/*/, "$1://");
|
|
13
12
|
for (let o = 0; o < e.length; o++) {
|
|
14
|
-
let i = e[o]
|
|
15
|
-
if (typeof i != "string")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
o < e.length - 1 ? (i = i.replace(/[/]+$/, "")) : (i = i.replace(/[/]+$/, "/")),
|
|
19
|
-
n.push(i))
|
|
13
|
+
let i = e[o];
|
|
14
|
+
if (typeof i != "string")
|
|
15
|
+
throw new TypeError("Url must be a string. Received " + i);
|
|
16
|
+
i !== "" && (o > 0 && (i = i.replace(/^[/]+/, "")), o < e.length - 1 ? i = i.replace(/[/]+$/, "") : i = i.replace(/[/]+$/, "/"), n.push(i));
|
|
20
17
|
}
|
|
21
|
-
let t = n.join("/")
|
|
22
|
-
t = t.replace(/\/(\?|&|#[^!])/g, "$1")
|
|
23
|
-
const c = t.split("?")
|
|
24
|
-
return
|
|
18
|
+
let t = n.join("/");
|
|
19
|
+
t = t.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
20
|
+
const c = t.split("?");
|
|
21
|
+
return t = c.shift() + (c.length > 0 ? "?" : "") + c.join("&"), t;
|
|
25
22
|
}
|
|
26
23
|
function s(...e) {
|
|
27
|
-
const n = Array.from(Array.isArray(e[0]) ? e[0] : e)
|
|
28
|
-
return l(n)
|
|
24
|
+
const n = Array.from(Array.isArray(e[0]) ? e[0] : e);
|
|
25
|
+
return l(n);
|
|
29
26
|
}
|
|
30
27
|
const r = (e) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
g = (e) => (e.length ? (e.indexOf(";") ? e.substring(0, e.indexOf(";")) : e) : void 0),
|
|
51
|
-
a = "prose-reader-resource-error"
|
|
28
|
+
switch (p(e)) {
|
|
29
|
+
case "png":
|
|
30
|
+
return "image/png";
|
|
31
|
+
case "jpg":
|
|
32
|
+
return "image/jpg";
|
|
33
|
+
case "jpeg":
|
|
34
|
+
return "image/jpeg";
|
|
35
|
+
case "txt":
|
|
36
|
+
return "text/plain";
|
|
37
|
+
case "webp":
|
|
38
|
+
return "image/webp";
|
|
39
|
+
case "xhtml":
|
|
40
|
+
return "application/xhtml+xml";
|
|
41
|
+
}
|
|
42
|
+
}, u = ({ mimeType: e, uri: n }) => {
|
|
43
|
+
const t = e ?? r(n ?? "");
|
|
44
|
+
return t == null ? void 0 : t.startsWith("application/xhtml+xml");
|
|
45
|
+
}, g = (e) => e.length ? e.indexOf(";") ? e.substring(0, e.indexOf(";")) : e : void 0, a = "prose-reader-resource-error";
|
|
52
46
|
export {
|
|
53
47
|
a as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,
|
|
54
48
|
r as detectMimeTypeFromName,
|
|
55
49
|
p as getUrlExtension,
|
|
56
50
|
u as isXmlBasedMimeType,
|
|
57
51
|
g as parseContentType,
|
|
58
|
-
s as urlJoin
|
|
59
|
-
}
|
|
52
|
+
s as urlJoin
|
|
53
|
+
};
|
|
60
54
|
//# sourceMappingURL=prose-shared.js.map
|
|
@@ -1,68 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
typeof exports == "object" && typeof module < "u"
|
|
3
|
-
? l(exports)
|
|
4
|
-
: typeof define == "function" && define.amd
|
|
5
|
-
? define(["exports"], l)
|
|
6
|
-
: ((t = typeof globalThis < "u" ? globalThis : t || self), l((t["prose-shared"] = {})))
|
|
7
|
-
})(this, function (t) {
|
|
8
|
-
"use strict"
|
|
9
|
-
const l = (e) => {
|
|
10
|
-
var i, n
|
|
11
|
-
return ((n = (i = e.split(/[#?]/)[0]) == null ? void 0 : i.split(".").pop()) == null ? void 0 : n.trim()) || ""
|
|
12
|
-
}
|
|
13
|
-
function u(e) {
|
|
14
|
-
const i = []
|
|
15
|
-
if (e.length === 0) return ""
|
|
16
|
-
if (typeof e[0] != "string") throw new TypeError("Url must be a string. Received " + e[0])
|
|
17
|
-
e[0].match(/^[^/:]+:\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]),
|
|
18
|
-
e[0].match(/^file:\/\/\//)
|
|
19
|
-
? (e[0] = e[0].replace(/^([^/:]+):\/*/, "$1:///"))
|
|
20
|
-
: (e[0] = e[0].replace(/^([^/:]+):\/*/, "$1://"))
|
|
21
|
-
for (let c = 0; c < e.length; c++) {
|
|
22
|
-
let o = e[c]
|
|
23
|
-
if (typeof o != "string") throw new TypeError("Url must be a string. Received " + o)
|
|
24
|
-
o !== "" &&
|
|
25
|
-
(c > 0 && (o = o.replace(/^[/]+/, "")),
|
|
26
|
-
c < e.length - 1 ? (o = o.replace(/[/]+$/, "")) : (o = o.replace(/[/]+$/, "/")),
|
|
27
|
-
i.push(o))
|
|
28
|
-
}
|
|
29
|
-
let n = i.join("/")
|
|
30
|
-
n = n.replace(/\/(\?|&|#[^!])/g, "$1")
|
|
31
|
-
const p = n.split("?")
|
|
32
|
-
return (n = p.shift() + (p.length > 0 ? "?" : "") + p.join("&")), n
|
|
33
|
-
}
|
|
34
|
-
function f(...e) {
|
|
35
|
-
const i = Array.from(Array.isArray(e[0]) ? e[0] : e)
|
|
36
|
-
return u(i)
|
|
37
|
-
}
|
|
38
|
-
const s = (e) => {
|
|
39
|
-
switch (l(e)) {
|
|
40
|
-
case "png":
|
|
41
|
-
return "image/png"
|
|
42
|
-
case "jpg":
|
|
43
|
-
return "image/jpg"
|
|
44
|
-
case "jpeg":
|
|
45
|
-
return "image/jpeg"
|
|
46
|
-
case "txt":
|
|
47
|
-
return "text/plain"
|
|
48
|
-
case "webp":
|
|
49
|
-
return "image/webp"
|
|
50
|
-
case "xhtml":
|
|
51
|
-
return "application/xhtml+xml"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
r = ({ mimeType: e, uri: i }) => {
|
|
55
|
-
const n = e ?? s(i ?? "")
|
|
56
|
-
return n == null ? void 0 : n.startsWith("application/xhtml+xml")
|
|
57
|
-
},
|
|
58
|
-
m = (e) => (e.length ? (e.indexOf(";") ? e.substring(0, e.indexOf(";")) : e) : void 0),
|
|
59
|
-
a = "prose-reader-resource-error"
|
|
60
|
-
;(t.PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME = a),
|
|
61
|
-
(t.detectMimeTypeFromName = s),
|
|
62
|
-
(t.getUrlExtension = l),
|
|
63
|
-
(t.isXmlBasedMimeType = r),
|
|
64
|
-
(t.parseContentType = m),
|
|
65
|
-
(t.urlJoin = f),
|
|
66
|
-
Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })
|
|
67
|
-
})
|
|
1
|
+
(function(t,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t["prose-shared"]={}))})(this,function(t){"use strict";const l=e=>{var i,n;return((n=(i=e.split(/[#?]/)[0])==null?void 0:i.split(".").pop())==null?void 0:n.trim())||""};function u(e){const i=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let c=0;c<e.length;c++){let o=e[c];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(c>0&&(o=o.replace(/^[/]+/,"")),c<e.length-1?o=o.replace(/[/]+$/,""):o=o.replace(/[/]+$/,"/"),i.push(o))}let n=i.join("/");n=n.replace(/\/(\?|&|#[^!])/g,"$1");const p=n.split("?");return n=p.shift()+(p.length>0?"?":"")+p.join("&"),n}function f(...e){const i=Array.from(Array.isArray(e[0])?e[0]:e);return u(i)}const s=e=>{switch(l(e)){case"png":return"image/png";case"jpg":return"image/jpg";case"jpeg":return"image/jpeg";case"txt":return"text/plain";case"webp":return"image/webp";case"xhtml":return"application/xhtml+xml"}},r=({mimeType:e,uri:i})=>{const n=e??s(i??"");return n==null?void 0:n.startsWith("application/xhtml+xml")},m=e=>e.length?e.indexOf(";")?e.substring(0,e.indexOf(";")):e:void 0,a="prose-reader-resource-error";t.PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME=a,t.detectMimeTypeFromName=s,t.getUrlExtension=l,t.isXmlBasedMimeType=r,t.parseContentType=m,t.urlJoin=f,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
68
2
|
//# sourceMappingURL=prose-shared.umd.cjs.map
|
package/dist/resources.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME = "prose-reader-resource-error"
|
|
1
|
+
export declare const PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME = "prose-reader-resource-error";
|
package/dist/url.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getUrlExtension: (url: string) => string
|
|
2
|
-
export declare function urlJoin(...args: (string | string[])[]): string
|
|
1
|
+
export declare const getUrlExtension: (url: string) => string;
|
|
2
|
+
export declare function urlJoin(...args: (string | string[])[]): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prose-reader/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/prose-shared.umd.cjs",
|
|
6
6
|
"module": "./dist/prose-shared.js",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"build": "tsc && vite build",
|
|
23
23
|
"test": "vitest run --coverage"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "3be4b2d76ae3b0ba3cf8c2faa9386edd5b51fc1b"
|
|
26
26
|
}
|