@storyteller-platform/epub 0.4.7 → 0.4.8

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/README.md CHANGED
@@ -262,7 +262,7 @@ https://www.w3.org/TR/epub-33/
262
262
  > `protected` **new Epub**(`extractPath`, `inputPath`): [`Epub`](#epub)
263
263
 
264
264
  Defined in:
265
- [epub/index.ts:379](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L379)
265
+ [epub/index.ts:391](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L391)
266
266
 
267
267
  ##### Parameters
268
268
 
@@ -282,14 +282,14 @@ Defined in:
282
282
  > `protected` **extractPath**: `string`
283
283
 
284
284
  Defined in:
285
- [epub/index.ts:380](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L380)
285
+ [epub/index.ts:392](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L392)
286
286
 
287
287
  #### inputPath
288
288
 
289
289
  > `protected` **inputPath**: `undefined` \| `string`
290
290
 
291
291
  Defined in:
292
- [epub/index.ts:381](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L381)
292
+ [epub/index.ts:393](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L393)
293
293
 
294
294
  #### xhtmlBuilder
295
295
 
@@ -326,7 +326,7 @@ Defined in:
326
326
  > **\[dispose\]**(): `void`
327
327
 
328
328
  Defined in:
329
- [epub/index.ts:2529](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2529)
329
+ [epub/index.ts:2541](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2541)
330
330
 
331
331
  ##### Returns
332
332
 
@@ -337,7 +337,7 @@ Defined in:
337
337
  > **addCollection**(`collection`, `index?`): `Promise`\<`void`\>
338
338
 
339
339
  Defined in:
340
- [epub/index.ts:1520](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1520)
340
+ [epub/index.ts:1532](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1532)
341
341
 
342
342
  Add a collection to the EPUB metadata.
343
343
 
@@ -360,7 +360,7 @@ collections. Otherwise, it will be added to the end of the list.
360
360
  > **addContributor**(`contributor`, `index?`): `Promise`\<`void`\>
361
361
 
362
362
  Defined in:
363
- [epub/index.ts:1862](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1862)
363
+ [epub/index.ts:1874](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1874)
364
364
 
365
365
  Add a contributor to the EPUB metadata.
366
366
 
@@ -390,7 +390,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
390
390
  > **addCreator**(`creator`, `index?`, `type?`): `Promise`\<`void`\>
391
391
 
392
392
  Defined in:
393
- [epub/index.ts:1707](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1707)
393
+ [epub/index.ts:1719](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1719)
394
394
 
395
395
  Add a creator to the EPUB metadata.
396
396
 
@@ -420,7 +420,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
420
420
  > **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
421
421
 
422
422
  Defined in:
423
- [epub/index.ts:2225](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2225)
423
+ [epub/index.ts:2237](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2237)
424
424
 
425
425
  Create a new manifest item and write its contents to a new entry.
426
426
 
@@ -449,7 +449,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
449
449
  > **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
450
450
 
451
451
  Defined in:
452
- [epub/index.ts:2230](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2230)
452
+ [epub/index.ts:2242](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2242)
453
453
 
454
454
  Create a new manifest item and write its contents to a new entry.
455
455
 
@@ -478,7 +478,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
478
478
  > **addManifestItem**(`item`, `contents`): `Promise`\<`void`\>
479
479
 
480
480
  Defined in:
481
- [epub/index.ts:2235](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2235)
481
+ [epub/index.ts:2247](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2247)
482
482
 
483
483
  Create a new manifest item and write its contents to a new entry.
484
484
 
@@ -506,7 +506,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
506
506
  > **addMetadata**(`entry`): `Promise`\<`void`\>
507
507
 
508
508
  Defined in:
509
- [epub/index.ts:2347](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2347)
509
+ [epub/index.ts:2359](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2359)
510
510
 
511
511
  Add a new metadata entry to the Epub.
512
512
 
@@ -533,7 +533,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
533
533
  > **addSpineItem**(`manifestId`, `index?`): `Promise`\<`void`\>
534
534
 
535
535
  Defined in:
536
- [epub/index.ts:1916](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1916)
536
+ [epub/index.ts:1928](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1928)
537
537
 
538
538
  Add an item to the spine of the EPUB.
539
539
 
@@ -563,7 +563,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
563
563
  > **addSubject**(`subject`): `Promise`\<`void`\>
564
564
 
565
565
  Defined in:
566
- [epub/index.ts:1049](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1049)
566
+ [epub/index.ts:1061](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1061)
567
567
 
568
568
  Add a subject to the EPUB metadata.
569
569
 
@@ -588,7 +588,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
588
588
  > [`XmlElement`](#xmlelement)\<`"?xml"`\>)[]\>
589
589
 
590
590
  Defined in:
591
- [epub/index.ts:2051](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2051)
591
+ [epub/index.ts:2063](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2063)
592
592
 
593
593
  Create a new XHTML document with the given body and head.
594
594
 
@@ -610,7 +610,7 @@ Create a new XHTML document with the given body and head.
610
610
  > **discardAndClose**(): `void`
611
611
 
612
612
  Defined in:
613
- [epub/index.ts:2456](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2456)
613
+ [epub/index.ts:2468](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2468)
614
614
 
615
615
  ##### Returns
616
616
 
@@ -621,7 +621,7 @@ Defined in:
621
621
  > **findAllMetadataItems**(`predicate`): `Promise`\<`object`[]\>
622
622
 
623
623
  Defined in:
624
- [epub/index.ts:772](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L772)
624
+ [epub/index.ts:784](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L784)
625
625
 
626
626
  Returns the item in the metadata element's children array that matches the
627
627
  provided predicate.
@@ -661,7 +661,7 @@ provided predicate.
661
661
  > \}\>
662
662
 
663
663
  Defined in:
664
- [epub/index.ts:763](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L763)
664
+ [epub/index.ts:775](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L775)
665
665
 
666
666
  Returns the item in the metadata element's children array that matches the
667
667
  provided predicate.
@@ -700,7 +700,7 @@ provided predicate.
700
700
  > **getCollections**(): `Promise`\<[`Collection`](#collection)[]\>
701
701
 
702
702
  Defined in:
703
- [epub/index.ts:1480](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1480)
703
+ [epub/index.ts:1492](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1492)
704
704
 
705
705
  Retrieve the list of collections.
706
706
 
@@ -713,7 +713,7 @@ Retrieve the list of collections.
713
713
  > **getContributors**(): `Promise`\<[`DcCreator`](#dccreator)[]\>
714
714
 
715
715
  Defined in:
716
- [epub/index.ts:1694](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1694)
716
+ [epub/index.ts:1706](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1706)
717
717
 
718
718
  Retrieve the list of contributors.
719
719
 
@@ -732,7 +732,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccontributor
732
732
  > **getCoverImage**(): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\>
733
733
 
734
734
  Defined in:
735
- [epub/index.ts:952](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L952)
735
+ [epub/index.ts:964](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L964)
736
736
 
737
737
  Retrieve the cover image data as a byte array.
738
738
 
@@ -753,7 +753,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
753
753
  > [`ManifestItem`](#manifestitem)\>
754
754
 
755
755
  Defined in:
756
- [epub/index.ts:933](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L933)
756
+ [epub/index.ts:945](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L945)
757
757
 
758
758
  Retrieve the cover image manifest item.
759
759
 
@@ -773,7 +773,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
773
773
  > **getCreators**(`type`): `Promise`\<[`DcCreator`](#dccreator)[]\>
774
774
 
775
775
  Defined in:
776
- [epub/index.ts:1633](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1633)
776
+ [epub/index.ts:1645](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1645)
777
777
 
778
778
  Retrieve the list of creators.
779
779
 
@@ -796,7 +796,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
796
796
  > **getDescription**(): `Promise`\<`null` \| `string`\>
797
797
 
798
798
  Defined in:
799
- [epub/index.ts:1331](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1331)
799
+ [epub/index.ts:1343](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1343)
800
800
 
801
801
  Retrieve the Epub's description as specified in its package document metadata.
802
802
 
@@ -812,7 +812,7 @@ as a string. Descriptions may include HTML markup.
812
812
  > **getIdentifier**(): `Promise`\<`null` \| `string`\>
813
813
 
814
814
  Defined in:
815
- [epub/index.ts:867](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L867)
815
+ [epub/index.ts:879](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L879)
816
816
 
817
817
  Retrieve the identifier from the dc:identifier element in the EPUB metadata.
818
818
 
@@ -831,7 +831,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
831
831
  > **getLanguage**(): `Promise`\<`null` \| `Locale`\>
832
832
 
833
833
  Defined in:
834
- [epub/index.ts:1168](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1168)
834
+ [epub/index.ts:1180](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1180)
835
835
 
836
836
  Retrieve the Epub's language as specified in its package document metadata.
837
837
 
@@ -852,7 +852,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
852
852
  > [`ManifestItem`](#manifestitem)\>\>
853
853
 
854
854
  Defined in:
855
- [epub/index.ts:688](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L688)
855
+ [epub/index.ts:700](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L700)
856
856
 
857
857
  Retrieve the manifest for the Epub.
858
858
 
@@ -872,7 +872,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
872
872
  > **getMetadata**(): `Promise`\<[`EpubMetadata`](#epubmetadata)\>
873
873
 
874
874
  Defined in:
875
- [epub/index.ts:839](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L839)
875
+ [epub/index.ts:851](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L851)
876
876
 
877
877
  Retrieve the metadata entries for the Epub.
878
878
 
@@ -896,7 +896,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
896
896
  > `string`\>\>
897
897
 
898
898
  Defined in:
899
- [epub/index.ts:1348](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1348)
899
+ [epub/index.ts:1360](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1360)
900
900
 
901
901
  Return the set of custom vocabulary prefixes set on this publication's root
902
902
  package element.
@@ -916,7 +916,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
916
916
  > **getPublicationDate**(): `Promise`\<`null` \| `Date`\>
917
917
 
918
918
  Defined in:
919
- [epub/index.ts:989](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L989)
919
+ [epub/index.ts:1001](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1001)
920
920
 
921
921
  Retrieve the publication date from the dc:date element in the EPUB metadata as a
922
922
  Date object.
@@ -936,7 +936,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
936
936
  > **getRootfile**(): `Promise`\<`string`\>
937
937
 
938
938
  Defined in:
939
- [epub/index.ts:540](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L540)
939
+ [epub/index.ts:552](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L552)
940
940
 
941
941
  ##### Returns
942
942
 
@@ -947,7 +947,7 @@ Defined in:
947
947
  > **getSpineItems**(): `Promise`\<[`ManifestItem`](#manifestitem)[]\>
948
948
 
949
949
  Defined in:
950
- [epub/index.ts:1897](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1897)
950
+ [epub/index.ts:1909](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1909)
951
951
 
952
952
  Retrieve the manifest items that make up the Epub's spine.
953
953
 
@@ -967,7 +967,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
967
967
  > **getSubjects**(): `Promise`\<(`string` \| [`DcSubject`](#dcsubject))[]\>
968
968
 
969
969
  Defined in:
970
- [epub/index.ts:1123](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1123)
970
+ [epub/index.ts:1135](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1135)
971
971
 
972
972
  Retrieve the list of subjects for this EPUB.
973
973
 
@@ -988,7 +988,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
988
988
  > **getSubtitle**(): `Promise`\<`null` \| `string`\>
989
989
 
990
990
  Defined in:
991
- [epub/index.ts:1238](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1238)
991
+ [epub/index.ts:1250](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1250)
992
992
 
993
993
  Retrieve the subtitle of the Epub, if it exists.
994
994
 
@@ -1005,7 +1005,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1005
1005
  > **getTitle**(`expanded`): `Promise`\<`null` \| `string`\>
1006
1006
 
1007
1007
  Defined in:
1008
- [epub/index.ts:1214](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1214)
1008
+ [epub/index.ts:1226](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1226)
1009
1009
 
1010
1010
  Retrieve the title of the Epub.
1011
1011
 
@@ -1028,7 +1028,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1028
1028
  > **getTitles**(): `Promise`\<`object`[]\>
1029
1029
 
1030
1030
  Defined in:
1031
- [epub/index.ts:1250](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1250)
1031
+ [epub/index.ts:1262](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1262)
1032
1032
 
1033
1033
  Retrieve all title entries of the Epub.
1034
1034
 
@@ -1045,7 +1045,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1045
1045
  > **getType**(): `Promise`\<`null` \| [`MetadataEntry`](#metadataentry)\>
1046
1046
 
1047
1047
  Defined in:
1048
- [epub/index.ts:1036](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1036)
1048
+ [epub/index.ts:1048](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1048)
1049
1049
 
1050
1050
  Retrieve the publication type from the dc:type element in the EPUB metadata.
1051
1051
 
@@ -1067,7 +1067,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
1067
1067
  > `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
1068
1068
 
1069
1069
  Defined in:
1070
- [epub/index.ts:1992](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1992)
1070
+ [epub/index.ts:2004](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2004)
1071
1071
 
1072
1072
  Retrieve the contents of a file, given its href.
1073
1073
 
@@ -1090,7 +1090,7 @@ encoding parameter.
1090
1090
  > **readFileContents**(`href`, `relativeTo`, `encoding`): `Promise`\<`string`\>
1091
1091
 
1092
1092
  Defined in:
1093
- [epub/index.ts:1993](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1993)
1093
+ [epub/index.ts:2005](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2005)
1094
1094
 
1095
1095
  Retrieve the contents of a file, given its href.
1096
1096
 
@@ -1116,7 +1116,7 @@ encoding parameter.
1116
1116
  > **readItemContents**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
1117
1117
 
1118
1118
  Defined in:
1119
- [epub/index.ts:2023](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2023)
1119
+ [epub/index.ts:2035](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2035)
1120
1120
 
1121
1121
  Retrieve the contents of a manifest item, given its id.
1122
1122
 
@@ -1139,7 +1139,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1139
1139
  > **readItemContents**(`id`, `encoding`): `Promise`\<`string`\>
1140
1140
 
1141
1141
  Defined in:
1142
- [epub/index.ts:2024](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2024)
1142
+ [epub/index.ts:2036](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2036)
1143
1143
 
1144
1144
  Retrieve the contents of a manifest item, given its id.
1145
1145
 
@@ -1165,7 +1165,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1165
1165
  > **readXhtmlItemContents**(`id`, `as?`): `Promise`\<[`ParsedXml`](#parsedxml)\>
1166
1166
 
1167
1167
  Defined in:
1168
- [epub/index.ts:2086](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2086)
1168
+ [epub/index.ts:2098](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2098)
1169
1169
 
1170
1170
  Retrieves the contents of an XHTML item, given its manifest id.
1171
1171
 
@@ -1189,7 +1189,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
1189
1189
  > **readXhtmlItemContents**(`id`, `as`): `Promise`\<`string`\>
1190
1190
 
1191
1191
  Defined in:
1192
- [epub/index.ts:2087](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2087)
1192
+ [epub/index.ts:2099](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2099)
1193
1193
 
1194
1194
  Retrieves the contents of an XHTML item, given its manifest id.
1195
1195
 
@@ -1213,7 +1213,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
1213
1213
  > **removeCollection**(`index`): `Promise`\<`void`\>
1214
1214
 
1215
1215
  Defined in:
1216
- [epub/index.ts:1589](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1589)
1216
+ [epub/index.ts:1601](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1601)
1217
1217
 
1218
1218
  Remove a collection from the EPUB metadata.
1219
1219
 
@@ -1235,7 +1235,7 @@ returned by `epub.getCollections()`.
1235
1235
  > **removeContributor**(`index`): `Promise`\<`void`\>
1236
1236
 
1237
1237
  Defined in:
1238
- [epub/index.ts:1846](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1846)
1238
+ [epub/index.ts:1858](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1858)
1239
1239
 
1240
1240
  Remove a contributor from the EPUB metadata.
1241
1241
 
@@ -1263,7 +1263,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1263
1263
  > **removeCreator**(`index`, `type`): `Promise`\<`void`\>
1264
1264
 
1265
1265
  Defined in:
1266
- [epub/index.ts:1794](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1794)
1266
+ [epub/index.ts:1806](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1806)
1267
1267
 
1268
1268
  Remove a creator from the EPUB metadata.
1269
1269
 
@@ -1290,7 +1290,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1290
1290
  > **removeManifestItem**(`id`): `Promise`\<`void`\>
1291
1291
 
1292
1292
  Defined in:
1293
- [epub/index.ts:2182](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2182)
1293
+ [epub/index.ts:2194](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2194)
1294
1294
 
1295
1295
  ##### Parameters
1296
1296
 
@@ -1307,7 +1307,7 @@ Defined in:
1307
1307
  > **removeMetadata**(`predicate`): `Promise`\<`void`\>
1308
1308
 
1309
1309
  Defined in:
1310
- [epub/index.ts:2431](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2431)
1310
+ [epub/index.ts:2443](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2443)
1311
1311
 
1312
1312
  Remove one or more metadata entries.
1313
1313
 
@@ -1333,7 +1333,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
1333
1333
  > **removeSpineItem**(`index`): `Promise`\<`void`\>
1334
1334
 
1335
1335
  Defined in:
1336
- [epub/index.ts:1952](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1952)
1336
+ [epub/index.ts:1964](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1964)
1337
1337
 
1338
1338
  Remove the spine item at the specified index.
1339
1339
 
@@ -1356,7 +1356,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
1356
1356
  > **removeSubject**(`index`): `Promise`\<`void`\>
1357
1357
 
1358
1358
  Defined in:
1359
- [epub/index.ts:1086](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1086)
1359
+ [epub/index.ts:1098](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1098)
1360
1360
 
1361
1361
  Remove a subject from the EPUB metadata.
1362
1362
 
@@ -1382,7 +1382,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1382
1382
  > **replaceMetadata**(`predicate`, `entry`): `Promise`\<`void`\>
1383
1383
 
1384
1384
  Defined in:
1385
- [epub/index.ts:2386](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2386)
1385
+ [epub/index.ts:2398](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2398)
1386
1386
 
1387
1387
  Replace a metadata entry with a new one.
1388
1388
 
@@ -1409,7 +1409,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
1409
1409
  > **saveAndClose**(): `Promise`\<`void`\>
1410
1410
 
1411
1411
  Defined in:
1412
- [epub/index.ts:2472](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2472)
1412
+ [epub/index.ts:2484](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2484)
1413
1413
 
1414
1414
  Write the current contents of the Epub to a new EPUB archive on disk.
1415
1415
 
@@ -1425,7 +1425,7 @@ updated to the current UTC timestamp.
1425
1425
  > **setCoverImage**(`href`, `data`): `Promise`\<`void`\>
1426
1426
 
1427
1427
  Defined in:
1428
- [epub/index.ts:966](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L966)
1428
+ [epub/index.ts:978](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L978)
1429
1429
 
1430
1430
  Set the cover image for the EPUB.
1431
1431
 
@@ -1448,7 +1448,7 @@ then writes the provided image data to the provided href within the publication.
1448
1448
  > **setDescription**(`description`): `Promise`\<`void`\>
1449
1449
 
1450
1450
  Defined in:
1451
- [epub/index.ts:1315](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1315)
1451
+ [epub/index.ts:1327](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1327)
1452
1452
 
1453
1453
  Update the Epub's description metadata entry.
1454
1454
 
@@ -1471,7 +1471,7 @@ encoded as HTML entities.
1471
1471
  > **setIdentifier**(`identifier`): `Promise`\<`void`\>
1472
1472
 
1473
1473
  Defined in:
1474
- [epub/index.ts:881](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L881)
1474
+ [epub/index.ts:893](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L893)
1475
1475
 
1476
1476
  Set the dc:identifier metadata element with the provided string.
1477
1477
 
@@ -1497,7 +1497,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
1497
1497
  > **setLanguage**(`locale`): `Promise`\<`void`\>
1498
1498
 
1499
1499
  Defined in:
1500
- [epub/index.ts:1197](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1197)
1500
+ [epub/index.ts:1209](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1209)
1501
1501
 
1502
1502
  Update the Epub's language metadata entry.
1503
1503
 
@@ -1523,7 +1523,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
1523
1523
  > **setPackageVocabularyPrefix**(`prefix`, `uri`): `Promise`\<`void`\>
1524
1524
 
1525
1525
  Defined in:
1526
- [epub/index.ts:1366](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1366)
1526
+ [epub/index.ts:1378](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1378)
1527
1527
 
1528
1528
  Set a custom vocabulary prefix on the root package element.
1529
1529
 
@@ -1547,7 +1547,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
1547
1547
  > **setPublicationDate**(`date`): `Promise`\<`void`\>
1548
1548
 
1549
1549
  Defined in:
1550
- [epub/index.ts:1004](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1004)
1550
+ [epub/index.ts:1016](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1016)
1551
1551
 
1552
1552
  Set the dc:date metadata element with the provided date.
1553
1553
 
@@ -1573,7 +1573,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
1573
1573
  > **setTitle**(`title`): `Promise`\<`void`\>
1574
1574
 
1575
1575
  Defined in:
1576
- [epub/index.ts:1390](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1390)
1576
+ [epub/index.ts:1402](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1402)
1577
1577
 
1578
1578
  Set the title of the Epub.
1579
1579
 
@@ -1601,7 +1601,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1601
1601
  > **setTitles**(`entries`): `Promise`\<`void`\>
1602
1602
 
1603
1603
  Defined in:
1604
- [epub/index.ts:1418](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1418)
1604
+ [epub/index.ts:1430](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1430)
1605
1605
 
1606
1606
  ##### Parameters
1607
1607
 
@@ -1618,7 +1618,7 @@ Defined in:
1618
1618
  > **setType**(`type`): `Promise`\<`void`\>
1619
1619
 
1620
1620
  Defined in:
1621
- [epub/index.ts:1020](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1020)
1621
+ [epub/index.ts:1032](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1032)
1622
1622
 
1623
1623
  Set the dc:type metadata element.
1624
1624
 
@@ -1644,7 +1644,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
1644
1644
  > **updateManifestItem**(`id`, `newItem`): `Promise`\<`void`\>
1645
1645
 
1646
1646
  Defined in:
1647
- [epub/index.ts:2298](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2298)
1647
+ [epub/index.ts:2310](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2310)
1648
1648
 
1649
1649
  Update the manifest entry for an existing item.
1650
1650
 
@@ -1673,7 +1673,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
1673
1673
  > **writeItemContents**(`id`, `contents`): `Promise`\<`void`\>
1674
1674
 
1675
1675
  Defined in:
1676
- [epub/index.ts:2134](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2134)
1676
+ [epub/index.ts:2146](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2146)
1677
1677
 
1678
1678
  Write new contents for an existing manifest item, specified by its id.
1679
1679
 
@@ -1700,7 +1700,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1700
1700
  > **writeItemContents**(`id`, `contents`, `encoding`): `Promise`\<`void`\>
1701
1701
 
1702
1702
  Defined in:
1703
- [epub/index.ts:2135](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2135)
1703
+ [epub/index.ts:2147](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2147)
1704
1704
 
1705
1705
  Write new contents for an existing manifest item, specified by its id.
1706
1706
 
@@ -1728,7 +1728,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1728
1728
  > **writeXhtmlItemContents**(`id`, `contents`): `Promise`\<`void`\>
1729
1729
 
1730
1730
  Defined in:
1731
- [epub/index.ts:2174](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2174)
1731
+ [epub/index.ts:2186](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2186)
1732
1732
 
1733
1733
  Write new contents for an existing XHTML item, specified by its id.
1734
1734
 
@@ -1782,7 +1782,7 @@ This method modifies the provided XML structure.
1782
1782
  > `Promise`\<[`Epub`](#epub)\>
1783
1783
 
1784
1784
  Defined in:
1785
- [epub/index.ts:399](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L399)
1785
+ [epub/index.ts:411](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L411)
1786
1786
 
1787
1787
  Construct an Epub instance, optionally beginning with the provided metadata.
1788
1788
 
@@ -1847,7 +1847,7 @@ Defined in:
1847
1847
  > `undefined` \| [`XmlElement`](#xmlelement)\<`Name`\>
1848
1848
 
1849
1849
  Defined in:
1850
- [epub/index.ts:354](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L354)
1850
+ [epub/index.ts:366](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L366)
1851
1851
 
1852
1852
  Given an XML structure, find the first child matching the provided name and
1853
1853
  optional filter.
@@ -1899,7 +1899,7 @@ https://www.w3.org/TR/epub-33/#sec-duration
1899
1899
  > `static` **from**(`pathOrData`): `Promise`\<[`Epub`](#epub)\>
1900
1900
 
1901
1901
  Defined in:
1902
- [epub/index.ts:483](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L483)
1902
+ [epub/index.ts:495](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L495)
1903
1903
 
1904
1904
  Construct an Epub instance by reading an existing EPUB publication.
1905
1905
 
@@ -1953,12 +1953,31 @@ representing the concatenation of all text nodes in the document.
1953
1953
 
1954
1954
  `string`
1955
1955
 
1956
+ #### getXmlAttributes()
1957
+
1958
+ > `static` **getXmlAttributes**(`element`): `Record`\<`string`, `string`\>
1959
+
1960
+ Defined in:
1961
+ [epub/index.ts:319](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L319)
1962
+
1963
+ Given an XMLElement, return its attributes.
1964
+
1965
+ ##### Parameters
1966
+
1967
+ | Parameter | Type |
1968
+ | --------- | --------------------------- |
1969
+ | `element` | [`XmlElement`](#xmlelement) |
1970
+
1971
+ ##### Returns
1972
+
1973
+ `Record`\<`string`, `string`\>
1974
+
1956
1975
  #### getXmlChildren()
1957
1976
 
1958
1977
  > `static` **getXmlChildren**\<`Name`\>(`element`): [`ParsedXml`](#parsedxml)
1959
1978
 
1960
1979
  Defined in:
1961
- [epub/index.ts:334](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L334)
1980
+ [epub/index.ts:346](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L346)
1962
1981
 
1963
1982
  Given an XMLElement, return a list of its children
1964
1983
 
@@ -1983,7 +2002,7 @@ Given an XMLElement, return a list of its children
1983
2002
  > `static` **getXmlElementName**\<`Name`\>(`element`): `Name`
1984
2003
 
1985
2004
  Defined in:
1986
- [epub/index.ts:319](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L319)
2005
+ [epub/index.ts:331](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L331)
1987
2006
 
1988
2007
  Given an XMLElement, return its tag name.
1989
2008
 
@@ -2008,7 +2027,7 @@ Given an XMLElement, return its tag name.
2008
2027
  > `static` **isXmlTextNode**(`node`): `node is XmlTextNode`
2009
2028
 
2010
2029
  Defined in:
2011
- [epub/index.ts:367](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L367)
2030
+ [epub/index.ts:379](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L379)
2012
2031
 
2013
2032
  Given an XMLNode, determine whether it represents a text node or an XML element.
2014
2033
 
@@ -2027,7 +2046,7 @@ Given an XMLNode, determine whether it represents a text node or an XML element.
2027
2046
  > `static` **replaceXmlChildren**\<`Name`\>(`element`, `children`): `void`
2028
2047
 
2029
2048
  Defined in:
2030
- [epub/index.ts:342](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L342)
2049
+ [epub/index.ts:354](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L354)
2031
2050
 
2032
2051
  ##### Type Parameters
2033
2052
 
package/dist/index.cjs CHANGED
@@ -213,6 +213,17 @@ class Epub {
213
213
  }
214
214
  return text;
215
215
  }
216
+ /**
217
+ * Given an XMLElement, return its attributes.
218
+ */
219
+ static getXmlAttributes(element) {
220
+ return Object.fromEntries(
221
+ Object.entries(element[":@"] ?? {}).map(([key, value]) => [
222
+ key.slice(2),
223
+ value
224
+ ])
225
+ );
226
+ }
216
227
  /**
217
228
  * Given an XMLElement, return its tag name.
218
229
  */
package/dist/index.d.cts CHANGED
@@ -141,6 +141,10 @@ declare class Epub {
141
141
  * in the document.
142
142
  */
143
143
  static getXhtmlTextContent(xml: ParsedXml): string;
144
+ /**
145
+ * Given an XMLElement, return its attributes.
146
+ */
147
+ static getXmlAttributes(element: XmlElement): Record<string, string>;
144
148
  /**
145
149
  * Given an XMLElement, return its tag name.
146
150
  */
package/dist/index.d.ts CHANGED
@@ -141,6 +141,10 @@ declare class Epub {
141
141
  * in the document.
142
142
  */
143
143
  static getXhtmlTextContent(xml: ParsedXml): string;
144
+ /**
145
+ * Given an XMLElement, return its attributes.
146
+ */
147
+ static getXmlAttributes(element: XmlElement): Record<string, string>;
144
148
  /**
145
149
  * Given an XMLElement, return its tag name.
146
150
  */
package/dist/index.js CHANGED
@@ -180,6 +180,17 @@ class Epub {
180
180
  }
181
181
  return text;
182
182
  }
183
+ /**
184
+ * Given an XMLElement, return its attributes.
185
+ */
186
+ static getXmlAttributes(element) {
187
+ return Object.fromEntries(
188
+ Object.entries(element[":@"] ?? {}).map(([key, value]) => [
189
+ key.slice(2),
190
+ value
191
+ ])
192
+ );
193
+ }
183
194
  /**
184
195
  * Given an XMLElement, return its tag name.
185
196
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyteller-platform/epub",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",