@storyteller-platform/epub 0.8.0 → 0.8.1

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/index.d.ts CHANGED
@@ -107,11 +107,13 @@ export interface Collection {
107
107
  export interface NavigationItem {
108
108
  title: string;
109
109
  href?: string;
110
+ role?: string;
110
111
  children?: NavigationList;
111
112
  }
112
113
  export type NavigationList = NavigationItem[];
113
114
  export interface Navigation {
114
115
  title?: string;
116
+ role: string;
115
117
  children: NavigationList;
116
118
  }
117
119
  interface GuideItem {
package/dist/index.js CHANGED
@@ -1909,6 +1909,10 @@ export class Epub {
1909
1909
  firstChild[":@"]?.["@_href"] && {
1910
1910
  href: await this.resolveHref(firstChild[":@"]["@_href"], undefined, { toRoot: resolveToRoot }),
1911
1911
  }),
1912
+ ...(Epub.getXmlElementName(firstChild) === "a" &&
1913
+ firstChild[":@"]?.["@_epub:type"] && {
1914
+ role: await this.resolveHref(firstChild[":@"]["@_epub:type"], undefined, { toRoot: resolveToRoot }),
1915
+ }),
1912
1916
  ...(secondChild &&
1913
1917
  Epub.getXmlElementName(secondChild) === "ol" && {
1914
1918
  children: await this.getNavigationChildren(secondChild, navHref, {
@@ -1947,6 +1951,7 @@ export class Epub {
1947
1951
  });
1948
1952
  return {
1949
1953
  ...(title && { title }),
1954
+ role,
1950
1955
  children,
1951
1956
  };
1952
1957
  }
@@ -1962,6 +1967,7 @@ export class Epub {
1962
1967
  return navigationToc;
1963
1968
  const ncxToc = await this.getNcxTableOfContents();
1964
1969
  return {
1970
+ role: "toc",
1965
1971
  children: ncxToc,
1966
1972
  };
1967
1973
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyteller-platform/epub",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "dependencies": {
41
41
  "@readium/shared": "^2.2.0",
42
42
  "@storyteller-platform/fs": "^0.3.0",
43
- "@storyteller-platform/media-types": "^0.2.0",
44
- "@storyteller-platform/path": "^0.3.0",
43
+ "@storyteller-platform/media-types": "^0.2.1",
44
+ "@storyteller-platform/path": "^0.3.1",
45
45
  "@zip.js/zip.js": "^2.0.0",
46
46
  "async-mutex": "^0.5.0",
47
47
  "fast-xml-builder": "^1.3.1",