@ryanyahya/opendoc 0.4.0
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/.agents/skills/opendoc-apply-comments/SKILL.md +30 -0
- package/.agents/skills/opendoc-apply-comments/agents/openai.yaml +4 -0
- package/.agents/skills/opendoc-create/SKILL.md +63 -0
- package/.agents/skills/opendoc-create/agents/openai.yaml +6 -0
- package/.agents/skills/opendoc-create-template/SKILL.md +50 -0
- package/.agents/skills/opendoc-create-template/agents/openai.yaml +4 -0
- package/.agents/skills/opendoc-create-template/references/structured-reports.md +11 -0
- package/.agents/skills/opendoc-create-theme/SKILL.md +40 -0
- package/.agents/skills/opendoc-create-theme/agents/openai.yaml +4 -0
- package/.agents/skills/opendoc-current-document/SKILL.md +32 -0
- package/.agents/skills/opendoc-current-document/agents/openai.yaml +4 -0
- package/.agents/skills/opendoc-current-document/references/context-fields.md +20 -0
- package/.agents/skills/opendoc-review-document/SKILL.md +60 -0
- package/.agents/skills/opendoc-review-document/agents/openai.yaml +4 -0
- package/AGENTS.md +69 -0
- package/CONTRIBUTING.md +38 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/SECURITY.md +9 -0
- package/THIRD_PARTY.md +49 -0
- package/VALIDATION.md +99 -0
- package/bin/opendoc.mjs +6 -0
- package/dist/assets/Markdown-sNZyjJi7.js +29 -0
- package/dist/assets/OpenDocSerif-Regular-D3OXs9A9.ttf +0 -0
- package/dist/assets/OpenDocSerif-Semibold-CjL9oDRo.ttf +0 -0
- package/dist/assets/geist-latin-ext-wght-italic-XgKbg5n7.woff2 +0 -0
- package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/assets/geist-latin-wght-italic-dTnRTFFJ.woff2 +0 -0
- package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/assets/index-DdrZ6ozO.css +1 -0
- package/dist/assets/index-DgNBz7mL.js +39 -0
- package/dist/assets/pdf-B7Emtyld.js +54 -0
- package/dist/assets/pdf.worker.min-Dswkl-cV.mjs +29 -0
- package/dist/assets/wordmark-DsqLlZpb.png +0 -0
- package/dist/index.html +17 -0
- package/docs/APPEARANCE.md +21 -0
- package/docs/ASSETS.md +176 -0
- package/docs/AUTHORING.md +178 -0
- package/docs/HEADLESS.md +120 -0
- package/docs/MEDIA.md +112 -0
- package/docs/PROJECTS.md +55 -0
- package/docs/PROSE.md +15 -0
- package/docs/SELECTION.md +59 -0
- package/docs/TEMPLATES.md +55 -0
- package/docs/THEMES.md +106 -0
- package/node_modules/@formepdf/core/LICENSE +21 -0
- package/node_modules/@formepdf/core/README.md +53 -0
- package/node_modules/@formepdf/core/dist/attachments.d.ts +55 -0
- package/node_modules/@formepdf/core/dist/attachments.js +59 -0
- package/node_modules/@formepdf/core/dist/extract.d.ts +8 -0
- package/node_modules/@formepdf/core/dist/extract.js +56 -0
- package/node_modules/@formepdf/core/dist/index.d.ts +311 -0
- package/node_modules/@formepdf/core/dist/index.js +167 -0
- package/node_modules/@formepdf/core/dist/layout.d.ts +132 -0
- package/node_modules/@formepdf/core/dist/layout.js +240 -0
- package/node_modules/@formepdf/core/dist/shared/browserHelpers.d.ts +19 -0
- package/node_modules/@formepdf/core/dist/shared/browserHelpers.js +128 -0
- package/node_modules/@formepdf/core/package.json +35 -0
- package/node_modules/@formepdf/core/pkg-node/LICENSE +21 -0
- package/node_modules/@formepdf/core/pkg-node/README.md +84 -0
- package/node_modules/@formepdf/core/pkg-node/forme.d.ts +39 -0
- package/node_modules/@formepdf/core/pkg-node/forme.js +394 -0
- package/node_modules/@formepdf/core/pkg-node/forme_bg.wasm +0 -0
- package/node_modules/@formepdf/core/pkg-node/forme_bg.wasm.d.ts +21 -0
- package/node_modules/@formepdf/core/pkg-node/package.json +25 -0
- package/node_modules/@formepdf/react/README.md +70 -0
- package/node_modules/@formepdf/react/dist/charts.d.ts +72 -0
- package/node_modules/@formepdf/react/dist/charts.js +338 -0
- package/node_modules/@formepdf/react/dist/components.d.ts +533 -0
- package/node_modules/@formepdf/react/dist/components.js +608 -0
- package/node_modules/@formepdf/react/dist/expr.d.ts +20 -0
- package/node_modules/@formepdf/react/dist/expr.js +39 -0
- package/node_modules/@formepdf/react/dist/font.d.ts +2 -0
- package/node_modules/@formepdf/react/dist/font.js +1 -0
- package/node_modules/@formepdf/react/dist/index.d.ts +11 -0
- package/node_modules/@formepdf/react/dist/index.js +15 -0
- package/node_modules/@formepdf/react/dist/render.d.ts +12 -0
- package/node_modules/@formepdf/react/dist/render.js +15 -0
- package/node_modules/@formepdf/react/dist/serialize.d.ts +12 -0
- package/node_modules/@formepdf/react/dist/serialize.js +1470 -0
- package/node_modules/@formepdf/react/dist/stylesheet.d.ts +4 -0
- package/node_modules/@formepdf/react/dist/stylesheet.js +5 -0
- package/node_modules/@formepdf/react/dist/template-proxy.d.ts +38 -0
- package/node_modules/@formepdf/react/dist/template-proxy.js +100 -0
- package/node_modules/@formepdf/react/dist/types.d.ts +287 -0
- package/node_modules/@formepdf/react/dist/types.js +1 -0
- package/node_modules/@formepdf/react/package.json +41 -0
- package/node_modules/@formepdf/shared/README.md +7 -0
- package/node_modules/@formepdf/shared/dist/canvas.d.ts +6 -0
- package/node_modules/@formepdf/shared/dist/canvas.js +43 -0
- package/node_modules/@formepdf/shared/dist/charts.d.ts +100 -0
- package/node_modules/@formepdf/shared/dist/charts.js +98 -0
- package/node_modules/@formepdf/shared/dist/encode.d.ts +27 -0
- package/node_modules/@formepdf/shared/dist/encode.js +93 -0
- package/node_modules/@formepdf/shared/dist/font.d.ts +13 -0
- package/node_modules/@formepdf/shared/dist/font.js +52 -0
- package/node_modules/@formepdf/shared/dist/index.d.ts +10 -0
- package/node_modules/@formepdf/shared/dist/index.js +15 -0
- package/node_modules/@formepdf/shared/dist/parser.d.ts +30 -0
- package/node_modules/@formepdf/shared/dist/parser.js +756 -0
- package/node_modules/@formepdf/shared/dist/semantics.d.ts +15 -0
- package/node_modules/@formepdf/shared/dist/semantics.js +44 -0
- package/node_modules/@formepdf/shared/dist/style.d.ts +7 -0
- package/node_modules/@formepdf/shared/dist/style.js +1024 -0
- package/node_modules/@formepdf/shared/dist/types.d.ts +743 -0
- package/node_modules/@formepdf/shared/dist/types.js +2 -0
- package/node_modules/@formepdf/shared/package.json +35 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/node_modules/@types/node/assert.d.ts +1078 -0
- package/node_modules/@types/node/async_hooks.d.ts +603 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +1934 -0
- package/node_modules/@types/node/child_process.d.ts +1476 -0
- package/node_modules/@types/node/cluster.d.ts +578 -0
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +452 -0
- package/node_modules/@types/node/constants.d.ts +21 -0
- package/node_modules/@types/node/crypto.d.ts +4545 -0
- package/node_modules/@types/node/dgram.d.ts +600 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
- package/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/node_modules/@types/node/dns.d.ts +923 -0
- package/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/node/events.d.ts +976 -0
- package/node_modules/@types/node/fs/promises.d.ts +1306 -0
- package/node_modules/@types/node/fs.d.ts +4463 -0
- package/node_modules/@types/node/globals.d.ts +172 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/node_modules/@types/node/http.d.ts +2097 -0
- package/node_modules/@types/node/http2.d.ts +2843 -0
- package/node_modules/@types/node/https.d.ts +579 -0
- package/node_modules/@types/node/index.d.ts +98 -0
- package/node_modules/@types/node/inspector.d.ts +253 -0
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +891 -0
- package/node_modules/@types/node/net.d.ts +1076 -0
- package/node_modules/@types/node/os.d.ts +506 -0
- package/node_modules/@types/node/package.json +145 -0
- package/node_modules/@types/node/path.d.ts +200 -0
- package/node_modules/@types/node/perf_hooks.d.ts +968 -0
- package/node_modules/@types/node/process.d.ts +2084 -0
- package/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/node/querystring.d.ts +152 -0
- package/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/node_modules/@types/node/readline.d.ts +594 -0
- package/node_modules/@types/node/repl.d.ts +428 -0
- package/node_modules/@types/node/sea.d.ts +162 -0
- package/node_modules/@types/node/sqlite.d.ts +722 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +573 -0
- package/node_modules/@types/node/stream.d.ts +1694 -0
- package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/test.d.ts +2265 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +287 -0
- package/node_modules/@types/node/tls.d.ts +1319 -0
- package/node_modules/@types/node/trace_events.d.ts +197 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +98 -0
- package/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@types/node/url.d.ts +984 -0
- package/node_modules/@types/node/util.d.ts +2606 -0
- package/node_modules/@types/node/v8.d.ts +920 -0
- package/node_modules/@types/node/vm.d.ts +1053 -0
- package/node_modules/@types/node/wasi.d.ts +181 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +819 -0
- package/node_modules/@types/node/zlib.d.ts +747 -0
- package/node_modules/@types/react/LICENSE +21 -0
- package/node_modules/@types/react/README.md +15 -0
- package/node_modules/@types/react/canary.d.ts +129 -0
- package/node_modules/@types/react/compiler-runtime.d.ts +4 -0
- package/node_modules/@types/react/experimental.d.ts +184 -0
- package/node_modules/@types/react/global.d.ts +166 -0
- package/node_modules/@types/react/index.d.ts +4378 -0
- package/node_modules/@types/react/jsx-dev-runtime.d.ts +33 -0
- package/node_modules/@types/react/jsx-runtime.d.ts +24 -0
- package/node_modules/@types/react/package.json +210 -0
- package/node_modules/@types/react/ts5.0/canary.d.ts +129 -0
- package/node_modules/@types/react/ts5.0/experimental.d.ts +184 -0
- package/node_modules/@types/react/ts5.0/global.d.ts +166 -0
- package/node_modules/@types/react/ts5.0/index.d.ts +4365 -0
- package/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +33 -0
- package/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +24 -0
- package/node_modules/csstype/LICENSE +19 -0
- package/node_modules/csstype/README.md +291 -0
- package/node_modules/csstype/index.d.ts +22569 -0
- package/node_modules/csstype/index.js.flow +6863 -0
- package/node_modules/csstype/package.json +70 -0
- package/node_modules/entities/LICENSE +11 -0
- package/node_modules/entities/decode.d.ts +1 -0
- package/node_modules/entities/decode.js +3 -0
- package/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +19 -0
- package/node_modules/entities/dist/commonjs/decode-codepoint.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/node_modules/entities/dist/commonjs/decode-codepoint.js.map +1 -0
- package/node_modules/entities/dist/commonjs/decode.d.ts +209 -0
- package/node_modules/entities/dist/commonjs/decode.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/decode.js +511 -0
- package/node_modules/entities/dist/commonjs/decode.js.map +1 -0
- package/node_modules/entities/dist/commonjs/encode.d.ts +22 -0
- package/node_modules/entities/dist/commonjs/encode.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/encode.js +73 -0
- package/node_modules/entities/dist/commonjs/encode.js.map +1 -0
- package/node_modules/entities/dist/commonjs/escape.d.ts +43 -0
- package/node_modules/entities/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/escape.js +121 -0
- package/node_modules/entities/dist/commonjs/escape.js.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +2 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-html.js +10 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +2 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +10 -0
- package/node_modules/entities/dist/commonjs/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/dist/commonjs/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/generated/encode-html.js +13 -0
- package/node_modules/entities/dist/commonjs/generated/encode-html.js.map +1 -0
- package/node_modules/entities/dist/commonjs/index.d.ts +96 -0
- package/node_modules/entities/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/entities/dist/commonjs/index.js +131 -0
- package/node_modules/entities/dist/commonjs/index.js.map +1 -0
- package/node_modules/entities/dist/commonjs/package.json +3 -0
- package/node_modules/entities/dist/esm/decode-codepoint.d.ts +19 -0
- package/node_modules/entities/dist/esm/decode-codepoint.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/decode-codepoint.js +72 -0
- package/node_modules/entities/dist/esm/decode-codepoint.js.map +1 -0
- package/node_modules/entities/dist/esm/decode.d.ts +209 -0
- package/node_modules/entities/dist/esm/decode.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/decode.js +497 -0
- package/node_modules/entities/dist/esm/decode.js.map +1 -0
- package/node_modules/entities/dist/esm/encode.d.ts +22 -0
- package/node_modules/entities/dist/esm/encode.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/encode.js +69 -0
- package/node_modules/entities/dist/esm/encode.js.map +1 -0
- package/node_modules/entities/dist/esm/escape.d.ts +43 -0
- package/node_modules/entities/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/escape.js +117 -0
- package/node_modules/entities/dist/esm/escape.js.map +1 -0
- package/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +2 -0
- package/node_modules/entities/dist/esm/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/generated/decode-data-html.js +7 -0
- package/node_modules/entities/dist/esm/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +2 -0
- package/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/generated/decode-data-xml.js +7 -0
- package/node_modules/entities/dist/esm/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/dist/esm/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/dist/esm/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/generated/encode-html.js +10 -0
- package/node_modules/entities/dist/esm/generated/encode-html.js.map +1 -0
- package/node_modules/entities/dist/esm/index.d.ts +96 -0
- package/node_modules/entities/dist/esm/index.d.ts.map +1 -0
- package/node_modules/entities/dist/esm/index.js +107 -0
- package/node_modules/entities/dist/esm/index.js.map +1 -0
- package/node_modules/entities/dist/esm/package.json +3 -0
- package/node_modules/entities/escape.d.ts +1 -0
- package/node_modules/entities/escape.js +3 -0
- package/node_modules/entities/package.json +118 -0
- package/node_modules/entities/readme.md +122 -0
- package/node_modules/entities/src/decode-codepoint.ts +81 -0
- package/node_modules/entities/src/decode.spec.ts +320 -0
- package/node_modules/entities/src/decode.ts +620 -0
- package/node_modules/entities/src/encode.spec.ts +78 -0
- package/node_modules/entities/src/encode.ts +77 -0
- package/node_modules/entities/src/escape.spec.ts +14 -0
- package/node_modules/entities/src/escape.ts +148 -0
- package/node_modules/entities/src/generated/.eslintrc.json +10 -0
- package/node_modules/entities/src/generated/decode-data-html.ts +8 -0
- package/node_modules/entities/src/generated/decode-data-xml.ts +8 -0
- package/node_modules/entities/src/generated/encode-html.ts +17 -0
- package/node_modules/entities/src/index.spec.ts +125 -0
- package/node_modules/entities/src/index.ts +188 -0
- package/node_modules/parse5/LICENSE +19 -0
- package/node_modules/parse5/README.md +38 -0
- package/node_modules/parse5/dist/cjs/common/doctype.d.ts +4 -0
- package/node_modules/parse5/dist/cjs/common/doctype.js +118 -0
- package/node_modules/parse5/dist/cjs/common/error-codes.d.ts +67 -0
- package/node_modules/parse5/dist/cjs/common/error-codes.js +66 -0
- package/node_modules/parse5/dist/cjs/common/foreign-content.d.ts +9 -0
- package/node_modules/parse5/dist/cjs/common/foreign-content.js +237 -0
- package/node_modules/parse5/dist/cjs/common/html.d.ts +289 -0
- package/node_modules/parse5/dist/cjs/common/html.js +528 -0
- package/node_modules/parse5/dist/cjs/common/token.d.ts +84 -0
- package/node_modules/parse5/dist/cjs/common/token.js +24 -0
- package/node_modules/parse5/dist/cjs/common/unicode.d.ts +42 -0
- package/node_modules/parse5/dist/cjs/common/unicode.js +70 -0
- package/node_modules/parse5/dist/cjs/index.d.ts +71 -0
- package/node_modules/parse5/dist/cjs/index.js +54 -0
- package/node_modules/parse5/dist/cjs/package.json +1 -0
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.d.ts +36 -0
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.js +114 -0
- package/node_modules/parse5/dist/cjs/parser/index.d.ts +221 -0
- package/node_modules/parse5/dist/cjs/parser/index.js +3240 -0
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.d.ts +53 -0
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.js +328 -0
- package/node_modules/parse5/dist/cjs/serializer/index.d.ts +60 -0
- package/node_modules/parse5/dist/cjs/serializer/index.js +172 -0
- package/node_modules/parse5/dist/cjs/tokenizer/index.d.ts +247 -0
- package/node_modules/parse5/dist/cjs/tokenizer/index.js +2714 -0
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.d.ts +36 -0
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.js +200 -0
- package/node_modules/parse5/dist/cjs/tree-adapters/default.d.ts +84 -0
- package/node_modules/parse5/dist/cjs/tree-adapters/default.js +176 -0
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.d.ts +255 -0
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.js +2 -0
- package/node_modules/parse5/dist/common/doctype.d.ts +4 -0
- package/node_modules/parse5/dist/common/doctype.js +114 -0
- package/node_modules/parse5/dist/common/error-codes.d.ts +67 -0
- package/node_modules/parse5/dist/common/error-codes.js +63 -0
- package/node_modules/parse5/dist/common/foreign-content.d.ts +9 -0
- package/node_modules/parse5/dist/common/foreign-content.js +228 -0
- package/node_modules/parse5/dist/common/html.d.ts +289 -0
- package/node_modules/parse5/dist/common/html.js +523 -0
- package/node_modules/parse5/dist/common/token.d.ts +84 -0
- package/node_modules/parse5/dist/common/token.js +20 -0
- package/node_modules/parse5/dist/common/unicode.d.ts +42 -0
- package/node_modules/parse5/dist/common/unicode.js +62 -0
- package/node_modules/parse5/dist/index.d.ts +71 -0
- package/node_modules/parse5/dist/index.js +42 -0
- package/node_modules/parse5/dist/parser/formatting-element-list.d.ts +36 -0
- package/node_modules/parse5/dist/parser/formatting-element-list.js +110 -0
- package/node_modules/parse5/dist/parser/index.d.ts +221 -0
- package/node_modules/parse5/dist/parser/index.js +3245 -0
- package/node_modules/parse5/dist/parser/open-element-stack.d.ts +53 -0
- package/node_modules/parse5/dist/parser/open-element-stack.js +324 -0
- package/node_modules/parse5/dist/serializer/index.d.ts +60 -0
- package/node_modules/parse5/dist/serializer/index.js +168 -0
- package/node_modules/parse5/dist/tokenizer/index.d.ts +247 -0
- package/node_modules/parse5/dist/tokenizer/index.js +2710 -0
- package/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +36 -0
- package/node_modules/parse5/dist/tokenizer/preprocessor.js +196 -0
- package/node_modules/parse5/dist/tree-adapters/default.d.ts +84 -0
- package/node_modules/parse5/dist/tree-adapters/default.js +173 -0
- package/node_modules/parse5/dist/tree-adapters/interface.d.ts +255 -0
- package/node_modules/parse5/dist/tree-adapters/interface.js +1 -0
- package/node_modules/parse5/package.json +50 -0
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +108 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/node_modules/undici-types/errors.d.ts +149 -0
- package/node_modules/undici-types/eventsource.d.ts +61 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +71 -0
- package/node_modules/undici-types/interceptors.d.ts +17 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +33 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +39 -0
- package/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/node_modules/undici-types/readable.d.ts +65 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/webidl.d.ts +228 -0
- package/node_modules/undici-types/websocket.d.ts +150 -0
- package/package.json +80 -0
- package/scripts/rebuild-forme.mjs +61 -0
- package/src/app/AppearanceControl.tsx +44 -0
- package/src/app/AssetThemeDefaults.tsx +87 -0
- package/src/app/AssetsBrowser.tsx +273 -0
- package/src/app/CommentDock.tsx +108 -0
- package/src/app/CreateDocumentDialog.tsx +51 -0
- package/src/app/DocumentActions.tsx +69 -0
- package/src/app/DocumentCard.tsx +50 -0
- package/src/app/DocumentViewControl.tsx +31 -0
- package/src/app/DocumentsBrowser.tsx +70 -0
- package/src/app/ExportHistoryDialog.tsx +86 -0
- package/src/app/ExportMenu.tsx +127 -0
- package/src/app/GuideDialog.tsx +80 -0
- package/src/app/InspectionLayer.tsx +77 -0
- package/src/app/LogoUploadDialog.tsx +92 -0
- package/src/app/Markdown.tsx +34 -0
- package/src/app/MaterialsBrowser.tsx +149 -0
- package/src/app/PageNumberInput.tsx +56 -0
- package/src/app/Pdf.tsx +561 -0
- package/src/app/ProjectDialogs.tsx +100 -0
- package/src/app/Reader.tsx +769 -0
- package/src/app/SearchField.tsx +13 -0
- package/src/app/Sidebar.tsx +86 -0
- package/src/app/SkillIndex.tsx +30 -0
- package/src/app/TemplatesBrowser.tsx +149 -0
- package/src/app/ThemesBrowser.tsx +159 -0
- package/src/app/api.ts +47 -0
- package/src/app/appearance.ts +35 -0
- package/src/app/assets.css +139 -0
- package/src/app/catalogPreview.ts +20 -0
- package/src/app/colors.css +167 -0
- package/src/app/comment-dock.css +53 -0
- package/src/app/commentDrafts.ts +67 -0
- package/src/app/componentCorrection.ts +17 -0
- package/src/app/edit-workbench.css +87 -0
- package/src/app/editSession.ts +238 -0
- package/src/app/editorRecovery.ts +25 -0
- package/src/app/export-history.css +31 -0
- package/src/app/export.css +17 -0
- package/src/app/guideLinks.ts +21 -0
- package/src/app/guides.css +40 -0
- package/src/app/main.tsx +221 -0
- package/src/app/materials.css +53 -0
- package/src/app/pdfLoading.ts +12 -0
- package/src/app/pdfSelection.ts +112 -0
- package/src/app/projects.css +63 -0
- package/src/app/reader-toolbar.css +65 -0
- package/src/app/selection.css +150 -0
- package/src/app/sidebar.css +60 -0
- package/src/app/skills.css +7 -0
- package/src/app/style.css +1061 -0
- package/src/app/templates.css +49 -0
- package/src/app/themes.css +80 -0
- package/src/app/ui/Icon.tsx +92 -0
- package/src/app/ui/README.md +27 -0
- package/src/app/ui/fonts.css +36 -0
- package/src/app/ui/index.tsx +223 -0
- package/src/app/ui/ui.css +388 -0
- package/src/app/useReaderPreview.ts +19 -0
- package/src/app/useTextEditing.ts +155 -0
- package/src/assets/adapter.ts +122 -0
- package/src/assets/files.ts +378 -0
- package/src/assets/import-worker.ts +294 -0
- package/src/assets/imports.ts +124 -0
- package/src/assets/index.ts +60 -0
- package/src/assets/store.ts +798 -0
- package/src/assets/usage.ts +118 -0
- package/src/cli/check.ts +25 -0
- package/src/cli/init.ts +119 -0
- package/src/cli/lock.ts +34 -0
- package/src/cli/main.ts +118 -0
- package/src/cli/process.ts +19 -0
- package/src/cli/start.ts +96 -0
- package/src/cli/update.ts +348 -0
- package/src/cli/workspace.ts +94 -0
- package/src/document/index.tsx +641 -0
- package/src/document/page.tsx +53 -0
- package/src/document/text-targets.tsx +162 -0
- package/src/media/files.ts +124 -0
- package/src/media/render.ts +63 -0
- package/src/rendering/resolve-sources.ts +84 -0
- package/src/runtime/jsx-dev-runtime.ts +2 -0
- package/src/runtime/jsx-runtime.ts +2 -0
- package/src/runtime/paths.ts +12 -0
- package/src/server/assets-cli.ts +162 -0
- package/src/server/assets-http.ts +100 -0
- package/src/server/client.ts +50 -0
- package/src/server/clipboard.ts +22 -0
- package/src/server/comments-cli.ts +64 -0
- package/src/server/comments.ts +130 -0
- package/src/server/create-cli.ts +33 -0
- package/src/server/create.ts +228 -0
- package/src/server/dependencies.ts +91 -0
- package/src/server/documents.ts +143 -0
- package/src/server/edits.ts +249 -0
- package/src/server/export-batch.ts +105 -0
- package/src/server/export-errors.ts +2 -0
- package/src/server/export-file.ts +57 -0
- package/src/server/export-inputs.ts +66 -0
- package/src/server/export-preview.ts +69 -0
- package/src/server/export.ts +32 -0
- package/src/server/exports.ts +283 -0
- package/src/server/files.ts +21 -0
- package/src/server/guides.ts +71 -0
- package/src/server/index.ts +432 -0
- package/src/server/materials.ts +39 -0
- package/src/server/media-cli.ts +73 -0
- package/src/server/media-mutations.ts +168 -0
- package/src/server/pptx.ts +160 -0
- package/src/server/preflight.ts +129 -0
- package/src/server/projects-cli.ts +29 -0
- package/src/server/projects.ts +187 -0
- package/src/server/render-error.ts +9 -0
- package/src/server/render-source.ts +24 -0
- package/src/server/render.ts +48 -0
- package/src/server/review-cli.ts +40 -0
- package/src/server/review.ts +161 -0
- package/src/server/selection.ts +23 -0
- package/src/server/source-overrides.ts +97 -0
- package/src/server/templates-cli.ts +51 -0
- package/src/server/templates.ts +186 -0
- package/src/server/text-layout.ts +41 -0
- package/src/server/text-source.ts +307 -0
- package/src/server/themes-cli.ts +59 -0
- package/src/server/themes.ts +215 -0
- package/src/server/ttf2eot.d.ts +3 -0
- package/src/server/worker.ts +166 -0
- package/src/server/workspace.ts +242 -0
- package/src/shared/anchors.ts +69 -0
- package/src/shared/assets.ts +154 -0
- package/src/shared/export.ts +34 -0
- package/src/shared/media.ts +33 -0
- package/src/shared/projects.ts +19 -0
- package/src/shared/selection.ts +94 -0
- package/src/shared/skill-index.ts +14 -0
- package/src/shared/starters.ts +19 -0
- package/src/shared/templates.ts +18 -0
- package/src/shared/themes.ts +24 -0
- package/src/shared/types.ts +39 -0
- package/src/template/index.ts +27 -0
- package/src/themes/index.ts +3 -0
- package/src/themes/neutral.ts +20 -0
- package/src/themes/types.ts +110 -0
- package/starter/assets/brand/wordmark.png +0 -0
- package/starter/assets/fonts/InterUI-LICENSE.txt +93 -0
- package/starter/assets/fonts/InterUI-Medium.ttf +0 -0
- package/starter/assets/fonts/InterUI-Regular.ttf +0 -0
- package/starter/assets/fonts/InterUI-source.json +19 -0
- package/starter/assets/fonts/OpenDocMono-Regular.ttf +0 -0
- package/starter/assets/fonts/OpenDocSans-Italic.ttf +0 -0
- package/starter/assets/fonts/OpenDocSans-Regular.ttf +0 -0
- package/starter/assets/fonts/OpenDocSans-Semibold.ttf +0 -0
- package/starter/assets/fonts/OpenDocSans-SemiboldItalic.ttf +0 -0
- package/starter/assets/fonts/OpenDocSerif-Italic.ttf +0 -0
- package/starter/assets/fonts/OpenDocSerif-Regular.ttf +0 -0
- package/starter/assets/fonts/OpenDocSerif-Semibold.ttf +0 -0
- package/starter/assets/fonts/OpenDocSerif-SemiboldItalic.ttf +0 -0
- package/starter/assets/fonts/SourceCode-LICENSE.md +93 -0
- package/starter/assets/fonts/SourceSans-LICENSE.md +93 -0
- package/starter/assets/fonts/SourceSerif-LICENSE.md +93 -0
- package/starter/assets/fonts/geist/OFL.txt +93 -0
- package/starter/assets/fonts/geist/asset.json +7 -0
- package/starter/assets/fonts/geist/files/1a9874b3be0fc168692a3d2327bccb4d28835653d3b91537a755296a467a83e3.ttf +0 -0
- package/starter/assets/fonts/geist/files/a8eefb873ba9c9020665f8a98302697ce1f3b79ab2deef6ee508c0ca6a82e876.ttf +0 -0
- package/starter/assets/fonts/geist/files/ccce59465ae5c61930ada5453834f60500fbd95084d85db63e0e65fad0125455.ttf +0 -0
- package/starter/assets/fonts/geist/files/f5e95110d70593672515080bee9148463ada0a7f77b89ed65a3d43cb2b0ff83a.pdf +0 -0
- package/starter/assets/fonts/geist/revisions/9a2bc12fb2f23cb27bc227087e63e1407bb804ee0586480bd6b7966ec69fb474.json +60 -0
- package/starter/assets/fonts/inter/OFL.txt +93 -0
- package/starter/assets/fonts/inter/asset.json +7 -0
- package/starter/assets/fonts/inter/files/1b08e7fc267a5c7e1d614100f604b83e7e8a0be241f0f288faa2b3ac93a683ba.ttf +0 -0
- package/starter/assets/fonts/inter/files/5b6f0c6f26e5c554a64cdcc3a9b5d802b7f9aec6206f1dbcfcdcad7b5860a2a9.ttf +0 -0
- package/starter/assets/fonts/inter/files/957db8560d510a198a7d0333fae7b6b444b00c20801581126273978d778eb3c3.pdf +0 -0
- package/starter/assets/fonts/inter/files/b37284b5701b6b168dfc770aa1a4ac492106422fd3ba76bc7641e37434e8019c.ttf +0 -0
- package/starter/assets/fonts/inter/files/c1811d32ac0f6eed1bbf57529f2ecdfc6c717d48a969dd864942436315a1b198.ttf +0 -0
- package/starter/assets/fonts/inter/files/e7a1aaf7eda9f2fad4131725fa556265ec75ca7b2d756260173a040363e8d4f7.ttf +0 -0
- package/starter/assets/fonts/inter/files/ef8f755d933b9310804cc9152f1f18cb2ac460d6b05054ec913d889c9f11f79e.ttf +0 -0
- package/starter/assets/fonts/inter/revisions/600391517c413963b71e278a57c26c40366c81fa3939a6b9755f446206766d12.json +99 -0
- package/starter/assets/fonts/inter/source.json +57 -0
- package/starter/assets/fonts/lato/OFL.txt +93 -0
- package/starter/assets/fonts/lato/asset.json +7 -0
- package/starter/assets/fonts/lato/files/4a6b566dbb28adb473a8789ce5169306f42f0c8a070ac92bae93636f36348b0d.pdf +0 -0
- package/starter/assets/fonts/lato/files/5adeb6b334d8fb99ef053bc052b952773d544315e0e1d668a12c0ce8bd51375c.ttf +0 -0
- package/starter/assets/fonts/lato/files/62c1b7f0d2e74b45960154c3520efc337b553db0961bfdc950d5618334596cc8.ttf +0 -0
- package/starter/assets/fonts/lato/files/71b8b7decbe75a881ed267be539d402bd1e9420b799658aada4e0d1bd5af803c.ttf +0 -0
- package/starter/assets/fonts/lato/files/8a0aace75d33794eece4b28187bfc1df0bbd2888b5d8a56e01788c8d65d16be1.ttf +0 -0
- package/starter/assets/fonts/lato/files/d636e4683231f931eda222d588e944d082bfd3bdba02f928bee461c0f185b251.ttf +0 -0
- package/starter/assets/fonts/lato/files/e399c44efe1387100531d26c7e4800c5d12251b890d6654a3098c7c679cb1786.ttf +0 -0
- package/starter/assets/fonts/lato/revisions/49ccb93400a9d466fab7d9843b1ecf8916ec6d47a475dd79a597a22eb39616bc.json +99 -0
- package/starter/assets/fonts/lato/source.json +57 -0
- package/starter/assets/fonts/merriweather/OFL.txt +93 -0
- package/starter/assets/fonts/merriweather/asset.json +7 -0
- package/starter/assets/fonts/merriweather/files/1c54f91b910454251c4c2b7bd4e472e1abf265fba7ca3c0ef2eee2f41324099e.ttf +0 -0
- package/starter/assets/fonts/merriweather/files/8bde8da2bb7f0265e27ba0481f70bb48d0f98a976c145f2f239c648ddd6532e0.pdf +0 -0
- package/starter/assets/fonts/merriweather/files/90b7db4460fcd1a5ca49575c2668a793f3cd6447664d312a068d690e1c01e6bc.ttf +0 -0
- package/starter/assets/fonts/merriweather/files/afff81272b7653417bb6f8bef57add055b1f9fda36f27eba5f32b40752bd08da.ttf +0 -0
- package/starter/assets/fonts/merriweather/files/e029d3b71e5bae3877c73f4f2b15af28db16593d49b0aed2a328d37ff7075846.ttf +0 -0
- package/starter/assets/fonts/merriweather/files/e9864a6790bf712a04e20f3662b206a1535186ed3e877fd859dd5fb9682335df.ttf +0 -0
- package/starter/assets/fonts/merriweather/files/fa71baebdd20a7d0de2e5e445a5922530fe9e1d740efbe791f113b682d3cb093.ttf +0 -0
- package/starter/assets/fonts/merriweather/revisions/1888e390b3e4f38a3d7cd2dc1bb805aeb6ce13f986a97656f0265fd436bc91d2.json +99 -0
- package/starter/assets/fonts/merriweather/source.json +57 -0
- package/starter/assets/fonts/open-sans/OFL.txt +92 -0
- package/starter/assets/fonts/open-sans/asset.json +7 -0
- package/starter/assets/fonts/open-sans/files/1bc0594a83762b2c25d38915a34464b7fec6088298ca22d151757bf98d6700ec.ttf +0 -0
- package/starter/assets/fonts/open-sans/files/47ed1cfaa7ffca04a04ab850b2938fd52c09d1b44cfa3e2980878e166b0cbd87.ttf +0 -0
- package/starter/assets/fonts/open-sans/files/574939af301f07df8e21cfff279465c5981dd9d9cf62086f7515897df951c6f5.pdf +0 -0
- package/starter/assets/fonts/open-sans/files/6d3884d0d57c1b67e9c50c54eca7b69c535c114e76bd7a9cfda0258588185553.ttf +0 -0
- package/starter/assets/fonts/open-sans/files/733eb93b167e6d45de09aa768f6c0355647c2c26f5416dbc7407a08ed41e81c6.ttf +0 -0
- package/starter/assets/fonts/open-sans/files/75367e6da7d914eaed87883ba51b2a2b5816b5cdbb39f96ec5c81a5b032bfd5a.ttf +0 -0
- package/starter/assets/fonts/open-sans/files/ff4fdc11204e0edd14e9a0bb6c374b847a9093b0ec2c16702e03afca79ac4ef7.ttf +0 -0
- package/starter/assets/fonts/open-sans/revisions/bbbe3a4915b9bccbc883c0decb4097511c43b6bd09ae22a1516aff128c219bc5.json +99 -0
- package/starter/assets/fonts/open-sans/source.json +57 -0
- package/starter/assets/fonts/roboto/OFL.txt +93 -0
- package/starter/assets/fonts/roboto/asset.json +7 -0
- package/starter/assets/fonts/roboto/files/22d45d989248a624252b8382067ac56550212fa675dcdbaf12f03d297dd87a58.pdf +0 -0
- package/starter/assets/fonts/roboto/files/35757eaa996b3359022f47f164a67ee9eac04971af24c5b8fbd4b89e844ff190.ttf +0 -0
- package/starter/assets/fonts/roboto/files/4d3035883c531846bd1ce2dc89f36d932e72dc114f56062c7e3a9cdd74f3d3ea.ttf +0 -0
- package/starter/assets/fonts/roboto/files/be7639306a4fc4a02ce2ae2ff59eb1335e4db4a7379dd0a384ed7cc053817789.ttf +0 -0
- package/starter/assets/fonts/roboto/files/d2920cbb1b60a3fd11fbf22049286e43a6baf522d37fdf1e7c89562319bcfea5.ttf +0 -0
- package/starter/assets/fonts/roboto/files/dece7c71bbe61710787f0839c722c65e87355dd2eb4a823e6b5488121ff81e4b.ttf +0 -0
- package/starter/assets/fonts/roboto/files/f478ba88b0292e685e487901dfbb1401457d32d6ebee4030cdfd5698235bffa8.ttf +0 -0
- package/starter/assets/fonts/roboto/revisions/bda5e2d84c17313373dd2dbf3e64fe0dd450c7e1b59e6929e69557e122fe976e.json +99 -0
- package/starter/assets/fonts/roboto/source.json +57 -0
- package/starter/assets/logos/opendoc/asset.json +6 -0
- package/starter/assets/logos/opendoc/files/831d5ccd9eb6709cc8439ea257c03d81452e81a28a3d1eedbd6a3b7daff687b6.png +0 -0
- package/starter/assets/logos/opendoc/revisions/834dde8926ddb81de687254195a168bb13bfb77803307f1257de1f2228be63b2.json +33 -0
- package/starter/assets/ui-fonts/geist/OFL.txt +93 -0
- package/starter/assets/ui-fonts/geist/geist-latin-ext-wght-italic.woff2 +0 -0
- package/starter/assets/ui-fonts/geist/geist-latin-ext-wght-normal.woff2 +0 -0
- package/starter/assets/ui-fonts/geist/geist-latin-wght-italic.woff2 +0 -0
- package/starter/assets/ui-fonts/geist/geist-latin-wght-normal.woff2 +0 -0
- package/starter/assets/ui-fonts/geist/source.json +26 -0
- package/starter/documents/welcome/assets.json +7 -0
- package/starter/documents/welcome/index.tsx +160 -0
- package/starter/documents/welcome/media/.gitkeep +0 -0
- package/starter/documents/welcome/media/paper-architecture/image.png +0 -0
- package/starter/documents/welcome/media/paper-architecture/meta.json +9 -0
- package/starter/documents/welcome/media/paper-architecture/prompt.txt +1 -0
- package/starter/documents/welcome/media/studio-rhythm/chart.svg +2343 -0
- package/starter/documents/welcome/media/studio-rhythm/data.json +234 -0
- package/starter/documents/welcome/media/studio-rhythm/generation.json +9 -0
- package/starter/documents/welcome/media/studio-rhythm/image.png +0 -0
- package/starter/documents/welcome/media/studio-rhythm/meta.json +11 -0
- package/starter/documents/welcome/media/studio-rhythm/recipe.py +79 -0
- package/starter/documents/welcome/theme.tsx +5 -0
- package/starter/documents/welcome-presentation/assets.json +7 -0
- package/starter/documents/welcome-presentation/index.tsx +166 -0
- package/starter/documents/welcome-presentation/media/.gitkeep +0 -0
- package/starter/documents/welcome-presentation/media/paper-architecture/image.png +0 -0
- package/starter/documents/welcome-presentation/media/paper-architecture/meta.json +9 -0
- package/starter/documents/welcome-presentation/media/paper-architecture/prompt.txt +1 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/chart.svg +1336 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/data.json +234 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/generation.json +9 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/image.png +0 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/meta.json +13 -0
- package/starter/documents/welcome-presentation/media/studio-rhythm/recipe.py +49 -0
- package/starter/documents/welcome-presentation/theme.tsx +5 -0
- package/starter/projects.json +17 -0
- package/starter/templates/AGENTS.md +9 -0
- package/starter/templates/_shared/BusinessLogo.tsx +14 -0
- package/starter/templates/_shared/Pricing.tsx +40 -0
- package/starter/templates/_shared/commerce.ts +93 -0
- package/starter/templates/brand-guidelines/AGENTS.md +32 -0
- package/starter/templates/brand-guidelines/index.tsx +62 -0
- package/starter/templates/brand-guidelines/preview.tsx +181 -0
- package/starter/templates/brand-guidelines/starter.tsx +179 -0
- package/starter/templates/brand-guidelines/template.json +15 -0
- package/starter/templates/business-proposal/AGENTS.md +13 -0
- package/starter/templates/business-proposal/README.md +36 -0
- package/starter/templates/business-proposal/data.json +37 -0
- package/starter/templates/business-proposal/examples/long.json +142 -0
- package/starter/templates/business-proposal/examples/sparse.json +17 -0
- package/starter/templates/business-proposal/examples/typical.json +37 -0
- package/starter/templates/business-proposal/index.tsx +59 -0
- package/starter/templates/business-proposal/preview.tsx +47 -0
- package/starter/templates/business-proposal/schema.ts +14 -0
- package/starter/templates/business-proposal/starter.tsx +18 -0
- package/starter/templates/business-proposal/template.json +11 -0
- package/starter/templates/company-profile/AGENTS.md +48 -0
- package/starter/templates/company-profile/index.tsx +69 -0
- package/starter/templates/company-profile/preview.tsx +185 -0
- package/starter/templates/company-profile/starter.tsx +186 -0
- package/starter/templates/company-profile/template.json +15 -0
- package/starter/templates/consulting-report/AGENTS.md +11 -0
- package/starter/templates/consulting-report/README.md +13 -0
- package/starter/templates/consulting-report/RESEARCH.md +10 -0
- package/starter/templates/consulting-report/index.tsx +44 -0
- package/starter/templates/consulting-report/preview.tsx +39 -0
- package/starter/templates/consulting-report/starter.tsx +15 -0
- package/starter/templates/consulting-report/template.json +11 -0
- package/starter/templates/editorial-essay/AGENTS.md +11 -0
- package/starter/templates/editorial-essay/README.md +11 -0
- package/starter/templates/editorial-essay/index.tsx +30 -0
- package/starter/templates/editorial-essay/preview.tsx +26 -0
- package/starter/templates/editorial-essay/starter.tsx +15 -0
- package/starter/templates/editorial-essay/template.json +11 -0
- package/starter/templates/executive-brief/AGENTS.md +9 -0
- package/starter/templates/executive-brief/README.md +11 -0
- package/starter/templates/executive-brief/index.tsx +33 -0
- package/starter/templates/executive-brief/preview.tsx +37 -0
- package/starter/templates/executive-brief/starter.tsx +11 -0
- package/starter/templates/executive-brief/template.json +11 -0
- package/starter/templates/image-story/AGENTS.md +37 -0
- package/starter/templates/image-story/index.tsx +106 -0
- package/starter/templates/image-story/preview.tsx +33 -0
- package/starter/templates/image-story/starter.tsx +24 -0
- package/starter/templates/image-story/template.json +13 -0
- package/starter/templates/invoice/AGENTS.md +13 -0
- package/starter/templates/invoice/README.md +40 -0
- package/starter/templates/invoice/data.json +61 -0
- package/starter/templates/invoice/examples/long.json +241 -0
- package/starter/templates/invoice/examples/sparse.json +33 -0
- package/starter/templates/invoice/examples/typical.json +61 -0
- package/starter/templates/invoice/index.tsx +57 -0
- package/starter/templates/invoice/preview.tsx +12 -0
- package/starter/templates/invoice/schema.ts +45 -0
- package/starter/templates/invoice/starter.tsx +12 -0
- package/starter/templates/invoice/template.json +11 -0
- package/starter/templates/literary-text/AGENTS.md +9 -0
- package/starter/templates/literary-text/README.md +11 -0
- package/starter/templates/literary-text/index.tsx +31 -0
- package/starter/templates/literary-text/preview.tsx +20 -0
- package/starter/templates/literary-text/starter.tsx +11 -0
- package/starter/templates/literary-text/template.json +11 -0
- package/starter/templates/magazine-feature/AGENTS.md +11 -0
- package/starter/templates/magazine-feature/README.md +13 -0
- package/starter/templates/magazine-feature/index.tsx +41 -0
- package/starter/templates/magazine-feature/preview.tsx +34 -0
- package/starter/templates/magazine-feature/starter.tsx +15 -0
- package/starter/templates/magazine-feature/template.json +11 -0
- package/starter/templates/monthly-report/AGENTS.md +11 -0
- package/starter/templates/monthly-report/README.md +24 -0
- package/starter/templates/monthly-report/data.json +131 -0
- package/starter/templates/monthly-report/examples/long.json +519 -0
- package/starter/templates/monthly-report/examples/sparse.json +20 -0
- package/starter/templates/monthly-report/examples/typical.json +37 -0
- package/starter/templates/monthly-report/index.tsx +92 -0
- package/starter/templates/monthly-report/preview.tsx +14 -0
- package/starter/templates/monthly-report/schema.ts +127 -0
- package/starter/templates/monthly-report/starter.tsx +13 -0
- package/starter/templates/monthly-report/template.json +11 -0
- package/starter/templates/pitch-deck/AGENTS.md +32 -0
- package/starter/templates/pitch-deck/index.tsx +46 -0
- package/starter/templates/pitch-deck/preview.tsx +142 -0
- package/starter/templates/pitch-deck/starter.tsx +140 -0
- package/starter/templates/pitch-deck/template.json +15 -0
- package/starter/templates/proposal-deck/AGENTS.md +25 -0
- package/starter/templates/proposal-deck/index.tsx +52 -0
- package/starter/templates/proposal-deck/preview.tsx +172 -0
- package/starter/templates/proposal-deck/starter.tsx +168 -0
- package/starter/templates/proposal-deck/template.json +7 -0
- package/starter/templates/quotation/AGENTS.md +13 -0
- package/starter/templates/quotation/README.md +42 -0
- package/starter/templates/quotation/data.json +64 -0
- package/starter/templates/quotation/examples/long.json +272 -0
- package/starter/templates/quotation/examples/sparse.json +31 -0
- package/starter/templates/quotation/examples/typical.json +64 -0
- package/starter/templates/quotation/index.tsx +51 -0
- package/starter/templates/quotation/preview.tsx +12 -0
- package/starter/templates/quotation/schema.ts +27 -0
- package/starter/templates/quotation/starter.tsx +12 -0
- package/starter/templates/quotation/template.json +11 -0
- package/starter/templates/scientific-paper/AGENTS.md +11 -0
- package/starter/templates/scientific-paper/README.md +13 -0
- package/starter/templates/scientific-paper/index.tsx +47 -0
- package/starter/templates/scientific-paper/preview.tsx +43 -0
- package/starter/templates/scientific-paper/starter.tsx +15 -0
- package/starter/templates/scientific-paper/template.json +11 -0
- package/starter/themes/Specimen.tsx +54 -0
- package/starter/themes/civic-spectrum/components.tsx +92 -0
- package/starter/themes/civic-spectrum/design.md +70 -0
- package/starter/themes/civic-spectrum/index.ts +57 -0
- package/starter/themes/civic-spectrum/preview.tsx +66 -0
- package/starter/themes/field-manual/components.tsx +106 -0
- package/starter/themes/field-manual/design.md +72 -0
- package/starter/themes/field-manual/index.ts +57 -0
- package/starter/themes/field-manual/preview.tsx +82 -0
- package/starter/themes/index.ts +3 -0
- package/starter/themes/mckinsey-consulting/components.tsx +69 -0
- package/starter/themes/mckinsey-consulting/design.md +68 -0
- package/starter/themes/mckinsey-consulting/index.ts +60 -0
- package/starter/themes/mckinsey-consulting/preview.tsx +53 -0
- package/starter/themes/neutral/design.md +35 -0
- package/starter/themes/neutral/index.ts +21 -0
- package/starter/themes/neutral/preview.tsx +4 -0
- package/starter/themes/opendoc-neutral/components.tsx +77 -0
- package/starter/themes/opendoc-neutral/design.md +70 -0
- package/starter/themes/opendoc-neutral/index.ts +54 -0
- package/starter/themes/opendoc-neutral/preview.tsx +43 -0
- package/starter/themes/types.ts +3 -0
- package/tsconfig.workspace.json +24 -0
- package/vendor/formepdf/LICENSE +21 -0
- package/vendor/formepdf/README.md +97 -0
- package/vendor/formepdf/font-subset.patch +228 -0
- package/vendor/formepdf/text-writer.patch +507 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract embedded JSON data from a Forme-generated PDF.
|
|
3
|
+
*
|
|
4
|
+
* Scans the PDF bytes for a `forme-data.json` EmbeddedFile attachment,
|
|
5
|
+
* decompresses the stream, and parses the JSON. Returns `null` if the
|
|
6
|
+
* PDF doesn't contain embedded data (e.g. non-Forme PDF).
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractData(pdfBytes: Uint8Array): unknown | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { inflateSync } from 'node:zlib';
|
|
2
|
+
/**
|
|
3
|
+
* Extract embedded JSON data from a Forme-generated PDF.
|
|
4
|
+
*
|
|
5
|
+
* Scans the PDF bytes for a `forme-data.json` EmbeddedFile attachment,
|
|
6
|
+
* decompresses the stream, and parses the JSON. Returns `null` if the
|
|
7
|
+
* PDF doesn't contain embedded data (e.g. non-Forme PDF).
|
|
8
|
+
*/
|
|
9
|
+
export function extractData(pdfBytes) {
|
|
10
|
+
const text = new TextDecoder('latin1').decode(pdfBytes);
|
|
11
|
+
// Find the FileSpec referencing forme-data.json
|
|
12
|
+
const fsMatch = text.match(/\/F\s*\(forme-data\.json\)/);
|
|
13
|
+
if (!fsMatch)
|
|
14
|
+
return null;
|
|
15
|
+
// Extract the EmbeddedFile stream object number from /EF << /F N 0 R >>
|
|
16
|
+
// Search around the FileSpec location for the /EF reference
|
|
17
|
+
const fsStart = fsMatch.index;
|
|
18
|
+
const fsRegion = text.slice(Math.max(0, fsStart - 200), fsStart + 200);
|
|
19
|
+
const efMatch = fsRegion.match(/\/EF\s*<<\s*\/F\s+(\d+)\s+0\s+R\s*>>/);
|
|
20
|
+
if (!efMatch)
|
|
21
|
+
return null;
|
|
22
|
+
const streamObjId = efMatch[1];
|
|
23
|
+
// Find the stream object: "N 0 obj ... stream\n...\nendstream"
|
|
24
|
+
const objPattern = new RegExp(streamObjId + '\\s+0\\s+obj\\b');
|
|
25
|
+
const objMatch = text.match(objPattern);
|
|
26
|
+
if (!objMatch)
|
|
27
|
+
return null;
|
|
28
|
+
const objStart = objMatch.index;
|
|
29
|
+
// Find stream start (after "stream\r\n" or "stream\n")
|
|
30
|
+
const streamKeyword = text.indexOf('stream', objStart);
|
|
31
|
+
if (streamKeyword === -1)
|
|
32
|
+
return null;
|
|
33
|
+
let streamDataStart = streamKeyword + 6; // "stream".length
|
|
34
|
+
// Skip \r\n or \n after "stream"
|
|
35
|
+
if (pdfBytes[streamDataStart] === 0x0d)
|
|
36
|
+
streamDataStart++; // \r
|
|
37
|
+
if (pdfBytes[streamDataStart] === 0x0a)
|
|
38
|
+
streamDataStart++; // \n
|
|
39
|
+
// Find endstream
|
|
40
|
+
const endstreamPos = text.indexOf('\nendstream', streamDataStart);
|
|
41
|
+
if (endstreamPos === -1)
|
|
42
|
+
return null;
|
|
43
|
+
const compressedBytes = pdfBytes.slice(streamDataStart, endstreamPos);
|
|
44
|
+
// Check if FlateDecode is used
|
|
45
|
+
const objRegion = text.slice(objStart, streamKeyword);
|
|
46
|
+
const isCompressed = objRegion.includes('/FlateDecode');
|
|
47
|
+
let jsonBytes;
|
|
48
|
+
if (isCompressed) {
|
|
49
|
+
jsonBytes = inflateSync(Buffer.from(compressedBytes));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
jsonBytes = compressedBytes;
|
|
53
|
+
}
|
|
54
|
+
const jsonString = new TextDecoder('utf-8').decode(jsonBytes);
|
|
55
|
+
return JSON.parse(jsonString);
|
|
56
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { type AttachmentOptions, type FacturXOptions } from './attachments.js';
|
|
3
|
+
export interface Color {
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
a: number;
|
|
8
|
+
}
|
|
9
|
+
export interface EdgeValues<T> {
|
|
10
|
+
top: T;
|
|
11
|
+
right: T;
|
|
12
|
+
bottom: T;
|
|
13
|
+
left: T;
|
|
14
|
+
}
|
|
15
|
+
export interface CornerValues {
|
|
16
|
+
top_left: number;
|
|
17
|
+
top_right: number;
|
|
18
|
+
bottom_right: number;
|
|
19
|
+
bottom_left: number;
|
|
20
|
+
}
|
|
21
|
+
export type ElementFlexDirection = 'Row' | 'Column' | 'RowReverse' | 'ColumnReverse';
|
|
22
|
+
export type ElementJustifyContent = 'FlexStart' | 'FlexEnd' | 'Center' | 'SpaceBetween' | 'SpaceAround' | 'SpaceEvenly';
|
|
23
|
+
export type ElementAlignItems = 'FlexStart' | 'FlexEnd' | 'Center' | 'Stretch' | 'Baseline';
|
|
24
|
+
export type ElementAlignContent = 'FlexStart' | 'FlexEnd' | 'Center' | 'SpaceBetween' | 'SpaceAround' | 'SpaceEvenly' | 'Stretch';
|
|
25
|
+
export type ElementFlexWrap = 'NoWrap' | 'Wrap' | 'WrapReverse';
|
|
26
|
+
export type ElementFontStyle = 'Normal' | 'Italic' | 'Oblique';
|
|
27
|
+
export type ElementTextAlign = 'Left' | 'Right' | 'Center' | 'Justify';
|
|
28
|
+
export type ElementTextDecoration = 'None' | 'Underline' | 'LineThrough';
|
|
29
|
+
export type ElementTextTransform = 'None' | 'Uppercase' | 'Lowercase' | 'Capitalize';
|
|
30
|
+
export type ElementOverflow = 'Visible' | 'Hidden';
|
|
31
|
+
export type ElementPosition = 'Relative' | 'Absolute';
|
|
32
|
+
/**
|
|
33
|
+
* Semantic role of a layout node. Note the specific transforms below
|
|
34
|
+
* (also documented on `ElementInfo`) — this union describes what the
|
|
35
|
+
* runtime actually emits, not what the JSX author wrote:
|
|
36
|
+
*
|
|
37
|
+
* - Six discrete heading tags (`H1`–`H6`) — NO generic `'Heading'`
|
|
38
|
+
* - `Table` wrapper containing `TableRow` / `TableCell` — one wrapper per
|
|
39
|
+
* page fragment when the table breaks across pages (clone semantics,
|
|
40
|
+
* like `View`). Before engine 0.14 layout unwrapped tables to sibling
|
|
41
|
+
* rows; the wrapper was added so table-level border/background paint
|
|
42
|
+
* and structural consumers get a real table node.
|
|
43
|
+
* - `List` + `ListItem` + `Lbl` — from `<OrderedList>` / `<UnorderedList>`
|
|
44
|
+
* - `FixedHeader` / `FixedFooter` — NO single `Fixed` (split by position)
|
|
45
|
+
* - `Bookmark` — zero-height marker from `bookmark` on a container, emitted
|
|
46
|
+
* on every container path (fits or overflowing) and the sole carrier of
|
|
47
|
+
* the outline entry
|
|
48
|
+
* - `TextLine` — leaf lines under `Text` blocks (holds `textContent`)
|
|
49
|
+
* - Inline `<Strong>`/`<Em>`/`<Code>`/`<Link>` do not appear here;
|
|
50
|
+
* they contribute style runs within `TextLine`
|
|
51
|
+
*
|
|
52
|
+
* ### When adding a new value here
|
|
53
|
+
*
|
|
54
|
+
* Also add a `<Component>` that produces the new nodeType to
|
|
55
|
+
* `RICH_FIXTURE` in `packages/core/tests/layout-shape.test.ts`.
|
|
56
|
+
* A coverage tripwire in that file fails otherwise ("declared but
|
|
57
|
+
* never rendered"), on the exact drift risk this whole file exists
|
|
58
|
+
* to prevent.
|
|
59
|
+
*/
|
|
60
|
+
export type ElementNodeType = 'View' | 'Text' | 'TextLine' | 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'Table' | 'TableRow' | 'TableCell' | 'List' | 'ListItem' | 'Lbl' | 'FixedHeader' | 'FixedFooter' | 'Bookmark' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Canvas' | 'Watermark' | 'BarChart' | 'LineChart' | 'PieChart' | 'AreaChart' | 'DotPlot' | 'TextField' | 'Checkbox' | 'Dropdown' | 'RadioButton';
|
|
61
|
+
/**
|
|
62
|
+
* Drawing kind for the node. Governs the PDF operator the serializer
|
|
63
|
+
* emits; NOT the same as `nodeType`, which describes semantic role.
|
|
64
|
+
*/
|
|
65
|
+
export type ElementKind = 'None' | 'Rect' | 'Text' | 'Image' | 'Svg' | 'QrCode' | 'Barcode' | 'Chart' | 'FormField' | 'Watermark';
|
|
66
|
+
export interface ElementStyleInfo {
|
|
67
|
+
flexDirection: ElementFlexDirection;
|
|
68
|
+
justifyContent: ElementJustifyContent;
|
|
69
|
+
alignItems: ElementAlignItems;
|
|
70
|
+
alignContent: ElementAlignContent;
|
|
71
|
+
flexWrap: ElementFlexWrap;
|
|
72
|
+
flexGrow: number;
|
|
73
|
+
flexShrink: number;
|
|
74
|
+
gap: number;
|
|
75
|
+
columnGap: number;
|
|
76
|
+
rowGap: number;
|
|
77
|
+
position: ElementPosition;
|
|
78
|
+
/** Offset from parent, in points. Only meaningful when `position === 'Absolute'`. */
|
|
79
|
+
top?: number;
|
|
80
|
+
right?: number;
|
|
81
|
+
bottom?: number;
|
|
82
|
+
left?: number;
|
|
83
|
+
margin: EdgeValues<number>;
|
|
84
|
+
padding: EdgeValues<number>;
|
|
85
|
+
borderWidth: EdgeValues<number>;
|
|
86
|
+
borderColor: EdgeValues<Color>;
|
|
87
|
+
borderRadius: CornerValues;
|
|
88
|
+
/**
|
|
89
|
+
* Explicit `style.width` from the source. May be a number (points) or
|
|
90
|
+
* a stringified value (e.g. percentage) — the layout engine formats
|
|
91
|
+
* some dimension variants as strings in the JSON output. Prefer the
|
|
92
|
+
* top-level `ElementInfo.width` for the resolved rendered width.
|
|
93
|
+
*/
|
|
94
|
+
width?: number | string;
|
|
95
|
+
/** Explicit `style.height`. See `width` for shape notes. */
|
|
96
|
+
height?: number | string;
|
|
97
|
+
fontFamily: string;
|
|
98
|
+
fontSize: number;
|
|
99
|
+
fontWeight: number;
|
|
100
|
+
fontStyle: ElementFontStyle;
|
|
101
|
+
lineHeight: number;
|
|
102
|
+
letterSpacing: number;
|
|
103
|
+
textAlign: ElementTextAlign;
|
|
104
|
+
textDecoration: ElementTextDecoration;
|
|
105
|
+
textTransform: ElementTextTransform;
|
|
106
|
+
color: Color;
|
|
107
|
+
backgroundColor: Color | null;
|
|
108
|
+
opacity: number;
|
|
109
|
+
overflow: ElementOverflow;
|
|
110
|
+
breakBefore: boolean;
|
|
111
|
+
breakable: boolean;
|
|
112
|
+
minOrphanLines: number;
|
|
113
|
+
minWidowLines: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A single node in the layout tree returned by
|
|
117
|
+
* `renderDocumentWithLayout()`. The tree does NOT mirror the JSX
|
|
118
|
+
* source — several transforms happen during layout:
|
|
119
|
+
*
|
|
120
|
+
* - `<Table>` is unwrapped. Its `<Row>` children appear as sibling
|
|
121
|
+
* `TableRow` nodes at the containing page/View level. There is no
|
|
122
|
+
* `Table` wrapper node.
|
|
123
|
+
* - `<OrderedList>` and `<UnorderedList>` both produce a `List` node
|
|
124
|
+
* containing `ListItem` children. Each `ListItem` has a `Lbl` child
|
|
125
|
+
* (the marker "1." / "•") followed by the item's own content children.
|
|
126
|
+
* - `<Fixed position="header">` produces a `FixedHeader` nodeType and
|
|
127
|
+
* `<Fixed position="footer">` produces `FixedFooter`. There is no
|
|
128
|
+
* single `Fixed` nodeType.
|
|
129
|
+
* - Headings render as six discrete `H1` … `H6` nodeTypes. There is
|
|
130
|
+
* no generic `Heading` nodeType with a `level` field.
|
|
131
|
+
* - `<Text>` block content is split into `TextLine` leaf children.
|
|
132
|
+
* The actual text lives on `TextLine.textContent`; on non-`TextLine`
|
|
133
|
+
* nodes (including the parent `Text` block), `textContent` is `null`.
|
|
134
|
+
* - Inline elements (`<Strong>`, `<Em>`, `<Code>`, `<Link>`) do NOT
|
|
135
|
+
* appear as their own nodes — they contribute style runs within
|
|
136
|
+
* `TextLine` leaves.
|
|
137
|
+
* - `<PageBreak>` produces no node. It triggers a page break at
|
|
138
|
+
* layout time and is otherwise invisible.
|
|
139
|
+
* - `bookmark` on a container (`<View>`, `<Page>`, and bare `<ListItem>` /
|
|
140
|
+
* `<TableRow>` / `<TableCell>`) produces a zero-height `Bookmark` marker
|
|
141
|
+
* node (no rect, draws nothing) so the entry reaches the PDF outline.
|
|
142
|
+
* The marker is emitted whether or not the container overflows a page,
|
|
143
|
+
* and it is the ONLY element carrying that `bookmark` — one marker, one
|
|
144
|
+
* outline entry.
|
|
145
|
+
* Caveat: `bookmark` on a NON-container (`<Text>`, `<Image>`, `<Svg>`,
|
|
146
|
+
* charts, form fields) still rides on that node's own element, and rows
|
|
147
|
+
* or cells laid out inside a `<Table>` carry it on the row/cell element.
|
|
148
|
+
* So `Bookmark` nodes are not an exhaustive index of the document's
|
|
149
|
+
* bookmarks — scan the `bookmark` field for that.
|
|
150
|
+
*
|
|
151
|
+
* The runtime-conformance test in this package asserts every one of
|
|
152
|
+
* these transforms explicitly. If it breaks, update this JSDoc first.
|
|
153
|
+
*/
|
|
154
|
+
export interface ElementInfo {
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
width: number;
|
|
158
|
+
height: number;
|
|
159
|
+
kind: ElementKind;
|
|
160
|
+
nodeType: ElementNodeType;
|
|
161
|
+
style: ElementStyleInfo;
|
|
162
|
+
children: ElementInfo[];
|
|
163
|
+
/**
|
|
164
|
+
* Rendered text for this line. Present ONLY on `TextLine` nodeType
|
|
165
|
+
* leaves — every non-`TextLine` node (including the parent `Text`
|
|
166
|
+
* block) emits `null` here at runtime. If you need the text of a
|
|
167
|
+
* `Text` block, concatenate its `TextLine` children's `textContent`.
|
|
168
|
+
*/
|
|
169
|
+
textContent?: string | null;
|
|
170
|
+
/**
|
|
171
|
+
* Source file / line / column of the JSX that produced this node.
|
|
172
|
+
* Populated only when the render pipeline seeds
|
|
173
|
+
* `globalThis.__formeSourceMap` — currently only the CLI dev server
|
|
174
|
+
* does that. Production `renderDocument` / `renderDocumentWithLayout`
|
|
175
|
+
* calls never populate this field.
|
|
176
|
+
*/
|
|
177
|
+
sourceLocation?: {
|
|
178
|
+
file: string;
|
|
179
|
+
line: number;
|
|
180
|
+
column: number;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
export interface PageInfo {
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
contentX: number;
|
|
187
|
+
contentY: number;
|
|
188
|
+
contentWidth: number;
|
|
189
|
+
contentHeight: number;
|
|
190
|
+
elements: ElementInfo[];
|
|
191
|
+
}
|
|
192
|
+
export interface LayoutInfo {
|
|
193
|
+
pages: PageInfo[];
|
|
194
|
+
}
|
|
195
|
+
export interface RenderWithLayoutResult {
|
|
196
|
+
pdf: Uint8Array;
|
|
197
|
+
layout: LayoutInfo;
|
|
198
|
+
/**
|
|
199
|
+
* Non-fatal warnings raised during rendering (e.g. `pdfUa: true` was
|
|
200
|
+
* requested but no embeddable font was registered, so a standard font
|
|
201
|
+
* was left unembedded). Empty when nothing went wrong.
|
|
202
|
+
*/
|
|
203
|
+
warnings: string[];
|
|
204
|
+
}
|
|
205
|
+
export declare function renderPdf(json: string): Promise<Uint8Array>;
|
|
206
|
+
export declare function renderPdfWithLayout(json: string): Promise<RenderWithLayoutResult>;
|
|
207
|
+
export interface CertificationConfig {
|
|
208
|
+
certificatePem: string;
|
|
209
|
+
privateKeyPem: string;
|
|
210
|
+
reason?: string;
|
|
211
|
+
location?: string;
|
|
212
|
+
contact?: string;
|
|
213
|
+
visible?: boolean;
|
|
214
|
+
page?: number;
|
|
215
|
+
x?: number;
|
|
216
|
+
y?: number;
|
|
217
|
+
width?: number;
|
|
218
|
+
height?: number;
|
|
219
|
+
}
|
|
220
|
+
/** @deprecated Use CertificationConfig */
|
|
221
|
+
export type SignatureConfig = CertificationConfig;
|
|
222
|
+
export interface RenderDocumentOptions {
|
|
223
|
+
/** Data to embed as a hidden JSON attachment in the PDF. */
|
|
224
|
+
embedData?: unknown;
|
|
225
|
+
/** When true, form field values are rendered as static text. No interactive fields in output. */
|
|
226
|
+
flattenForms?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Files to embed as PDF attachments (associated files). Under a
|
|
229
|
+
* PDF/A-3 level each becomes a conformant associated file; PDF/A-2
|
|
230
|
+
* refuses attachments (it only allows other PDF/A files).
|
|
231
|
+
*/
|
|
232
|
+
attachments?: AttachmentOptions[];
|
|
233
|
+
/**
|
|
234
|
+
* Factur-X / ZUGFeRD e-invoice container: embeds the caller-supplied
|
|
235
|
+
* invoice XML with the spec filename, MIME type, `/AFRelationship`,
|
|
236
|
+
* and XMP identification. Requires `pdfa: "3b"` (or 3a/3u) on the
|
|
237
|
+
* `<Document>`. Forme does not generate or validate the XML itself.
|
|
238
|
+
*/
|
|
239
|
+
facturX?: FacturXOptions;
|
|
240
|
+
}
|
|
241
|
+
export declare function renderDocument(element: ReactElement, options?: RenderDocumentOptions): Promise<Uint8Array>;
|
|
242
|
+
export declare function renderDocumentWithLayout(element: ReactElement, options?: RenderDocumentOptions): Promise<RenderWithLayoutResult>;
|
|
243
|
+
/**
|
|
244
|
+
* Render a pre-serialized document object (from `serialize()`) to PDF,
|
|
245
|
+
* resolving font sources (file paths, byte arrays) and HTTP image URLs
|
|
246
|
+
* first.
|
|
247
|
+
*
|
|
248
|
+
* Use this when you have a serialized doc (e.g. from a non-react
|
|
249
|
+
* adapter that calls its own `serialize()`) and need font/image
|
|
250
|
+
* resolution without going through the React element-based
|
|
251
|
+
* `renderDocument()`. The browser and worker entries export the same
|
|
252
|
+
* pair.
|
|
253
|
+
*/
|
|
254
|
+
export declare function renderSerializedDoc(doc: Record<string, unknown>, options?: RenderDocumentOptions): Promise<Uint8Array>;
|
|
255
|
+
/**
|
|
256
|
+
* Like `renderSerializedDoc` but also returns layout info for overlays.
|
|
257
|
+
*/
|
|
258
|
+
export declare function renderSerializedDocWithLayout(doc: Record<string, unknown>, options?: RenderDocumentOptions): Promise<RenderWithLayoutResult>;
|
|
259
|
+
export declare function renderTemplate(templateJson: string, dataJson: string): Promise<Uint8Array>;
|
|
260
|
+
export declare function renderTemplateWithLayout(templateJson: string, dataJson: string): Promise<RenderWithLayoutResult>;
|
|
261
|
+
export declare function certifyPdf(pdfBytes: Uint8Array, config: CertificationConfig): Promise<Uint8Array>;
|
|
262
|
+
/** @deprecated Use certifyPdf */
|
|
263
|
+
export declare const signPdf: typeof certifyPdf;
|
|
264
|
+
export interface RedactionRegion {
|
|
265
|
+
/** 0-indexed page number. */
|
|
266
|
+
page: number;
|
|
267
|
+
/** X coordinate in points from the left edge. */
|
|
268
|
+
x: number;
|
|
269
|
+
/** Y coordinate in points from the top edge (web/screen coordinates). */
|
|
270
|
+
y: number;
|
|
271
|
+
/** Width of the redaction rectangle in points. */
|
|
272
|
+
width: number;
|
|
273
|
+
/** Height of the redaction rectangle in points. */
|
|
274
|
+
height: number;
|
|
275
|
+
/** Fill color as hex string (e.g. "#000000"). Defaults to black. */
|
|
276
|
+
color?: string;
|
|
277
|
+
}
|
|
278
|
+
export declare function redactPdf(pdfBytes: Uint8Array, regions: RedactionRegion[]): Promise<Uint8Array>;
|
|
279
|
+
export interface RedactionPattern {
|
|
280
|
+
/** The text or regex pattern to search for. */
|
|
281
|
+
pattern: string;
|
|
282
|
+
/** 'Literal' for exact text match (case-insensitive), 'Regex' for regex. */
|
|
283
|
+
pattern_type: 'Literal' | 'Regex';
|
|
284
|
+
/** Optional 0-indexed page to restrict search to. */
|
|
285
|
+
page?: number;
|
|
286
|
+
/** Fill color as hex string (e.g. "#000000"). Defaults to black. */
|
|
287
|
+
color?: string;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Find text regions matching patterns in a PDF.
|
|
291
|
+
*
|
|
292
|
+
* Searches PDF content streams for literal or regex patterns and returns
|
|
293
|
+
* redaction regions (in web top-origin coordinates) for each match.
|
|
294
|
+
*/
|
|
295
|
+
export declare function findTextRegions(pdfBytes: Uint8Array, patterns: RedactionPattern[]): Promise<RedactionRegion[]>;
|
|
296
|
+
/**
|
|
297
|
+
* Redact text matching patterns from a PDF.
|
|
298
|
+
*
|
|
299
|
+
* Convenience wrapper: finds all text matching the patterns, then
|
|
300
|
+
* applies coordinate-based redaction to each match.
|
|
301
|
+
*/
|
|
302
|
+
export declare function redactText(pdfBytes: Uint8Array, patterns: RedactionPattern[]): Promise<Uint8Array>;
|
|
303
|
+
/**
|
|
304
|
+
* Merge multiple PDF documents into a single PDF.
|
|
305
|
+
*
|
|
306
|
+
* @param pdfs - Array of PDF byte arrays to merge in order.
|
|
307
|
+
* @returns The merged PDF as a Uint8Array.
|
|
308
|
+
*/
|
|
309
|
+
export declare function mergePdfs(pdfs: Uint8Array[]): Promise<Uint8Array>;
|
|
310
|
+
export { extractData } from './extract.js';
|
|
311
|
+
export type { AttachmentOptions, FacturXOptions, AfRelationship, FacturXProfile } from './attachments.js';
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Node entry uses the wasm-pack `--target nodejs` build, which is a
|
|
2
|
+
// self-initializing CJS module: it `require('fs').readFileSync`s its
|
|
3
|
+
// own .wasm at import time, so callers don't need to await any init.
|
|
4
|
+
import { render_pdf as wasmRenderPdf } from '../pkg-node/forme.js';
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
import { resolve } from 'node:path';
|
|
7
|
+
import { applyAttachmentOptions } from './attachments.js';
|
|
8
|
+
// ── Font resolution ──────────────────────────────────────────────
|
|
9
|
+
function uint8ArrayToBase64(bytes) {
|
|
10
|
+
return Buffer.from(bytes).toString('base64');
|
|
11
|
+
}
|
|
12
|
+
async function resolveFonts(doc) {
|
|
13
|
+
const fonts = doc.fonts;
|
|
14
|
+
if (!fonts?.length)
|
|
15
|
+
return;
|
|
16
|
+
for (const font of fonts) {
|
|
17
|
+
if (font.src instanceof Uint8Array) {
|
|
18
|
+
font.src = uint8ArrayToBase64(font.src);
|
|
19
|
+
}
|
|
20
|
+
else if (typeof font.src === 'string' && !font.src.startsWith('data:')) {
|
|
21
|
+
const bytes = await readFile(resolve(font.src));
|
|
22
|
+
font.src = uint8ArrayToBase64(new Uint8Array(bytes));
|
|
23
|
+
}
|
|
24
|
+
// data URIs pass through as-is (engine extracts base64 portion)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// ── Image resolution ─────────────────────────────────────────────
|
|
28
|
+
async function resolveImages(doc) {
|
|
29
|
+
const children = doc.children;
|
|
30
|
+
if (!children?.length)
|
|
31
|
+
return;
|
|
32
|
+
for (const child of children) {
|
|
33
|
+
await resolveImagesInNode(child);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function resolveImagesInNode(node) {
|
|
37
|
+
const kind = node.kind;
|
|
38
|
+
if (kind?.type === 'Image' && typeof kind.src === 'string') {
|
|
39
|
+
const src = kind.src;
|
|
40
|
+
if (src.startsWith('http://') || src.startsWith('https://')) {
|
|
41
|
+
const res = await fetch(src);
|
|
42
|
+
if (!res.ok)
|
|
43
|
+
throw new Error(`Failed to fetch image: ${src} (${res.status})`);
|
|
44
|
+
const contentType = res.headers.get('content-type') || 'image/png';
|
|
45
|
+
const buf = new Uint8Array(await res.arrayBuffer());
|
|
46
|
+
kind.src = `data:${contentType};base64,${uint8ArrayToBase64(buf)}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const children = node.children;
|
|
50
|
+
if (children?.length) {
|
|
51
|
+
for (const child of children) {
|
|
52
|
+
await resolveImagesInNode(child);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// ── Render functions ───────────────────────────────────────────────
|
|
57
|
+
export async function renderPdf(json) {
|
|
58
|
+
return wasmRenderPdf(json);
|
|
59
|
+
}
|
|
60
|
+
export async function renderPdfWithLayout(json) {
|
|
61
|
+
const { render_pdf_with_layout } = await import('../pkg-node/forme.js');
|
|
62
|
+
const result = render_pdf_with_layout(json);
|
|
63
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
64
|
+
}
|
|
65
|
+
export async function renderDocument(element, options) {
|
|
66
|
+
const { serialize } = await import('@formepdf/react');
|
|
67
|
+
const doc = serialize(element);
|
|
68
|
+
return renderSerializedDoc(doc, options);
|
|
69
|
+
}
|
|
70
|
+
export async function renderDocumentWithLayout(element, options) {
|
|
71
|
+
const { serialize } = await import('@formepdf/react');
|
|
72
|
+
const doc = serialize(element);
|
|
73
|
+
return renderSerializedDocWithLayout(doc, options);
|
|
74
|
+
}
|
|
75
|
+
// ── Serialized document rendering ────────────────────────────────────
|
|
76
|
+
/**
|
|
77
|
+
* Render a pre-serialized document object (from `serialize()`) to PDF,
|
|
78
|
+
* resolving font sources (file paths, byte arrays) and HTTP image URLs
|
|
79
|
+
* first.
|
|
80
|
+
*
|
|
81
|
+
* Use this when you have a serialized doc (e.g. from a non-react
|
|
82
|
+
* adapter that calls its own `serialize()`) and need font/image
|
|
83
|
+
* resolution without going through the React element-based
|
|
84
|
+
* `renderDocument()`. The browser and worker entries export the same
|
|
85
|
+
* pair.
|
|
86
|
+
*/
|
|
87
|
+
export async function renderSerializedDoc(doc, options) {
|
|
88
|
+
if (options?.embedData !== undefined) {
|
|
89
|
+
doc.embeddedData = JSON.stringify(options.embedData);
|
|
90
|
+
}
|
|
91
|
+
if (options?.flattenForms) {
|
|
92
|
+
doc.flattenForms = true;
|
|
93
|
+
}
|
|
94
|
+
applyAttachmentOptions(doc, options);
|
|
95
|
+
await Promise.all([resolveFonts(doc), resolveImages(doc)]);
|
|
96
|
+
return renderPdf(JSON.stringify(doc));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Like `renderSerializedDoc` but also returns layout info for overlays.
|
|
100
|
+
*/
|
|
101
|
+
export async function renderSerializedDocWithLayout(doc, options) {
|
|
102
|
+
if (options?.embedData !== undefined) {
|
|
103
|
+
doc.embeddedData = JSON.stringify(options.embedData);
|
|
104
|
+
}
|
|
105
|
+
if (options?.flattenForms) {
|
|
106
|
+
doc.flattenForms = true;
|
|
107
|
+
}
|
|
108
|
+
applyAttachmentOptions(doc, options);
|
|
109
|
+
await Promise.all([resolveFonts(doc), resolveImages(doc)]);
|
|
110
|
+
return renderPdfWithLayout(JSON.stringify(doc));
|
|
111
|
+
}
|
|
112
|
+
// ── Template rendering ──────────────────────────────────────────────
|
|
113
|
+
export async function renderTemplate(templateJson, dataJson) {
|
|
114
|
+
const { render_template_pdf } = await import('../pkg-node/forme.js');
|
|
115
|
+
return render_template_pdf(templateJson, dataJson);
|
|
116
|
+
}
|
|
117
|
+
export async function renderTemplateWithLayout(templateJson, dataJson) {
|
|
118
|
+
const { render_template_pdf_with_layout } = await import('../pkg-node/forme.js');
|
|
119
|
+
const result = render_template_pdf_with_layout(templateJson, dataJson);
|
|
120
|
+
return { ...result, warnings: result.warnings ?? [] };
|
|
121
|
+
}
|
|
122
|
+
// ── PDF certification ────────────────────────────────────────────────
|
|
123
|
+
export async function certifyPdf(pdfBytes, config) {
|
|
124
|
+
const { certify_pdf } = await import('../pkg-node/forme.js');
|
|
125
|
+
return certify_pdf(pdfBytes, JSON.stringify(config));
|
|
126
|
+
}
|
|
127
|
+
/** @deprecated Use certifyPdf */
|
|
128
|
+
export const signPdf = certifyPdf;
|
|
129
|
+
export async function redactPdf(pdfBytes, regions) {
|
|
130
|
+
const { redact_pdf } = await import('../pkg-node/forme.js');
|
|
131
|
+
return redact_pdf(pdfBytes, JSON.stringify(regions));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Find text regions matching patterns in a PDF.
|
|
135
|
+
*
|
|
136
|
+
* Searches PDF content streams for literal or regex patterns and returns
|
|
137
|
+
* redaction regions (in web top-origin coordinates) for each match.
|
|
138
|
+
*/
|
|
139
|
+
export async function findTextRegions(pdfBytes, patterns) {
|
|
140
|
+
const { find_text_regions } = await import('../pkg-node/forme.js');
|
|
141
|
+
const json = find_text_regions(pdfBytes, JSON.stringify(patterns));
|
|
142
|
+
return JSON.parse(json);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Redact text matching patterns from a PDF.
|
|
146
|
+
*
|
|
147
|
+
* Convenience wrapper: finds all text matching the patterns, then
|
|
148
|
+
* applies coordinate-based redaction to each match.
|
|
149
|
+
*/
|
|
150
|
+
export async function redactText(pdfBytes, patterns) {
|
|
151
|
+
const { redact_text } = await import('../pkg-node/forme.js');
|
|
152
|
+
return redact_text(pdfBytes, JSON.stringify(patterns));
|
|
153
|
+
}
|
|
154
|
+
// ── PDF merging ──────────────────────────────────────────────────────
|
|
155
|
+
/**
|
|
156
|
+
* Merge multiple PDF documents into a single PDF.
|
|
157
|
+
*
|
|
158
|
+
* @param pdfs - Array of PDF byte arrays to merge in order.
|
|
159
|
+
* @returns The merged PDF as a Uint8Array.
|
|
160
|
+
*/
|
|
161
|
+
export async function mergePdfs(pdfs) {
|
|
162
|
+
const { merge_pdfs } = await import('../pkg-node/forme.js');
|
|
163
|
+
const base64Pdfs = pdfs.map((pdf) => Buffer.from(pdf).toString('base64'));
|
|
164
|
+
return merge_pdfs(JSON.stringify(base64Pdfs));
|
|
165
|
+
}
|
|
166
|
+
// ── Data extraction ──────────────────────────────────────────────────
|
|
167
|
+
export { extractData } from './extract.js';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable accessor helpers for the layout tree returned by
|
|
3
|
+
* `renderDocumentWithLayout()`.
|
|
4
|
+
*
|
|
5
|
+
* These helpers exist for one specific reason: the raw `ElementInfo` /
|
|
6
|
+
* `LayoutInfo` shape is documented but the documentation is not a
|
|
7
|
+
* contract, and it has drifted from runtime twice now. Consumers that
|
|
8
|
+
* hard-code invariants like "the text lives on `TextLine` children,
|
|
9
|
+
* not the parent `Text`" break silently every time an internal refactor
|
|
10
|
+
* shifts them.
|
|
11
|
+
*
|
|
12
|
+
* The helpers in this module encapsulate those invariants once, in a
|
|
13
|
+
* narrow, deliberately-maintained surface. Each helper corresponds to
|
|
14
|
+
* one of the layout-time transforms documented on `ElementInfo`. When
|
|
15
|
+
* an invariant changes in the engine, this file is where you update it
|
|
16
|
+
* — the runtime-conformance test (`tests/layout-shape.test.ts`) catches
|
|
17
|
+
* engine drift; helper tests (`tests/layout-helpers.test.ts`) catch
|
|
18
|
+
* drift in the helpers themselves.
|
|
19
|
+
*
|
|
20
|
+
* **Prefer these helpers to raw tree walking unless you specifically
|
|
21
|
+
* need raw shape access** (e.g. custom snapshot comparison, structural
|
|
22
|
+
* analysis the helpers don't cover).
|
|
23
|
+
*/
|
|
24
|
+
import type { LayoutInfo, PageInfo, ElementInfo, ElementNodeType } from './index.js';
|
|
25
|
+
/**
|
|
26
|
+
* Any of the layout-tree root shapes a helper might reasonably accept.
|
|
27
|
+
* All helpers that traverse the tree accept this union so consumers
|
|
28
|
+
* don't have to unwrap `layout.pages[0].elements` themselves.
|
|
29
|
+
*/
|
|
30
|
+
export type LayoutRoot = LayoutInfo | PageInfo | PageInfo[] | ElementInfo | ElementInfo[];
|
|
31
|
+
/**
|
|
32
|
+
* Depth-first walk of every node in `root`, calling `cb` for each.
|
|
33
|
+
*
|
|
34
|
+
* `path` is a human-readable string identifying where in the tree the
|
|
35
|
+
* node lives (e.g. `"[0].children[2]"` for the third child of the first
|
|
36
|
+
* root element). Useful for building error messages; ignore if you
|
|
37
|
+
* don't need it.
|
|
38
|
+
*
|
|
39
|
+
* Callbacks that return `false` skip descent into that node's children.
|
|
40
|
+
* Any other return (including `void`) descends normally.
|
|
41
|
+
*/
|
|
42
|
+
export declare function walkElements(root: LayoutRoot, cb: (node: ElementInfo, path: string) => void | boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Every node in `root` for which `predicate` returns truthy. Order is
|
|
45
|
+
* depth-first, source-order.
|
|
46
|
+
*/
|
|
47
|
+
export declare function findElements(root: LayoutRoot, predicate: (node: ElementInfo, path: string) => boolean): ElementInfo[];
|
|
48
|
+
/**
|
|
49
|
+
* First node in `root` for which `predicate` returns truthy, or `null`
|
|
50
|
+
* if none. Order is depth-first, source-order. Stops as soon as a match
|
|
51
|
+
* is found (does not descend into the match's children).
|
|
52
|
+
*/
|
|
53
|
+
export declare function findFirstElement(root: LayoutRoot, predicate: (node: ElementInfo, path: string) => boolean): ElementInfo | null;
|
|
54
|
+
/**
|
|
55
|
+
* Every `TextLine` leaf descendant of `node`, in source order. If
|
|
56
|
+
* `node` is itself a `TextLine`, returns `[node]`.
|
|
57
|
+
*
|
|
58
|
+
* This is the load-bearing helper: it encapsulates the invariant that
|
|
59
|
+
* text lives on `TextLine` children, never on the parent `Text` block.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getTextLines(node: ElementInfo): ElementInfo[];
|
|
62
|
+
/**
|
|
63
|
+
* Concatenated text of every `TextLine` descendant of `node`, joined
|
|
64
|
+
* with `"\n"`. If `node` is itself a `TextLine`, returns its own text.
|
|
65
|
+
*
|
|
66
|
+
* Lines are joined with newlines rather than spaces because the layout
|
|
67
|
+
* engine may have wrapped a single JSX string across multiple lines,
|
|
68
|
+
* and preserving that structure is more useful than silently smushing
|
|
69
|
+
* or space-joining. If you want a flat string, `.replace(/\n/g, ' ')`
|
|
70
|
+
* the result.
|
|
71
|
+
*
|
|
72
|
+
* Returns `""` if no `TextLine` descendants exist.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getNodeText(node: ElementInfo): string;
|
|
75
|
+
/**
|
|
76
|
+
* If `node` is a heading (`H1`–`H6`), returns the numeric level (1–6).
|
|
77
|
+
* Returns `null` otherwise.
|
|
78
|
+
*
|
|
79
|
+
* Encapsulates the invariant that headings render as six discriminated
|
|
80
|
+
* nodeTypes (`H1`, `H2`, …) rather than a generic `Heading` node with a
|
|
81
|
+
* separate `level` field.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getHeadingLevel(node: ElementInfo): 1 | 2 | 3 | 4 | 5 | 6 | null;
|
|
84
|
+
/**
|
|
85
|
+
* Every `TableRow` under `parent`, looking through `Table` wrapper nodes.
|
|
86
|
+
*
|
|
87
|
+
* Since engine 0.14, `<Table>` emits a `Table` container element per page
|
|
88
|
+
* fragment with the rows nested inside it. Pass the containing `page`
|
|
89
|
+
* (or the parent `View` that held the `<Table>` in JSX) as `parent` —
|
|
90
|
+
* or a `Table` element directly. Loose sibling rows (the pre-0.14 shape)
|
|
91
|
+
* are still returned for compatibility with stored layouts.
|
|
92
|
+
*
|
|
93
|
+
* Returns rows in source order.
|
|
94
|
+
*/
|
|
95
|
+
export declare function getTableRows(parent: PageInfo | ElementInfo): ElementInfo[];
|
|
96
|
+
/**
|
|
97
|
+
* The `FixedHeader` and `FixedFooter` nodes on `page`. Encapsulates the
|
|
98
|
+
* invariant that `<Fixed position="header">` and `<Fixed position="footer">`
|
|
99
|
+
* produce two distinct nodeTypes rather than a shared `Fixed` node with
|
|
100
|
+
* a `position` field.
|
|
101
|
+
*
|
|
102
|
+
* Both arrays may be empty. Multiple entries in either array indicate
|
|
103
|
+
* repeating fixed regions (e.g. when the same `<Fixed>` repeats across
|
|
104
|
+
* page breaks — the layout may emit one node per occurrence).
|
|
105
|
+
*/
|
|
106
|
+
export declare function getFixedRegions(page: PageInfo): {
|
|
107
|
+
header: ElementInfo[];
|
|
108
|
+
footer: ElementInfo[];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Every `ListItem` child of a `List` node. Returns `[]` if `list` is
|
|
112
|
+
* not a `List` (silently — no throw, so this composes cleanly with
|
|
113
|
+
* `.flatMap`).
|
|
114
|
+
*/
|
|
115
|
+
export declare function getListItems(list: ElementInfo): ElementInfo[];
|
|
116
|
+
/**
|
|
117
|
+
* Rendered text of the marker (`Lbl`) child of a `ListItem` — e.g.
|
|
118
|
+
* `"1."` for the first item of an `<OrderedList>`, `"•"` for an
|
|
119
|
+
* `<UnorderedList>` item. Returns `null` if `item` is not a `ListItem`
|
|
120
|
+
* or has no `Lbl` child.
|
|
121
|
+
*
|
|
122
|
+
* Encapsulates the invariant that list markers are separate `Lbl`
|
|
123
|
+
* children of each `ListItem` rather than a field on `ListItem` itself.
|
|
124
|
+
*/
|
|
125
|
+
export declare function getListItemMarker(item: ElementInfo): string | null;
|
|
126
|
+
/**
|
|
127
|
+
* Type-guard for narrowing to a specific `ElementNodeType`. Useful for
|
|
128
|
+
* `.filter(isNodeType('TableRow'))` chains.
|
|
129
|
+
*/
|
|
130
|
+
export declare function isNodeType<T extends ElementNodeType>(nodeType: T): (node: ElementInfo) => node is ElementInfo & {
|
|
131
|
+
nodeType: T;
|
|
132
|
+
};
|