@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,1024 @@
|
|
|
1
|
+
// ─── Style mapping ──────────────────────────────────────────────────
|
|
2
|
+
const FLEX_DIRECTION_MAP = {
|
|
3
|
+
'row': 'Row',
|
|
4
|
+
'column': 'Column',
|
|
5
|
+
'row-reverse': 'RowReverse',
|
|
6
|
+
'column-reverse': 'ColumnReverse',
|
|
7
|
+
};
|
|
8
|
+
const JUSTIFY_CONTENT_MAP = {
|
|
9
|
+
'flex-start': 'FlexStart',
|
|
10
|
+
'flex-end': 'FlexEnd',
|
|
11
|
+
'center': 'Center',
|
|
12
|
+
'space-between': 'SpaceBetween',
|
|
13
|
+
'space-around': 'SpaceAround',
|
|
14
|
+
'space-evenly': 'SpaceEvenly',
|
|
15
|
+
};
|
|
16
|
+
const ALIGN_ITEMS_MAP = {
|
|
17
|
+
'flex-start': 'FlexStart',
|
|
18
|
+
'flex-end': 'FlexEnd',
|
|
19
|
+
'center': 'Center',
|
|
20
|
+
'stretch': 'Stretch',
|
|
21
|
+
'baseline': 'Baseline',
|
|
22
|
+
};
|
|
23
|
+
const FLEX_WRAP_MAP = {
|
|
24
|
+
'nowrap': 'NoWrap',
|
|
25
|
+
'wrap': 'Wrap',
|
|
26
|
+
'wrap-reverse': 'WrapReverse',
|
|
27
|
+
};
|
|
28
|
+
const ALIGN_CONTENT_MAP = {
|
|
29
|
+
'flex-start': 'FlexStart',
|
|
30
|
+
'flex-end': 'FlexEnd',
|
|
31
|
+
'center': 'Center',
|
|
32
|
+
'space-between': 'SpaceBetween',
|
|
33
|
+
'space-around': 'SpaceAround',
|
|
34
|
+
'space-evenly': 'SpaceEvenly',
|
|
35
|
+
'stretch': 'Stretch',
|
|
36
|
+
};
|
|
37
|
+
const FONT_STYLE_MAP = {
|
|
38
|
+
'normal': 'Normal',
|
|
39
|
+
'italic': 'Italic',
|
|
40
|
+
'oblique': 'Oblique',
|
|
41
|
+
};
|
|
42
|
+
const TEXT_ALIGN_MAP = {
|
|
43
|
+
'left': 'Left',
|
|
44
|
+
'right': 'Right',
|
|
45
|
+
'center': 'Center',
|
|
46
|
+
'justify': 'Justify',
|
|
47
|
+
};
|
|
48
|
+
const TEXT_DECORATION_MAP = {
|
|
49
|
+
'none': 'None',
|
|
50
|
+
'underline': 'Underline',
|
|
51
|
+
'line-through': 'LineThrough',
|
|
52
|
+
};
|
|
53
|
+
const TEXT_TRANSFORM_MAP = {
|
|
54
|
+
'none': 'None',
|
|
55
|
+
'uppercase': 'Uppercase',
|
|
56
|
+
'lowercase': 'Lowercase',
|
|
57
|
+
'capitalize': 'Capitalize',
|
|
58
|
+
};
|
|
59
|
+
const HYPHENS_MAP = {
|
|
60
|
+
'none': 'none',
|
|
61
|
+
'manual': 'manual',
|
|
62
|
+
'auto': 'auto',
|
|
63
|
+
};
|
|
64
|
+
const TEXT_OVERFLOW_MAP = {
|
|
65
|
+
'wrap': 'Wrap',
|
|
66
|
+
'ellipsis': 'Ellipsis',
|
|
67
|
+
'clip': 'Clip',
|
|
68
|
+
};
|
|
69
|
+
const LINE_BREAKING_MAP = {
|
|
70
|
+
'optimal': 'optimal',
|
|
71
|
+
'greedy': 'greedy',
|
|
72
|
+
};
|
|
73
|
+
const OVERFLOW_MAP = {
|
|
74
|
+
'visible': 'Visible',
|
|
75
|
+
'hidden': 'Hidden',
|
|
76
|
+
};
|
|
77
|
+
export function mapStyle(style) {
|
|
78
|
+
if (!style)
|
|
79
|
+
return {};
|
|
80
|
+
const result = {};
|
|
81
|
+
// Dimensions
|
|
82
|
+
if (style.width !== undefined)
|
|
83
|
+
result.width = mapDimension(style.width);
|
|
84
|
+
if (style.height !== undefined)
|
|
85
|
+
result.height = mapDimension(style.height);
|
|
86
|
+
if (style.minWidth !== undefined)
|
|
87
|
+
result.minWidth = mapDimension(style.minWidth);
|
|
88
|
+
if (style.minHeight !== undefined)
|
|
89
|
+
result.minHeight = mapDimension(style.minHeight);
|
|
90
|
+
if (style.maxWidth !== undefined)
|
|
91
|
+
result.maxWidth = mapDimension(style.maxWidth);
|
|
92
|
+
if (style.maxHeight !== undefined)
|
|
93
|
+
result.maxHeight = mapDimension(style.maxHeight);
|
|
94
|
+
// Edges (individual > axis > base)
|
|
95
|
+
if (style.padding !== undefined || style.paddingTop !== undefined || style.paddingRight !== undefined || style.paddingBottom !== undefined || style.paddingLeft !== undefined || style.paddingHorizontal !== undefined || style.paddingVertical !== undefined) {
|
|
96
|
+
const base = style.padding !== undefined ? expandEdges(style.padding) : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
97
|
+
const vt = style.paddingVertical ?? base.top;
|
|
98
|
+
const vb = style.paddingVertical ?? base.bottom;
|
|
99
|
+
const hl = style.paddingHorizontal ?? base.left;
|
|
100
|
+
const hr = style.paddingHorizontal ?? base.right;
|
|
101
|
+
result.padding = {
|
|
102
|
+
top: style.paddingTop ?? vt,
|
|
103
|
+
right: style.paddingRight ?? hr,
|
|
104
|
+
bottom: style.paddingBottom ?? vb,
|
|
105
|
+
left: style.paddingLeft ?? hl,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (style.margin !== undefined || style.marginTop !== undefined || style.marginRight !== undefined || style.marginBottom !== undefined || style.marginLeft !== undefined || style.marginHorizontal !== undefined || style.marginVertical !== undefined) {
|
|
109
|
+
const base = style.margin !== undefined ? expandMarginEdges(style.margin) : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
110
|
+
const vt = style.marginVertical ?? base.top;
|
|
111
|
+
const vb = style.marginVertical ?? base.bottom;
|
|
112
|
+
const hl = style.marginHorizontal ?? base.left;
|
|
113
|
+
const hr = style.marginHorizontal ?? base.right;
|
|
114
|
+
result.margin = {
|
|
115
|
+
top: style.marginTop ?? vt,
|
|
116
|
+
right: style.marginRight ?? hr,
|
|
117
|
+
bottom: style.marginBottom ?? vb,
|
|
118
|
+
left: style.marginLeft ?? hl,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Flex shorthand: flex: N → flexGrow: N, flexShrink: 1, flexBasis: 0
|
|
122
|
+
if (style.flex !== undefined) {
|
|
123
|
+
if (style.flexGrow === undefined)
|
|
124
|
+
result.flexGrow = style.flex;
|
|
125
|
+
if (style.flexShrink === undefined)
|
|
126
|
+
result.flexShrink = 1;
|
|
127
|
+
if (style.flexBasis === undefined)
|
|
128
|
+
result.flexBasis = { Pt: 0 };
|
|
129
|
+
}
|
|
130
|
+
// Flex
|
|
131
|
+
if (style.flexDirection !== undefined)
|
|
132
|
+
result.flexDirection = FLEX_DIRECTION_MAP[style.flexDirection];
|
|
133
|
+
if (style.justifyContent !== undefined)
|
|
134
|
+
result.justifyContent = JUSTIFY_CONTENT_MAP[style.justifyContent];
|
|
135
|
+
if (style.alignItems !== undefined)
|
|
136
|
+
result.alignItems = ALIGN_ITEMS_MAP[style.alignItems];
|
|
137
|
+
if (style.alignSelf !== undefined)
|
|
138
|
+
result.alignSelf = ALIGN_ITEMS_MAP[style.alignSelf];
|
|
139
|
+
if (style.flexWrap !== undefined)
|
|
140
|
+
result.flexWrap = FLEX_WRAP_MAP[style.flexWrap];
|
|
141
|
+
if (style.alignContent !== undefined)
|
|
142
|
+
result.alignContent = ALIGN_CONTENT_MAP[style.alignContent];
|
|
143
|
+
if (style.flexGrow !== undefined)
|
|
144
|
+
result.flexGrow = style.flexGrow;
|
|
145
|
+
if (style.flexShrink !== undefined)
|
|
146
|
+
result.flexShrink = style.flexShrink;
|
|
147
|
+
if (style.flexBasis !== undefined)
|
|
148
|
+
result.flexBasis = mapDimension(style.flexBasis);
|
|
149
|
+
if (style.gap !== undefined)
|
|
150
|
+
result.gap = style.gap;
|
|
151
|
+
if (style.rowGap !== undefined)
|
|
152
|
+
result.rowGap = style.rowGap;
|
|
153
|
+
if (style.columnGap !== undefined)
|
|
154
|
+
result.columnGap = style.columnGap;
|
|
155
|
+
// Display mode
|
|
156
|
+
if (style.display !== undefined) {
|
|
157
|
+
result.display = style.display === 'grid' ? 'Grid' : 'Flex';
|
|
158
|
+
}
|
|
159
|
+
// CSS Grid
|
|
160
|
+
if (style.gridTemplateColumns !== undefined) {
|
|
161
|
+
result.gridTemplateColumns = parseGridTemplate(style.gridTemplateColumns);
|
|
162
|
+
}
|
|
163
|
+
if (style.gridTemplateRows !== undefined) {
|
|
164
|
+
result.gridTemplateRows = parseGridTemplate(style.gridTemplateRows);
|
|
165
|
+
}
|
|
166
|
+
if (style.gridAutoRows !== undefined) {
|
|
167
|
+
result.gridAutoRows = mapGridTrack(style.gridAutoRows);
|
|
168
|
+
}
|
|
169
|
+
if (style.gridAutoColumns !== undefined) {
|
|
170
|
+
result.gridAutoColumns = mapGridTrack(style.gridAutoColumns);
|
|
171
|
+
}
|
|
172
|
+
// Grid placement (individual props → single gridPlacement object)
|
|
173
|
+
if (style.gridColumnStart !== undefined || style.gridColumnEnd !== undefined ||
|
|
174
|
+
style.gridRowStart !== undefined || style.gridRowEnd !== undefined ||
|
|
175
|
+
style.gridColumnSpan !== undefined || style.gridRowSpan !== undefined) {
|
|
176
|
+
const placement = {};
|
|
177
|
+
if (style.gridColumnStart !== undefined)
|
|
178
|
+
placement.columnStart = style.gridColumnStart;
|
|
179
|
+
if (style.gridColumnEnd !== undefined)
|
|
180
|
+
placement.columnEnd = style.gridColumnEnd;
|
|
181
|
+
if (style.gridRowStart !== undefined)
|
|
182
|
+
placement.rowStart = style.gridRowStart;
|
|
183
|
+
if (style.gridRowEnd !== undefined)
|
|
184
|
+
placement.rowEnd = style.gridRowEnd;
|
|
185
|
+
if (style.gridColumnSpan !== undefined)
|
|
186
|
+
placement.columnSpan = style.gridColumnSpan;
|
|
187
|
+
if (style.gridRowSpan !== undefined)
|
|
188
|
+
placement.rowSpan = style.gridRowSpan;
|
|
189
|
+
result.gridPlacement = placement;
|
|
190
|
+
}
|
|
191
|
+
// Typography
|
|
192
|
+
if (style.fontFamily !== undefined)
|
|
193
|
+
result.fontFamily = style.fontFamily;
|
|
194
|
+
if (style.fontSize !== undefined)
|
|
195
|
+
result.fontSize = style.fontSize;
|
|
196
|
+
if (style.fontWeight !== undefined) {
|
|
197
|
+
result.fontWeight = style.fontWeight === 'bold' ? 700 : style.fontWeight === 'normal' ? 400 : style.fontWeight;
|
|
198
|
+
}
|
|
199
|
+
if (style.fontStyle !== undefined)
|
|
200
|
+
result.fontStyle = FONT_STYLE_MAP[style.fontStyle];
|
|
201
|
+
if (style.lineHeight !== undefined)
|
|
202
|
+
result.lineHeight = style.lineHeight;
|
|
203
|
+
if (style.textAlign !== undefined)
|
|
204
|
+
result.textAlign = TEXT_ALIGN_MAP[style.textAlign];
|
|
205
|
+
if (style.letterSpacing !== undefined)
|
|
206
|
+
result.letterSpacing = style.letterSpacing;
|
|
207
|
+
if (style.wordSpacing !== undefined)
|
|
208
|
+
result.wordSpacing = style.wordSpacing;
|
|
209
|
+
if (style.boxShadow !== undefined) {
|
|
210
|
+
const parsed = parseBoxShadow(style.boxShadow);
|
|
211
|
+
if (parsed)
|
|
212
|
+
result.boxShadow = parsed;
|
|
213
|
+
}
|
|
214
|
+
if (style.transform !== undefined) {
|
|
215
|
+
const parsed = parseTransform(style.transform);
|
|
216
|
+
if (parsed && parsed.length > 0)
|
|
217
|
+
result.transform = parsed;
|
|
218
|
+
}
|
|
219
|
+
if (style.transformOrigin !== undefined) {
|
|
220
|
+
const parsed = parseTransformOrigin(style.transformOrigin);
|
|
221
|
+
if (parsed)
|
|
222
|
+
result.transformOrigin = parsed;
|
|
223
|
+
}
|
|
224
|
+
if (style.textDecoration !== undefined)
|
|
225
|
+
result.textDecoration = TEXT_DECORATION_MAP[style.textDecoration];
|
|
226
|
+
if (style.textTransform !== undefined)
|
|
227
|
+
result.textTransform = TEXT_TRANSFORM_MAP[style.textTransform];
|
|
228
|
+
if (style.hyphens !== undefined)
|
|
229
|
+
result.hyphens = HYPHENS_MAP[style.hyphens];
|
|
230
|
+
if (style.lang !== undefined)
|
|
231
|
+
result.lang = style.lang;
|
|
232
|
+
if (style.direction !== undefined)
|
|
233
|
+
result.direction = style.direction;
|
|
234
|
+
if (style.textOverflow !== undefined)
|
|
235
|
+
result.textOverflow = TEXT_OVERFLOW_MAP[style.textOverflow];
|
|
236
|
+
if (style.lineBreaking !== undefined)
|
|
237
|
+
result.lineBreaking = LINE_BREAKING_MAP[style.lineBreaking];
|
|
238
|
+
if (style.overflow !== undefined)
|
|
239
|
+
result.overflow = OVERFLOW_MAP[style.overflow];
|
|
240
|
+
// Color
|
|
241
|
+
if (style.color !== undefined)
|
|
242
|
+
result.color = parseColor(style.color);
|
|
243
|
+
if (style.backgroundColor !== undefined)
|
|
244
|
+
result.backgroundColor = parseColor(style.backgroundColor);
|
|
245
|
+
if (style.background !== undefined) {
|
|
246
|
+
const parsed = parseBackground(style.background);
|
|
247
|
+
if (parsed) {
|
|
248
|
+
if (parsed.type === 'color') {
|
|
249
|
+
// Solid color string in `background`: route to backgroundColor for
|
|
250
|
+
// engine compatibility (Background::Color also works, but
|
|
251
|
+
// backgroundColor is the canonical solid path).
|
|
252
|
+
if (result.backgroundColor === undefined)
|
|
253
|
+
result.backgroundColor = parsed.value;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
result.background = parsed;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (style.opacity !== undefined)
|
|
261
|
+
result.opacity = style.opacity;
|
|
262
|
+
// Border — cascade: border < borderTop/Right/Bottom/Left < borderWidth/borderColor < borderTopWidth/borderTopColor
|
|
263
|
+
// Step 1: Parse string shorthands into intermediate per-side values
|
|
264
|
+
let shortWidth = { top: undefined, right: undefined, bottom: undefined, left: undefined };
|
|
265
|
+
let shortColor = { top: undefined, right: undefined, bottom: undefined, left: undefined };
|
|
266
|
+
if (style.border !== undefined) {
|
|
267
|
+
const parsed = parseBorderString(style.border);
|
|
268
|
+
if (parsed.width !== undefined)
|
|
269
|
+
shortWidth = { top: parsed.width, right: parsed.width, bottom: parsed.width, left: parsed.width };
|
|
270
|
+
if (parsed.color !== undefined)
|
|
271
|
+
shortColor = { top: parsed.color, right: parsed.color, bottom: parsed.color, left: parsed.color };
|
|
272
|
+
}
|
|
273
|
+
// Per-side string shorthands override all-side shorthand
|
|
274
|
+
for (const [side, prop] of [['top', 'borderTop'], ['right', 'borderRight'], ['bottom', 'borderBottom'], ['left', 'borderLeft']]) {
|
|
275
|
+
const val = style[prop];
|
|
276
|
+
if (val === undefined)
|
|
277
|
+
continue;
|
|
278
|
+
if (typeof val === 'number') {
|
|
279
|
+
shortWidth[side] = val;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
const parsed = parseBorderString(val);
|
|
283
|
+
if (parsed.width !== undefined)
|
|
284
|
+
shortWidth[side] = parsed.width;
|
|
285
|
+
if (parsed.color !== undefined)
|
|
286
|
+
shortColor[side] = parsed.color;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// Step 2: Build borderWidth — existing borderWidth/borderTopWidth override shorthands
|
|
290
|
+
const hasBorderWidth = style.borderWidth !== undefined || style.borderTopWidth !== undefined || style.borderRightWidth !== undefined || style.borderBottomWidth !== undefined || style.borderLeftWidth !== undefined;
|
|
291
|
+
const hasShortWidth = shortWidth.top !== undefined || shortWidth.right !== undefined || shortWidth.bottom !== undefined || shortWidth.left !== undefined;
|
|
292
|
+
if (hasBorderWidth || hasShortWidth) {
|
|
293
|
+
const base = style.borderWidth !== undefined
|
|
294
|
+
? expandEdgeValues(style.borderWidth)
|
|
295
|
+
: { top: shortWidth.top ?? 0, right: shortWidth.right ?? 0, bottom: shortWidth.bottom ?? 0, left: shortWidth.left ?? 0 };
|
|
296
|
+
result.borderWidth = {
|
|
297
|
+
top: style.borderTopWidth ?? base.top,
|
|
298
|
+
right: style.borderRightWidth ?? base.right,
|
|
299
|
+
bottom: style.borderBottomWidth ?? base.bottom,
|
|
300
|
+
left: style.borderLeftWidth ?? base.left,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
// Step 3: Build borderColor — existing borderColor/borderTopColor override shorthands
|
|
304
|
+
const hasBorderColor = style.borderColor !== undefined || style.borderTopColor !== undefined || style.borderRightColor !== undefined || style.borderBottomColor !== undefined || style.borderLeftColor !== undefined;
|
|
305
|
+
const hasShortColor = shortColor.top !== undefined || shortColor.right !== undefined || shortColor.bottom !== undefined || shortColor.left !== undefined;
|
|
306
|
+
if (hasBorderColor || hasShortColor) {
|
|
307
|
+
const defaultColor = parseColor('#000000');
|
|
308
|
+
let base = {
|
|
309
|
+
top: shortColor.top ?? defaultColor,
|
|
310
|
+
right: shortColor.right ?? defaultColor,
|
|
311
|
+
bottom: shortColor.bottom ?? defaultColor,
|
|
312
|
+
left: shortColor.left ?? defaultColor,
|
|
313
|
+
};
|
|
314
|
+
if (typeof style.borderColor === 'string') {
|
|
315
|
+
const c = parseColor(style.borderColor);
|
|
316
|
+
base = { top: c, right: c, bottom: c, left: c };
|
|
317
|
+
}
|
|
318
|
+
else if (style.borderColor && typeof style.borderColor === 'object') {
|
|
319
|
+
base = {
|
|
320
|
+
top: parseColor(style.borderColor.top),
|
|
321
|
+
right: parseColor(style.borderColor.right),
|
|
322
|
+
bottom: parseColor(style.borderColor.bottom),
|
|
323
|
+
left: parseColor(style.borderColor.left),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
result.borderColor = {
|
|
327
|
+
top: style.borderTopColor ? parseColor(style.borderTopColor) : base.top,
|
|
328
|
+
right: style.borderRightColor ? parseColor(style.borderRightColor) : base.right,
|
|
329
|
+
bottom: style.borderBottomColor ? parseColor(style.borderBottomColor) : base.bottom,
|
|
330
|
+
left: style.borderLeftColor ? parseColor(style.borderLeftColor) : base.left,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
if (style.borderRadius !== undefined || style.borderTopLeftRadius !== undefined || style.borderTopRightRadius !== undefined || style.borderBottomRightRadius !== undefined || style.borderBottomLeftRadius !== undefined) {
|
|
334
|
+
const base = style.borderRadius !== undefined ? expandCorners(style.borderRadius) : { top_left: 0, top_right: 0, bottom_right: 0, bottom_left: 0 };
|
|
335
|
+
result.borderRadius = {
|
|
336
|
+
top_left: style.borderTopLeftRadius ?? base.top_left,
|
|
337
|
+
top_right: style.borderTopRightRadius ?? base.top_right,
|
|
338
|
+
bottom_right: style.borderBottomRightRadius ?? base.bottom_right,
|
|
339
|
+
bottom_left: style.borderBottomLeftRadius ?? base.bottom_left,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
// Positioning
|
|
343
|
+
if (style.position !== undefined) {
|
|
344
|
+
result.position = style.position === 'absolute' ? 'Absolute' : 'Relative';
|
|
345
|
+
}
|
|
346
|
+
if (style.top !== undefined)
|
|
347
|
+
result.top = style.top;
|
|
348
|
+
if (style.right !== undefined)
|
|
349
|
+
result.right = style.right;
|
|
350
|
+
if (style.bottom !== undefined)
|
|
351
|
+
result.bottom = style.bottom;
|
|
352
|
+
if (style.left !== undefined)
|
|
353
|
+
result.left = style.left;
|
|
354
|
+
// Page behavior
|
|
355
|
+
if (style.wrap !== undefined)
|
|
356
|
+
result.wrap = style.wrap;
|
|
357
|
+
if (style.breakBefore !== undefined)
|
|
358
|
+
result.breakBefore = style.breakBefore;
|
|
359
|
+
if (style.minWidowLines !== undefined)
|
|
360
|
+
result.minWidowLines = style.minWidowLines;
|
|
361
|
+
if (style.minOrphanLines !== undefined)
|
|
362
|
+
result.minOrphanLines = style.minOrphanLines;
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
365
|
+
// ─── Grid helpers ───────────────────────────────────────────────────
|
|
366
|
+
/** Convert a single GridTrackSize to the Forme JSON format. */
|
|
367
|
+
function mapGridTrack(track) {
|
|
368
|
+
if (typeof track === 'number')
|
|
369
|
+
return { Pt: track };
|
|
370
|
+
if (track === 'auto')
|
|
371
|
+
return 'Auto';
|
|
372
|
+
if (typeof track === 'string') {
|
|
373
|
+
const frMatch = track.match(/^([0-9.]+)fr$/);
|
|
374
|
+
if (frMatch)
|
|
375
|
+
return { Fr: parseFloat(frMatch[1]) };
|
|
376
|
+
// Try numeric string
|
|
377
|
+
const num = parseFloat(track);
|
|
378
|
+
if (!isNaN(num))
|
|
379
|
+
return { Pt: num };
|
|
380
|
+
return 'Auto';
|
|
381
|
+
}
|
|
382
|
+
if (typeof track === 'object' && 'min' in track && 'max' in track) {
|
|
383
|
+
return { MinMax: [mapGridTrack(track.min), mapGridTrack(track.max)] };
|
|
384
|
+
}
|
|
385
|
+
return 'Auto';
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Expand `repeat(N, tracks)` in a grid template string.
|
|
389
|
+
* E.g. `"repeat(3, 1fr)"` → `"1fr 1fr 1fr"`
|
|
390
|
+
* `"200 repeat(2, 1fr) 200"` → `"200 1fr 1fr 200"`
|
|
391
|
+
*/
|
|
392
|
+
function expandRepeat(input) {
|
|
393
|
+
return input.replace(/repeat\(\s*(\d+)\s*,\s*([^)]+)\)/g, (_match, count, tracks) => {
|
|
394
|
+
return (tracks.trim() + ' ').repeat(parseInt(count, 10)).trim();
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Parse a grid template string shorthand into an array of FormeGridTrackSize.
|
|
399
|
+
* E.g. `"1fr 2fr 200"` → `[{Fr:1}, {Fr:2}, {Pt:200}]`
|
|
400
|
+
* Supports `repeat(N, tracks)` syntax.
|
|
401
|
+
*/
|
|
402
|
+
function parseGridTemplate(value) {
|
|
403
|
+
if (Array.isArray(value)) {
|
|
404
|
+
return value.map(mapGridTrack);
|
|
405
|
+
}
|
|
406
|
+
const expanded = expandRepeat(value);
|
|
407
|
+
return expanded.split(/\s+/).filter(Boolean).map((token) => {
|
|
408
|
+
if (token === 'auto')
|
|
409
|
+
return 'Auto';
|
|
410
|
+
const frMatch = token.match(/^([0-9.]+)fr$/);
|
|
411
|
+
if (frMatch)
|
|
412
|
+
return { Fr: parseFloat(frMatch[1]) };
|
|
413
|
+
const num = parseFloat(token);
|
|
414
|
+
if (!isNaN(num))
|
|
415
|
+
return { Pt: num };
|
|
416
|
+
return 'Auto';
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
export function mapDimension(val) {
|
|
420
|
+
if (typeof val === 'number') {
|
|
421
|
+
return { Pt: val };
|
|
422
|
+
}
|
|
423
|
+
if (val === 'auto')
|
|
424
|
+
return 'Auto';
|
|
425
|
+
const match = val.match(/^([0-9.]+)%$/);
|
|
426
|
+
if (match) {
|
|
427
|
+
return { Percent: parseFloat(match[1]) };
|
|
428
|
+
}
|
|
429
|
+
// Try to parse as a number (e.g. "100" without units)
|
|
430
|
+
const num = parseFloat(val);
|
|
431
|
+
if (!isNaN(num)) {
|
|
432
|
+
return { Pt: num };
|
|
433
|
+
}
|
|
434
|
+
return 'Auto';
|
|
435
|
+
}
|
|
436
|
+
export function parseColor(hex) {
|
|
437
|
+
const s = hex.trim();
|
|
438
|
+
// rgba(r, g, b, a)
|
|
439
|
+
const rgbaMatch = s.match(/^rgba\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*\)$/);
|
|
440
|
+
if (rgbaMatch) {
|
|
441
|
+
return {
|
|
442
|
+
r: parseFloat(rgbaMatch[1]) / 255,
|
|
443
|
+
g: parseFloat(rgbaMatch[2]) / 255,
|
|
444
|
+
b: parseFloat(rgbaMatch[3]) / 255,
|
|
445
|
+
a: parseFloat(rgbaMatch[4]),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// rgb(r, g, b)
|
|
449
|
+
const rgbMatch = s.match(/^rgb\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*\)$/);
|
|
450
|
+
if (rgbMatch) {
|
|
451
|
+
return {
|
|
452
|
+
r: parseFloat(rgbMatch[1]) / 255,
|
|
453
|
+
g: parseFloat(rgbMatch[2]) / 255,
|
|
454
|
+
b: parseFloat(rgbMatch[3]) / 255,
|
|
455
|
+
a: 1,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
const h = s.replace(/^#/, '');
|
|
459
|
+
if (h.length === 3) {
|
|
460
|
+
const r = parseInt(h[0] + h[0], 16) / 255;
|
|
461
|
+
const g = parseInt(h[1] + h[1], 16) / 255;
|
|
462
|
+
const b = parseInt(h[2] + h[2], 16) / 255;
|
|
463
|
+
return { r, g, b, a: 1 };
|
|
464
|
+
}
|
|
465
|
+
if (h.length === 6) {
|
|
466
|
+
const r = parseInt(h.slice(0, 2), 16) / 255;
|
|
467
|
+
const g = parseInt(h.slice(2, 4), 16) / 255;
|
|
468
|
+
const b = parseInt(h.slice(4, 6), 16) / 255;
|
|
469
|
+
return { r, g, b, a: 1 };
|
|
470
|
+
}
|
|
471
|
+
if (h.length === 8) {
|
|
472
|
+
const r = parseInt(h.slice(0, 2), 16) / 255;
|
|
473
|
+
const g = parseInt(h.slice(2, 4), 16) / 255;
|
|
474
|
+
const b = parseInt(h.slice(4, 6), 16) / 255;
|
|
475
|
+
const a = parseInt(h.slice(6, 8), 16) / 255;
|
|
476
|
+
return { r, g, b, a };
|
|
477
|
+
}
|
|
478
|
+
// Fallback: black
|
|
479
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Parse a CSS-like `transform` string into the engine's TransformOp[].
|
|
483
|
+
*
|
|
484
|
+
* Accepted syntax (space- or comma-separated ops, in any order):
|
|
485
|
+
* `rotate(45deg)`, `rotate(-15deg)`, `rotate(0.5turn)`, `rotate(1.2rad)`
|
|
486
|
+
* `scale(1.5)`, `scale(2, 0.5)`
|
|
487
|
+
* `translate(10, -4)`, `translate(10px, -4pt)`
|
|
488
|
+
*
|
|
489
|
+
* Lengths are interpreted as points (px/pt suffix accepted and ignored;
|
|
490
|
+
* Forme is a print-first engine — 1 point = 1 point). Returns `null` on
|
|
491
|
+
* unparseable input (the property is silently dropped, matching the
|
|
492
|
+
* boxShadow precedent).
|
|
493
|
+
*/
|
|
494
|
+
function parseTransform(val) {
|
|
495
|
+
const ops = [];
|
|
496
|
+
// Match `name(args)` pairs. Names: ASCII letters. Args: anything between
|
|
497
|
+
// parentheses (no nesting in this grammar).
|
|
498
|
+
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
499
|
+
let m;
|
|
500
|
+
let matched = false;
|
|
501
|
+
while ((m = re.exec(val)) !== null) {
|
|
502
|
+
matched = true;
|
|
503
|
+
const name = m[1].toLowerCase();
|
|
504
|
+
const args = m[2]
|
|
505
|
+
.split(/[,\s]+/)
|
|
506
|
+
.map((s) => s.trim())
|
|
507
|
+
.filter((s) => s.length > 0);
|
|
508
|
+
if (name === 'rotate' || name === 'rotatez') {
|
|
509
|
+
if (args.length !== 1)
|
|
510
|
+
return null;
|
|
511
|
+
const deg = parseAngle(args[0]);
|
|
512
|
+
if (deg === null)
|
|
513
|
+
return null;
|
|
514
|
+
ops.push({ type: 'rotate', deg });
|
|
515
|
+
}
|
|
516
|
+
else if (name === 'scale') {
|
|
517
|
+
if (args.length === 0 || args.length > 2)
|
|
518
|
+
return null;
|
|
519
|
+
const x = parseFloat(args[0]);
|
|
520
|
+
if (Number.isNaN(x))
|
|
521
|
+
return null;
|
|
522
|
+
const y = args.length === 2 ? parseFloat(args[1]) : x;
|
|
523
|
+
if (Number.isNaN(y))
|
|
524
|
+
return null;
|
|
525
|
+
ops.push({ type: 'scale', x, y });
|
|
526
|
+
}
|
|
527
|
+
else if (name === 'scalex') {
|
|
528
|
+
if (args.length !== 1)
|
|
529
|
+
return null;
|
|
530
|
+
const x = parseFloat(args[0]);
|
|
531
|
+
if (Number.isNaN(x))
|
|
532
|
+
return null;
|
|
533
|
+
ops.push({ type: 'scale', x, y: 1 });
|
|
534
|
+
}
|
|
535
|
+
else if (name === 'scaley') {
|
|
536
|
+
if (args.length !== 1)
|
|
537
|
+
return null;
|
|
538
|
+
const y = parseFloat(args[0]);
|
|
539
|
+
if (Number.isNaN(y))
|
|
540
|
+
return null;
|
|
541
|
+
ops.push({ type: 'scale', x: 1, y });
|
|
542
|
+
}
|
|
543
|
+
else if (name === 'translate') {
|
|
544
|
+
if (args.length === 0 || args.length > 2)
|
|
545
|
+
return null;
|
|
546
|
+
const x = parseLengthPt(args[0]);
|
|
547
|
+
if (x === null)
|
|
548
|
+
return null;
|
|
549
|
+
const y = args.length === 2 ? parseLengthPt(args[1]) : 0;
|
|
550
|
+
if (y === null)
|
|
551
|
+
return null;
|
|
552
|
+
ops.push({ type: 'translate', x, y });
|
|
553
|
+
}
|
|
554
|
+
else if (name === 'translatex') {
|
|
555
|
+
if (args.length !== 1)
|
|
556
|
+
return null;
|
|
557
|
+
const x = parseLengthPt(args[0]);
|
|
558
|
+
if (x === null)
|
|
559
|
+
return null;
|
|
560
|
+
ops.push({ type: 'translate', x, y: 0 });
|
|
561
|
+
}
|
|
562
|
+
else if (name === 'translatey') {
|
|
563
|
+
if (args.length !== 1)
|
|
564
|
+
return null;
|
|
565
|
+
const y = parseLengthPt(args[0]);
|
|
566
|
+
if (y === null)
|
|
567
|
+
return null;
|
|
568
|
+
ops.push({ type: 'translate', x: 0, y });
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
// Unknown op (e.g. skew, matrix) — reject the whole transform so
|
|
572
|
+
// users notice rather than getting silently-half-applied transforms.
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (!matched)
|
|
577
|
+
return null;
|
|
578
|
+
return ops;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Parse an angle in `deg` / `rad` / `turn` (no unit defaults to deg).
|
|
582
|
+
* Returns the angle in DEGREES, or null on parse failure.
|
|
583
|
+
*/
|
|
584
|
+
function parseAngle(s) {
|
|
585
|
+
const t = s.trim().toLowerCase();
|
|
586
|
+
let mult = 1;
|
|
587
|
+
let body = t;
|
|
588
|
+
if (t.endsWith('deg')) {
|
|
589
|
+
body = t.slice(0, -3);
|
|
590
|
+
}
|
|
591
|
+
else if (t.endsWith('rad')) {
|
|
592
|
+
body = t.slice(0, -3);
|
|
593
|
+
mult = 180 / Math.PI;
|
|
594
|
+
}
|
|
595
|
+
else if (t.endsWith('turn')) {
|
|
596
|
+
body = t.slice(0, -4);
|
|
597
|
+
mult = 360;
|
|
598
|
+
}
|
|
599
|
+
const n = parseFloat(body);
|
|
600
|
+
if (Number.isNaN(n))
|
|
601
|
+
return null;
|
|
602
|
+
return n * mult;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Parse a length value — accepts a bare number or `<n>px`/`<n>pt` and
|
|
606
|
+
* returns the value in points. Forme is print-first; px/pt are treated
|
|
607
|
+
* as the same unit at this layer.
|
|
608
|
+
*/
|
|
609
|
+
function parseLengthPt(s) {
|
|
610
|
+
const t = s.trim().toLowerCase();
|
|
611
|
+
const body = t.endsWith('px') || t.endsWith('pt') ? t.slice(0, -2) : t;
|
|
612
|
+
const n = parseFloat(body);
|
|
613
|
+
return Number.isNaN(n) ? null : n;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Parse a `transformOrigin` value into a `[x, y]` tuple of fractions
|
|
617
|
+
* (0.0–1.0). Accepts the user-side tuple shape directly, or a CSS-like
|
|
618
|
+
* string with two tokens (`"50% 50%"`, `"0% 100%"`, `"center top"`,
|
|
619
|
+
* `"left bottom"`, etc.). Returns null on unparseable input.
|
|
620
|
+
*/
|
|
621
|
+
function parseTransformOrigin(val) {
|
|
622
|
+
if (Array.isArray(val)) {
|
|
623
|
+
const [x, y] = val;
|
|
624
|
+
if (typeof x !== 'number' || typeof y !== 'number')
|
|
625
|
+
return null;
|
|
626
|
+
return [x, y];
|
|
627
|
+
}
|
|
628
|
+
const tokens = val.trim().split(/\s+/).filter((t) => t.length > 0);
|
|
629
|
+
if (tokens.length === 0 || tokens.length > 2)
|
|
630
|
+
return null;
|
|
631
|
+
const x = parseOriginToken(tokens[0], 'x');
|
|
632
|
+
if (x === null)
|
|
633
|
+
return null;
|
|
634
|
+
const y = tokens.length === 2 ? parseOriginToken(tokens[1], 'y') : 0.5;
|
|
635
|
+
if (y === null)
|
|
636
|
+
return null;
|
|
637
|
+
return [x, y];
|
|
638
|
+
}
|
|
639
|
+
function parseOriginToken(token, axis) {
|
|
640
|
+
const t = token.toLowerCase();
|
|
641
|
+
if (t === 'center')
|
|
642
|
+
return 0.5;
|
|
643
|
+
if (axis === 'x') {
|
|
644
|
+
if (t === 'left')
|
|
645
|
+
return 0;
|
|
646
|
+
if (t === 'right')
|
|
647
|
+
return 1;
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
if (t === 'top')
|
|
651
|
+
return 0;
|
|
652
|
+
if (t === 'bottom')
|
|
653
|
+
return 1;
|
|
654
|
+
}
|
|
655
|
+
if (t.endsWith('%')) {
|
|
656
|
+
const n = parseFloat(t.slice(0, -1));
|
|
657
|
+
return Number.isNaN(n) ? null : n / 100;
|
|
658
|
+
}
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Parse a `boxShadow` value (object form or CSS-like string
|
|
663
|
+
* `"offsetX offsetY blur color"`) into the engine's FormeBoxShadow shape.
|
|
664
|
+
* Returns null on malformed input. v1 ignores blur but parses it.
|
|
665
|
+
*/
|
|
666
|
+
function parseBoxShadow(val) {
|
|
667
|
+
if (typeof val === 'object') {
|
|
668
|
+
const c = parseColor(val.color);
|
|
669
|
+
return {
|
|
670
|
+
offsetX: val.offsetX,
|
|
671
|
+
offsetY: val.offsetY,
|
|
672
|
+
blur: val.blur ?? 0,
|
|
673
|
+
color: c,
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
// String form: "offsetX offsetY blur color".
|
|
677
|
+
// Split on whitespace, but preserve any rgba(...)/rgb(...) parens.
|
|
678
|
+
const tokens = [];
|
|
679
|
+
let depth = 0;
|
|
680
|
+
let buf = '';
|
|
681
|
+
for (const ch of val.trim()) {
|
|
682
|
+
if (ch === '(')
|
|
683
|
+
depth += 1;
|
|
684
|
+
if (ch === ')')
|
|
685
|
+
depth = Math.max(0, depth - 1);
|
|
686
|
+
if (/\s/.test(ch) && depth === 0) {
|
|
687
|
+
if (buf) {
|
|
688
|
+
tokens.push(buf);
|
|
689
|
+
buf = '';
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
buf += ch;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (buf)
|
|
697
|
+
tokens.push(buf);
|
|
698
|
+
if (tokens.length < 4)
|
|
699
|
+
return null;
|
|
700
|
+
const offsetX = parseFloat(tokens[0]);
|
|
701
|
+
const offsetY = parseFloat(tokens[1]);
|
|
702
|
+
const blur = parseFloat(tokens[2]);
|
|
703
|
+
if (Number.isNaN(offsetX) || Number.isNaN(offsetY) || Number.isNaN(blur))
|
|
704
|
+
return null;
|
|
705
|
+
const color = parseColor(tokens[3]);
|
|
706
|
+
return { offsetX, offsetY, blur, color };
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Parse a CSS `background` value. Supports three forms:
|
|
710
|
+
* - `linear-gradient(<angle>, <stop>, <stop>, ...)` — CSS angle conventions
|
|
711
|
+
* (`0deg` = bottom→top, `90deg` = left→right, `180deg` = top→bottom).
|
|
712
|
+
* Angle is optional; defaults to `180deg` (top→bottom). Side keywords
|
|
713
|
+
* (`to bottom`, `to right`, etc.) also supported.
|
|
714
|
+
* - `radial-gradient(circle, <stop>, <stop>, ...)` — `circle` is the only
|
|
715
|
+
* shape in v1. The `circle` keyword is optional.
|
|
716
|
+
* - solid color (`#abc`, `rgb(...)`, `rgba(...)`) — falls through to a
|
|
717
|
+
* `Color`-typed background, which the caller routes to `backgroundColor`.
|
|
718
|
+
*
|
|
719
|
+
* v1 supports exactly 2 stops; gradients with 3+ stops are flattened to
|
|
720
|
+
* the first and last stop (the engine's v1 ShadingType 2 only renders 2
|
|
721
|
+
* colors). Multi-stop support is planned via PDF Type 3 stitching.
|
|
722
|
+
*
|
|
723
|
+
* Returns null on parse failure (e.g. malformed gradient string with no
|
|
724
|
+
* usable color tokens) so the caller can omit the property.
|
|
725
|
+
*/
|
|
726
|
+
function parseBackground(val) {
|
|
727
|
+
const s = val.trim();
|
|
728
|
+
// linear-gradient(...)
|
|
729
|
+
const linearMatch = s.match(/^linear-gradient\s*\(\s*([\s\S]*)\s*\)$/i);
|
|
730
|
+
if (linearMatch) {
|
|
731
|
+
const inner = linearMatch[1];
|
|
732
|
+
const parts = splitGradientArgs(inner);
|
|
733
|
+
if (parts.length === 0)
|
|
734
|
+
return null;
|
|
735
|
+
let angleDeg = 180;
|
|
736
|
+
let stopParts = parts;
|
|
737
|
+
const first = parts[0].trim();
|
|
738
|
+
const angleParsed = parseGradientAngle(first);
|
|
739
|
+
if (angleParsed !== null) {
|
|
740
|
+
angleDeg = angleParsed;
|
|
741
|
+
stopParts = parts.slice(1);
|
|
742
|
+
}
|
|
743
|
+
const stops = parseGradientStops(stopParts);
|
|
744
|
+
if (stops.length < 2)
|
|
745
|
+
return null;
|
|
746
|
+
return { type: 'linear', angleDeg, stops };
|
|
747
|
+
}
|
|
748
|
+
// radial-gradient(...)
|
|
749
|
+
const radialMatch = s.match(/^radial-gradient\s*\(\s*([\s\S]*)\s*\)$/i);
|
|
750
|
+
if (radialMatch) {
|
|
751
|
+
const inner = radialMatch[1];
|
|
752
|
+
const parts = splitGradientArgs(inner);
|
|
753
|
+
if (parts.length === 0)
|
|
754
|
+
return null;
|
|
755
|
+
let stopParts = parts;
|
|
756
|
+
// Optional shape keyword (`circle`, `ellipse`) — only `circle` honored
|
|
757
|
+
// here; `ellipse` strings parse but render as a circle.
|
|
758
|
+
const first = parts[0].trim().toLowerCase();
|
|
759
|
+
if (first === 'circle' || first === 'ellipse' || first.startsWith('circle ') || first.startsWith('ellipse ')) {
|
|
760
|
+
stopParts = parts.slice(1);
|
|
761
|
+
}
|
|
762
|
+
const stops = parseGradientStops(stopParts);
|
|
763
|
+
if (stops.length < 2)
|
|
764
|
+
return null;
|
|
765
|
+
return { type: 'radial', stops };
|
|
766
|
+
}
|
|
767
|
+
// Solid color fallback. parseColor never throws; on garbage input it
|
|
768
|
+
// returns black, so check that the input looks color-shaped first to
|
|
769
|
+
// avoid silently turning a typo'd gradient into a black background.
|
|
770
|
+
if (/^(#|rgb\(|rgba\()/i.test(s)) {
|
|
771
|
+
return { type: 'color', value: parseColor(s) };
|
|
772
|
+
}
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Split a gradient's interior comma-separated arguments, respecting parens
|
|
777
|
+
* so `rgba(0, 0, 0, 0.5)` doesn't get split mid-color.
|
|
778
|
+
*/
|
|
779
|
+
function splitGradientArgs(inner) {
|
|
780
|
+
const parts = [];
|
|
781
|
+
let depth = 0;
|
|
782
|
+
let buf = '';
|
|
783
|
+
for (const ch of inner) {
|
|
784
|
+
if (ch === '(')
|
|
785
|
+
depth += 1;
|
|
786
|
+
else if (ch === ')')
|
|
787
|
+
depth = Math.max(0, depth - 1);
|
|
788
|
+
if (ch === ',' && depth === 0) {
|
|
789
|
+
parts.push(buf);
|
|
790
|
+
buf = '';
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
buf += ch;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
if (buf.trim())
|
|
797
|
+
parts.push(buf);
|
|
798
|
+
return parts.map((p) => p.trim()).filter((p) => p.length > 0);
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Parse a CSS gradient angle token. Returns degrees, or null if the token
|
|
802
|
+
* isn't an angle.
|
|
803
|
+
*
|
|
804
|
+
* Forms supported:
|
|
805
|
+
* - `<n>deg` (e.g. `135deg`)
|
|
806
|
+
* - `<n>turn` (e.g. `0.5turn`)
|
|
807
|
+
* - `<n>rad` / `<n>grad`
|
|
808
|
+
* - `to <side>` keywords: `to top` (0), `to right` (90), `to bottom` (180), `to left` (270),
|
|
809
|
+
* and the four diagonal forms (`to top right`, etc.).
|
|
810
|
+
*/
|
|
811
|
+
function parseGradientAngle(token) {
|
|
812
|
+
const t = token.trim().toLowerCase();
|
|
813
|
+
const degMatch = t.match(/^(-?\d+(?:\.\d+)?)deg$/);
|
|
814
|
+
if (degMatch)
|
|
815
|
+
return parseFloat(degMatch[1]);
|
|
816
|
+
const turnMatch = t.match(/^(-?\d+(?:\.\d+)?)turn$/);
|
|
817
|
+
if (turnMatch)
|
|
818
|
+
return parseFloat(turnMatch[1]) * 360;
|
|
819
|
+
const radMatch = t.match(/^(-?\d+(?:\.\d+)?)rad$/);
|
|
820
|
+
if (radMatch)
|
|
821
|
+
return (parseFloat(radMatch[1]) * 180) / Math.PI;
|
|
822
|
+
const gradMatch = t.match(/^(-?\d+(?:\.\d+)?)grad$/);
|
|
823
|
+
if (gradMatch)
|
|
824
|
+
return parseFloat(gradMatch[1]) * 0.9;
|
|
825
|
+
if (t === 'to top')
|
|
826
|
+
return 0;
|
|
827
|
+
if (t === 'to right')
|
|
828
|
+
return 90;
|
|
829
|
+
if (t === 'to bottom')
|
|
830
|
+
return 180;
|
|
831
|
+
if (t === 'to left')
|
|
832
|
+
return 270;
|
|
833
|
+
if (t === 'to top right' || t === 'to right top')
|
|
834
|
+
return 45;
|
|
835
|
+
if (t === 'to bottom right' || t === 'to right bottom')
|
|
836
|
+
return 135;
|
|
837
|
+
if (t === 'to bottom left' || t === 'to left bottom')
|
|
838
|
+
return 225;
|
|
839
|
+
if (t === 'to top left' || t === 'to left top')
|
|
840
|
+
return 315;
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Parse a list of gradient color stops. Each stop is `<color>` or
|
|
845
|
+
* `<color> <position>`. Position can be `<n>%` (CSS) or `<n>` (treated as
|
|
846
|
+
* a 0..1 fraction). Stops without explicit positions get evenly distributed
|
|
847
|
+
* positions matching CSS defaults: first at 0, last at 1, intermediate
|
|
848
|
+
* stops linearly interpolated.
|
|
849
|
+
*/
|
|
850
|
+
function parseGradientStops(parts) {
|
|
851
|
+
if (parts.length === 0)
|
|
852
|
+
return [];
|
|
853
|
+
const positions = [];
|
|
854
|
+
const colors = [];
|
|
855
|
+
for (const p of parts) {
|
|
856
|
+
// Find the last whitespace-separated token; if it's a position
|
|
857
|
+
// (`50%` or `0.5`), treat it as such, else everything is the color.
|
|
858
|
+
const trimmed = p.trim();
|
|
859
|
+
const tokens = splitColorAndPosition(trimmed);
|
|
860
|
+
if (!tokens)
|
|
861
|
+
continue;
|
|
862
|
+
colors.push(parseColor(tokens.color));
|
|
863
|
+
positions.push(tokens.position);
|
|
864
|
+
}
|
|
865
|
+
if (colors.length === 0)
|
|
866
|
+
return [];
|
|
867
|
+
// Fill in missing positions with CSS defaults.
|
|
868
|
+
if (positions[0] === null)
|
|
869
|
+
positions[0] = 0;
|
|
870
|
+
if (positions[positions.length - 1] === null)
|
|
871
|
+
positions[positions.length - 1] = 1;
|
|
872
|
+
for (let i = 1; i < positions.length - 1; i += 1) {
|
|
873
|
+
if (positions[i] === null) {
|
|
874
|
+
// Linear interpolate between previous known and next known.
|
|
875
|
+
let prev = i - 1;
|
|
876
|
+
while (prev >= 0 && positions[prev] === null)
|
|
877
|
+
prev -= 1;
|
|
878
|
+
let next = i + 1;
|
|
879
|
+
while (next < positions.length && positions[next] === null)
|
|
880
|
+
next += 1;
|
|
881
|
+
const p0 = positions[prev] ?? 0;
|
|
882
|
+
const p1 = positions[next] ?? 1;
|
|
883
|
+
positions[i] = p0 + ((p1 - p0) * (i - prev)) / (next - prev);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return colors.map((color, i) => ({
|
|
887
|
+
position: Math.max(0, Math.min(1, positions[i])),
|
|
888
|
+
color,
|
|
889
|
+
}));
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Split a stop string like `"#fff 50%"` into color + position.
|
|
893
|
+
* Position can be percentage or fraction; null if not specified.
|
|
894
|
+
*/
|
|
895
|
+
function splitColorAndPosition(s) {
|
|
896
|
+
// The position token, if present, is the last whitespace-separated piece
|
|
897
|
+
// and matches `<number>%` or a bare number. Splitting on whitespace
|
|
898
|
+
// respects parens so `rgba(...)` is not chopped up.
|
|
899
|
+
const tokens = [];
|
|
900
|
+
let depth = 0;
|
|
901
|
+
let buf = '';
|
|
902
|
+
for (const ch of s) {
|
|
903
|
+
if (ch === '(')
|
|
904
|
+
depth += 1;
|
|
905
|
+
else if (ch === ')')
|
|
906
|
+
depth = Math.max(0, depth - 1);
|
|
907
|
+
if (/\s/.test(ch) && depth === 0) {
|
|
908
|
+
if (buf) {
|
|
909
|
+
tokens.push(buf);
|
|
910
|
+
buf = '';
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
buf += ch;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (buf)
|
|
918
|
+
tokens.push(buf);
|
|
919
|
+
if (tokens.length === 0)
|
|
920
|
+
return null;
|
|
921
|
+
const last = tokens[tokens.length - 1];
|
|
922
|
+
const pctMatch = last.match(/^(-?\d+(?:\.\d+)?)%$/);
|
|
923
|
+
if (pctMatch) {
|
|
924
|
+
return { color: tokens.slice(0, -1).join(' '), position: parseFloat(pctMatch[1]) / 100 };
|
|
925
|
+
}
|
|
926
|
+
const fracMatch = last.match(/^(-?\d+(?:\.\d+)?)$/);
|
|
927
|
+
if (fracMatch && tokens.length > 1) {
|
|
928
|
+
return { color: tokens.slice(0, -1).join(' '), position: parseFloat(fracMatch[1]) };
|
|
929
|
+
}
|
|
930
|
+
return { color: tokens.join(' '), position: null };
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Parse a CSS-style 1-4 value edge shorthand.
|
|
934
|
+
* Accepts: `"8"`, `"8 16"`, `"8 16 24"`, `"8 16 24 32"` (with optional `px` suffix).
|
|
935
|
+
* Also accepts number arrays: `[8]`, `[8, 16]`, `[8, 16, 24]`, `[8, 16, 24, 32]`.
|
|
936
|
+
*/
|
|
937
|
+
function parseCSSEdges(val) {
|
|
938
|
+
const values = Array.isArray(val)
|
|
939
|
+
? val
|
|
940
|
+
: val.trim().split(/\s+/).map(s => parseFloat(s.replace(/px$/i, '')));
|
|
941
|
+
switch (values.length) {
|
|
942
|
+
case 1: return { top: values[0], right: values[0], bottom: values[0], left: values[0] };
|
|
943
|
+
case 2: return { top: values[0], right: values[1], bottom: values[0], left: values[1] };
|
|
944
|
+
case 3: return { top: values[0], right: values[1], bottom: values[2], left: values[1] };
|
|
945
|
+
default: return { top: values[0], right: values[1], bottom: values[2], left: values[3] };
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
const BORDER_STYLE_KEYWORDS = new Set([
|
|
949
|
+
'solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset', 'none', 'hidden',
|
|
950
|
+
]);
|
|
951
|
+
/**
|
|
952
|
+
* Parse a CSS border shorthand string like `"1px solid #000"`.
|
|
953
|
+
* Returns extracted width and/or color. Style keywords are recognized but ignored.
|
|
954
|
+
*/
|
|
955
|
+
function parseBorderString(val) {
|
|
956
|
+
const tokens = val.trim().split(/\s+/);
|
|
957
|
+
let width;
|
|
958
|
+
let color;
|
|
959
|
+
for (const token of tokens) {
|
|
960
|
+
const lower = token.toLowerCase();
|
|
961
|
+
if (BORDER_STYLE_KEYWORDS.has(lower))
|
|
962
|
+
continue;
|
|
963
|
+
const num = parseFloat(lower.replace(/px$/i, ''));
|
|
964
|
+
if (!isNaN(num) && /^[\d.]/.test(lower)) {
|
|
965
|
+
width = num;
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
color = parseColor(token);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return { width, color };
|
|
972
|
+
}
|
|
973
|
+
export function expandEdges(val) {
|
|
974
|
+
if (typeof val === 'number') {
|
|
975
|
+
return { top: val, right: val, bottom: val, left: val };
|
|
976
|
+
}
|
|
977
|
+
if (typeof val === 'string' || Array.isArray(val)) {
|
|
978
|
+
return parseCSSEdges(val);
|
|
979
|
+
}
|
|
980
|
+
return { top: val.top, right: val.right, bottom: val.bottom, left: val.left };
|
|
981
|
+
}
|
|
982
|
+
/** Expand margin edges, preserving 'auto' string values. */
|
|
983
|
+
function expandMarginEdges(val) {
|
|
984
|
+
if (typeof val === 'number') {
|
|
985
|
+
return { top: val, right: val, bottom: val, left: val };
|
|
986
|
+
}
|
|
987
|
+
if (typeof val === 'string') {
|
|
988
|
+
if (val === 'auto') {
|
|
989
|
+
return { top: 'auto', right: 'auto', bottom: 'auto', left: 'auto' };
|
|
990
|
+
}
|
|
991
|
+
const edges = parseCSSEdges(val);
|
|
992
|
+
return edges;
|
|
993
|
+
}
|
|
994
|
+
if (Array.isArray(val)) {
|
|
995
|
+
return parseCSSEdges(val);
|
|
996
|
+
}
|
|
997
|
+
return { top: val.top, right: val.right, bottom: val.bottom, left: val.left };
|
|
998
|
+
}
|
|
999
|
+
function expandEdgeValues(val) {
|
|
1000
|
+
if (typeof val === 'number') {
|
|
1001
|
+
return { top: val, right: val, bottom: val, left: val };
|
|
1002
|
+
}
|
|
1003
|
+
return { top: val.top, right: val.right, bottom: val.bottom, left: val.left };
|
|
1004
|
+
}
|
|
1005
|
+
export function expandCorners(val) {
|
|
1006
|
+
if (typeof val === 'number') {
|
|
1007
|
+
return { top_left: val, top_right: val, bottom_right: val, bottom_left: val };
|
|
1008
|
+
}
|
|
1009
|
+
return {
|
|
1010
|
+
top_left: val.topLeft,
|
|
1011
|
+
top_right: val.topRight,
|
|
1012
|
+
bottom_right: val.bottomRight,
|
|
1013
|
+
bottom_left: val.bottomLeft,
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
export function mapColumnWidth(w) {
|
|
1017
|
+
if (w === 'auto')
|
|
1018
|
+
return 'Auto';
|
|
1019
|
+
if ('fraction' in w)
|
|
1020
|
+
return { Fraction: w.fraction };
|
|
1021
|
+
if ('fixed' in w)
|
|
1022
|
+
return { Fixed: w.fixed };
|
|
1023
|
+
return 'Auto';
|
|
1024
|
+
}
|