@opencraw/studio 0.0.8 → 0.0.10
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 +31 -5
- package/dist/index.esm.js +1362 -1072
- package/dist/src/browser-provisioning/ensure-browser-launch.use-case.d.ts +12 -0
- package/dist/src/browser-provisioning/index.d.ts +2 -0
- package/dist/src/browser-provisioning/install-chromium.use-case.d.ts +2 -0
- package/dist/src/browser-provisioning/missing-browser.policy.d.ts +3 -0
- package/dist/src/document-view/index.d.ts +2 -0
- package/dist/src/document-view/region-preview.use-case.d.ts +30 -0
- package/dist/src/index.d.ts +4 -3
- package/dist/src/recipe-workspace/import-document.use-case.d.ts +22 -0
- package/dist/src/recipe-workspace/index.d.ts +2 -0
- package/dist/src/studio-api/command.contract.d.ts +41 -0
- package/dist/src/studio-api/import-document-view.contract.d.ts +8 -0
- package/dist/src/studio-api/index.d.ts +6 -2
- package/dist/src/studio-api/region-preview-view.contract.d.ts +53 -0
- package/dist/src/studio-server/import-document.handler.d.ts +14 -0
- package/dist/src/studio-server/open-workspace.handler.d.ts +8 -1
- package/dist/src/studio-server/region-preview.handler.d.ts +17 -0
- package/dist/ui/assets/index-CxiFCU_G.js +37 -0
- package/dist/ui/assets/{pdf-lqXfRfkR.js → pdf-4CYQHobd.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +3 -3
- package/dist/ui/assets/index-DdiGdaTN.js +0 -13
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BrowserSessionConfig } from '@opencraw/core';
|
|
2
|
+
/**
|
|
3
|
+
* Runs a browser-launching function, and — only when it fails with Playwright's own "no browser
|
|
4
|
+
* downloaded" error, only for a default chromium launch with no explicit binary configured — installs
|
|
5
|
+
* Chromium once and retries, instead of letting Playwright's raw error reach the studio's caller.
|
|
6
|
+
*
|
|
7
|
+
* An explicit `executablePath` or `OPENCRAW_CHROMIUM` means the person (or this repo's own sandbox)
|
|
8
|
+
* already chose a specific binary; a missing-browser failure there is their setup to fix, not
|
|
9
|
+
* something to silently install over.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ensureBrowserLaunch<T>(browser: BrowserSessionConfig | undefined, launch: () => Promise<T>, installChromium?: (run?: () => Promise<void>) => Promise<void>): Promise<T>;
|
|
12
|
+
//# sourceMappingURL=ensure-browser-launch.use-case.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Recognises Playwright's own "no browser downloaded" failure so a launch can be retried after installing one, instead of surfacing Playwright's raw ASCII-art error. */
|
|
2
|
+
export declare function isMissingBrowserError(error: unknown): boolean;
|
|
3
|
+
//# sourceMappingURL=missing-browser.policy.d.ts.map
|
|
@@ -6,6 +6,8 @@ export { pdfDocumentView } from './pdf-view.mapper.js';
|
|
|
6
6
|
export type { PdfCellView, PdfDocumentView, PdfPageView, PdfRowView } from './pdf-view.mapper.js';
|
|
7
7
|
export { previewDeckTable, previewGridTable, previewPdfTable } from './table-preview.use-case.js';
|
|
8
8
|
export type { DeckTablePreviewMatch, DeckTablePreviewOptions, DeckTablePreviewResult, GridTablePreviewMatch, GridTablePreviewOptions, GridTablePreviewResult, TablePreviewMatch, TablePreviewOptions, TablePreviewResult } from './table-preview.use-case.js';
|
|
9
|
+
export { previewRegion } from './region-preview.use-case.js';
|
|
10
|
+
export type { RegionPreviewResult, RegionPreviewMatch } from './region-preview.use-case.js';
|
|
9
11
|
export { workbookDocumentView } from './workbook-view.mapper.js';
|
|
10
12
|
export type { GridCellType, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView } from './workbook-view.mapper.js';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DeckDocument, DeckShape, PdfCell, PdfDocument } from '@opencraw/core';
|
|
2
|
+
/** One page (or slide) a `region` extract's box reads text off: the text the step binds, and what it was read from — a PDF's cells or a deck's text boxes (what the canvas highlights). */
|
|
3
|
+
export interface RegionPreviewMatch {
|
|
4
|
+
/** The page number of a PDF, or the slide number of a deck. */
|
|
5
|
+
page: number;
|
|
6
|
+
text: string;
|
|
7
|
+
cells: PdfCell[];
|
|
8
|
+
shapes: DeckShape[];
|
|
9
|
+
}
|
|
10
|
+
/** What a `region` extract's selector reads off the already-read document: one match per page or slide with text in the box. */
|
|
11
|
+
export interface RegionPreviewResult {
|
|
12
|
+
matches: RegionPreviewMatch[];
|
|
13
|
+
/** The selector does not parse yet (the person is still typing it, or dragging a box into shape), or names a `page=` on a deck (or a `slide=` on a PDF): reported, not thrown. */
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runs a `region` extract's selector against an already-read PDF or deck
|
|
18
|
+
* (issues #121 and #122: the canvases' click-to-snap selection) — the
|
|
19
|
+
* engine's own `regionText` / `deckRegionText`, so what the canvas
|
|
20
|
+
* highlights and the text it shows are exactly what the step will read,
|
|
21
|
+
* and a pure function of the document, so re-running it on every change
|
|
22
|
+
* of the box costs nothing. A `slide=` on a PDF (or a `page=` on a deck)
|
|
23
|
+
* is the same mismatch the step would fail with, reported as `error`.
|
|
24
|
+
*
|
|
25
|
+
* @param document - The read PDF or deck (`take-snapshot`'s cached body).
|
|
26
|
+
* @param selector - The `region` selector, `page=1 x=72..252 y=640..664` or `slide=2 x=60..900 y=30..90`.
|
|
27
|
+
* @returns The matches, or `error` when the selector does not parse or does not fit the document.
|
|
28
|
+
*/
|
|
29
|
+
export declare function previewRegion(document: PdfDocument | DeckDocument, selector: string): RegionPreviewResult;
|
|
30
|
+
//# sourceMappingURL=region-preview.use-case.d.ts.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { main } from './main.js';
|
|
2
2
|
export { startStudioServer } from './studio-server/index.js';
|
|
3
3
|
export type { StudioServer, StudioServerOptions } from './studio-server/index.js';
|
|
4
|
-
export { openWorkspace, saveRecipe } from './recipe-workspace/index.js';
|
|
4
|
+
export { openWorkspace, saveRecipe, importDocument } from './recipe-workspace/index.js';
|
|
5
|
+
export type { ImportedDocument } from './recipe-workspace/index.js';
|
|
5
6
|
export { runSample, loadRecipePair } from './sample-run/index.js';
|
|
6
7
|
export type { RecipePair, SampleRunCallbacks, SampleRunHandle, SampleRunRecord, SampleRunRejected, SampleRunResult, SampleStepSummary, SampleStoppedBy } from './sample-run/index.js';
|
|
7
8
|
export { fetchStartPage } from './page-snapshot/index.js';
|
|
8
9
|
export type { WhyFacts, WhyStepFact } from './explain-why/index.js';
|
|
9
|
-
export { sampleBudgetSchema, openWorkspaceCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, studioCommandSchema, stoppedBySchema, fieldTraceSchema, traceLineEventSchema, recordEventSchema, recordRejectedEventSchema, runFinishedEventSchema, workspaceChangedEventSchema, studioEventSchema, recipeIssueSchema, recipeListingSchema, workspaceViewSchema, sampleRunRecordSchema, sampleRunViewSchema, startPageViewSchema, snapshotViewSchema, verifySelectorViewSchema, fieldPickSchema, inferSelectorViewSchema, sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema, whyViewSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, domTreeNodeViewSchema, pageDataFindingSchema, inspectViewSchema, observedResponseSchema, responsesSeenViewSchema, documentTreeNodeViewSchema, documentTreeViewSchema, pdfCellViewSchema, pdfRowViewSchema, pdfPageViewSchema, pdfDocumentViewSchema, tablePreviewTableSchema, tablePreviewBandSchema, tablePreviewMatchSchema, tablePreviewViewSchema, gridCellViewSchema, gridMergeViewSchema, gridSheetViewSchema, workbookDocumentViewSchema, gridTablePreviewMatchSchema, gridTablePreviewViewSchema, deckShapeViewSchema, deckChartSeriesViewSchema, deckChartViewSchema, deckSlideViewSchema, deckDocumentViewSchema, deckTablePreviewMatchSchema, deckTablePreviewViewSchema, startRecordingCommandSchema, stopRecordingCommandSchema, recordingCardEventSchema, recordingNoteEventSchema, recordingStoppedEventSchema, } from './studio-api/index.js';
|
|
10
|
-
export type { SampleBudget, OpenWorkspaceCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StudioCommand, StoppedBy, FieldTraceView, TraceLineEvent, RecordEvent, RecordRejectedEvent, RunFinishedEvent, WorkspaceChangedEvent, StudioEvent, RecipeIssue, RecipeListing, WorkspaceView, SampleRunView, StartPageView, SnapshotView, VerifySelectorView, FieldPick, InferSelectorView, SentencePart, OutlineCard, OutlineBracket, OutlineNode, OutlineView, WhyView, DomTreeNodeView, PageDataKind, PageDataFindingView, InspectView, ObservedResponseView, ResponsesSeenView, DocumentTreeNodeView, DocumentTreeView, PdfCellView, PdfRowView, PdfPageView, PdfDocumentView, TablePreviewTableView, TablePreviewBandView, TablePreviewMatchView, TablePreviewView, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView, GridTablePreviewMatchView, GridTablePreviewView, DeckShapeView, DeckChartSeriesView, DeckChartView, DeckSlideView, DeckDocumentView, DeckTablePreviewMatchView, DeckTablePreviewView, StartRecordingCommand, StopRecordingCommand, RecordingCardEvent, RecordingNoteEvent, RecordingStoppedEvent, } from './studio-api/index.js';
|
|
10
|
+
export { sampleBudgetSchema, openWorkspaceCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, studioCommandSchema, importDocumentViewSchema, stoppedBySchema, fieldTraceSchema, traceLineEventSchema, recordEventSchema, recordRejectedEventSchema, runFinishedEventSchema, workspaceChangedEventSchema, studioEventSchema, recipeIssueSchema, recipeListingSchema, workspaceViewSchema, sampleRunRecordSchema, sampleRunViewSchema, startPageViewSchema, snapshotViewSchema, verifySelectorViewSchema, fieldPickSchema, inferSelectorViewSchema, sentencePartSchema, outlineCardSchema, outlineBracketSchema, outlineNodeSchema, outlineViewSchema, whyViewSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, regionPreviewMatchSchema, regionPreviewViewSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, domTreeNodeViewSchema, pageDataFindingSchema, inspectViewSchema, observedResponseSchema, responsesSeenViewSchema, documentTreeNodeViewSchema, documentTreeViewSchema, pdfCellViewSchema, pdfRowViewSchema, pdfPageViewSchema, pdfDocumentViewSchema, tablePreviewTableSchema, tablePreviewBandSchema, tablePreviewMatchSchema, tablePreviewViewSchema, gridCellViewSchema, gridMergeViewSchema, gridSheetViewSchema, workbookDocumentViewSchema, gridTablePreviewMatchSchema, gridTablePreviewViewSchema, deckShapeViewSchema, deckChartSeriesViewSchema, deckChartViewSchema, deckSlideViewSchema, deckDocumentViewSchema, deckTablePreviewMatchSchema, deckTablePreviewViewSchema, startRecordingCommandSchema, stopRecordingCommandSchema, recordingCardEventSchema, recordingNoteEventSchema, recordingStoppedEventSchema, } from './studio-api/index.js';
|
|
11
|
+
export type { SampleBudget, OpenWorkspaceCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StudioCommand, ImportDocumentView, RegionPreviewMatchView, RegionPreviewView, StoppedBy, FieldTraceView, TraceLineEvent, RecordEvent, RecordRejectedEvent, RunFinishedEvent, WorkspaceChangedEvent, StudioEvent, RecipeIssue, RecipeListing, WorkspaceView, SampleRunView, StartPageView, SnapshotView, VerifySelectorView, FieldPick, InferSelectorView, SentencePart, OutlineCard, OutlineBracket, OutlineNode, OutlineView, WhyView, DomTreeNodeView, PageDataKind, PageDataFindingView, InspectView, ObservedResponseView, ResponsesSeenView, DocumentTreeNodeView, DocumentTreeView, PdfCellView, PdfRowView, PdfPageView, PdfDocumentView, TablePreviewTableView, TablePreviewBandView, TablePreviewMatchView, TablePreviewView, GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView, GridTablePreviewMatchView, GridTablePreviewView, DeckShapeView, DeckChartSeriesView, DeckChartView, DeckSlideView, DeckDocumentView, DeckTablePreviewMatchView, DeckTablePreviewView, StartRecordingCommand, StopRecordingCommand, RecordingCardEvent, RecordingNoteEvent, RecordingStoppedEvent, } from './studio-api/index.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ImportedDocument {
|
|
2
|
+
/** The copy's path on disk, inside `folder`. */
|
|
3
|
+
path: string;
|
|
4
|
+
/** The copy as a `file:` URL: what the recipe's `start.url` becomes. */
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Copies a document into a workspace folder, so a recipe can read it with a
|
|
9
|
+
* `file:` URL the same way a run would read any downloaded file (core's
|
|
10
|
+
* `HttpClient` handles `file:` itself). The folder is created when missing,
|
|
11
|
+
* so dropping a file is also a way to start a workspace. A name already in
|
|
12
|
+
* the folder is never overwritten: the copy gets the next free numbered
|
|
13
|
+
* name (`report-2.pdf`), and the returned `path`/`url` say which.
|
|
14
|
+
*
|
|
15
|
+
* @param folder - The workspace folder; created (recursively) when it does not exist.
|
|
16
|
+
* @param name - The file's own name, no directories: the copy keeps it, extension included.
|
|
17
|
+
* @param bytes - The file's content.
|
|
18
|
+
* @returns Where the copy landed.
|
|
19
|
+
* @throws Error when `name` is not a plain file name, or the folder already holds too many same-named copies.
|
|
20
|
+
*/
|
|
21
|
+
export declare function importDocument(folder: string, name: string, bytes: Uint8Array): Promise<ImportedDocument>;
|
|
22
|
+
//# sourceMappingURL=import-document.use-case.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { openWorkspace } from './open-workspace.use-case.js';
|
|
2
2
|
export { saveRecipe } from './save-recipe.use-case.js';
|
|
3
|
+
export { importDocument } from './import-document.use-case.js';
|
|
4
|
+
export type { ImportedDocument } from './import-document.use-case.js';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -157,6 +157,19 @@ export declare const tablePreviewCommandSchema: z.ZodObject<{
|
|
|
157
157
|
}>>;
|
|
158
158
|
}, z.core.$strip>;
|
|
159
159
|
}, z.core.$strip>;
|
|
160
|
+
/**
|
|
161
|
+
* The live preview of a `region` extract's selector against a cached PDF
|
|
162
|
+
* snapshot (`document-view`'s `region-preview.use-case.ts`, issue #121: the
|
|
163
|
+
* PDF canvas's click-to-snap selection): the text the step would bind and
|
|
164
|
+
* the cells to highlight, recomputed as the box changes — call
|
|
165
|
+
* `take-snapshot` first.
|
|
166
|
+
*/
|
|
167
|
+
export declare const regionPreviewCommandSchema: z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"region-preview">;
|
|
169
|
+
recipeId: z.ZodString;
|
|
170
|
+
path: z.ZodString;
|
|
171
|
+
selector: z.ZodString;
|
|
172
|
+
}, z.core.$strip>;
|
|
160
173
|
/**
|
|
161
174
|
* The grid canvas's sheets and cells (`document-view`'s `workbook-view.mapper.ts`,
|
|
162
175
|
* studio plan §3.4, issue #94's 5c), off the same cached snapshot
|
|
@@ -327,9 +340,30 @@ export declare const startRecordingCommandSchema: z.ZodObject<{
|
|
|
327
340
|
export declare const stopRecordingCommandSchema: z.ZodObject<{
|
|
328
341
|
type: z.ZodLiteral<"stop-recording">;
|
|
329
342
|
}, z.core.$strip>;
|
|
343
|
+
/**
|
|
344
|
+
* Copies a document the person dropped on (or opened in) the studio into a
|
|
345
|
+
* workspace folder, so a recipe can point at it with a `file:` URL (issue
|
|
346
|
+
* #120). The bytes travel base64-encoded inside the JSON command envelope
|
|
347
|
+
* every other command uses: a local tool's own files are a few megabytes at
|
|
348
|
+
* most, not worth a second, multipart endpoint. `folder` is created when it
|
|
349
|
+
* does not exist yet, so a dropped file can also start a workspace; `name`
|
|
350
|
+
* is a plain file name (no directories), kept as the copy's name unless one
|
|
351
|
+
* is already there, in which case a numbered one is used.
|
|
352
|
+
*/
|
|
353
|
+
export declare const importDocumentCommandSchema: z.ZodObject<{
|
|
354
|
+
type: z.ZodLiteral<"import-document">;
|
|
355
|
+
folder: z.ZodString;
|
|
356
|
+
name: z.ZodString;
|
|
357
|
+
bytes: z.ZodString;
|
|
358
|
+
}, z.core.$strip>;
|
|
330
359
|
export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
331
360
|
type: z.ZodLiteral<"open-workspace">;
|
|
332
361
|
folder: z.ZodString;
|
|
362
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
363
|
+
type: z.ZodLiteral<"import-document">;
|
|
364
|
+
folder: z.ZodString;
|
|
365
|
+
name: z.ZodString;
|
|
366
|
+
bytes: z.ZodString;
|
|
333
367
|
}, z.core.$strip>, z.ZodObject<{
|
|
334
368
|
type: z.ZodLiteral<"run-sample">;
|
|
335
369
|
recipeId: z.ZodString;
|
|
@@ -408,6 +442,11 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
408
442
|
bottom: "bottom";
|
|
409
443
|
}>>;
|
|
410
444
|
}, z.core.$strip>;
|
|
445
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
446
|
+
type: z.ZodLiteral<"region-preview">;
|
|
447
|
+
recipeId: z.ZodString;
|
|
448
|
+
path: z.ZodString;
|
|
449
|
+
selector: z.ZodString;
|
|
411
450
|
}, z.core.$strip>, z.ZodObject<{
|
|
412
451
|
type: z.ZodLiteral<"grid-view">;
|
|
413
452
|
recipeId: z.ZodString;
|
|
@@ -459,6 +498,7 @@ export declare const studioCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
459
498
|
}, z.core.$strip>], "type">;
|
|
460
499
|
export type SampleBudget = z.infer<typeof sampleBudgetSchema>;
|
|
461
500
|
export type OpenWorkspaceCommand = z.infer<typeof openWorkspaceCommandSchema>;
|
|
501
|
+
export type ImportDocumentCommand = z.infer<typeof importDocumentCommandSchema>;
|
|
462
502
|
export type RunSampleCommand = z.infer<typeof runSampleCommandSchema>;
|
|
463
503
|
export type StopRunCommand = z.infer<typeof stopRunCommandSchema>;
|
|
464
504
|
export type SaveRecipeCommand = z.infer<typeof saveRecipeCommandSchema>;
|
|
@@ -473,6 +513,7 @@ export type DocumentTreeCommand = z.infer<typeof documentTreeCommandSchema>;
|
|
|
473
513
|
export type PdfViewCommand = z.infer<typeof pdfViewCommandSchema>;
|
|
474
514
|
export type TablePreviewOptions = z.infer<typeof tablePreviewOptionsSchema>;
|
|
475
515
|
export type TablePreviewCommand = z.infer<typeof tablePreviewCommandSchema>;
|
|
516
|
+
export type RegionPreviewCommand = z.infer<typeof regionPreviewCommandSchema>;
|
|
476
517
|
export type GridViewCommand = z.infer<typeof gridViewCommandSchema>;
|
|
477
518
|
export type GridPreviewOptions = z.infer<typeof gridPreviewOptionsSchema>;
|
|
478
519
|
export type GridPreviewCommand = z.infer<typeof gridPreviewCommandSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** `import-document`'s answer: where the copy landed, and the `file:` URL a recipe's `start.url` points at it with. */
|
|
3
|
+
export declare const importDocumentViewSchema: z.ZodObject<{
|
|
4
|
+
path: z.ZodString;
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type ImportDocumentView = z.infer<typeof importDocumentViewSchema>;
|
|
8
|
+
//# sourceMappingURL=import-document-view.contract.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { sampleBudgetSchema, openWorkspaceCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract.js';
|
|
2
|
-
export type { SampleBudget, OpenWorkspaceCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract.js';
|
|
1
|
+
export { sampleBudgetSchema, openWorkspaceCommandSchema, importDocumentCommandSchema, runSampleCommandSchema, stopRunCommandSchema, saveRecipeCommandSchema, fetchStartPageCommandSchema, saveOutlineCommandSchema, takeSnapshotCommandSchema, verifySelectorCommandSchema, inferSelectorCommandSchema, missingWhyTargetSchema, rejectedWhyTargetSchema, whyTargetSchema, explainWhyCommandSchema, inspectPageCommandSchema, responsesSeenCommandSchema, documentTreeCommandSchema, pdfViewCommandSchema, tablePreviewOptionsSchema, tablePreviewCommandSchema, regionPreviewCommandSchema, gridViewCommandSchema, gridPreviewOptionsSchema, gridPreviewCommandSchema, deckViewCommandSchema, deckPreviewOptionsSchema, deckPreviewCommandSchema, startRecordingCommandSchema, stopRecordingCommandSchema, studioCommandSchema } from './command.contract.js';
|
|
2
|
+
export type { SampleBudget, OpenWorkspaceCommand, ImportDocumentCommand, RunSampleCommand, StopRunCommand, SaveRecipeCommand, FetchStartPageCommand, SaveOutlineCommand, TakeSnapshotCommand, VerifySelectorCommand, InferSelectorCommand, MissingWhyTarget, RejectedWhyTarget, WhyTarget, ExplainWhyCommand, InspectPageCommand, ResponsesSeenCommand, DocumentTreeCommand, PdfViewCommand, TablePreviewOptions, TablePreviewCommand, RegionPreviewCommand, GridViewCommand, GridPreviewOptions, GridPreviewCommand, DeckViewCommand, DeckPreviewOptions, DeckPreviewCommand, StartRecordingCommand, StopRecordingCommand, StudioCommand } from './command.contract.js';
|
|
3
3
|
export { snapshotViewSchema } from './snapshot-view.contract.js';
|
|
4
4
|
export type { SnapshotView } from './snapshot-view.contract.js';
|
|
5
5
|
export { verifySelectorViewSchema } from './verify-selector-view.contract.js';
|
|
@@ -10,6 +10,8 @@ export { stoppedBySchema, fieldTraceSchema, traceLineEventSchema, recordEventSch
|
|
|
10
10
|
export type { StoppedBy, FieldTraceView, TraceLineEvent, RecordEvent, RecordRejectedEvent, RunFinishedEvent, WorkspaceChangedEvent, RecordingCardEvent, RecordingNoteEvent, RecordingStoppedEvent, StudioEvent } from './event.contract.js';
|
|
11
11
|
export { recipeIssueSchema, recipeListingSchema, workspaceViewSchema } from './workspace-view.contract.js';
|
|
12
12
|
export type { RecipeIssue, RecipeListing, WorkspaceView } from './workspace-view.contract.js';
|
|
13
|
+
export { importDocumentViewSchema } from './import-document-view.contract.js';
|
|
14
|
+
export type { ImportDocumentView } from './import-document-view.contract.js';
|
|
13
15
|
export { sampleRunRecordSchema, sampleRunViewSchema } from './sample-run-view.contract.js';
|
|
14
16
|
export type { SampleRunRecord, SampleRunView } from './sample-run-view.contract.js';
|
|
15
17
|
export { startPageViewSchema } from './start-page-view.contract.js';
|
|
@@ -28,6 +30,8 @@ export { pdfCellViewSchema, pdfRowViewSchema, pdfPageViewSchema, pdfDocumentView
|
|
|
28
30
|
export type { PdfCellView, PdfRowView, PdfPageView, PdfDocumentView } from './pdf-view.contract.js';
|
|
29
31
|
export { tablePreviewTableSchema, tablePreviewBandSchema, tablePreviewMatchSchema, tablePreviewViewSchema } from './table-preview-view.contract.js';
|
|
30
32
|
export type { TablePreviewTableView, TablePreviewBandView, TablePreviewMatchView, TablePreviewView } from './table-preview-view.contract.js';
|
|
33
|
+
export { regionPreviewMatchSchema, regionPreviewViewSchema } from './region-preview-view.contract.js';
|
|
34
|
+
export type { RegionPreviewMatchView, RegionPreviewView } from './region-preview-view.contract.js';
|
|
31
35
|
export { gridCellViewSchema, gridMergeViewSchema, gridSheetViewSchema, workbookDocumentViewSchema } from './grid-view.contract.js';
|
|
32
36
|
export type { GridCellView, GridMergeView, GridSheetView, WorkbookDocumentView } from './grid-view.contract.js';
|
|
33
37
|
export { gridTablePreviewMatchSchema, gridTablePreviewViewSchema } from './grid-preview-view.contract.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** One page of a PDF, or one slide of a deck, a `region` extract's box reads text off — mirrors `document-view/region-preview.use-case.ts`'s `RegionPreviewMatch`: `cells` for a PDF, `shapes` for a deck, the other empty. */
|
|
3
|
+
export declare const regionPreviewMatchSchema: z.ZodObject<{
|
|
4
|
+
page: z.ZodNumber;
|
|
5
|
+
text: z.ZodString;
|
|
6
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
7
|
+
x: z.ZodNumber;
|
|
8
|
+
y: z.ZodNumber;
|
|
9
|
+
width: z.ZodNumber;
|
|
10
|
+
height: z.ZodNumber;
|
|
11
|
+
text: z.ZodString;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
shapes: z.ZodArray<z.ZodObject<{
|
|
14
|
+
x: z.ZodNumber;
|
|
15
|
+
y: z.ZodNumber;
|
|
16
|
+
width: z.ZodNumber;
|
|
17
|
+
height: z.ZodNumber;
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* What `region-preview` answers with (issues #121 and #122: the PDF and
|
|
24
|
+
* deck canvases' click-to-snap selection): the engine's own matches for
|
|
25
|
+
* the selector — the text the step would bind, and the cells or text boxes
|
|
26
|
+
* to highlight — or `error` when the selector does not parse yet, or names
|
|
27
|
+
* the other document's keyword, reported rather than thrown.
|
|
28
|
+
*/
|
|
29
|
+
export declare const regionPreviewViewSchema: z.ZodObject<{
|
|
30
|
+
matches: z.ZodArray<z.ZodObject<{
|
|
31
|
+
page: z.ZodNumber;
|
|
32
|
+
text: z.ZodString;
|
|
33
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
34
|
+
x: z.ZodNumber;
|
|
35
|
+
y: z.ZodNumber;
|
|
36
|
+
width: z.ZodNumber;
|
|
37
|
+
height: z.ZodNumber;
|
|
38
|
+
text: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
shapes: z.ZodArray<z.ZodObject<{
|
|
41
|
+
x: z.ZodNumber;
|
|
42
|
+
y: z.ZodNumber;
|
|
43
|
+
width: z.ZodNumber;
|
|
44
|
+
height: z.ZodNumber;
|
|
45
|
+
text: z.ZodString;
|
|
46
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
error: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type RegionPreviewMatchView = z.infer<typeof regionPreviewMatchSchema>;
|
|
52
|
+
export type RegionPreviewView = z.infer<typeof regionPreviewViewSchema>;
|
|
53
|
+
//# sourceMappingURL=region-preview-view.contract.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ImportDocumentCommand, ImportDocumentView } from '../studio-api/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handles `import-document` (issue #120): decodes the base64 bytes and copies
|
|
4
|
+
* the file into the folder (see `recipe-workspace/import-document.use-case.ts`
|
|
5
|
+
* for the folder creation and the no-overwrite numbering). Nothing is
|
|
6
|
+
* broadcast: the copy is not a recipe, the workspace listing does not change
|
|
7
|
+
* until the UI saves the recipe pair that points at it, which `save-recipe`
|
|
8
|
+
* announces as usual.
|
|
9
|
+
*
|
|
10
|
+
* @param command - The folder, the file's name and its base64 content.
|
|
11
|
+
* @returns Where the copy landed and its `file:` URL.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleImportDocument(command: ImportDocumentCommand): Promise<ImportDocumentView>;
|
|
14
|
+
//# sourceMappingURL=import-document.handler.d.ts.map
|
|
@@ -3,7 +3,14 @@ import type { StudioState } from './workspace.store.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Handles `open-workspace`: reads the folder, remembers it as the server's
|
|
5
5
|
* current workspace (every later command that names a recipe resolves it
|
|
6
|
-
* against this folder), and
|
|
6
|
+
* against this folder), and, when that is a different folder than before,
|
|
7
|
+
* tells every connected client the workspace changed.
|
|
8
|
+
*
|
|
9
|
+
* Only on an actual switch: the UI answers `workspace-changed` with another
|
|
10
|
+
* `open-workspace` of the same folder (its workspace query re-fetches), so a
|
|
11
|
+
* broadcast on every open would answer that re-fetch with another broadcast,
|
|
12
|
+
* for ever — and each round cancels the fetch in flight, so a recipe saved
|
|
13
|
+
* meanwhile never showed up in the listing (found by issue #120's drop flow).
|
|
7
14
|
*
|
|
8
15
|
* @param state - The server state to update.
|
|
9
16
|
* @param command - The command.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RegionPreviewCommand, RegionPreviewView } from '../studio-api/index.js';
|
|
2
|
+
import type { StudioState } from './workspace.store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handles `region-preview`: the PDF and deck canvases' live preview of a
|
|
5
|
+
* `region` extract's selector (`document-view`'s
|
|
6
|
+
* `region-preview.use-case.ts`, issues #121 and #122), off the same cached
|
|
7
|
+
* snapshot `take-snapshot` already captured — a pure computation over it,
|
|
8
|
+
* so this answers instantly on every change of the box, no re-fetch or
|
|
9
|
+
* re-parse (mirrors `table-preview.handler.ts`).
|
|
10
|
+
*
|
|
11
|
+
* @param state - The server state.
|
|
12
|
+
* @param command - The command; `command.path` must already have a cached snapshot (call `take-snapshot` first).
|
|
13
|
+
* @returns The matches, or `error` when the selector does not parse or does not fit the document.
|
|
14
|
+
* @throws Error when `command.path` has no cached snapshot yet, or the snapshot is neither a PDF nor a deck.
|
|
15
|
+
*/
|
|
16
|
+
export declare function handleRegionPreview(state: StudioState, command: RegionPreviewCommand): RegionPreviewView;
|
|
17
|
+
//# sourceMappingURL=region-preview.handler.d.ts.map
|