epub-codec 1.2.4 → 1.2.5

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/codec.d.cts CHANGED
@@ -96,9 +96,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
96
96
  symbol: z.ZodString;
97
97
  name: z.ZodOptional<z.ZodString>;
98
98
  dimension: z.ZodRecord<z.ZodEnum<{
99
- time: "time";
100
99
  length: "length";
101
100
  mass: "mass";
101
+ time: "time";
102
102
  electricCurrent: "electricCurrent";
103
103
  thermodynamicTemperature: "thermodynamicTemperature";
104
104
  amountOfSubstance: "amountOfSubstance";
@@ -244,9 +244,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
244
244
  symbol: z.ZodString;
245
245
  name: z.ZodOptional<z.ZodString>;
246
246
  dimension: z.ZodRecord<z.ZodEnum<{
247
- time: "time";
248
247
  length: "length";
249
248
  mass: "mass";
249
+ time: "time";
250
250
  electricCurrent: "electricCurrent";
251
251
  thermodynamicTemperature: "thermodynamicTemperature";
252
252
  amountOfSubstance: "amountOfSubstance";
@@ -392,9 +392,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
392
392
  symbol: z.ZodString;
393
393
  name: z.ZodOptional<z.ZodString>;
394
394
  dimension: z.ZodRecord<z.ZodEnum<{
395
- time: "time";
396
395
  length: "length";
397
396
  mass: "mass";
397
+ time: "time";
398
398
  electricCurrent: "electricCurrent";
399
399
  thermodynamicTemperature: "thermodynamicTemperature";
400
400
  amountOfSubstance: "amountOfSubstance";
@@ -540,9 +540,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
540
540
  symbol: z.ZodString;
541
541
  name: z.ZodOptional<z.ZodString>;
542
542
  dimension: z.ZodRecord<z.ZodEnum<{
543
- time: "time";
544
543
  length: "length";
545
544
  mass: "mass";
545
+ time: "time";
546
546
  electricCurrent: "electricCurrent";
547
547
  thermodynamicTemperature: "thermodynamicTemperature";
548
548
  amountOfSubstance: "amountOfSubstance";
@@ -719,9 +719,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
719
719
  symbol: z.ZodString;
720
720
  name: z.ZodOptional<z.ZodString>;
721
721
  dimension: z.ZodRecord<z.ZodEnum<{
722
- time: "time";
723
722
  length: "length";
724
723
  mass: "mass";
724
+ time: "time";
725
725
  electricCurrent: "electricCurrent";
726
726
  thermodynamicTemperature: "thermodynamicTemperature";
727
727
  amountOfSubstance: "amountOfSubstance";
@@ -826,9 +826,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
826
826
  symbol: z.ZodString;
827
827
  name: z.ZodOptional<z.ZodString>;
828
828
  dimension: z.ZodRecord<z.ZodEnum<{
829
- time: "time";
830
829
  length: "length";
831
830
  mass: "mass";
831
+ time: "time";
832
832
  electricCurrent: "electricCurrent";
833
833
  thermodynamicTemperature: "thermodynamicTemperature";
834
834
  amountOfSubstance: "amountOfSubstance";
@@ -965,9 +965,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
965
965
  symbol: z.ZodString;
966
966
  name: z.ZodOptional<z.ZodString>;
967
967
  dimension: z.ZodRecord<z.ZodEnum<{
968
- time: "time";
969
968
  length: "length";
970
969
  mass: "mass";
970
+ time: "time";
971
971
  electricCurrent: "electricCurrent";
972
972
  thermodynamicTemperature: "thermodynamicTemperature";
973
973
  amountOfSubstance: "amountOfSubstance";
@@ -1427,9 +1427,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1427
1427
  type: z.ZodEnum<{
1428
1428
  date: "date";
1429
1429
  custom: "custom";
1430
+ time: "time";
1430
1431
  decimal: "decimal";
1431
1432
  list: "list";
1432
- time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
1435
1435
  }>;
@@ -1884,11 +1884,11 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1884
1884
  stops: z.ZodArray<z.ZodObject<{
1885
1885
  value: z.ZodObject<{
1886
1886
  type: z.ZodEnum<{
1887
- formula: "formula";
1888
1887
  num: "num";
1889
- percent: "percent";
1890
- max: "max";
1891
1888
  min: "min";
1889
+ max: "max";
1890
+ formula: "formula";
1891
+ percent: "percent";
1892
1892
  percentile: "percentile";
1893
1893
  }>;
1894
1894
  value: z.ZodOptional<z.ZodString>;
@@ -1930,22 +1930,22 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1930
1930
  }, z.core.$strip>, z.ZodObject<{
1931
1931
  min: z.ZodObject<{
1932
1932
  type: z.ZodEnum<{
1933
- formula: "formula";
1934
1933
  num: "num";
1935
- percent: "percent";
1936
- max: "max";
1937
1934
  min: "min";
1935
+ max: "max";
1936
+ formula: "formula";
1937
+ percent: "percent";
1938
1938
  percentile: "percentile";
1939
1939
  }>;
1940
1940
  value: z.ZodOptional<z.ZodString>;
1941
1941
  }, z.core.$strip>;
1942
1942
  max: z.ZodObject<{
1943
1943
  type: z.ZodEnum<{
1944
- formula: "formula";
1945
1944
  num: "num";
1946
- percent: "percent";
1947
- max: "max";
1948
1945
  min: "min";
1946
+ max: "max";
1947
+ formula: "formula";
1948
+ percent: "percent";
1949
1949
  percentile: "percentile";
1950
1950
  }>;
1951
1951
  value: z.ZodOptional<z.ZodString>;
@@ -1988,11 +1988,11 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1988
1988
  iconSetType: z.ZodString;
1989
1989
  thresholds: z.ZodArray<z.ZodObject<{
1990
1990
  type: z.ZodEnum<{
1991
- formula: "formula";
1992
1991
  num: "num";
1993
- percent: "percent";
1994
- max: "max";
1995
1992
  min: "min";
1993
+ max: "max";
1994
+ formula: "formula";
1995
+ percent: "percent";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
@@ -2062,9 +2062,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2062
2062
  symbol: z.ZodString;
2063
2063
  name: z.ZodOptional<z.ZodString>;
2064
2064
  dimension: z.ZodRecord<z.ZodEnum<{
2065
- time: "time";
2066
2065
  length: "length";
2067
2066
  mass: "mass";
2067
+ time: "time";
2068
2068
  electricCurrent: "electricCurrent";
2069
2069
  thermodynamicTemperature: "thermodynamicTemperature";
2070
2070
  amountOfSubstance: "amountOfSubstance";
@@ -2453,9 +2453,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2453
2453
  symbol: z.ZodString;
2454
2454
  name: z.ZodOptional<z.ZodString>;
2455
2455
  dimension: z.ZodRecord<z.ZodEnum<{
2456
- time: "time";
2457
2456
  length: "length";
2458
2457
  mass: "mass";
2458
+ time: "time";
2459
2459
  electricCurrent: "electricCurrent";
2460
2460
  thermodynamicTemperature: "thermodynamicTemperature";
2461
2461
  amountOfSubstance: "amountOfSubstance";
@@ -2553,9 +2553,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2553
2553
  symbol: z.ZodString;
2554
2554
  name: z.ZodOptional<z.ZodString>;
2555
2555
  dimension: z.ZodRecord<z.ZodEnum<{
2556
- time: "time";
2557
2556
  length: "length";
2558
2557
  mass: "mass";
2558
+ time: "time";
2559
2559
  electricCurrent: "electricCurrent";
2560
2560
  thermodynamicTemperature: "thermodynamicTemperature";
2561
2561
  amountOfSubstance: "amountOfSubstance";
package/dist/codec.d.ts CHANGED
@@ -96,9 +96,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
96
96
  symbol: z.ZodString;
97
97
  name: z.ZodOptional<z.ZodString>;
98
98
  dimension: z.ZodRecord<z.ZodEnum<{
99
- time: "time";
100
99
  length: "length";
101
100
  mass: "mass";
101
+ time: "time";
102
102
  electricCurrent: "electricCurrent";
103
103
  thermodynamicTemperature: "thermodynamicTemperature";
104
104
  amountOfSubstance: "amountOfSubstance";
@@ -244,9 +244,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
244
244
  symbol: z.ZodString;
245
245
  name: z.ZodOptional<z.ZodString>;
246
246
  dimension: z.ZodRecord<z.ZodEnum<{
247
- time: "time";
248
247
  length: "length";
249
248
  mass: "mass";
249
+ time: "time";
250
250
  electricCurrent: "electricCurrent";
251
251
  thermodynamicTemperature: "thermodynamicTemperature";
252
252
  amountOfSubstance: "amountOfSubstance";
@@ -392,9 +392,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
392
392
  symbol: z.ZodString;
393
393
  name: z.ZodOptional<z.ZodString>;
394
394
  dimension: z.ZodRecord<z.ZodEnum<{
395
- time: "time";
396
395
  length: "length";
397
396
  mass: "mass";
397
+ time: "time";
398
398
  electricCurrent: "electricCurrent";
399
399
  thermodynamicTemperature: "thermodynamicTemperature";
400
400
  amountOfSubstance: "amountOfSubstance";
@@ -540,9 +540,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
540
540
  symbol: z.ZodString;
541
541
  name: z.ZodOptional<z.ZodString>;
542
542
  dimension: z.ZodRecord<z.ZodEnum<{
543
- time: "time";
544
543
  length: "length";
545
544
  mass: "mass";
545
+ time: "time";
546
546
  electricCurrent: "electricCurrent";
547
547
  thermodynamicTemperature: "thermodynamicTemperature";
548
548
  amountOfSubstance: "amountOfSubstance";
@@ -719,9 +719,9 @@ declare const epubCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Ar
719
719
  symbol: z.ZodString;
720
720
  name: z.ZodOptional<z.ZodString>;
721
721
  dimension: z.ZodRecord<z.ZodEnum<{
722
- time: "time";
723
722
  length: "length";
724
723
  mass: "mass";
724
+ time: "time";
725
725
  electricCurrent: "electricCurrent";
726
726
  thermodynamicTemperature: "thermodynamicTemperature";
727
727
  amountOfSubstance: "amountOfSubstance";
@@ -826,9 +826,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
826
826
  symbol: z.ZodString;
827
827
  name: z.ZodOptional<z.ZodString>;
828
828
  dimension: z.ZodRecord<z.ZodEnum<{
829
- time: "time";
830
829
  length: "length";
831
830
  mass: "mass";
831
+ time: "time";
832
832
  electricCurrent: "electricCurrent";
833
833
  thermodynamicTemperature: "thermodynamicTemperature";
834
834
  amountOfSubstance: "amountOfSubstance";
@@ -965,9 +965,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
965
965
  symbol: z.ZodString;
966
966
  name: z.ZodOptional<z.ZodString>;
967
967
  dimension: z.ZodRecord<z.ZodEnum<{
968
- time: "time";
969
968
  length: "length";
970
969
  mass: "mass";
970
+ time: "time";
971
971
  electricCurrent: "electricCurrent";
972
972
  thermodynamicTemperature: "thermodynamicTemperature";
973
973
  amountOfSubstance: "amountOfSubstance";
@@ -1427,9 +1427,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1427
1427
  type: z.ZodEnum<{
1428
1428
  date: "date";
1429
1429
  custom: "custom";
1430
+ time: "time";
1430
1431
  decimal: "decimal";
1431
1432
  list: "list";
1432
- time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
1435
1435
  }>;
@@ -1884,11 +1884,11 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1884
1884
  stops: z.ZodArray<z.ZodObject<{
1885
1885
  value: z.ZodObject<{
1886
1886
  type: z.ZodEnum<{
1887
- formula: "formula";
1888
1887
  num: "num";
1889
- percent: "percent";
1890
- max: "max";
1891
1888
  min: "min";
1889
+ max: "max";
1890
+ formula: "formula";
1891
+ percent: "percent";
1892
1892
  percentile: "percentile";
1893
1893
  }>;
1894
1894
  value: z.ZodOptional<z.ZodString>;
@@ -1930,22 +1930,22 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1930
1930
  }, z.core.$strip>, z.ZodObject<{
1931
1931
  min: z.ZodObject<{
1932
1932
  type: z.ZodEnum<{
1933
- formula: "formula";
1934
1933
  num: "num";
1935
- percent: "percent";
1936
- max: "max";
1937
1934
  min: "min";
1935
+ max: "max";
1936
+ formula: "formula";
1937
+ percent: "percent";
1938
1938
  percentile: "percentile";
1939
1939
  }>;
1940
1940
  value: z.ZodOptional<z.ZodString>;
1941
1941
  }, z.core.$strip>;
1942
1942
  max: z.ZodObject<{
1943
1943
  type: z.ZodEnum<{
1944
- formula: "formula";
1945
1944
  num: "num";
1946
- percent: "percent";
1947
- max: "max";
1948
1945
  min: "min";
1946
+ max: "max";
1947
+ formula: "formula";
1948
+ percent: "percent";
1949
1949
  percentile: "percentile";
1950
1950
  }>;
1951
1951
  value: z.ZodOptional<z.ZodString>;
@@ -1988,11 +1988,11 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1988
1988
  iconSetType: z.ZodString;
1989
1989
  thresholds: z.ZodArray<z.ZodObject<{
1990
1990
  type: z.ZodEnum<{
1991
- formula: "formula";
1992
1991
  num: "num";
1993
- percent: "percent";
1994
- max: "max";
1995
1992
  min: "min";
1993
+ max: "max";
1994
+ formula: "formula";
1995
+ percent: "percent";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
@@ -2062,9 +2062,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2062
2062
  symbol: z.ZodString;
2063
2063
  name: z.ZodOptional<z.ZodString>;
2064
2064
  dimension: z.ZodRecord<z.ZodEnum<{
2065
- time: "time";
2066
2065
  length: "length";
2067
2066
  mass: "mass";
2067
+ time: "time";
2068
2068
  electricCurrent: "electricCurrent";
2069
2069
  thermodynamicTemperature: "thermodynamicTemperature";
2070
2070
  amountOfSubstance: "amountOfSubstance";
@@ -2453,9 +2453,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2453
2453
  symbol: z.ZodString;
2454
2454
  name: z.ZodOptional<z.ZodString>;
2455
2455
  dimension: z.ZodRecord<z.ZodEnum<{
2456
- time: "time";
2457
2456
  length: "length";
2458
2457
  mass: "mass";
2458
+ time: "time";
2459
2459
  electricCurrent: "electricCurrent";
2460
2460
  thermodynamicTemperature: "thermodynamicTemperature";
2461
2461
  amountOfSubstance: "amountOfSubstance";
@@ -2553,9 +2553,9 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
2553
2553
  symbol: z.ZodString;
2554
2554
  name: z.ZodOptional<z.ZodString>;
2555
2555
  dimension: z.ZodRecord<z.ZodEnum<{
2556
- time: "time";
2557
2556
  length: "length";
2558
2557
  mass: "mass";
2558
+ time: "time";
2559
2559
  electricCurrent: "electricCurrent";
2560
2560
  thermodynamicTemperature: "thermodynamicTemperature";
2561
2561
  amountOfSubstance: "amountOfSubstance";
package/dist/index.cjs CHANGED
@@ -93,6 +93,7 @@ exports.readNav3TocHrefs = require_nav_nav3.readNav3TocHrefs;
93
93
  exports.readNcxHrefs = require_nav_ncx.readNcxHrefs;
94
94
  exports.readOpfMetadata = require_opf_metadata.readOpfMetadata;
95
95
  exports.readXhtmlBody = require_xhtml_read.readXhtmlBody;
96
+ exports.rebaseConstructs = require_xhtml_inline.rebaseConstructs;
96
97
  exports.reportInertElementSkip = require_xhtml_context.reportInertElementSkip;
97
98
  exports.resolveOpfPath = require_ocf_container.resolveOpfPath;
98
99
  exports.resolvePackagePath = require_path.resolvePackagePath;
package/dist/index.d.cts CHANGED
@@ -12,7 +12,7 @@ import { WriteOpfInput, writeOpf } from "./opf/write.cjs";
12
12
  import { base64ToBytes, bytesToBase64 } from "./util/base64.cjs";
13
13
  import { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip } from "./xhtml/context.cjs";
14
14
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.cjs";
15
- import { InlineResult, buildInlineRuns } from "./xhtml/inline.cjs";
15
+ import { InlineResult, buildInlineRuns, rebaseConstructs } from "./xhtml/inline.cjs";
16
16
  import { ListNumIdInfo, MintListNumIdOptions, mintListNumId, parseListNumId } from "./xhtml/list-id.cjs";
17
17
  import { ReadXhtmlBodyOptions, ReadXhtmlBodyResult, readXhtmlBody } from "./xhtml/read.cjs";
18
18
  import { DEFINITION_BODY_INDENT_PT, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID } from "./xhtml/style-constants.cjs";
@@ -29,4 +29,4 @@ import { parseXml } from "./xml/parse.cjs";
29
29
  import { buildXml } from "./xml/build.cjs";
30
30
  import { attrValue, childrenWithTag, decodedTextContent, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.cjs";
31
31
  import { decodeEntities, decodeTextLikeNode, encodeEntities } from "./xml/entities.cjs";
32
- export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
32
+ export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, rebaseConstructs, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import { WriteOpfInput, writeOpf } from "./opf/write.js";
12
12
  import { base64ToBytes, bytesToBase64 } from "./util/base64.js";
13
13
  import { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip } from "./xhtml/context.js";
14
14
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.js";
15
- import { InlineResult, buildInlineRuns } from "./xhtml/inline.js";
15
+ import { InlineResult, buildInlineRuns, rebaseConstructs } from "./xhtml/inline.js";
16
16
  import { ListNumIdInfo, MintListNumIdOptions, mintListNumId, parseListNumId } from "./xhtml/list-id.js";
17
17
  import { ReadXhtmlBodyOptions, ReadXhtmlBodyResult, readXhtmlBody } from "./xhtml/read.js";
18
18
  import { DEFINITION_BODY_INDENT_PT, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID } from "./xhtml/style-constants.js";
@@ -29,4 +29,4 @@ import { parseXml } from "./xml/parse.js";
29
29
  import { buildXml } from "./xml/build.js";
30
30
  import { attrValue, childrenWithTag, decodedTextContent, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.js";
31
31
  import { decodeEntities, decodeTextLikeNode, encodeEntities } from "./xml/entities.js";
32
- export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
32
+ export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, rebaseConstructs, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import { buildXml } from "./xml/build.js";
16
16
  import { isInertElement, reportInertElementSkip } from "./xhtml/context.js";
17
17
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.js";
18
18
  import { DEFINITION_BODY_INDENT_PT, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID } from "./xhtml/style-constants.js";
19
- import { buildInlineRuns } from "./xhtml/inline.js";
19
+ import { buildInlineRuns, rebaseConstructs } from "./xhtml/inline.js";
20
20
  import { mintListNumId, parseListNumId } from "./xhtml/list-id.js";
21
21
  import { readXhtmlBody } from "./xhtml/read.js";
22
22
  import { dirname, resolvePackagePath } from "./path.js";
@@ -29,4 +29,4 @@ import { writeXhtmlBody } from "./xhtml/write.js";
29
29
  import { writeEpub, writeEpubContent } from "./write.js";
30
30
  import { EpubBytesSchema, epubCodec, epubContentCodec } from "./codec.js";
31
31
  import "./opf/types.js";
32
- export { AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnosticCodes, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, NOOP_EPUB_DIAGNOSTIC_SINK, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
32
+ export { AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnosticCodes, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, NOOP_EPUB_DIAGNOSTIC_SINK, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, rebaseConstructs, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
@@ -104,10 +104,18 @@ function appendImageFallback(element, style, context, runs) {
104
104
  });
105
105
  if (alt !== void 0 && alt.length > 0) runs.push(styledRun(require_xml_entities.decodeEntities(alt), style));
106
106
  }
107
+ function rebaseConstructs(constructs, offset) {
108
+ return constructs.map((construct) => ({
109
+ ...construct,
110
+ startRun: construct.startRun + offset,
111
+ endRun: construct.endRun + offset
112
+ }));
113
+ }
107
114
  function appendNested(element, style, context, runs, constructs) {
115
+ const offset = runs.length;
108
116
  const nested = buildInlineRuns(element.children, style, context);
109
117
  runs.push(...nested.runs);
110
- constructs.push(...nested.constructs);
118
+ constructs.push(...rebaseConstructs(nested.constructs, offset));
111
119
  }
112
120
  function appendAnchor(element, style, context, runs, constructs) {
113
121
  const footnoteName = require_xhtml_footnote.isFootnoteReferenceAnchor(element, context.idElements);
@@ -115,7 +123,7 @@ function appendAnchor(element, style, context, runs, constructs) {
115
123
  const startRun = runs.length;
116
124
  const nested = buildInlineRuns(element.children, style, context);
117
125
  runs.push(...nested.runs);
118
- constructs.push(...nested.constructs);
126
+ constructs.push(...rebaseConstructs(nested.constructs, startRun));
119
127
  constructs.push({
120
128
  descriptor: {
121
129
  kind: "anchor",
@@ -132,12 +140,13 @@ function appendAnchor(element, style, context, runs, constructs) {
132
140
  appendNested(element, style, context, runs, constructs);
133
141
  return;
134
142
  }
143
+ const offset = runs.length;
135
144
  const nested = buildInlineRuns(element.children, style, context);
136
145
  for (const run of nested.runs) runs.push({
137
146
  ...run,
138
147
  hyperlink: href
139
148
  });
140
- constructs.push(...nested.constructs);
149
+ constructs.push(...rebaseConstructs(nested.constructs, offset));
141
150
  if (require_xhtml_footnote.sameDocumentFragment(href) === void 0 && !/^[a-z][a-z0-9+.-]*:/iu.test(href)) context.sink({
142
151
  code: require_diagnostics.EpubDiagnosticCodes.LINK_TARGET_EXTERNAL_ONLY,
143
152
  severity: "info",
@@ -147,3 +156,4 @@ function appendAnchor(element, style, context, runs, constructs) {
147
156
  }
148
157
  //#endregion
149
158
  exports.buildInlineRuns = buildInlineRuns;
159
+ exports.rebaseConstructs = rebaseConstructs;
@@ -7,5 +7,6 @@ interface InlineResult {
7
7
  readonly constructs: RunConstructExtent[];
8
8
  }
9
9
  declare function buildInlineRuns(nodes: readonly XmlNode[], style: InlineStyle, context: XhtmlReadContext): InlineResult;
10
+ declare function rebaseConstructs(constructs: readonly RunConstructExtent[], offset: number): RunConstructExtent[];
10
11
  //#endregion
11
- export { InlineResult, buildInlineRuns };
12
+ export { InlineResult, buildInlineRuns, rebaseConstructs };
@@ -7,5 +7,6 @@ interface InlineResult {
7
7
  readonly constructs: RunConstructExtent[];
8
8
  }
9
9
  declare function buildInlineRuns(nodes: readonly XmlNode[], style: InlineStyle, context: XhtmlReadContext): InlineResult;
10
+ declare function rebaseConstructs(constructs: readonly RunConstructExtent[], offset: number): RunConstructExtent[];
10
11
  //#endregion
11
- export { InlineResult, buildInlineRuns };
12
+ export { InlineResult, buildInlineRuns, rebaseConstructs };
@@ -103,10 +103,18 @@ function appendImageFallback(element, style, context, runs) {
103
103
  });
104
104
  if (alt !== void 0 && alt.length > 0) runs.push(styledRun(decodeEntities(alt), style));
105
105
  }
106
+ function rebaseConstructs(constructs, offset) {
107
+ return constructs.map((construct) => ({
108
+ ...construct,
109
+ startRun: construct.startRun + offset,
110
+ endRun: construct.endRun + offset
111
+ }));
112
+ }
106
113
  function appendNested(element, style, context, runs, constructs) {
114
+ const offset = runs.length;
107
115
  const nested = buildInlineRuns(element.children, style, context);
108
116
  runs.push(...nested.runs);
109
- constructs.push(...nested.constructs);
117
+ constructs.push(...rebaseConstructs(nested.constructs, offset));
110
118
  }
111
119
  function appendAnchor(element, style, context, runs, constructs) {
112
120
  const footnoteName = isFootnoteReferenceAnchor(element, context.idElements);
@@ -114,7 +122,7 @@ function appendAnchor(element, style, context, runs, constructs) {
114
122
  const startRun = runs.length;
115
123
  const nested = buildInlineRuns(element.children, style, context);
116
124
  runs.push(...nested.runs);
117
- constructs.push(...nested.constructs);
125
+ constructs.push(...rebaseConstructs(nested.constructs, startRun));
118
126
  constructs.push({
119
127
  descriptor: {
120
128
  kind: "anchor",
@@ -131,12 +139,13 @@ function appendAnchor(element, style, context, runs, constructs) {
131
139
  appendNested(element, style, context, runs, constructs);
132
140
  return;
133
141
  }
142
+ const offset = runs.length;
134
143
  const nested = buildInlineRuns(element.children, style, context);
135
144
  for (const run of nested.runs) runs.push({
136
145
  ...run,
137
146
  hyperlink: href
138
147
  });
139
- constructs.push(...nested.constructs);
148
+ constructs.push(...rebaseConstructs(nested.constructs, offset));
140
149
  if (sameDocumentFragment(href) === void 0 && !/^[a-z][a-z0-9+.-]*:/iu.test(href)) context.sink({
141
150
  code: EpubDiagnosticCodes.LINK_TARGET_EXTERNAL_ONLY,
142
151
  severity: "info",
@@ -145,4 +154,4 @@ function appendAnchor(element, style, context, runs, constructs) {
145
154
  });
146
155
  }
147
156
  //#endregion
148
- export { buildInlineRuns };
157
+ export { buildInlineRuns, rebaseConstructs };
@@ -327,11 +327,7 @@ function readPreRuns(nodes, context) {
327
327
  const startRun = runs.length;
328
328
  const nested = readPreRuns(node.children, context);
329
329
  runs.push(...nested.runs);
330
- for (const construct of nested.constructs) constructs.push({
331
- ...construct,
332
- startRun: construct.startRun + startRun,
333
- endRun: construct.endRun + startRun
334
- });
330
+ constructs.push(...require_xhtml_inline.rebaseConstructs(nested.constructs, startRun));
335
331
  if (footnoteName !== void 0) constructs.push({
336
332
  descriptor: {
337
333
  kind: "anchor",
@@ -9,7 +9,7 @@ import { buildXml } from "../xml/build.js";
9
9
  import { isInertElement, reportInertElementSkip } from "./context.js";
10
10
  import { isFootnoteAside, isFootnoteReferenceAnchor } from "./footnote.js";
11
11
  import { HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY } from "./style-constants.js";
12
- import { buildInlineRuns } from "./inline.js";
12
+ import { buildInlineRuns, rebaseConstructs } from "./inline.js";
13
13
  import { mintListNumId } from "./list-id.js";
14
14
  import { clampHeadingLevel } from "document-schema.js";
15
15
  //#region src/xhtml/read.ts
@@ -326,11 +326,7 @@ function readPreRuns(nodes, context) {
326
326
  const startRun = runs.length;
327
327
  const nested = readPreRuns(node.children, context);
328
328
  runs.push(...nested.runs);
329
- for (const construct of nested.constructs) constructs.push({
330
- ...construct,
331
- startRun: construct.startRun + startRun,
332
- endRun: construct.endRun + startRun
333
- });
329
+ constructs.push(...rebaseConstructs(nested.constructs, startRun));
334
330
  if (footnoteName !== void 0) constructs.push({
335
331
  descriptor: {
336
332
  kind: "anchor",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epub-codec",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "EPUB 2/3 reading and deterministic EPUB 3 writing against the shared document-schema.js content pivot.",
5
5
  "type": "module",
6
6
  "repository": {