@opencraw/studio 0.0.30 → 0.0.31

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.
@@ -12,6 +12,8 @@ export interface PdfRowView {
12
12
  top: number;
13
13
  bottom: number;
14
14
  cells: PdfCellView[];
15
+ /** A running header or footer (see `@opencraw/core`'s `marginRows`); absent for body text. */
16
+ running?: boolean;
15
17
  }
16
18
  /** One page's geometry and diagnostics for the PDF canvas (studio plan §3.4, issue #94's 5b). */
17
19
  export interface PdfPageView {
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import { createServer } from 'node:http';
3
3
  import { promisify, stripVTControlCharacters } from 'node:util';
4
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
5
5
  import { z } from 'zod';
6
- import { BODY_KINDS, HttpClient, BrowserClient, NODE_ID_ATTRIBUTE, sessionStateOf, rowsOfCells, parseXml, findDeckTables, findGridTables, analyzeTables, parseRegion, regionText, deckRegionText, isDeckDocument, readRecipeSource, parseInputRecipe, parseOutputRecipe, calloutLabel, bindRecipeSet, memorySink, createCrawler, traceLine, UnknownHookError, resolveMissingPolicy, isWorkbookDocument, RecipeBindingError, RecipeValidationError, countMatches, matchesOf, tryParseJson, isPdfDocument, BrowserProfiles } from '@opencraw/core';
6
+ import { BODY_KINDS, HttpClient, BrowserClient, NODE_ID_ATTRIBUTE, sessionStateOf, rowsOfCells, parseXml, marginRows, findDeckTables, findGridTables, analyzeTables, parseRegion, regionText, deckRegionText, isDeckDocument, readRecipeSource, parseInputRecipe, parseOutputRecipe, calloutLabel, bindRecipeSet, memorySink, createCrawler, traceLine, UnknownHookError, resolveMissingPolicy, isWorkbookDocument, RecipeBindingError, RecipeValidationError, countMatches, matchesOf, tryParseJson, isPdfDocument, BrowserProfiles } from '@opencraw/core';
7
7
  import { randomBytes, createHash } from 'node:crypto';
8
8
  import { execFile } from 'node:child_process';
9
9
  import { createRequire } from 'node:module';
@@ -675,7 +675,9 @@ const pdfCellViewSchema = z.object({
675
675
  const pdfRowViewSchema = z.object({
676
676
  top: z.number(),
677
677
  bottom: z.number(),
678
- cells: z.array(pdfCellViewSchema)
678
+ cells: z.array(pdfCellViewSchema),
679
+ /** A running header or footer: the same text at the same height on several pages (page numbers aside). */
680
+ running: z.boolean().optional()
679
681
  });
680
682
  const pdfPageViewSchema = z.object({
681
683
  number: z.number().int(),
@@ -1918,6 +1920,7 @@ function textOf(element) {
1918
1920
  * @returns The view.
1919
1921
  */
1920
1922
  function pdfDocumentView(document) {
1923
+ const margins = marginRows(document);
1921
1924
  return {
1922
1925
  pages: document.pages.map(page => ({
1923
1926
  number: page.number,
@@ -1932,7 +1935,10 @@ function pdfDocumentView(document) {
1932
1935
  width: cell.width,
1933
1936
  height: cell.height,
1934
1937
  text: cell.text
1935
- }))
1938
+ })),
1939
+ ...(margins.has(row) && {
1940
+ running: true
1941
+ })
1936
1942
  })),
1937
1943
  rowCount: page.rows.length,
1938
1944
  cellCount: page.rows.reduce((total, row) => total + row.cells.length, 0),
@@ -12,6 +12,8 @@ export interface PdfRowView {
12
12
  top: number;
13
13
  bottom: number;
14
14
  cells: PdfCellView[];
15
+ /** A running header or footer (see `@opencraw/core`'s `marginRows`); absent for body text. */
16
+ running?: boolean;
15
17
  }
16
18
  /** One page's geometry and diagnostics for the PDF canvas (studio plan §3.4, issue #94's 5b). */
17
19
  export interface PdfPageView {
@@ -17,6 +17,7 @@ export declare const pdfRowViewSchema: z.ZodObject<{
17
17
  height: z.ZodNumber;
18
18
  text: z.ZodString;
19
19
  }, z.core.$strip>>;
20
+ running: z.ZodOptional<z.ZodBoolean>;
20
21
  }, z.core.$strip>;
21
22
  export declare const pdfPageViewSchema: z.ZodObject<{
22
23
  number: z.ZodNumber;
@@ -32,6 +33,7 @@ export declare const pdfPageViewSchema: z.ZodObject<{
32
33
  height: z.ZodNumber;
33
34
  text: z.ZodString;
34
35
  }, z.core.$strip>>;
36
+ running: z.ZodOptional<z.ZodBoolean>;
35
37
  }, z.core.$strip>>;
36
38
  rowCount: z.ZodNumber;
37
39
  cellCount: z.ZodNumber;
@@ -53,6 +55,7 @@ export declare const pdfDocumentViewSchema: z.ZodObject<{
53
55
  height: z.ZodNumber;
54
56
  text: z.ZodString;
55
57
  }, z.core.$strip>>;
58
+ running: z.ZodOptional<z.ZodBoolean>;
56
59
  }, z.core.$strip>>;
57
60
  rowCount: z.ZodNumber;
58
61
  cellCount: z.ZodNumber;
@@ -17,6 +17,7 @@ export declare const pdfRowViewSchema: z.ZodObject<{
17
17
  height: z.ZodNumber;
18
18
  text: z.ZodString;
19
19
  }, z.core.$strip>>;
20
+ running: z.ZodOptional<z.ZodBoolean>;
20
21
  }, z.core.$strip>;
21
22
  export declare const pdfPageViewSchema: z.ZodObject<{
22
23
  number: z.ZodNumber;
@@ -32,6 +33,7 @@ export declare const pdfPageViewSchema: z.ZodObject<{
32
33
  height: z.ZodNumber;
33
34
  text: z.ZodString;
34
35
  }, z.core.$strip>>;
36
+ running: z.ZodOptional<z.ZodBoolean>;
35
37
  }, z.core.$strip>>;
36
38
  rowCount: z.ZodNumber;
37
39
  cellCount: z.ZodNumber;
@@ -53,6 +55,7 @@ export declare const pdfDocumentViewSchema: z.ZodObject<{
53
55
  height: z.ZodNumber;
54
56
  text: z.ZodString;
55
57
  }, z.core.$strip>>;
58
+ running: z.ZodOptional<z.ZodBoolean>;
56
59
  }, z.core.$strip>>;
57
60
  rowCount: z.ZodNumber;
58
61
  cellCount: z.ZodNumber;