@formfeed/engine 0.3.16 → 0.3.18
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 +34 -15
- package/index.cjs +657 -15
- package/index.js +657 -15
- package/package.json +1 -1
- package/types/frame/paged-print.d.cts +66 -0
- package/types/frame/paged-print.d.ts +66 -0
- package/types/frame/paged-print.entry.d.cts +1 -0
- package/types/frame/paged-print.entry.d.ts +1 -0
- package/types/index.d.cts +2 -2
- package/types/index.d.ts +2 -2
- package/types/lib/assemble.d.cts +7 -1
- package/types/lib/assemble.d.ts +7 -1
- package/types/lib/einvoice/check.d.cts +1 -1
- package/types/lib/einvoice/check.d.ts +1 -1
- package/types/lib/einvoice/coverage.d.cts +28 -0
- package/types/lib/einvoice/coverage.d.ts +28 -0
- package/types/lib/einvoice/index.d.cts +1 -0
- package/types/lib/einvoice/index.d.ts +1 -0
- package/types/lib/einvoice/report.d.cts +14 -0
- package/types/lib/einvoice/report.d.ts +14 -0
- package/types/lib/generated/frames.d.cts +2 -0
- package/types/lib/generated/frames.d.ts +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Chromium's print does that Paged.js does not, for the paged preview (the editor's and
|
|
3
|
+
* `formfeed dev`'s). Paged.js lays a page out in CSS columns, treats what reaches the second column
|
|
4
|
+
* as the next page's, and rebuilds a table that goes on to the next page from its body alone.
|
|
5
|
+
* Chromium repeats a table's head at the top of every page the table reaches and its footer group at
|
|
6
|
+
* the foot of every page it goes on from, and keeps room for both. Without that, page 2 of an invoice
|
|
7
|
+
* had no header row, its rows drifted by one a page, and at 120 lines the preview had five pages where
|
|
8
|
+
* the PDF had six. And a `position: fixed` footer stood in the page's margin, where Chromium puts it
|
|
9
|
+
* over the last row of a full page.
|
|
10
|
+
*
|
|
11
|
+
* Measured on 2026-10-18 against the PDFs of the blog post `page-breaks-in-tables` (21 tables, Paged.js
|
|
12
|
+
* 0.4.3): Paged.js alone laid out 2 of them as the PDF does, with this runtime all 21. The render-worker's
|
|
13
|
+
* `paged-preview.spec.ts` holds the preview to those PDFs.
|
|
14
|
+
*
|
|
15
|
+
* `pagedDocument` adds it after Paged.js's script; its `PagedConfig.before` calls
|
|
16
|
+
* `formfeedMoveTableFeet` while the document is still the one the template wrote. Bundled by
|
|
17
|
+
* `engine:frames`; keep it self-contained.
|
|
18
|
+
*/
|
|
19
|
+
/** The part of Paged.js this runtime uses (`window.Paged`, a UMD global of the polyfill). */
|
|
20
|
+
interface PagedChunker {
|
|
21
|
+
source: ParentNode;
|
|
22
|
+
}
|
|
23
|
+
interface PagedGlobal {
|
|
24
|
+
Handler: new (chunker: PagedChunker, polisher: unknown, caller: unknown) => {
|
|
25
|
+
chunker: PagedChunker;
|
|
26
|
+
};
|
|
27
|
+
registerHandlers: (...handlers: unknown[]) => void;
|
|
28
|
+
}
|
|
29
|
+
type PagedWindow = Window & {
|
|
30
|
+
Paged?: PagedGlobal;
|
|
31
|
+
formfeedMoveTableFeet?: () => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* HTML lets a `tfoot` stand before the `tbody`. Chromium draws a footer group at the table's foot
|
|
35
|
+
* wherever it stands; Paged.js lays it out where it stands and then laid the first page's rows out
|
|
36
|
+
* twice. Moved to the end of its table it draws the same, before Paged.js takes the document. A
|
|
37
|
+
* `tfoot` the template made a row group stays where it is, because that one prints where it stands.
|
|
38
|
+
*/
|
|
39
|
+
export declare function moveTableFeet(doc: Document, win: Window): void;
|
|
40
|
+
/**
|
|
41
|
+
* Paged.js's `renderNode` hook: the first node placed on a page in a table that goes on from the page
|
|
42
|
+
* before gets the table's head in front of it, as Chromium prints it. The row it is in is at the top
|
|
43
|
+
* of its page then, so a row taller than what is left may break there (Chromium's view), instead of
|
|
44
|
+
* moving on to the next page and the next with `tr { break-inside: avoid }`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function repeatHead(clone: Node, node: Node, win: Window): void;
|
|
47
|
+
/**
|
|
48
|
+
* Paged.js's `onOverflow` hook, where the page's last content is settled: a table row that does not
|
|
49
|
+
* fit moves on, also one a wrapper with `overflow` clips at the page's foot, which Paged.js would
|
|
50
|
+
* keep; a table with a footer group keeps room for its copy (`data-ff-foot`, filled in by
|
|
51
|
+
* `repeatFoot`); and a head with no row under it at the foot of a page moves on with its table, and a
|
|
52
|
+
* heading kept to that by `break-after: avoid` with both. Returns the range, changed or not.
|
|
53
|
+
*/
|
|
54
|
+
export declare function settleTable(overflow: Range, rendered: Node, bottom: number, source: ParentNode, win: Window): Range | undefined;
|
|
55
|
+
/** Paged.js's `afterOverflowRemoved` hook: the footer group's copy at the foot of the page `settleTable` kept room on. */
|
|
56
|
+
export declare function repeatFoot(rendered: ParentNode, source: ParentNode): void;
|
|
57
|
+
/**
|
|
58
|
+
* Paged.js's `afterPageLayout` hook. Paged.js puts a copy of every `position: fixed` element on every
|
|
59
|
+
* page, as Chromium prints it, but measures it from the whole sheet: a footer with `bottom: 0` stood in
|
|
60
|
+
* the bottom margin. Chromium measures it from the page area inside the margins, where it covers the
|
|
61
|
+
* last row of a full page (the post's `fixed-footer` case). The copies move into a layer laid over
|
|
62
|
+
* that area; clicks go through the layer to the page, and still reach the copies.
|
|
63
|
+
*/
|
|
64
|
+
export declare function anchorFixed(pageElement: Element): void;
|
|
65
|
+
export declare function installPagedPrint(win: PagedWindow): void;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Chromium's print does that Paged.js does not, for the paged preview (the editor's and
|
|
3
|
+
* `formfeed dev`'s). Paged.js lays a page out in CSS columns, treats what reaches the second column
|
|
4
|
+
* as the next page's, and rebuilds a table that goes on to the next page from its body alone.
|
|
5
|
+
* Chromium repeats a table's head at the top of every page the table reaches and its footer group at
|
|
6
|
+
* the foot of every page it goes on from, and keeps room for both. Without that, page 2 of an invoice
|
|
7
|
+
* had no header row, its rows drifted by one a page, and at 120 lines the preview had five pages where
|
|
8
|
+
* the PDF had six. And a `position: fixed` footer stood in the page's margin, where Chromium puts it
|
|
9
|
+
* over the last row of a full page.
|
|
10
|
+
*
|
|
11
|
+
* Measured on 2026-10-18 against the PDFs of the blog post `page-breaks-in-tables` (21 tables, Paged.js
|
|
12
|
+
* 0.4.3): Paged.js alone laid out 2 of them as the PDF does, with this runtime all 21. The render-worker's
|
|
13
|
+
* `paged-preview.spec.ts` holds the preview to those PDFs.
|
|
14
|
+
*
|
|
15
|
+
* `pagedDocument` adds it after Paged.js's script; its `PagedConfig.before` calls
|
|
16
|
+
* `formfeedMoveTableFeet` while the document is still the one the template wrote. Bundled by
|
|
17
|
+
* `engine:frames`; keep it self-contained.
|
|
18
|
+
*/
|
|
19
|
+
/** The part of Paged.js this runtime uses (`window.Paged`, a UMD global of the polyfill). */
|
|
20
|
+
interface PagedChunker {
|
|
21
|
+
source: ParentNode;
|
|
22
|
+
}
|
|
23
|
+
interface PagedGlobal {
|
|
24
|
+
Handler: new (chunker: PagedChunker, polisher: unknown, caller: unknown) => {
|
|
25
|
+
chunker: PagedChunker;
|
|
26
|
+
};
|
|
27
|
+
registerHandlers: (...handlers: unknown[]) => void;
|
|
28
|
+
}
|
|
29
|
+
type PagedWindow = Window & {
|
|
30
|
+
Paged?: PagedGlobal;
|
|
31
|
+
formfeedMoveTableFeet?: () => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* HTML lets a `tfoot` stand before the `tbody`. Chromium draws a footer group at the table's foot
|
|
35
|
+
* wherever it stands; Paged.js lays it out where it stands and then laid the first page's rows out
|
|
36
|
+
* twice. Moved to the end of its table it draws the same, before Paged.js takes the document. A
|
|
37
|
+
* `tfoot` the template made a row group stays where it is, because that one prints where it stands.
|
|
38
|
+
*/
|
|
39
|
+
export declare function moveTableFeet(doc: Document, win: Window): void;
|
|
40
|
+
/**
|
|
41
|
+
* Paged.js's `renderNode` hook: the first node placed on a page in a table that goes on from the page
|
|
42
|
+
* before gets the table's head in front of it, as Chromium prints it. The row it is in is at the top
|
|
43
|
+
* of its page then, so a row taller than what is left may break there (Chromium's view), instead of
|
|
44
|
+
* moving on to the next page and the next with `tr { break-inside: avoid }`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function repeatHead(clone: Node, node: Node, win: Window): void;
|
|
47
|
+
/**
|
|
48
|
+
* Paged.js's `onOverflow` hook, where the page's last content is settled: a table row that does not
|
|
49
|
+
* fit moves on, also one a wrapper with `overflow` clips at the page's foot, which Paged.js would
|
|
50
|
+
* keep; a table with a footer group keeps room for its copy (`data-ff-foot`, filled in by
|
|
51
|
+
* `repeatFoot`); and a head with no row under it at the foot of a page moves on with its table, and a
|
|
52
|
+
* heading kept to that by `break-after: avoid` with both. Returns the range, changed or not.
|
|
53
|
+
*/
|
|
54
|
+
export declare function settleTable(overflow: Range, rendered: Node, bottom: number, source: ParentNode, win: Window): Range | undefined;
|
|
55
|
+
/** Paged.js's `afterOverflowRemoved` hook: the footer group's copy at the foot of the page `settleTable` kept room on. */
|
|
56
|
+
export declare function repeatFoot(rendered: ParentNode, source: ParentNode): void;
|
|
57
|
+
/**
|
|
58
|
+
* Paged.js's `afterPageLayout` hook. Paged.js puts a copy of every `position: fixed` element on every
|
|
59
|
+
* page, as Chromium prints it, but measures it from the whole sheet: a footer with `bottom: 0` stood in
|
|
60
|
+
* the bottom margin. Chromium measures it from the page area inside the margins, where it covers the
|
|
61
|
+
* last row of a full page (the post's `fixed-footer` case). The copies move into a layer laid over
|
|
62
|
+
* that area; clicks go through the layer to the page, and still reach the copies.
|
|
63
|
+
*/
|
|
64
|
+
export declare function anchorFixed(pageElement: Element): void;
|
|
65
|
+
export declare function installPagedPrint(win: PagedWindow): void;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/index.d.cts
CHANGED
|
@@ -30,8 +30,8 @@ export type { ApplyResult, ChipKind, EditableRegion, EditItem, RegionChip, Regio
|
|
|
30
30
|
export { resolveTranslation, translationTarget } from './lib/translation.cjs';
|
|
31
31
|
export { DESIGN_LIMITS, DESIGN_VERSION, dataPathPattern, defaultLayer, designBytes, designOutputHash, designStarters, emitDesign, emptyDesign, genericFamily, googleFont, googleFonts, googleFontsUrl, imageIsEmpty, layerIdPattern, nearestWeight, nextLayerId, parseDesign, } from './lib/design/index.cjs';
|
|
32
32
|
export type { BarcodeLayer, BarcodeSymbology, Binding, CanvasSize, DesignDocument, DesignLayer, DesignStarter, EmittedDesign, FontChoice, GoogleFont, ImageLayer, ImageSource, LayerBase, LayerType, Paint, ParsedDesign, QrLayer, Shadow, ShapeLayer, Stroke, TextFormat, TextItem, TextLayer, TextStyle, } from './lib/design/index.cjs';
|
|
33
|
-
export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.cjs';
|
|
34
|
-
export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.cjs';
|
|
33
|
+
export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.cjs';
|
|
34
|
+
export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceTerm, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.cjs';
|
|
35
35
|
export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.cjs';
|
|
36
36
|
export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.cjs';
|
|
37
37
|
export { staticAudit, staticAuditDiagnostics, } from './lib/accessibility/static.cjs';
|
package/types/index.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export type { ApplyResult, ChipKind, EditableRegion, EditItem, RegionChip, Regio
|
|
|
30
30
|
export { resolveTranslation, translationTarget } from './lib/translation.js';
|
|
31
31
|
export { DESIGN_LIMITS, DESIGN_VERSION, dataPathPattern, defaultLayer, designBytes, designOutputHash, designStarters, emitDesign, emptyDesign, genericFamily, googleFont, googleFonts, googleFontsUrl, imageIsEmpty, layerIdPattern, nearestWeight, nextLayerId, parseDesign, } from './lib/design/index.js';
|
|
32
32
|
export type { BarcodeLayer, BarcodeSymbology, Binding, CanvasSize, DesignDocument, DesignLayer, DesignStarter, EmittedDesign, FontChoice, GoogleFont, ImageLayer, ImageSource, LayerBase, LayerType, Paint, ParsedDesign, QrLayer, Shadow, ShapeLayer, Stroke, TextFormat, TextItem, TextLayer, TextStyle, } from './lib/design/index.js';
|
|
33
|
-
export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.js';
|
|
34
|
-
export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.js';
|
|
33
|
+
export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.js';
|
|
34
|
+
export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceTerm, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.js';
|
|
35
35
|
export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.js';
|
|
36
36
|
export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.js';
|
|
37
37
|
export { staticAudit, staticAuditDiagnostics, } from './lib/accessibility/static.js';
|
package/types/lib/assemble.d.cts
CHANGED
|
@@ -35,7 +35,13 @@ export interface TemplateSettings {
|
|
|
35
35
|
preferCssPageSize?: boolean;
|
|
36
36
|
pageRanges?: string;
|
|
37
37
|
waitFor?: {
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* `true` waits until the network has been idle for half a second, `false` only for the `load`
|
|
40
|
+
* event. `'auto'`, the default, waits for `load` and then for the requests still in flight, and as
|
|
41
|
+
* `true` does for a URL source or a document with code of its own (the render-worker's
|
|
42
|
+
* `render/load-wait.ts`).
|
|
43
|
+
*/
|
|
44
|
+
networkIdle?: boolean | 'auto';
|
|
39
45
|
selector?: string | null;
|
|
40
46
|
timeoutMs?: number;
|
|
41
47
|
delayMs?: number;
|
package/types/lib/assemble.d.ts
CHANGED
|
@@ -35,7 +35,13 @@ export interface TemplateSettings {
|
|
|
35
35
|
preferCssPageSize?: boolean;
|
|
36
36
|
pageRanges?: string;
|
|
37
37
|
waitFor?: {
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* `true` waits until the network has been idle for half a second, `false` only for the `load`
|
|
40
|
+
* event. `'auto'`, the default, waits for `load` and then for the requests still in flight, and as
|
|
41
|
+
* `true` does for a URL source or a document with code of its own (the render-worker's
|
|
42
|
+
* `render/load-wait.ts`).
|
|
43
|
+
*/
|
|
44
|
+
networkIdle?: boolean | 'auto';
|
|
39
45
|
selector?: string | null;
|
|
40
46
|
timeoutMs?: number;
|
|
41
47
|
delayMs?: number;
|
|
@@ -25,7 +25,7 @@ export interface InvoiceProblem {
|
|
|
25
25
|
/** The values `message` was built from. */
|
|
26
26
|
args: Record<string, string | number>;
|
|
27
27
|
}
|
|
28
|
-
export type InvoiceProblemCode = 'missing' | 'invalid' | 'not_a_number' | 'decimals' | 'negative' | 'code_list' | 'date' | 'date_order' | 'scheme_required' | 'vat_id_prefix' | 'iban' | 'sum' | 'breakdown_missing' | 'breakdown_duplicate' | 'rate_required' | 'rate_positive' | 'rate_zero' | 'rate_forbidden' | 'amount_zero' | 'exemption_reason_required' | 'exemption_reason_forbidden' | 'seller_tax_id_required' | 'buyer_tax_id_required' | 'vat_id_forbidden' | 'only_category' | 'delivery_required' | 'account_required' | 'means_code_required' | 'due_or_terms_required' | 'seller_identifier_required' | 'siren_mismatch' | 'fr_seller_siren' | 'fr_buyer_siren' | 'fr_operation' | 'fr_vat_on_debits' | 'profile';
|
|
28
|
+
export type InvoiceProblemCode = 'missing' | 'invalid' | 'not_a_number' | 'decimals' | 'negative' | 'code_list' | 'date' | 'date_order' | 'scheme_required' | 'vat_id_prefix' | 'iban' | 'sum' | 'breakdown_missing' | 'breakdown_duplicate' | 'rate_required' | 'rate_positive' | 'rate_zero' | 'rate_forbidden' | 'amount_zero' | 'exemption_reason_required' | 'exemption_reason_forbidden' | 'seller_tax_id_required' | 'buyer_tax_id_required' | 'vat_id_forbidden' | 'only_category' | 'delivery_required' | 'account_required' | 'means_code_required' | 'due_or_terms_required' | 'seller_identifier_required' | 'siren_mismatch' | 'fr_seller_siren' | 'fr_buyer_siren' | 'fr_operation' | 'fr_vat_on_debits' | 'fr_note' | 'fr_electronic_address' | 'fr_profile' | 'profile';
|
|
29
29
|
export interface Identifier {
|
|
30
30
|
value: string;
|
|
31
31
|
scheme?: string;
|
|
@@ -25,7 +25,7 @@ export interface InvoiceProblem {
|
|
|
25
25
|
/** The values `message` was built from. */
|
|
26
26
|
args: Record<string, string | number>;
|
|
27
27
|
}
|
|
28
|
-
export type InvoiceProblemCode = 'missing' | 'invalid' | 'not_a_number' | 'decimals' | 'negative' | 'code_list' | 'date' | 'date_order' | 'scheme_required' | 'vat_id_prefix' | 'iban' | 'sum' | 'breakdown_missing' | 'breakdown_duplicate' | 'rate_required' | 'rate_positive' | 'rate_zero' | 'rate_forbidden' | 'amount_zero' | 'exemption_reason_required' | 'exemption_reason_forbidden' | 'seller_tax_id_required' | 'buyer_tax_id_required' | 'vat_id_forbidden' | 'only_category' | 'delivery_required' | 'account_required' | 'means_code_required' | 'due_or_terms_required' | 'seller_identifier_required' | 'siren_mismatch' | 'fr_seller_siren' | 'fr_buyer_siren' | 'fr_operation' | 'fr_vat_on_debits' | 'profile';
|
|
28
|
+
export type InvoiceProblemCode = 'missing' | 'invalid' | 'not_a_number' | 'decimals' | 'negative' | 'code_list' | 'date' | 'date_order' | 'scheme_required' | 'vat_id_prefix' | 'iban' | 'sum' | 'breakdown_missing' | 'breakdown_duplicate' | 'rate_required' | 'rate_positive' | 'rate_zero' | 'rate_forbidden' | 'amount_zero' | 'exemption_reason_required' | 'exemption_reason_forbidden' | 'seller_tax_id_required' | 'buyer_tax_id_required' | 'vat_id_forbidden' | 'only_category' | 'delivery_required' | 'account_required' | 'means_code_required' | 'due_or_terms_required' | 'seller_identifier_required' | 'siren_mismatch' | 'fr_seller_siren' | 'fr_buyer_siren' | 'fr_operation' | 'fr_vat_on_debits' | 'fr_note' | 'fr_electronic_address' | 'fr_profile' | 'profile';
|
|
29
29
|
export interface Identifier {
|
|
30
30
|
value: string;
|
|
31
31
|
scheme?: string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which business terms of EN 16931 the `_invoice` block carries into the e-invoice, term by term
|
|
3
|
+
* (spec 17 §4.3): the fields of the block each one is written from, or none where the block does
|
|
4
|
+
* not carry it. The documentation's coverage page is generated from this list
|
|
5
|
+
* (`apps/docs/scripts/gen-einvoice.ts`), and `coverage.spec.ts` holds it to the schema both ways, so
|
|
6
|
+
* a field added to the block without its term fails there, and to what the profile `basic` leaves out.
|
|
7
|
+
*
|
|
8
|
+
* The 164 terms and their names are those of the English edition of EN 16931-1 (2017): BT-1 to BT-165,
|
|
9
|
+
* the standard has no BT-4. The names were taken from KoSIT's XRechnung semantic model
|
|
10
|
+
* (`itplr-kosit/xrechnung-visualization`, `src/xsd/xrechnung-semantic-model.xsd`, Apache-2.0), read on
|
|
11
|
+
* 9 October 2026, without the terms XRechnung adds of its own.
|
|
12
|
+
*/
|
|
13
|
+
/** A business term of EN 16931 and what the `_invoice` block writes it from. */
|
|
14
|
+
export interface EinvoiceTerm {
|
|
15
|
+
/** `BT-1` to `BT-165`. */
|
|
16
|
+
term: string;
|
|
17
|
+
/** Its name in the English edition of the standard. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Where the block takes it from, dotted, `[]` for every item of a list; empty where it does not. */
|
|
20
|
+
fields: readonly string[];
|
|
21
|
+
/** Written from an e-invoice option rather than a field of the block. */
|
|
22
|
+
option?: 'profile';
|
|
23
|
+
/** Written in the profile `en16931` only: `basic` leaves it out. */
|
|
24
|
+
en16931Only?: true;
|
|
25
|
+
}
|
|
26
|
+
export declare const EN16931_TERMS: readonly EinvoiceTerm[];
|
|
27
|
+
/** Whether an e-invoice from the block can carry the term. */
|
|
28
|
+
export declare const carriesTerm: (term: EinvoiceTerm) => boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which business terms of EN 16931 the `_invoice` block carries into the e-invoice, term by term
|
|
3
|
+
* (spec 17 §4.3): the fields of the block each one is written from, or none where the block does
|
|
4
|
+
* not carry it. The documentation's coverage page is generated from this list
|
|
5
|
+
* (`apps/docs/scripts/gen-einvoice.ts`), and `coverage.spec.ts` holds it to the schema both ways, so
|
|
6
|
+
* a field added to the block without its term fails there, and to what the profile `basic` leaves out.
|
|
7
|
+
*
|
|
8
|
+
* The 164 terms and their names are those of the English edition of EN 16931-1 (2017): BT-1 to BT-165,
|
|
9
|
+
* the standard has no BT-4. The names were taken from KoSIT's XRechnung semantic model
|
|
10
|
+
* (`itplr-kosit/xrechnung-visualization`, `src/xsd/xrechnung-semantic-model.xsd`, Apache-2.0), read on
|
|
11
|
+
* 9 October 2026, without the terms XRechnung adds of its own.
|
|
12
|
+
*/
|
|
13
|
+
/** A business term of EN 16931 and what the `_invoice` block writes it from. */
|
|
14
|
+
export interface EinvoiceTerm {
|
|
15
|
+
/** `BT-1` to `BT-165`. */
|
|
16
|
+
term: string;
|
|
17
|
+
/** Its name in the English edition of the standard. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Where the block takes it from, dotted, `[]` for every item of a list; empty where it does not. */
|
|
20
|
+
fields: readonly string[];
|
|
21
|
+
/** Written from an e-invoice option rather than a field of the block. */
|
|
22
|
+
option?: 'profile';
|
|
23
|
+
/** Written in the profile `en16931` only: `basic` leaves it out. */
|
|
24
|
+
en16931Only?: true;
|
|
25
|
+
}
|
|
26
|
+
export declare const EN16931_TERMS: readonly EinvoiceTerm[];
|
|
27
|
+
/** Whether an e-invoice from the block can carry the term. */
|
|
28
|
+
export declare const carriesTerm: (term: EinvoiceTerm) => boolean;
|
|
@@ -8,6 +8,7 @@ import { type Invoice, type InvoiceProblem } from './check.cjs';
|
|
|
8
8
|
import type { EinvoiceFlavour, EinvoiceProfile } from './schema.cjs';
|
|
9
9
|
export { checkInvoice, type CheckOptions, type Identifier, type Invoice, type InvoiceAddress, type InvoiceAllowance, type InvoiceBreakdown, type InvoiceCheck, type InvoiceLine, type InvoiceParty, type InvoiceProblem, type InvoiceProblemCode, type InvoiceTax, } from './check.cjs';
|
|
10
10
|
export { CII_GUIDELINES, EINVOICE_XML_NAME, invoiceToCii } from './cii.cjs';
|
|
11
|
+
export { EN16931_TERMS, carriesTerm, type EinvoiceTerm } from './coverage.cjs';
|
|
11
12
|
export { CODE_LIST_RELEASE } from './codes.generated.cjs';
|
|
12
13
|
export { DISPLAY_TERMS, displayCheck, displayMissingText, shownAmounts, type DisplayCheck, type DisplayValue, } from './display.cjs';
|
|
13
14
|
export { EINVOICE_FLAVOURS, EINVOICE_PROFILES, VAT_CATEGORIES, defaultEinvoiceOptions, einvoiceOptionsSchema, invoiceSchema, resolveEinvoiceOptions, type EinvoiceFlavour, type EinvoiceOptions, type EinvoiceOptionsInput, type EinvoiceProfile, type InvoiceInput, type ResolvedEinvoice, type VatCategory, } from './schema.cjs';
|
|
@@ -8,6 +8,7 @@ import { type Invoice, type InvoiceProblem } from './check.js';
|
|
|
8
8
|
import type { EinvoiceFlavour, EinvoiceProfile } from './schema.js';
|
|
9
9
|
export { checkInvoice, type CheckOptions, type Identifier, type Invoice, type InvoiceAddress, type InvoiceAllowance, type InvoiceBreakdown, type InvoiceCheck, type InvoiceLine, type InvoiceParty, type InvoiceProblem, type InvoiceProblemCode, type InvoiceTax, } from './check.js';
|
|
10
10
|
export { CII_GUIDELINES, EINVOICE_XML_NAME, invoiceToCii } from './cii.js';
|
|
11
|
+
export { EN16931_TERMS, carriesTerm, type EinvoiceTerm } from './coverage.js';
|
|
11
12
|
export { CODE_LIST_RELEASE } from './codes.generated.js';
|
|
12
13
|
export { DISPLAY_TERMS, displayCheck, displayMissingText, shownAmounts, type DisplayCheck, type DisplayValue, } from './display.js';
|
|
13
14
|
export { EINVOICE_FLAVOURS, EINVOICE_PROFILES, VAT_CATEGORIES, defaultEinvoiceOptions, einvoiceOptionsSchema, invoiceSchema, resolveEinvoiceOptions, type EinvoiceFlavour, type EinvoiceOptions, type EinvoiceOptionsInput, type EinvoiceProfile, type InvoiceInput, type ResolvedEinvoice, type VatCategory, } from './schema.js';
|
|
@@ -24,6 +24,20 @@ export interface EinvoiceValidation {
|
|
|
24
24
|
messages: EinvoiceMessage[];
|
|
25
25
|
/** More findings than the render keeps. */
|
|
26
26
|
truncated?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The validator's own id for this report, which its log names too. Absent in reports from before
|
|
29
|
+
* 2026-10-09, like the three fields below.
|
|
30
|
+
*/
|
|
31
|
+
id?: string;
|
|
32
|
+
/** The versions of the validator's parts that judged the file: `mustang`, `verapdf`, `pdfbox`. */
|
|
33
|
+
versions?: Record<string, string>;
|
|
34
|
+
/** SHA-256 of the XML that was judged, which is the XML inside the PDF. */
|
|
35
|
+
xml_sha256?: string;
|
|
36
|
+
/**
|
|
37
|
+
* SHA-256 of the PDF that was judged: the delivered file when the render succeeded. `null` when the
|
|
38
|
+
* validator ended before there was a converted file.
|
|
39
|
+
*/
|
|
40
|
+
pdf_sha256?: string | null;
|
|
27
41
|
}
|
|
28
42
|
export interface EinvoiceDisplay {
|
|
29
43
|
/** The business terms looked for in the text of the PDF (`BT-1`, `BT-112`). */
|
|
@@ -24,6 +24,20 @@ export interface EinvoiceValidation {
|
|
|
24
24
|
messages: EinvoiceMessage[];
|
|
25
25
|
/** More findings than the render keeps. */
|
|
26
26
|
truncated?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The validator's own id for this report, which its log names too. Absent in reports from before
|
|
29
|
+
* 2026-10-09, like the three fields below.
|
|
30
|
+
*/
|
|
31
|
+
id?: string;
|
|
32
|
+
/** The versions of the validator's parts that judged the file: `mustang`, `verapdf`, `pdfbox`. */
|
|
33
|
+
versions?: Record<string, string>;
|
|
34
|
+
/** SHA-256 of the XML that was judged, which is the XML inside the PDF. */
|
|
35
|
+
xml_sha256?: string;
|
|
36
|
+
/**
|
|
37
|
+
* SHA-256 of the PDF that was judged: the delivered file when the render succeeded. `null` when the
|
|
38
|
+
* validator ended before there was a converted file.
|
|
39
|
+
*/
|
|
40
|
+
pdf_sha256?: string | null;
|
|
27
41
|
}
|
|
28
42
|
export interface EinvoiceDisplay {
|
|
29
43
|
/** The business terms looked for in the text of the PDF (`BT-1`, `BT-112`). */
|
|
@@ -6,3 +6,5 @@ export declare const fitRuntime = "\"use strict\";(()=>{function a(t,e,n){if(e==
|
|
|
6
6
|
export declare const stageRuntime = "\"use strict\";(()=>{var W=`\nhtml.ff-edit-mode [data-ff-edit] { cursor: text; }\nhtml.ff-edit-mode [data-ff-edit]:hover { outline: 1px dashed rgba(37,99,235,.85); outline-offset: 2px; }\nhtml.ff-edit-mode [data-ff-edit=\"t\"]:hover { outline-color: rgba(147,51,234,.9); }\n.ff-editing { outline: 2px solid #2563eb !important; outline-offset: 2px; cursor: text; }\n.ff-editing .ff-chip { background: rgba(37,99,235,.14) !important; box-shadow: inset 0 0 0 1px rgba(37,99,235,.45) !important; border-radius: 3px !important; padding: 0 1px !important; cursor: default; }\n.ff-edit-badge { position: absolute; z-index: 2147483647; font: 500 11px/1.4 system-ui, sans-serif !important; color: #fff !important; background: #2563eb !important; padding: 1px 6px !important; border-radius: 4px !important; pointer-events: none; white-space: nowrap; }\n`;function H(a,l={}){let f=l.clicks!==!1,p=l.live===!0,n=a.document,o=null,d=null,u=e=>{try{a.parent.postMessage(e,\"*\")}catch{}},m=f?n.querySelector('meta[name=\"formfeed:document\"]')?.getAttribute(\"content\")??null:null,s=!1;a.addEventListener(\"blur\",()=>{s=!0}),a.addEventListener(\"focus\",()=>{s=!1});let g=n.createElement(\"style\");g.setAttribute(\"data-formfeed\",\"edit\"),g.setAttribute(\"data-pagedjs-ignore\",\"\"),g.textContent=W,(n.head??n.documentElement).appendChild(g),f&&n.documentElement.classList.add(\"ff-edit-mode\");let x=e=>(e&&typeof e.closest==\"function\"?e:null)?.closest(\"[data-ff-edit]\")??null;n.addEventListener(\"click\",e=>{if(!f)return;if(o&&!o.done&&o.element.contains(e.target)){e.stopImmediatePropagation();return}let t=x(e.target);t&&(e.preventDefault(),e.stopImmediatePropagation(),v(t,{x:e.clientX,y:e.clientY}))},!0);function v(e,t){o&&!o.done&&L();let r=e.getAttribute(\"data-ff-src\")??\"\",i=e.getBoundingClientRect(),b=Array.from(n.querySelectorAll(`[data-ff-src=\"${r.replace(/\"/g,\"\")}\"]`));d={src:r,element:e,point:t},u({type:\"formfeed:edit-request\",src:r,doc:m,edit:e.getAttribute(\"data-ff-edit\"),text:e.textContent??\"\",elements:e.childElementCount,count:b.length,index:Math.max(0,b.indexOf(e)),split:e.hasAttribute(\"data-split-from\")||e.hasAttribute(\"data-split-to\"),rect:{left:i.left,top:i.top,width:i.width,height:i.height}})}n.addEventListener(\"keydown\",e=>{if(!f||o&&!o.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t===\"z\"||t===\"y\")&&(e.preventDefault(),u({type:t===\"y\"||e.shiftKey?\"formfeed:redo\":\"formfeed:undo\"}))}),a.addEventListener(\"message\",e=>{if(e.source!==a.parent)return;let t=e.data;!t||typeof t.type!=\"string\"||(t.type===\"formfeed:edit-begin\"?B(t):t.type===\"formfeed:edit-refuse\"||t.type===\"formfeed:edit-end\"?(d=null,o&&!o.done&&S(!1)):t.type===\"formfeed:edit-open\"&&E(t))});function E(e){if(!f||typeof e.src!=\"string\"||o&&!o.done)return;let t=Array.from(n.querySelectorAll(`[data-ff-src=\"${e.src.replace(/\"/g,\"\")}\"][data-ff-edit]`)),r=Number.isInteger(e.index)?Number(e.index):0,i=t[r]??t[0];i&&v(i,null)}if(f){let e=()=>u({type:\"formfeed:edit-ready\",doc:m}),t=a;t.PagedConfig?t.formfeedEditReady=e:n.readyState===\"loading\"?n.addEventListener(\"DOMContentLoaded\",e):e()}function B(e){o&&!o.done&&S(!1);let t=e.layer?n.querySelector(`[data-ff-layer=\"${String(e.layer).replace(/\"/g,\"\")}\"] > .ff-text`):d&&d.src===e.src?d.element:n.querySelector(`[data-ff-src=\"${String(e.src).replace(/\"/g,\"\")}\"]`),r=e.at,i=e.layer?r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?{x:Number(r.x),y:Number(r.y)}:null:d&&d.src===e.src?d.point:null;d=null;let b=s&&!n.hasFocus();if(!t||!Array.isArray(e.items)||b){u({type:\"formfeed:edit-cancel\",token:String(e.token)});return}let y=Array.from(t.childNodes),k=n.createDocumentFragment();for(let c of e.items)if(c.kind===\"text\")k.appendChild(n.createTextNode(String(c.text)));else if(c.kind===\"break\")k.appendChild(n.createElement(\"br\"));else if(c.kind===\"chip\"){let h=n.createElement(\"span\");h.className=\"ff-chip\",h.setAttribute(\"data-ff-chip\",String(c.index)),h.setAttribute(\"contenteditable\",\"false\"),c.title&&(h.title=String(c.title)),h.textContent=String(c.text),k.appendChild(h)}for(let c of y)t.removeChild(c);t.appendChild(k),t.contentEditable=\"true\",t.classList.add(\"ff-editing\"),t.setAttribute(\"role\",\"textbox\"),e.label&&t.setAttribute(\"aria-label\",String(e.label)),t.spellcheck=!0,o={token:String(e.token),element:t,saved:y,allowBreaks:e.allowBreaks===!0,badge:e.note?I(t,String(e.note)):null,done:!1},t.addEventListener(\"keydown\",T),t.addEventListener(\"beforeinput\",N),t.addEventListener(\"paste\",w),t.addEventListener(\"drop\",R),t.addEventListener(\"focusout\",F),p&&t.addEventListener(\"input\",C),t.focus(),e.select===\"all\"?q(t):K(t,i),u({type:\"formfeed:edit-started\",token:o.token}),typeof e.insert==\"string\"&&e.insert&&A(e.insert.replace(/\\r\\n?|\\n/g,\" \"))}function A(e){if(typeof n.execCommand==\"function\"&&n.execCommand(\"insertText\",!1,e))return;let t=a.getSelection(),r=t&&t.rangeCount?t.getRangeAt(0):null;r&&(r.deleteContents(),r.insertNode(n.createTextNode(e)),r.collapse(!1),p&&C())}function C(){o&&!o.done&&u({type:\"formfeed:edit-input\",token:o.token,items:D(o.element)})}function I(e,t){let r=n.createElement(\"div\");r.className=\"ff-edit-badge\",r.textContent=t;let i=e.getBoundingClientRect();return r.style.left=`${i.left+a.scrollX}px`,r.style.top=`${Math.max(0,i.top+a.scrollY-22)}px`,n.body.appendChild(r),r}function q(e){let t=a.getSelection();if(!t)return;let r=n.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}function K(e,t){let r=a.getSelection();if(!r)return;let i=null,b=n;if(t){if(b.caretRangeFromPoint)i=b.caretRangeFromPoint(t.x,t.y);else if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(t.x,t.y);y&&(i=n.createRange(),i.setStart(y.offsetNode,y.offset))}}if(!i||!e.contains(i.startContainer))i=n.createRange(),i.selectNodeContents(e),i.collapse(!1);else if(t){let y=i.startContainer,c=(y.nodeType===1?y:y.parentElement)?.closest(\"[data-ff-chip]\")??null;if(c&&c!==e&&e.contains(c)){let h=c.getBoundingClientRect();i=n.createRange(),t.x<h.left+h.width/2?i.setStartBefore(c):i.setStartAfter(c),i.collapse(!0)}}r.removeAllRanges(),r.addRange(i)}function T(e){let t=e.key;t===\"Escape\"?(e.preventDefault(),S(!0)):t===\"Enter\"&&!e.shiftKey?(e.preventDefault(),L()):t===\"Enter\"?(e.preventDefault(),o?.allowBreaks&&$()):t===\"Tab\"?(e.preventDefault(),L()):(e.ctrlKey||e.metaKey)&&[\"b\",\"i\",\"u\"].includes(t.toLowerCase())&&(e.preventDefault(),p&&o&&!e.altKey&&u({type:\"formfeed:edit-style\",token:o.token,key:t.toLowerCase()}))}function N(e){let t=e.inputType??\"\";(t.startsWith(\"format\")||t===\"insertFromDrop\"||t===\"insertParagraph\"||t===\"insertLineBreak\")&&e.preventDefault()}function w(e){e.preventDefault(),A((e.clipboardData?.getData(\"text/plain\")??\"\").replace(/\\r\\n?|\\n/g,\" \"))}function R(e){e.preventDefault()}function F(){a.setTimeout(()=>{o&&!o.done&&(!n.hasFocus()||!o.element.contains(n.activeElement))&&L()},0)}function $(){let e=a.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let r=n.createElement(\"br\");t.insertNode(r),r.nextSibling||r.parentNode?.appendChild(n.createElement(\"br\"));let i=n.createRange();i.setStartAfter(r),i.collapse(!0),e.removeAllRanges(),e.addRange(i)}function M(e){e.done=!0;let t=e.element;t.removeEventListener(\"keydown\",T),t.removeEventListener(\"beforeinput\",N),t.removeEventListener(\"paste\",w),t.removeEventListener(\"drop\",R),t.removeEventListener(\"focusout\",F),t.removeEventListener(\"input\",C),t.removeAttribute(\"contenteditable\"),t.removeAttribute(\"role\"),t.removeAttribute(\"aria-label\"),t.classList.remove(\"ff-editing\"),e.badge?.remove(),o===e&&(o=null)}function L(){let e=o;if(!e||e.done)return;let t=D(e.element);M(e),u({type:\"formfeed:edit-commit\",token:e.token,items:t})}function S(e){let t=o;if(!t||t.done)return;let r=t.element;for(;r.firstChild;)r.removeChild(r.firstChild);for(let i of t.saved)r.appendChild(i);M(t),e&&u({type:\"formfeed:edit-cancel\",token:t.token})}}function D(a){let l=[],f=n=>{let o=l[l.length-1];o?.kind===\"text\"?o.text+=n:n&&l.push({kind:\"text\",text:n})},p=n=>{for(let o of Array.from(n.childNodes))if(o.nodeType===3)f(o.data);else if(o.nodeType===1){let d=o,u=d.getAttribute(\"data-ff-chip\");u!==null?l.push({kind:\"chip\",index:Number(u)}):d.tagName===\"BR\"?l.push({kind:\"break\"}):((d.tagName===\"DIV\"||d.tagName===\"P\")&&l.length&&l.push({kind:\"break\"}),p(d))}};for(p(a);l[l.length-1]?.kind===\"break\";)l.pop();return l}function O(a,l){return Array.from(a.querySelectorAll(\"[data-ff-layer]\")).map(f=>{let p=f.querySelector(\":scope > .ff-text\"),n=!1;if(p&&f.style.height!==\"auto\"){let o=l.getComputedStyle(f),d=f.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);n=o.overflow===\"hidden\"&&(p.scrollHeight>d+1||p.scrollWidth>p.clientWidth+1)}return{id:f.getAttribute(\"data-ff-layer\")??\"\",width:f.offsetWidth,height:f.offsetHeight,overflow:n}})}function P(a){let l=a.document,f=m=>{try{a.parent.postMessage(m,\"*\")}catch{}},p=m=>typeof m==\"string\"?l.querySelector(`[data-ff-layer=\"${m.replace(/\"/g,\"\")}\"]`):null,n=()=>{for(let m of Array.from(l.querySelectorAll(\"[data-ff-layer]\")))for(let s of[\"left\",\"top\",\"width\",\"height\",\"transform\"])m.style.removeProperty(s)},o=()=>{a.formfeedFit?.(),f({type:\"formfeed:ready\",layers:O(l,a)})};a.addEventListener(\"message\",m=>{if(m.source!==a.parent)return;let s=m.data;if(!(!s||typeof s.type!=\"string\")){if(s.type===\"formfeed:layer-style\"){let g=p(s.id);if(!g)return;let x=(v,E)=>{typeof E==\"number\"&&Number.isFinite(E)&&g.style.setProperty(v,`${E}px`)};x(\"left\",s.left),x(\"top\",s.top),x(\"width\",s.width),x(\"height\",s.height),typeof s.rotation==\"number\"&&Number.isFinite(s.rotation)&&g.style.setProperty(\"transform\",s.rotation?`rotate(${s.rotation}deg)`:\"none\")}else if(s.type===\"formfeed:layer-style-clear\")n();else if(s.type===\"formfeed:css\"&&typeof s.css==\"string\"){let g=l.querySelector('style[data-formfeed=\"template\"]');g&&(g.textContent=s.css),n(),o()}}}),H(a,{clicks:!1,live:!0});let d=l.fonts,u=()=>d?void d.ready.then(o):o();l.readyState===\"complete\"?u():a.addEventListener(\"load\",u)}P(window);})();";
|
|
7
7
|
/** Bundled from src/frame/audit.entry.ts. */
|
|
8
8
|
export declare const auditRuntime = "\"use strict\";(()=>{var I={\"document-title\":\"error\",\"image-alt\":\"error\",\"figure-name\":\"error\",\"heading-order\":\"error\",\"table-rows\":\"error\",\"table-cell-empty\":\"error\",\"masked-text\":\"error\",\"filtered-text\":\"warning\",\"document-language\":\"warning\",\"table-headers\":\"warning\",\"link-name\":\"warning\",\"generated-text\":\"warning\",\"fixed-text\":\"warning\",\"running-text\":\"warning\"};var S=120;var O=\".formfeed-chrome, .ff-running-header, .ff-running-footer\",_=\".pageNumber, .totalPages, .date, .title, .url, .ff-page-no, .ff-page-total\",k=new Set([\"script\",\"style\",\"template\",\"noscript\",\"head\"]),j=2e4,q=10,B=new Set([\"page\",\"pages\",\"of\",\"seite\",\"seiten\",\"von\",\"p\",\"s\"]),u=t=>(t??\"\").replace(/\\s+/g,\" \").trim(),D=t=>t.replace(/\\s+/g,\"\").toLowerCase(),$=t=>/[\\p{L}\\p{N}]/u.test(t),Y=/^data-(ref|id|split-(from|to|original)|(previous-|next-)?break-(before|after|inside)|(align-)?last-split-element|nth-of-type|counter-.+|page(-number)?|undisplayed|after-page|following|has-notes|children|item-num)$/;function X(t){let n=t.cloneNode(!1);n.removeAttribute(\"data-ff-src\"),n.removeAttribute(\"data-ff-edit\");let i=t.closest(\".pagedjs_page\")!==null;for(let s of Array.from(n.attributes))i&&Y.test(s.name)?n.removeAttribute(s.name):s.value.length>48&&n.setAttribute(s.name,`${s.value.slice(0,40)}\\u2026`);let o=n.outerHTML.replace(new RegExp(`</${t.tagName}>$`,\"i\"),\"\");return o.length>S?`${o.slice(0,S-1)}\\u2026`:o}function F(t,n={}){let i=t.document,o=i.body,s=[],d=new Set,a=n.findings!==!1,c=(e,r,l={})=>{if(!a)return;let m=r?.closest(\"[data-ff-src]\")?.getAttribute(\"data-ff-src\")??null,h=r?X(r):\"\",g=`${e}|${m??h}|${JSON.stringify(l)}`;d.has(g)||(d.add(g),s.push({code:e,severity:I[e],src:m,snippet:h,args:l}))},f=new WeakMap,A=e=>{let r=f.get(e);if(r!==void 0)return r;let l=t.getComputedStyle(e),m=l.display===\"none\"||l.visibility===\"hidden\"||l.visibility===\"collapse\"||e.parentElement!==null&&e.parentElement!==i.documentElement&&A(e.parentElement);return f.set(e,m),m},p=e=>e.closest('[aria-hidden=\"true\"]')!==null,E=e=>/^(presentation|none)$/.test(e.getAttribute(\"role\")??\"\"),H=e=>e.closest(O)!==null,y=e=>$(e.textContent??\"\"),x=e=>{let r=u(e.getAttribute(\"aria-label\"));return r||u((e.getAttribute(\"aria-labelledby\")??\"\").split(/\\s+/).filter(Boolean).map(l=>e.ownerDocument.getElementById(l)?.textContent??\"\").join(\" \"))},P=e=>x(e)||u(e.textContent)||u(Array.from(e.querySelectorAll(\"img[alt]\")).map(r=>r.getAttribute(\"alt\")).join(\" \"))||u(e.getAttribute(\"title\")),T=e=>{let r=e.getAttribute(\"href\")??\"\";return{href:r.startsWith(\"#\")?r:e.href??r,name:P(e)}};u(i.title)||c(\"document-title\",null),!u(i.documentElement.getAttribute(\"lang\"))&&!n.locale&&c(\"document-language\",null);let M=n.pages??(n.pageHeight&&n.pageHeight>0?Math.ceil(i.documentElement.scrollHeight/n.pageHeight):1),C=[],v=[],R={\"masked-text\":[],\"filtered-text\":[],\"fixed-text\":[]},w=(e,r)=>{R[e].some(l=>l.contains(r))||(R[e].push(r),c(e,r))},V=a&&ne(i),G=o?Array.from(o.querySelectorAll(\"*\")).slice(0,j):[];for(let e of G){let r=e.tagName.toLowerCase();if(k.has(r)||H(e)||A(e))continue;if(r===\"a\"&&e.hasAttribute(\"href\")){let g=T(e);C.push(g),!g.name&&!p(e)&&c(\"link-name\",e)}if(!a)continue;let l=t.getComputedStyle(e),m=l.getPropertyValue(\"mask-image\")||l.getPropertyValue(\"-webkit-mask-image\");if(m&&m!==\"none\"&&y(e)&&w(\"masked-text\",e),l.filter&&l.filter!==\"none\"&&y(e)&&w(\"filtered-text\",e),l.position===\"fixed\"&&M>1&&y(e)&&w(\"fixed-text\",e),V)for(let g of[\"::before\",\"::after\"]){let U=re(t.getComputedStyle(e,g).content);U&&c(\"generated-text\",e,{text:U})}if(p(e))continue;r===\"img\"&&!E(e)?e.hasAttribute(\"alt\")||x(e)||u(e.getAttribute(\"title\"))||c(\"image-alt\",e):(r===\"canvas\"||e.getAttribute(\"role\")===\"img\"&&r!==\"img\")&&(x(e)||u(e.getAttribute(\"title\"))||u(e.querySelector(\":scope > title\")?.textContent)||c(\"figure-name\",e,{tag:r}));let h=/^h[1-6]$/.test(r)?Number(r[1]):e.getAttribute(\"role\")===\"heading\"?Number(e.getAttribute(\"aria-level\"))||2:0;h&&v.push({element:e,level:h}),r===\"table\"&&!E(e)&&Q(e,c)}let b=0;for(let{element:e,level:r}of v)(b===0?r!==1:r>b+1)&&c(\"heading-order\",e,{level:r,previous:b}),b=r;let N=[],W=a&&o?D(J(o)):\"\",L=0;for(let e of[\"header\",\"footer\"])for(let r of z(i,e,n[e])){for(let l of Array.from(r.querySelectorAll(\"a[href]\")))N.push(T(l));if(a)for(let{text:l,element:m}of K(r)){if(L>=q||W.includes(D(l)))continue;let h=s.length;c(\"running-text\",m,{text:l.slice(0,80),part:e}),s.length>h&&L++}}return{findings:s,links:C,templateLinks:N}}function z(t,n,i){if(i!==void 0){if(!i.trim())return[];let o=new DOMParser().parseFromString(`<!doctype html><body>${i}</body>`,\"text/html\");return o.body?[o.body]:[]}return Array.from(t.querySelectorAll(`.ff-running-${n}, .formfeed-chrome[data-ff-chrome=\"${n}\"]`))}function J(t){let n=[],i=o=>{if(o.nodeType===3){n.push(o.nodeValue??\"\");return}if(o.nodeType!==1)return;let s=o;if(!(k.has(s.tagName.toLowerCase())||s.matches(O)))for(let d of Array.from(o.childNodes))i(d)};return i(t),n.join(\" \")}function K(t){let n=[],i=o=>{let s=o.tagName.toLowerCase();if(k.has(s)||o.matches(_))return;let d=Array.from(o.children).some(a=>a.matches(_));for(let a of Array.from(o.childNodes))if(a.nodeType===1)i(a);else if(a.nodeType===3&&!d)for(let c of(a.nodeValue??\"\").split(/\\s*[\u00B7\u2022|]\\s*|\\s{2,}|\\n/)){let f=u(c);(f.toLowerCase().match(/[\\p{L}\\p{N}]+/gu)??[]).some(p=>!B.has(p))&&n.push({text:f,element:o})}};return i(t),n}function Q(t,n){let i=Array.from(t.rows);if(!(t.querySelector('th, [role=\"columnheader\"], [role=\"rowheader\"]')!==null)){i.length>=2&&n(\"table-headers\",t);return}let s=te(i),d=s.find(c=>c!==s[0]);d!==void 0&&n(\"table-rows\",t,{first:s[0]??0,other:d});let a=i.flatMap(c=>Array.from(c.cells).filter(f=>f.tagName===\"TD\"&&ee(f)));a[0]&&n(\"table-cell-empty\",a[0],{count:a.length})}var Z='img[alt]:not([alt=\"\"]), svg, canvas, input, select, textarea, button, meter, progress';function ee(t){return!/[^ \\t\\n\\r\\f]/.test(t.textContent??\"\")&&t.querySelector(Z)===null}function te(t){let n=[];return t.map(i=>{let o=[],s=0,d=()=>{for(;(n[s]??0)>0;)o[s]=n[s]-1,s++};for(let a of Array.from(i.cells)){d();let c=Math.max(1,a.rowSpan||1)-1;for(let f=Math.max(1,a.colSpan||1);f>0;f--)o[s++]=c}d();for(let a=s;a<n.length;a++)(n[a]??0)>0&&(o[a]=n[a]-1,s=a+1);return n=o,s})}function ne(t){let n=i=>{for(let o of Array.from(i??[])){let s=o;if(s.selectorText&&/::?(before|after)/.test(s.selectorText)&&s.style?.content||o.cssRules&&n(o.cssRules))return!0}return!1};for(let i of Array.from(t.styleSheets))try{if(n(i.cssRules))return!0}catch{return!0}return!1}function re(t){if(!t||t===\"none\"||t===\"normal\")return\"\";let n=(t.match(/\"(?:[^\"\\\\]|\\\\.)*\"/g)??[]).map(o=>o.slice(1,-1).replace(/\\\\(.)/g,\"$1\"));if(/\\bcounters?\\(/.test(t))return u(t).slice(0,80);let i=u(n.join(\"\"));return $(i)?i.slice(0,80):\"\"}window.formfeedAudit=t=>F(window,t);})();";
|
|
9
|
+
/** Bundled from src/frame/paged-print.entry.ts. */
|
|
10
|
+
export declare const pagedPrintRuntime = "\"use strict\";(()=>{var N=t=>!!t&&t.nodeType===1,y=t=>N(t)?t:t?.parentElement??null;function b(t,o){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.nodeName===o)return e;return null}var T=t=>Array.from(t.querySelectorAll(\":scope > tbody > tr, :scope > tr\"));function v(t,o){for(let e=t.parentElement;e&&!e.classList.contains(\"pagedjs_page_content\");e=e.parentElement)if(o.getComputedStyle(e).display.startsWith(\"inline\"))return!0;return!1}function O(t,o){for(let e=t;e&&e!==o;e=e.parentElement)for(let r=e.previousSibling;r;r=r.previousSibling)if(N(r)||(r.textContent??\"\").trim())return!0;return!1}function P(t){let o=t.cloneNode(!0);for(let e of[o,...Array.from(o.querySelectorAll(\"[id]\"))])e.id&&(e.setAttribute(\"data-id\",e.id),e.removeAttribute(\"id\"));return o.setAttribute(\"data-ff-repeated\",\"\"),o}function k(t,o){for(let e of Array.from(t.querySelectorAll(\"table > tfoot\"))){let r=e.nextElementSibling;for(;r&&r.nodeName!==\"TBODY\"&&r.nodeName!==\"TR\";)r=r.nextElementSibling;r&&o.getComputedStyle(e).display===\"table-footer-group\"&&e.parentNode?.appendChild(e)}}function H(t,o,e){let r=y(t),n=r?.closest(\"table\");if(!r||!n||!n.hasAttribute(\"data-split-from\")||n.hasAttribute(\"data-ff-head\")||(n.setAttribute(\"data-ff-head\",\"\"),b(n,\"THEAD\")))return;let a=y(o)?.closest(\"table\"),f=a&&b(a,\"THEAD\");if(!a||!f||v(n,e))return;let l=P(f),d=n.firstChild;for(;d&&(d.nodeName===\"CAPTION\"||d.nodeName===\"COLGROUP\");)d=d.nextSibling;if(n.insertBefore(l,d),e.getComputedStyle(l).display!==\"table-header-group\"){l.remove();return}for(let s=a.firstElementChild;s;s=s.nextElementSibling)s.nodeName===\"COLGROUP\"&&n.insertBefore(s.cloneNode(!0),l);let i=r.closest(\"tr\"),u=i?.parentElement;i&&u&&u.parentElement===n&&u.nodeName!==\"THEAD\"&&(i.style.breakInside=\"auto\",i.removeAttribute(\"data-break-inside\"))}function w(t,o,e,r,n){let a=t.startContainer,f=N(a)?a.childNodes[t.startOffset]??a:a,l=y(f);if(!l)return;let d=l.nodeName===\"TBODY\"?l.querySelector(\"tr\"):l.closest(\"tr\"),i=d?.closest(\"table\"),u=d?.parentElement;if(!d||!i||!u||u.nodeName===\"THEAD\"||u.nodeName===\"TFOOT\"||v(i,n))return;let s=T(i),h=s.indexOf(d);if(h<0)return;let m=h,E=0;if(h>0&&(f===d||f===u)){let p=r.querySelector(`[data-ref=\"${i.getAttribute(\"data-ref\")??\"\"}\"]`),g=p&&b(p,\"TFOOT\");if(g){let c=g.cloneNode(!0);i.appendChild(c),n.getComputedStyle(c).display===\"table-footer-group\"&&(E=c.getBoundingClientRect().height),c.remove()}let C=Math.round(e),S=c=>!c||Math.floor(c.getBoundingClientRect().bottom)+E<=C;for(;m>0&&!S(s[m-1]);)m--}if(m===0){if(i.hasAttribute(\"data-split-from\")||!b(i,\"THEAD\"))return;let p=i.previousElementSibling,g=i.getAttribute(\"data-previous-break-after\")===\"avoid\"&&p?p:i;return O(g,o)?(t.setStartBefore(g),t):void 0}let A=s[m];return m<h&&A&&t.setStartBefore(A),E&&i.setAttribute(\"data-ff-foot\",\"\"),t}function R(t,o){let e=t.querySelector(\"table[data-ff-foot]\");if(!e)return;e.removeAttribute(\"data-ff-foot\");let r=o.querySelector(`[data-ref=\"${e.getAttribute(\"data-ref\")??\"\"}\"]`),n=r&&b(r,\"TFOOT\");n&&e.appendChild(P(n))}function B(t){let o=t.querySelector(\".pagedjs_pagebox\");if(!o)return;let e=Array.from(o.children).filter(n=>!(n.getAttribute(\"class\")??\"\").includes(\"pagedjs_\")&&!n.hasAttribute(\"data-ff-fixed\"));if(!e.length)return;let r=o.ownerDocument.createElement(\"div\");r.setAttribute(\"data-ff-fixed\",\"\"),r.setAttribute(\"style\",\"grid-column: center; grid-row: page; position: relative; pointer-events: none;\");for(let n of e)\"style\"in n&&(n.style.pointerEvents=\"auto\"),r.appendChild(n);o.appendChild(r)}function x(t){t.formfeedMoveTableFeet=()=>k(t.document,t);let o=t.Paged;if(!o?.Handler)return;class e extends o.Handler{renderNode(n,a){H(n,a,t)}onOverflow(n,a,f){return n?w(n,a,f.bottom,this.chunker.source,t):void 0}afterOverflowRemoved(n,a){R(a,this.chunker.source)}afterPageLayout(n){B(n)}}o.registerHandlers(e)}x(window);})();";
|
|
@@ -6,3 +6,5 @@ export declare const fitRuntime = "\"use strict\";(()=>{function a(t,e,n){if(e==
|
|
|
6
6
|
export declare const stageRuntime = "\"use strict\";(()=>{var W=`\nhtml.ff-edit-mode [data-ff-edit] { cursor: text; }\nhtml.ff-edit-mode [data-ff-edit]:hover { outline: 1px dashed rgba(37,99,235,.85); outline-offset: 2px; }\nhtml.ff-edit-mode [data-ff-edit=\"t\"]:hover { outline-color: rgba(147,51,234,.9); }\n.ff-editing { outline: 2px solid #2563eb !important; outline-offset: 2px; cursor: text; }\n.ff-editing .ff-chip { background: rgba(37,99,235,.14) !important; box-shadow: inset 0 0 0 1px rgba(37,99,235,.45) !important; border-radius: 3px !important; padding: 0 1px !important; cursor: default; }\n.ff-edit-badge { position: absolute; z-index: 2147483647; font: 500 11px/1.4 system-ui, sans-serif !important; color: #fff !important; background: #2563eb !important; padding: 1px 6px !important; border-radius: 4px !important; pointer-events: none; white-space: nowrap; }\n`;function H(a,l={}){let f=l.clicks!==!1,p=l.live===!0,n=a.document,o=null,d=null,u=e=>{try{a.parent.postMessage(e,\"*\")}catch{}},m=f?n.querySelector('meta[name=\"formfeed:document\"]')?.getAttribute(\"content\")??null:null,s=!1;a.addEventListener(\"blur\",()=>{s=!0}),a.addEventListener(\"focus\",()=>{s=!1});let g=n.createElement(\"style\");g.setAttribute(\"data-formfeed\",\"edit\"),g.setAttribute(\"data-pagedjs-ignore\",\"\"),g.textContent=W,(n.head??n.documentElement).appendChild(g),f&&n.documentElement.classList.add(\"ff-edit-mode\");let x=e=>(e&&typeof e.closest==\"function\"?e:null)?.closest(\"[data-ff-edit]\")??null;n.addEventListener(\"click\",e=>{if(!f)return;if(o&&!o.done&&o.element.contains(e.target)){e.stopImmediatePropagation();return}let t=x(e.target);t&&(e.preventDefault(),e.stopImmediatePropagation(),v(t,{x:e.clientX,y:e.clientY}))},!0);function v(e,t){o&&!o.done&&L();let r=e.getAttribute(\"data-ff-src\")??\"\",i=e.getBoundingClientRect(),b=Array.from(n.querySelectorAll(`[data-ff-src=\"${r.replace(/\"/g,\"\")}\"]`));d={src:r,element:e,point:t},u({type:\"formfeed:edit-request\",src:r,doc:m,edit:e.getAttribute(\"data-ff-edit\"),text:e.textContent??\"\",elements:e.childElementCount,count:b.length,index:Math.max(0,b.indexOf(e)),split:e.hasAttribute(\"data-split-from\")||e.hasAttribute(\"data-split-to\"),rect:{left:i.left,top:i.top,width:i.width,height:i.height}})}n.addEventListener(\"keydown\",e=>{if(!f||o&&!o.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t===\"z\"||t===\"y\")&&(e.preventDefault(),u({type:t===\"y\"||e.shiftKey?\"formfeed:redo\":\"formfeed:undo\"}))}),a.addEventListener(\"message\",e=>{if(e.source!==a.parent)return;let t=e.data;!t||typeof t.type!=\"string\"||(t.type===\"formfeed:edit-begin\"?B(t):t.type===\"formfeed:edit-refuse\"||t.type===\"formfeed:edit-end\"?(d=null,o&&!o.done&&S(!1)):t.type===\"formfeed:edit-open\"&&E(t))});function E(e){if(!f||typeof e.src!=\"string\"||o&&!o.done)return;let t=Array.from(n.querySelectorAll(`[data-ff-src=\"${e.src.replace(/\"/g,\"\")}\"][data-ff-edit]`)),r=Number.isInteger(e.index)?Number(e.index):0,i=t[r]??t[0];i&&v(i,null)}if(f){let e=()=>u({type:\"formfeed:edit-ready\",doc:m}),t=a;t.PagedConfig?t.formfeedEditReady=e:n.readyState===\"loading\"?n.addEventListener(\"DOMContentLoaded\",e):e()}function B(e){o&&!o.done&&S(!1);let t=e.layer?n.querySelector(`[data-ff-layer=\"${String(e.layer).replace(/\"/g,\"\")}\"] > .ff-text`):d&&d.src===e.src?d.element:n.querySelector(`[data-ff-src=\"${String(e.src).replace(/\"/g,\"\")}\"]`),r=e.at,i=e.layer?r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?{x:Number(r.x),y:Number(r.y)}:null:d&&d.src===e.src?d.point:null;d=null;let b=s&&!n.hasFocus();if(!t||!Array.isArray(e.items)||b){u({type:\"formfeed:edit-cancel\",token:String(e.token)});return}let y=Array.from(t.childNodes),k=n.createDocumentFragment();for(let c of e.items)if(c.kind===\"text\")k.appendChild(n.createTextNode(String(c.text)));else if(c.kind===\"break\")k.appendChild(n.createElement(\"br\"));else if(c.kind===\"chip\"){let h=n.createElement(\"span\");h.className=\"ff-chip\",h.setAttribute(\"data-ff-chip\",String(c.index)),h.setAttribute(\"contenteditable\",\"false\"),c.title&&(h.title=String(c.title)),h.textContent=String(c.text),k.appendChild(h)}for(let c of y)t.removeChild(c);t.appendChild(k),t.contentEditable=\"true\",t.classList.add(\"ff-editing\"),t.setAttribute(\"role\",\"textbox\"),e.label&&t.setAttribute(\"aria-label\",String(e.label)),t.spellcheck=!0,o={token:String(e.token),element:t,saved:y,allowBreaks:e.allowBreaks===!0,badge:e.note?I(t,String(e.note)):null,done:!1},t.addEventListener(\"keydown\",T),t.addEventListener(\"beforeinput\",N),t.addEventListener(\"paste\",w),t.addEventListener(\"drop\",R),t.addEventListener(\"focusout\",F),p&&t.addEventListener(\"input\",C),t.focus(),e.select===\"all\"?q(t):K(t,i),u({type:\"formfeed:edit-started\",token:o.token}),typeof e.insert==\"string\"&&e.insert&&A(e.insert.replace(/\\r\\n?|\\n/g,\" \"))}function A(e){if(typeof n.execCommand==\"function\"&&n.execCommand(\"insertText\",!1,e))return;let t=a.getSelection(),r=t&&t.rangeCount?t.getRangeAt(0):null;r&&(r.deleteContents(),r.insertNode(n.createTextNode(e)),r.collapse(!1),p&&C())}function C(){o&&!o.done&&u({type:\"formfeed:edit-input\",token:o.token,items:D(o.element)})}function I(e,t){let r=n.createElement(\"div\");r.className=\"ff-edit-badge\",r.textContent=t;let i=e.getBoundingClientRect();return r.style.left=`${i.left+a.scrollX}px`,r.style.top=`${Math.max(0,i.top+a.scrollY-22)}px`,n.body.appendChild(r),r}function q(e){let t=a.getSelection();if(!t)return;let r=n.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}function K(e,t){let r=a.getSelection();if(!r)return;let i=null,b=n;if(t){if(b.caretRangeFromPoint)i=b.caretRangeFromPoint(t.x,t.y);else if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(t.x,t.y);y&&(i=n.createRange(),i.setStart(y.offsetNode,y.offset))}}if(!i||!e.contains(i.startContainer))i=n.createRange(),i.selectNodeContents(e),i.collapse(!1);else if(t){let y=i.startContainer,c=(y.nodeType===1?y:y.parentElement)?.closest(\"[data-ff-chip]\")??null;if(c&&c!==e&&e.contains(c)){let h=c.getBoundingClientRect();i=n.createRange(),t.x<h.left+h.width/2?i.setStartBefore(c):i.setStartAfter(c),i.collapse(!0)}}r.removeAllRanges(),r.addRange(i)}function T(e){let t=e.key;t===\"Escape\"?(e.preventDefault(),S(!0)):t===\"Enter\"&&!e.shiftKey?(e.preventDefault(),L()):t===\"Enter\"?(e.preventDefault(),o?.allowBreaks&&$()):t===\"Tab\"?(e.preventDefault(),L()):(e.ctrlKey||e.metaKey)&&[\"b\",\"i\",\"u\"].includes(t.toLowerCase())&&(e.preventDefault(),p&&o&&!e.altKey&&u({type:\"formfeed:edit-style\",token:o.token,key:t.toLowerCase()}))}function N(e){let t=e.inputType??\"\";(t.startsWith(\"format\")||t===\"insertFromDrop\"||t===\"insertParagraph\"||t===\"insertLineBreak\")&&e.preventDefault()}function w(e){e.preventDefault(),A((e.clipboardData?.getData(\"text/plain\")??\"\").replace(/\\r\\n?|\\n/g,\" \"))}function R(e){e.preventDefault()}function F(){a.setTimeout(()=>{o&&!o.done&&(!n.hasFocus()||!o.element.contains(n.activeElement))&&L()},0)}function $(){let e=a.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let r=n.createElement(\"br\");t.insertNode(r),r.nextSibling||r.parentNode?.appendChild(n.createElement(\"br\"));let i=n.createRange();i.setStartAfter(r),i.collapse(!0),e.removeAllRanges(),e.addRange(i)}function M(e){e.done=!0;let t=e.element;t.removeEventListener(\"keydown\",T),t.removeEventListener(\"beforeinput\",N),t.removeEventListener(\"paste\",w),t.removeEventListener(\"drop\",R),t.removeEventListener(\"focusout\",F),t.removeEventListener(\"input\",C),t.removeAttribute(\"contenteditable\"),t.removeAttribute(\"role\"),t.removeAttribute(\"aria-label\"),t.classList.remove(\"ff-editing\"),e.badge?.remove(),o===e&&(o=null)}function L(){let e=o;if(!e||e.done)return;let t=D(e.element);M(e),u({type:\"formfeed:edit-commit\",token:e.token,items:t})}function S(e){let t=o;if(!t||t.done)return;let r=t.element;for(;r.firstChild;)r.removeChild(r.firstChild);for(let i of t.saved)r.appendChild(i);M(t),e&&u({type:\"formfeed:edit-cancel\",token:t.token})}}function D(a){let l=[],f=n=>{let o=l[l.length-1];o?.kind===\"text\"?o.text+=n:n&&l.push({kind:\"text\",text:n})},p=n=>{for(let o of Array.from(n.childNodes))if(o.nodeType===3)f(o.data);else if(o.nodeType===1){let d=o,u=d.getAttribute(\"data-ff-chip\");u!==null?l.push({kind:\"chip\",index:Number(u)}):d.tagName===\"BR\"?l.push({kind:\"break\"}):((d.tagName===\"DIV\"||d.tagName===\"P\")&&l.length&&l.push({kind:\"break\"}),p(d))}};for(p(a);l[l.length-1]?.kind===\"break\";)l.pop();return l}function O(a,l){return Array.from(a.querySelectorAll(\"[data-ff-layer]\")).map(f=>{let p=f.querySelector(\":scope > .ff-text\"),n=!1;if(p&&f.style.height!==\"auto\"){let o=l.getComputedStyle(f),d=f.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);n=o.overflow===\"hidden\"&&(p.scrollHeight>d+1||p.scrollWidth>p.clientWidth+1)}return{id:f.getAttribute(\"data-ff-layer\")??\"\",width:f.offsetWidth,height:f.offsetHeight,overflow:n}})}function P(a){let l=a.document,f=m=>{try{a.parent.postMessage(m,\"*\")}catch{}},p=m=>typeof m==\"string\"?l.querySelector(`[data-ff-layer=\"${m.replace(/\"/g,\"\")}\"]`):null,n=()=>{for(let m of Array.from(l.querySelectorAll(\"[data-ff-layer]\")))for(let s of[\"left\",\"top\",\"width\",\"height\",\"transform\"])m.style.removeProperty(s)},o=()=>{a.formfeedFit?.(),f({type:\"formfeed:ready\",layers:O(l,a)})};a.addEventListener(\"message\",m=>{if(m.source!==a.parent)return;let s=m.data;if(!(!s||typeof s.type!=\"string\")){if(s.type===\"formfeed:layer-style\"){let g=p(s.id);if(!g)return;let x=(v,E)=>{typeof E==\"number\"&&Number.isFinite(E)&&g.style.setProperty(v,`${E}px`)};x(\"left\",s.left),x(\"top\",s.top),x(\"width\",s.width),x(\"height\",s.height),typeof s.rotation==\"number\"&&Number.isFinite(s.rotation)&&g.style.setProperty(\"transform\",s.rotation?`rotate(${s.rotation}deg)`:\"none\")}else if(s.type===\"formfeed:layer-style-clear\")n();else if(s.type===\"formfeed:css\"&&typeof s.css==\"string\"){let g=l.querySelector('style[data-formfeed=\"template\"]');g&&(g.textContent=s.css),n(),o()}}}),H(a,{clicks:!1,live:!0});let d=l.fonts,u=()=>d?void d.ready.then(o):o();l.readyState===\"complete\"?u():a.addEventListener(\"load\",u)}P(window);})();";
|
|
7
7
|
/** Bundled from src/frame/audit.entry.ts. */
|
|
8
8
|
export declare const auditRuntime = "\"use strict\";(()=>{var I={\"document-title\":\"error\",\"image-alt\":\"error\",\"figure-name\":\"error\",\"heading-order\":\"error\",\"table-rows\":\"error\",\"table-cell-empty\":\"error\",\"masked-text\":\"error\",\"filtered-text\":\"warning\",\"document-language\":\"warning\",\"table-headers\":\"warning\",\"link-name\":\"warning\",\"generated-text\":\"warning\",\"fixed-text\":\"warning\",\"running-text\":\"warning\"};var S=120;var O=\".formfeed-chrome, .ff-running-header, .ff-running-footer\",_=\".pageNumber, .totalPages, .date, .title, .url, .ff-page-no, .ff-page-total\",k=new Set([\"script\",\"style\",\"template\",\"noscript\",\"head\"]),j=2e4,q=10,B=new Set([\"page\",\"pages\",\"of\",\"seite\",\"seiten\",\"von\",\"p\",\"s\"]),u=t=>(t??\"\").replace(/\\s+/g,\" \").trim(),D=t=>t.replace(/\\s+/g,\"\").toLowerCase(),$=t=>/[\\p{L}\\p{N}]/u.test(t),Y=/^data-(ref|id|split-(from|to|original)|(previous-|next-)?break-(before|after|inside)|(align-)?last-split-element|nth-of-type|counter-.+|page(-number)?|undisplayed|after-page|following|has-notes|children|item-num)$/;function X(t){let n=t.cloneNode(!1);n.removeAttribute(\"data-ff-src\"),n.removeAttribute(\"data-ff-edit\");let i=t.closest(\".pagedjs_page\")!==null;for(let s of Array.from(n.attributes))i&&Y.test(s.name)?n.removeAttribute(s.name):s.value.length>48&&n.setAttribute(s.name,`${s.value.slice(0,40)}\\u2026`);let o=n.outerHTML.replace(new RegExp(`</${t.tagName}>$`,\"i\"),\"\");return o.length>S?`${o.slice(0,S-1)}\\u2026`:o}function F(t,n={}){let i=t.document,o=i.body,s=[],d=new Set,a=n.findings!==!1,c=(e,r,l={})=>{if(!a)return;let m=r?.closest(\"[data-ff-src]\")?.getAttribute(\"data-ff-src\")??null,h=r?X(r):\"\",g=`${e}|${m??h}|${JSON.stringify(l)}`;d.has(g)||(d.add(g),s.push({code:e,severity:I[e],src:m,snippet:h,args:l}))},f=new WeakMap,A=e=>{let r=f.get(e);if(r!==void 0)return r;let l=t.getComputedStyle(e),m=l.display===\"none\"||l.visibility===\"hidden\"||l.visibility===\"collapse\"||e.parentElement!==null&&e.parentElement!==i.documentElement&&A(e.parentElement);return f.set(e,m),m},p=e=>e.closest('[aria-hidden=\"true\"]')!==null,E=e=>/^(presentation|none)$/.test(e.getAttribute(\"role\")??\"\"),H=e=>e.closest(O)!==null,y=e=>$(e.textContent??\"\"),x=e=>{let r=u(e.getAttribute(\"aria-label\"));return r||u((e.getAttribute(\"aria-labelledby\")??\"\").split(/\\s+/).filter(Boolean).map(l=>e.ownerDocument.getElementById(l)?.textContent??\"\").join(\" \"))},P=e=>x(e)||u(e.textContent)||u(Array.from(e.querySelectorAll(\"img[alt]\")).map(r=>r.getAttribute(\"alt\")).join(\" \"))||u(e.getAttribute(\"title\")),T=e=>{let r=e.getAttribute(\"href\")??\"\";return{href:r.startsWith(\"#\")?r:e.href??r,name:P(e)}};u(i.title)||c(\"document-title\",null),!u(i.documentElement.getAttribute(\"lang\"))&&!n.locale&&c(\"document-language\",null);let M=n.pages??(n.pageHeight&&n.pageHeight>0?Math.ceil(i.documentElement.scrollHeight/n.pageHeight):1),C=[],v=[],R={\"masked-text\":[],\"filtered-text\":[],\"fixed-text\":[]},w=(e,r)=>{R[e].some(l=>l.contains(r))||(R[e].push(r),c(e,r))},V=a&&ne(i),G=o?Array.from(o.querySelectorAll(\"*\")).slice(0,j):[];for(let e of G){let r=e.tagName.toLowerCase();if(k.has(r)||H(e)||A(e))continue;if(r===\"a\"&&e.hasAttribute(\"href\")){let g=T(e);C.push(g),!g.name&&!p(e)&&c(\"link-name\",e)}if(!a)continue;let l=t.getComputedStyle(e),m=l.getPropertyValue(\"mask-image\")||l.getPropertyValue(\"-webkit-mask-image\");if(m&&m!==\"none\"&&y(e)&&w(\"masked-text\",e),l.filter&&l.filter!==\"none\"&&y(e)&&w(\"filtered-text\",e),l.position===\"fixed\"&&M>1&&y(e)&&w(\"fixed-text\",e),V)for(let g of[\"::before\",\"::after\"]){let U=re(t.getComputedStyle(e,g).content);U&&c(\"generated-text\",e,{text:U})}if(p(e))continue;r===\"img\"&&!E(e)?e.hasAttribute(\"alt\")||x(e)||u(e.getAttribute(\"title\"))||c(\"image-alt\",e):(r===\"canvas\"||e.getAttribute(\"role\")===\"img\"&&r!==\"img\")&&(x(e)||u(e.getAttribute(\"title\"))||u(e.querySelector(\":scope > title\")?.textContent)||c(\"figure-name\",e,{tag:r}));let h=/^h[1-6]$/.test(r)?Number(r[1]):e.getAttribute(\"role\")===\"heading\"?Number(e.getAttribute(\"aria-level\"))||2:0;h&&v.push({element:e,level:h}),r===\"table\"&&!E(e)&&Q(e,c)}let b=0;for(let{element:e,level:r}of v)(b===0?r!==1:r>b+1)&&c(\"heading-order\",e,{level:r,previous:b}),b=r;let N=[],W=a&&o?D(J(o)):\"\",L=0;for(let e of[\"header\",\"footer\"])for(let r of z(i,e,n[e])){for(let l of Array.from(r.querySelectorAll(\"a[href]\")))N.push(T(l));if(a)for(let{text:l,element:m}of K(r)){if(L>=q||W.includes(D(l)))continue;let h=s.length;c(\"running-text\",m,{text:l.slice(0,80),part:e}),s.length>h&&L++}}return{findings:s,links:C,templateLinks:N}}function z(t,n,i){if(i!==void 0){if(!i.trim())return[];let o=new DOMParser().parseFromString(`<!doctype html><body>${i}</body>`,\"text/html\");return o.body?[o.body]:[]}return Array.from(t.querySelectorAll(`.ff-running-${n}, .formfeed-chrome[data-ff-chrome=\"${n}\"]`))}function J(t){let n=[],i=o=>{if(o.nodeType===3){n.push(o.nodeValue??\"\");return}if(o.nodeType!==1)return;let s=o;if(!(k.has(s.tagName.toLowerCase())||s.matches(O)))for(let d of Array.from(o.childNodes))i(d)};return i(t),n.join(\" \")}function K(t){let n=[],i=o=>{let s=o.tagName.toLowerCase();if(k.has(s)||o.matches(_))return;let d=Array.from(o.children).some(a=>a.matches(_));for(let a of Array.from(o.childNodes))if(a.nodeType===1)i(a);else if(a.nodeType===3&&!d)for(let c of(a.nodeValue??\"\").split(/\\s*[\u00B7\u2022|]\\s*|\\s{2,}|\\n/)){let f=u(c);(f.toLowerCase().match(/[\\p{L}\\p{N}]+/gu)??[]).some(p=>!B.has(p))&&n.push({text:f,element:o})}};return i(t),n}function Q(t,n){let i=Array.from(t.rows);if(!(t.querySelector('th, [role=\"columnheader\"], [role=\"rowheader\"]')!==null)){i.length>=2&&n(\"table-headers\",t);return}let s=te(i),d=s.find(c=>c!==s[0]);d!==void 0&&n(\"table-rows\",t,{first:s[0]??0,other:d});let a=i.flatMap(c=>Array.from(c.cells).filter(f=>f.tagName===\"TD\"&&ee(f)));a[0]&&n(\"table-cell-empty\",a[0],{count:a.length})}var Z='img[alt]:not([alt=\"\"]), svg, canvas, input, select, textarea, button, meter, progress';function ee(t){return!/[^ \\t\\n\\r\\f]/.test(t.textContent??\"\")&&t.querySelector(Z)===null}function te(t){let n=[];return t.map(i=>{let o=[],s=0,d=()=>{for(;(n[s]??0)>0;)o[s]=n[s]-1,s++};for(let a of Array.from(i.cells)){d();let c=Math.max(1,a.rowSpan||1)-1;for(let f=Math.max(1,a.colSpan||1);f>0;f--)o[s++]=c}d();for(let a=s;a<n.length;a++)(n[a]??0)>0&&(o[a]=n[a]-1,s=a+1);return n=o,s})}function ne(t){let n=i=>{for(let o of Array.from(i??[])){let s=o;if(s.selectorText&&/::?(before|after)/.test(s.selectorText)&&s.style?.content||o.cssRules&&n(o.cssRules))return!0}return!1};for(let i of Array.from(t.styleSheets))try{if(n(i.cssRules))return!0}catch{return!0}return!1}function re(t){if(!t||t===\"none\"||t===\"normal\")return\"\";let n=(t.match(/\"(?:[^\"\\\\]|\\\\.)*\"/g)??[]).map(o=>o.slice(1,-1).replace(/\\\\(.)/g,\"$1\"));if(/\\bcounters?\\(/.test(t))return u(t).slice(0,80);let i=u(n.join(\"\"));return $(i)?i.slice(0,80):\"\"}window.formfeedAudit=t=>F(window,t);})();";
|
|
9
|
+
/** Bundled from src/frame/paged-print.entry.ts. */
|
|
10
|
+
export declare const pagedPrintRuntime = "\"use strict\";(()=>{var N=t=>!!t&&t.nodeType===1,y=t=>N(t)?t:t?.parentElement??null;function b(t,o){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.nodeName===o)return e;return null}var T=t=>Array.from(t.querySelectorAll(\":scope > tbody > tr, :scope > tr\"));function v(t,o){for(let e=t.parentElement;e&&!e.classList.contains(\"pagedjs_page_content\");e=e.parentElement)if(o.getComputedStyle(e).display.startsWith(\"inline\"))return!0;return!1}function O(t,o){for(let e=t;e&&e!==o;e=e.parentElement)for(let r=e.previousSibling;r;r=r.previousSibling)if(N(r)||(r.textContent??\"\").trim())return!0;return!1}function P(t){let o=t.cloneNode(!0);for(let e of[o,...Array.from(o.querySelectorAll(\"[id]\"))])e.id&&(e.setAttribute(\"data-id\",e.id),e.removeAttribute(\"id\"));return o.setAttribute(\"data-ff-repeated\",\"\"),o}function k(t,o){for(let e of Array.from(t.querySelectorAll(\"table > tfoot\"))){let r=e.nextElementSibling;for(;r&&r.nodeName!==\"TBODY\"&&r.nodeName!==\"TR\";)r=r.nextElementSibling;r&&o.getComputedStyle(e).display===\"table-footer-group\"&&e.parentNode?.appendChild(e)}}function H(t,o,e){let r=y(t),n=r?.closest(\"table\");if(!r||!n||!n.hasAttribute(\"data-split-from\")||n.hasAttribute(\"data-ff-head\")||(n.setAttribute(\"data-ff-head\",\"\"),b(n,\"THEAD\")))return;let a=y(o)?.closest(\"table\"),f=a&&b(a,\"THEAD\");if(!a||!f||v(n,e))return;let l=P(f),d=n.firstChild;for(;d&&(d.nodeName===\"CAPTION\"||d.nodeName===\"COLGROUP\");)d=d.nextSibling;if(n.insertBefore(l,d),e.getComputedStyle(l).display!==\"table-header-group\"){l.remove();return}for(let s=a.firstElementChild;s;s=s.nextElementSibling)s.nodeName===\"COLGROUP\"&&n.insertBefore(s.cloneNode(!0),l);let i=r.closest(\"tr\"),u=i?.parentElement;i&&u&&u.parentElement===n&&u.nodeName!==\"THEAD\"&&(i.style.breakInside=\"auto\",i.removeAttribute(\"data-break-inside\"))}function w(t,o,e,r,n){let a=t.startContainer,f=N(a)?a.childNodes[t.startOffset]??a:a,l=y(f);if(!l)return;let d=l.nodeName===\"TBODY\"?l.querySelector(\"tr\"):l.closest(\"tr\"),i=d?.closest(\"table\"),u=d?.parentElement;if(!d||!i||!u||u.nodeName===\"THEAD\"||u.nodeName===\"TFOOT\"||v(i,n))return;let s=T(i),h=s.indexOf(d);if(h<0)return;let m=h,E=0;if(h>0&&(f===d||f===u)){let p=r.querySelector(`[data-ref=\"${i.getAttribute(\"data-ref\")??\"\"}\"]`),g=p&&b(p,\"TFOOT\");if(g){let c=g.cloneNode(!0);i.appendChild(c),n.getComputedStyle(c).display===\"table-footer-group\"&&(E=c.getBoundingClientRect().height),c.remove()}let C=Math.round(e),S=c=>!c||Math.floor(c.getBoundingClientRect().bottom)+E<=C;for(;m>0&&!S(s[m-1]);)m--}if(m===0){if(i.hasAttribute(\"data-split-from\")||!b(i,\"THEAD\"))return;let p=i.previousElementSibling,g=i.getAttribute(\"data-previous-break-after\")===\"avoid\"&&p?p:i;return O(g,o)?(t.setStartBefore(g),t):void 0}let A=s[m];return m<h&&A&&t.setStartBefore(A),E&&i.setAttribute(\"data-ff-foot\",\"\"),t}function R(t,o){let e=t.querySelector(\"table[data-ff-foot]\");if(!e)return;e.removeAttribute(\"data-ff-foot\");let r=o.querySelector(`[data-ref=\"${e.getAttribute(\"data-ref\")??\"\"}\"]`),n=r&&b(r,\"TFOOT\");n&&e.appendChild(P(n))}function B(t){let o=t.querySelector(\".pagedjs_pagebox\");if(!o)return;let e=Array.from(o.children).filter(n=>!(n.getAttribute(\"class\")??\"\").includes(\"pagedjs_\")&&!n.hasAttribute(\"data-ff-fixed\"));if(!e.length)return;let r=o.ownerDocument.createElement(\"div\");r.setAttribute(\"data-ff-fixed\",\"\"),r.setAttribute(\"style\",\"grid-column: center; grid-row: page; position: relative; pointer-events: none;\");for(let n of e)\"style\"in n&&(n.style.pointerEvents=\"auto\"),r.appendChild(n);o.appendChild(r)}function x(t){t.formfeedMoveTableFeet=()=>k(t.document,t);let o=t.Paged;if(!o?.Handler)return;class e extends o.Handler{renderNode(n,a){H(n,a,t)}onOverflow(n,a,f){return n?w(n,a,f.bottom,this.chunker.source,t):void 0}afterOverflowRemoved(n,a){R(a,this.chunker.source)}afterPageLayout(n){B(n)}}o.registerHandlers(e)}x(window);})();";
|