@prose-reader/shared 1.3.0 → 1.4.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
CHANGED
|
@@ -13,7 +13,7 @@ export declare type Manifest = {
|
|
|
13
13
|
renditionLayout: `reflowable` | `pre-paginated` | undefined;
|
|
14
14
|
renditionFlow?: `scrolled-continuous` | `scrolled-doc` | `paginated` | `auto`;
|
|
15
15
|
renditionSpread: `none` | `landscape` | `portrait` | `both` | `auto` | undefined;
|
|
16
|
-
readingDirection:
|
|
16
|
+
readingDirection: "ltr" | "rtl";
|
|
17
17
|
guide?: {
|
|
18
18
|
type: `cover` | `title-page` | `copyright-page` | `text`;
|
|
19
19
|
title: string;
|
|
@@ -22,7 +22,6 @@ export declare type Manifest = {
|
|
|
22
22
|
spineItems: {
|
|
23
23
|
id: string;
|
|
24
24
|
href: string;
|
|
25
|
-
path: string;
|
|
26
25
|
renditionLayout: `reflowable` | `pre-paginated`;
|
|
27
26
|
progressionWeight: number;
|
|
28
27
|
pageSpreadLeft: true | undefined;
|
package/dist/contentType.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
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;
|
|
2
6
|
export declare const parseContentType: (str: string) => string | undefined;
|
package/dist/index.d.ts
CHANGED
package/dist/prose-shared.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = (e) => {
|
|
2
2
|
var t, n;
|
|
3
3
|
return ((n = (t = e.split(/[#?]/)[0]) == null ? void 0 : t.split(".").pop()) == null ? void 0 : n.trim()) || "";
|
|
4
|
-
},
|
|
5
|
-
switch (
|
|
4
|
+
}, r = (e) => {
|
|
5
|
+
switch (i(e)) {
|
|
6
6
|
case "png":
|
|
7
7
|
return "image/png";
|
|
8
8
|
case "jpg":
|
|
@@ -13,12 +13,20 @@ const r = (e) => {
|
|
|
13
13
|
return "text/plain";
|
|
14
14
|
case "webp":
|
|
15
15
|
return "image/webp";
|
|
16
|
+
case "xhtml":
|
|
17
|
+
return "application/xhtml+xml";
|
|
16
18
|
}
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
+
}, s = ({
|
|
20
|
+
mimeType: e,
|
|
21
|
+
uri: t
|
|
22
|
+
}) => {
|
|
23
|
+
const n = e ?? r(t ?? "");
|
|
24
|
+
return n == null ? void 0 : n.startsWith("application/xhtml+xml");
|
|
25
|
+
}, p = (e) => e.length ? e.indexOf(";") ? e.substring(0, e.indexOf(";")) : e : void 0;
|
|
19
26
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
r as detectMimeTypeFromName,
|
|
28
|
+
i as getUrlExtension,
|
|
29
|
+
s as isXmlBasedMimeType,
|
|
30
|
+
p as parseContentType
|
|
23
31
|
};
|
|
24
32
|
//# sourceMappingURL=prose-shared.js.map
|
package/dist/prose-shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prose-shared.js","sources":["../src/url.ts","../src/contentType.ts"
|
|
1
|
+
{"version":3,"file":"prose-shared.js","sources":["../src/url.ts","../src/contentType.ts"],"sourcesContent":["export const getUrlExtension = (url: string) => {\n return url.split(/[#?]/)[0]?.split(`.`).pop()?.trim() || ``\n}\n","import { getUrlExtension } from \"./url\";\n\nexport const detectMimeTypeFromName = (name: string) => {\n const extension = getUrlExtension(name);\n\n switch (extension) {\n case `png`:\n return `image/png`;\n case `jpg`:\n return `image/jpg`;\n case `jpeg`:\n return `image/jpeg`;\n case `txt`:\n return `text/plain`;\n case `webp`:\n return `image/webp`;\n case `xhtml`:\n return `application/xhtml+xml`;\n }\n\n return undefined;\n};\n\nexport const isXmlBasedMimeType = ({\n mimeType,\n uri,\n}: {\n uri?: string;\n mimeType?: string;\n}) => {\n const _mimeType = mimeType ?? detectMimeTypeFromName(uri ?? \"\");\n\n return _mimeType?.startsWith(`application/xhtml+xml`);\n};\n\nexport const parseContentType = (str: string) => {\n if (!str.length) return undefined;\n\n const cut = str.indexOf(`;`);\n\n return cut ? str.substring(0, str.indexOf(`;`)) : str;\n};\n"],"names":["getUrlExtension","url","_a","_b","detectMimeTypeFromName","name","isXmlBasedMimeType","mimeType","uri","_mimeType","parseContentType","str"],"mappings":"AAAa,MAAAA,IAAkB,CAACC,MAAgB;AAAnC,MAAAC,GAAAC;AACJ,WAAAA,KAAAD,IAAAD,EAAI,MAAM,MAAM,EAAE,OAAlB,gBAAAC,EAAsB,MAAM,KAAK,UAAjC,gBAAAC,EAAwC,WAAU;AAC3D,GCAaC,IAAyB,CAACC,MAAiB;AAGtD,UAFkBL,EAAgBK,CAAI,GAEnB;AAAA,IACjB,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,EACX;AAGF,GAEaC,IAAqB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,KAAAC;AACF,MAGM;AACJ,QAAMC,IAAYF,KAAYH,EAAuBI,KAAO,EAAE;AAEvD,SAAAC,KAAA,gBAAAA,EAAW,WAAW;AAC/B,GAEaC,IAAmB,CAACC,MAC1BA,EAAI,SAEGA,EAAI,QAAQ,GAAG,IAEdA,EAAI,UAAU,GAAGA,EAAI,QAAQ,GAAG,CAAC,IAAIA,IAJ1B;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(n
|
|
1
|
+
(function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["prose-shared"]={}))})(this,function(t){"use strict";const n=e=>{var i,s;return((s=(i=e.split(/[#?]/)[0])==null?void 0:i.split(".").pop())==null?void 0:s.trim())||""},o=e=>{switch(n(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 s=e??o(i??"");return s==null?void 0:s.startsWith("application/xhtml+xml")},p=e=>e.length?e.indexOf(";")?e.substring(0,e.indexOf(";")):e:void 0;t.detectMimeTypeFromName=o,t.getUrlExtension=n,t.isXmlBasedMimeType=r,t.parseContentType=p,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=prose-shared.umd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prose-shared.umd.cjs","sources":["../src/url.ts","../src/contentType.ts"
|
|
1
|
+
{"version":3,"file":"prose-shared.umd.cjs","sources":["../src/url.ts","../src/contentType.ts"],"sourcesContent":["export const getUrlExtension = (url: string) => {\n return url.split(/[#?]/)[0]?.split(`.`).pop()?.trim() || ``\n}\n","import { getUrlExtension } from \"./url\";\n\nexport const detectMimeTypeFromName = (name: string) => {\n const extension = getUrlExtension(name);\n\n switch (extension) {\n case `png`:\n return `image/png`;\n case `jpg`:\n return `image/jpg`;\n case `jpeg`:\n return `image/jpeg`;\n case `txt`:\n return `text/plain`;\n case `webp`:\n return `image/webp`;\n case `xhtml`:\n return `application/xhtml+xml`;\n }\n\n return undefined;\n};\n\nexport const isXmlBasedMimeType = ({\n mimeType,\n uri,\n}: {\n uri?: string;\n mimeType?: string;\n}) => {\n const _mimeType = mimeType ?? detectMimeTypeFromName(uri ?? \"\");\n\n return _mimeType?.startsWith(`application/xhtml+xml`);\n};\n\nexport const parseContentType = (str: string) => {\n if (!str.length) return undefined;\n\n const cut = str.indexOf(`;`);\n\n return cut ? str.substring(0, str.indexOf(`;`)) : str;\n};\n"],"names":["getUrlExtension","url","_b","_a","detectMimeTypeFromName","name","isXmlBasedMimeType","mimeType","uri","_mimeType","parseContentType","str"],"mappings":"uOAAa,MAAAA,EAAmBC,GAAgB,SACvC,QAAAC,GAAAC,EAAAF,EAAI,MAAM,MAAM,EAAE,KAAlB,YAAAE,EAAsB,MAAM,KAAK,QAAjC,YAAAD,EAAwC,SAAU,EAC3D,ECAaE,EAA0BC,GAAiB,CAGtD,OAFkBL,EAAgBK,CAAI,EAEnB,CACjB,IAAK,MACI,MAAA,YACT,IAAK,MACI,MAAA,YACT,IAAK,OACI,MAAA,aACT,IAAK,MACI,MAAA,aACT,IAAK,OACI,MAAA,aACT,IAAK,QACI,MAAA,uBACX,CAGF,EAEaC,EAAqB,CAAC,CACjC,SAAAC,EACA,IAAAC,CACF,IAGM,CACJ,MAAMC,EAAYF,GAAYH,EAAuBI,GAAO,EAAE,EAEvD,OAAAC,GAAA,YAAAA,EAAW,WAAW,wBAC/B,EAEaC,EAAoBC,GAC1BA,EAAI,OAEGA,EAAI,QAAQ,GAAG,EAEdA,EAAI,UAAU,EAAGA,EAAI,QAAQ,GAAG,CAAC,EAAIA,EAJ1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prose-reader/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/prose-shared.umd.cjs",
|
|
6
6
|
"module": "./dist/prose-shared.js",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"build": "tsc && vite build",
|
|
22
22
|
"test": "echo"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "d129e75105282d6302a81dce3183ae3737e74e9d"
|
|
25
25
|
}
|