@opencraw/studio 0.0.29 → 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.
- package/README.md +2 -2
- package/dist/document-view/pdf-view.mapper.d.ts +2 -0
- package/dist/index.esm.js +9 -3
- package/dist/src/document-view/pdf-view.mapper.d.ts +2 -0
- package/dist/src/studio-api/pdf-view.contract.d.ts +3 -0
- package/dist/studio-api/pdf-view.contract.d.ts +3 -0
- package/dist/ui/assets/index-CMzc4-FL.js +40 -0
- package/dist/ui/assets/{pdf-BReC8938.js → pdf-CtmGNMM2.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +3 -3
- package/dist/ui/assets/index-Bzb5bAuR.js +0 -38
package/README.md
CHANGED
|
@@ -27,8 +27,8 @@ OpenCraw Studio: http://127.0.0.1:52341/?token=8f2a1c9e4b7d3f6a0e5c8b1d2a4f7e9c
|
|
|
27
27
|
Workspace: /home/you/project/recipes
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
`recipes/` can already have `.
|
|
31
|
-
|
|
30
|
+
`recipes/` can already have `.ocw-in.json`/`.ocw-out.json` files in it, or be empty — the studio's own
|
|
31
|
+
**Recipe ▾ → New recipe…** writes a minimal, valid pair to start from.
|
|
32
32
|
|
|
33
33
|
## Learn more
|
|
34
34
|
|
|
@@ -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;
|