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

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
@@ -87513,6 +87513,10 @@ init_HTMLUtilities();
87513
87513
  // src/model/Link.ts
87514
87514
  init_polyfills();
87515
87515
  function convertAndCamel(o) {
87516
+ if (o == null) return o;
87517
+ if (o.items && Array.isArray(o.items)) {
87518
+ return convertAndCamel(o.items);
87519
+ }
87516
87520
  let newO, origKey, newKey, value;
87517
87521
  if (o instanceof Array) {
87518
87522
  return o.map(function(value2) {
@@ -87527,7 +87531,9 @@ function convertAndCamel(o) {
87527
87531
  if (o.hasOwnProperty(origKey)) {
87528
87532
  newKey = (origKey.charAt(0).toLowerCase() + origKey.slice(1) || origKey).toString();
87529
87533
  value = o[origKey];
87530
- if (value instanceof Array || value !== null && value !== void 0 && value.constructor === Object) {
87534
+ if (value && value.items && Array.isArray(value.items)) {
87535
+ value = convertAndCamel(value.items);
87536
+ } else if (value instanceof Array || value !== null && value !== void 0 && value.constructor === Object) {
87531
87537
  value = convertAndCamel(value);
87532
87538
  }
87533
87539
  if (newKey === "href1") {
@@ -88016,13 +88022,19 @@ var D2Reader = class _D2Reader {
88016
88022
  if (pubInput instanceof Publication) {
88017
88023
  publication = pubInput;
88018
88024
  } 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
+ const json = {
88026
+ metadata: pubInput.metadata ?? pubInput.Metadata ?? { title: "" },
88027
+ links: pubInput.links ?? pubInput.Links ?? [],
88028
+ readingOrder: pubInput.readingOrder ?? pubInput.spine ?? pubInput.Spine ?? [],
88029
+ resources: pubInput.resources ?? pubInput.Resources,
88030
+ toc: pubInput.toc ?? pubInput.TOC
88025
88031
  };
88032
+ if (!json.metadata.title && !json.metadata.Title) {
88033
+ json.metadata.title = "";
88034
+ }
88035
+ if (json.metadata.Title && !json.metadata.title) {
88036
+ json.metadata.title = json.metadata.Title;
88037
+ }
88026
88038
  const manifest = Ue.deserialize(json);
88027
88039
  if (!manifest) {
88028
88040
  throw new Error("Failed to parse publication manifest from config");