@d-i-t-a/reader 3.0.0-alpha.3 → 3.0.0-alpha.4

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/esm/index.js CHANGED
@@ -88012,13 +88012,24 @@ var D2Reader = class _D2Reader {
88012
88012
  let webPubManifestUrl = initialConfig.url;
88013
88013
  let publication;
88014
88014
  if (initialConfig.publication) {
88015
- const pubJson = initialConfig.publication;
88016
- const manifest = Ue.deserialize(pubJson);
88017
- if (!manifest) {
88018
- throw new Error("Failed to parse publication manifest from config");
88015
+ const pubInput = initialConfig.publication;
88016
+ if (pubInput instanceof Publication) {
88017
+ publication = pubInput;
88018
+ } else {
88019
+ const json = pubInput.metadata ? pubInput : {
88020
+ metadata: pubInput.Metadata ?? pubInput.metadata,
88021
+ readingOrder: pubInput.Spine ?? pubInput.readingOrder ?? pubInput.spine,
88022
+ resources: pubInput.Resources ?? pubInput.resources,
88023
+ toc: pubInput.TOC ?? pubInput.toc,
88024
+ links: pubInput.Links ?? pubInput.links ?? []
88025
+ };
88026
+ const manifest = Ue.deserialize(json);
88027
+ if (!manifest) {
88028
+ throw new Error("Failed to parse publication manifest from config");
88029
+ }
88030
+ manifest.setSelfLink(webPubManifestUrl.href);
88031
+ publication = new Publication(manifest, new URL(webPubManifestUrl));
88019
88032
  }
88020
- manifest.setSelfLink(webPubManifestUrl.href);
88021
- publication = new Publication(manifest, new URL(webPubManifestUrl));
88022
88033
  } else {
88023
88034
  publication = await Publication.fromUrl(
88024
88035
  webPubManifestUrl,