@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,388 @@
|
|
|
1
|
+
/* Shared interaction tokens. Document themes have their own independent palette. */
|
|
2
|
+
:root {
|
|
3
|
+
--page-title-size: 18px;
|
|
4
|
+
--title-size: 14px;
|
|
5
|
+
--title-leading: 20px;
|
|
6
|
+
--label-size: 13px;
|
|
7
|
+
--label-leading: 18px;
|
|
8
|
+
--body-size: 13px;
|
|
9
|
+
--body-leading: 20px;
|
|
10
|
+
--control-radius: 6px;
|
|
11
|
+
--control-hit-size: 32px;
|
|
12
|
+
--data-row-height: 32px;
|
|
13
|
+
--browse-row-height: 40px;
|
|
14
|
+
--badge-height: 20px;
|
|
15
|
+
--badge-radius: 6px;
|
|
16
|
+
/* Reserved for a future switch; the app currently has no switch control. */
|
|
17
|
+
--switch-width: 24px;
|
|
18
|
+
--switch-height: 14px;
|
|
19
|
+
--switch-thumb-size: 10px;
|
|
20
|
+
--popup-radius: 6px;
|
|
21
|
+
--menu-font-size: 12.5px;
|
|
22
|
+
--menu-leading: 18px;
|
|
23
|
+
--menu-row-height: 32px;
|
|
24
|
+
--menu-padding: 4px;
|
|
25
|
+
--menu-item-padding: 5px 8px;
|
|
26
|
+
--menu-item-gap: 8px;
|
|
27
|
+
--menu-min-width: 184px;
|
|
28
|
+
--motion-quick: 140ms;
|
|
29
|
+
}
|
|
30
|
+
@media (pointer: coarse) {
|
|
31
|
+
:root { --data-row-height: 44px; --menu-row-height: 44px; }
|
|
32
|
+
}
|
|
33
|
+
#root {
|
|
34
|
+
isolation: isolate;
|
|
35
|
+
}
|
|
36
|
+
.ui-button {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
border: 1px solid var(--line);
|
|
39
|
+
border-radius: var(--control-radius);
|
|
40
|
+
background: var(--surface-raised);
|
|
41
|
+
color: inherit;
|
|
42
|
+
padding: 6px 10px;
|
|
43
|
+
font-size: var(--label-size);
|
|
44
|
+
line-height: var(--label-leading);
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
min-width: var(--control-hit-size);
|
|
47
|
+
min-height: var(--control-hit-size);
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
gap: 7px;
|
|
52
|
+
transition:
|
|
53
|
+
background-color var(--motion-quick),
|
|
54
|
+
color var(--motion-quick),
|
|
55
|
+
box-shadow var(--motion-quick),
|
|
56
|
+
scale 140ms cubic-bezier(0.2, 0, 0, 1);
|
|
57
|
+
}
|
|
58
|
+
.ui-button:hover {
|
|
59
|
+
background: var(--control-hover);
|
|
60
|
+
}
|
|
61
|
+
.ui-button:active:not(:disabled) {
|
|
62
|
+
background: var(--control-active);
|
|
63
|
+
}
|
|
64
|
+
.ui-button:disabled,
|
|
65
|
+
.ui-button[data-disabled] {
|
|
66
|
+
opacity: 0.45;
|
|
67
|
+
cursor: not-allowed;
|
|
68
|
+
}
|
|
69
|
+
:where(button, a, input, textarea, [tabindex]):focus-visible {
|
|
70
|
+
outline: 2px solid var(--focus-ring);
|
|
71
|
+
outline-offset: 3px;
|
|
72
|
+
}
|
|
73
|
+
:where(input, textarea):focus-visible {
|
|
74
|
+
outline: 1px solid var(--focus-ring);
|
|
75
|
+
outline-offset: -1px;
|
|
76
|
+
box-shadow: 0 0 3px color-mix(in srgb, var(--focus-ring) 25%, transparent);
|
|
77
|
+
}
|
|
78
|
+
.ui-button.primary {
|
|
79
|
+
background: var(--accent);
|
|
80
|
+
border-color: var(--accent);
|
|
81
|
+
color: var(--on-accent);
|
|
82
|
+
font-weight: 500;
|
|
83
|
+
box-shadow: var(--shadow-control);
|
|
84
|
+
padding: 6px 10px;
|
|
85
|
+
}
|
|
86
|
+
.ui-button.primary:hover {
|
|
87
|
+
background: var(--accent-hover);
|
|
88
|
+
border-color: var(--accent-hover);
|
|
89
|
+
}
|
|
90
|
+
.ui-button.primary:active:not(:disabled) {
|
|
91
|
+
background: var(--accent-active);
|
|
92
|
+
border-color: var(--accent-active);
|
|
93
|
+
}
|
|
94
|
+
.ui-button.icon-button {
|
|
95
|
+
background: transparent;
|
|
96
|
+
border: 0;
|
|
97
|
+
min-width: var(--control-hit-size);
|
|
98
|
+
min-height: var(--control-hit-size);
|
|
99
|
+
padding: 6px;
|
|
100
|
+
}
|
|
101
|
+
.ui-button.icon-button:hover {
|
|
102
|
+
background: var(--control-hover);
|
|
103
|
+
}
|
|
104
|
+
.ui-button.text-button {
|
|
105
|
+
border: 0;
|
|
106
|
+
background: transparent;
|
|
107
|
+
padding: 3px 0;
|
|
108
|
+
color: var(--accent-ink);
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
}
|
|
112
|
+
.ui-button.text-button:hover {
|
|
113
|
+
color: var(--accent-ink-hover);
|
|
114
|
+
}
|
|
115
|
+
.appearance-option { display: flex; align-items: center; gap: var(--menu-item-gap); }
|
|
116
|
+
.ui-button.tool-button {
|
|
117
|
+
background: transparent;
|
|
118
|
+
border: 0;
|
|
119
|
+
font-size: var(--label-size);
|
|
120
|
+
line-height: var(--label-leading);
|
|
121
|
+
font-weight: 500;
|
|
122
|
+
padding: 7px 9px;
|
|
123
|
+
color: var(--muted);
|
|
124
|
+
}
|
|
125
|
+
.ui-button.tool-button:hover {
|
|
126
|
+
background: var(--control-hover);
|
|
127
|
+
}
|
|
128
|
+
.ui-button.tool-button[data-pressed] {
|
|
129
|
+
background: var(--selected-surface);
|
|
130
|
+
color: var(--accent-ink);
|
|
131
|
+
}
|
|
132
|
+
.ui-button.ui-select {
|
|
133
|
+
min-height: var(--control-hit-size);
|
|
134
|
+
min-width: 90px;
|
|
135
|
+
justify-content: space-between;
|
|
136
|
+
background: transparent;
|
|
137
|
+
border: 0;
|
|
138
|
+
padding: 6px 8px;
|
|
139
|
+
font-size: var(--label-size);
|
|
140
|
+
line-height: var(--label-leading);
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
}
|
|
143
|
+
.ui-button.ui-select:hover,
|
|
144
|
+
.ui-button.ui-select[data-popup-open] {
|
|
145
|
+
background: var(--control-hover);
|
|
146
|
+
}
|
|
147
|
+
.ui-positioner {
|
|
148
|
+
z-index: 62;
|
|
149
|
+
outline: 0;
|
|
150
|
+
}
|
|
151
|
+
.ui-menu-popup,
|
|
152
|
+
.ui-popover-popup,
|
|
153
|
+
.ui-select-popup {
|
|
154
|
+
max-width: calc(100vw - 24px);
|
|
155
|
+
max-height: var(--available-height);
|
|
156
|
+
overflow-y: auto;
|
|
157
|
+
padding: var(--menu-padding);
|
|
158
|
+
border: 1px solid var(--line);
|
|
159
|
+
border-radius: var(--popup-radius);
|
|
160
|
+
background: var(--popup-surface);
|
|
161
|
+
color: var(--ink);
|
|
162
|
+
box-shadow: var(--shadow-popup);
|
|
163
|
+
}
|
|
164
|
+
.ui-menu-popup { min-width: var(--menu-min-width); }
|
|
165
|
+
.ui-select-popup {
|
|
166
|
+
min-width: min(max(var(--anchor-width), 128px), calc(100vw - 24px));
|
|
167
|
+
transform-origin: var(--transform-origin);
|
|
168
|
+
transition:
|
|
169
|
+
opacity var(--motion-quick),
|
|
170
|
+
transform var(--motion-quick);
|
|
171
|
+
}
|
|
172
|
+
.ui-menu-item,
|
|
173
|
+
.ui-select-item {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: var(--menu-item-gap);
|
|
177
|
+
padding: var(--menu-item-padding);
|
|
178
|
+
min-height: var(--menu-row-height);
|
|
179
|
+
border-radius: calc(var(--popup-radius) - 2px);
|
|
180
|
+
font-size: var(--menu-font-size);
|
|
181
|
+
line-height: var(--menu-leading);
|
|
182
|
+
font-weight: 400;
|
|
183
|
+
overflow-wrap: anywhere;
|
|
184
|
+
cursor: default;
|
|
185
|
+
user-select: none;
|
|
186
|
+
outline: 0;
|
|
187
|
+
}
|
|
188
|
+
.ui-menu-item[data-highlighted],
|
|
189
|
+
.ui-select-item[data-highlighted],
|
|
190
|
+
.ui-menu-item:focus-visible,
|
|
191
|
+
.ui-select-item:focus-visible {
|
|
192
|
+
background: var(--control-hover);
|
|
193
|
+
}
|
|
194
|
+
.ui-select-item[data-selected] {
|
|
195
|
+
color: var(--accent-ink);
|
|
196
|
+
font-weight: 500;
|
|
197
|
+
}
|
|
198
|
+
.ui-select-item { justify-content: space-between; gap: 16px; }
|
|
199
|
+
.ui-menu-item { cursor: pointer; background: transparent; }
|
|
200
|
+
.ui-popover-popup .ui-menu-item { width: 100%; justify-content: flex-start; border: 0; text-decoration: none; }
|
|
201
|
+
.ui-popover-popup .ui-menu-item:hover { background: var(--control-hover); }
|
|
202
|
+
.ui-menu-item > svg { flex-shrink: 0; color: var(--muted); }
|
|
203
|
+
.ui-menu-item > span:not(.pill):not(.ui-menu-check) { flex: 1; min-width: 0; }
|
|
204
|
+
.ui-menu-item[data-disabled], .ui-select-item[data-disabled] { opacity: 0.45; cursor: default; }
|
|
205
|
+
.ui-menu-check { margin-inline-start: auto; display: flex; }
|
|
206
|
+
.ui-menu-label { margin: 0; padding: var(--menu-item-padding); font-size: var(--menu-font-size); line-height: var(--menu-leading); font-weight: 500; color: var(--muted); }
|
|
207
|
+
.ui-menu-group { margin-top: 4px; }
|
|
208
|
+
.ui-menu-separator { height: 1px; background: var(--line); margin: 3px var(--menu-padding); }
|
|
209
|
+
.ui-menu-item-danger, .ui-menu-item-danger > svg { color: var(--destructive); }
|
|
210
|
+
.ui-select-popup[data-starting-style],
|
|
211
|
+
.ui-select-popup[data-ending-style] {
|
|
212
|
+
opacity: 0;
|
|
213
|
+
transform: translateY(-3px);
|
|
214
|
+
}
|
|
215
|
+
.ui-tooltip {
|
|
216
|
+
max-width: 240px;
|
|
217
|
+
background: var(--inverse-surface);
|
|
218
|
+
color: var(--inverse-ink);
|
|
219
|
+
border-radius: 5px;
|
|
220
|
+
padding: 6px 9px;
|
|
221
|
+
font-size: 11px;
|
|
222
|
+
line-height: 1.4;
|
|
223
|
+
box-shadow: var(--shadow-tooltip);
|
|
224
|
+
transition: opacity var(--motion-quick);
|
|
225
|
+
}
|
|
226
|
+
.ui-tooltip[data-starting-style],
|
|
227
|
+
.ui-tooltip[data-ending-style] {
|
|
228
|
+
opacity: 0;
|
|
229
|
+
}
|
|
230
|
+
.ui-dialog-backdrop {
|
|
231
|
+
position: fixed;
|
|
232
|
+
inset: 0;
|
|
233
|
+
z-index: 60;
|
|
234
|
+
background: var(--backdrop);
|
|
235
|
+
transition: opacity 160ms;
|
|
236
|
+
}
|
|
237
|
+
.ui-dialog-backdrop[data-starting-style],
|
|
238
|
+
.ui-dialog-backdrop[data-ending-style] {
|
|
239
|
+
opacity: 0;
|
|
240
|
+
}
|
|
241
|
+
.help-dialog {
|
|
242
|
+
position: fixed;
|
|
243
|
+
top: 50%;
|
|
244
|
+
left: 50%;
|
|
245
|
+
z-index: 61;
|
|
246
|
+
margin: 0;
|
|
247
|
+
width: min(490px, calc(100vw - 32px));
|
|
248
|
+
max-height: calc(100dvh - 48px);
|
|
249
|
+
overflow-y: auto;
|
|
250
|
+
transform: translate(-50%, -50%);
|
|
251
|
+
transition:
|
|
252
|
+
opacity 160ms,
|
|
253
|
+
translate 160ms;
|
|
254
|
+
}
|
|
255
|
+
.help-dialog[data-starting-style],
|
|
256
|
+
.help-dialog[data-ending-style] {
|
|
257
|
+
opacity: 0;
|
|
258
|
+
translate: 0 6px;
|
|
259
|
+
}
|
|
260
|
+
.ui-notifications {
|
|
261
|
+
position: fixed;
|
|
262
|
+
bottom: 24px;
|
|
263
|
+
right: 24px;
|
|
264
|
+
z-index: 70;
|
|
265
|
+
display: flex;
|
|
266
|
+
flex-direction: column;
|
|
267
|
+
gap: 8px;
|
|
268
|
+
width: min(380px, calc(100vw - 32px));
|
|
269
|
+
outline: 0;
|
|
270
|
+
}
|
|
271
|
+
.ui-notification {
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
justify-content: space-between;
|
|
275
|
+
gap: 12px;
|
|
276
|
+
padding: 12px 12px 12px 16px;
|
|
277
|
+
border: 1px solid var(--line);
|
|
278
|
+
border-radius: var(--popup-radius);
|
|
279
|
+
background: var(--popup-surface);
|
|
280
|
+
color: var(--ink);
|
|
281
|
+
box-shadow: var(--shadow-popup);
|
|
282
|
+
transition:
|
|
283
|
+
opacity 160ms,
|
|
284
|
+
transform 160ms;
|
|
285
|
+
}
|
|
286
|
+
.ui-notification-title {
|
|
287
|
+
font-size: 13px;
|
|
288
|
+
line-height: 1.5;
|
|
289
|
+
overflow-wrap: anywhere;
|
|
290
|
+
}
|
|
291
|
+
.ui-notification[data-kind="error"] {
|
|
292
|
+
border-color: var(--error-line);
|
|
293
|
+
}
|
|
294
|
+
.ui-notification[data-starting-style],
|
|
295
|
+
.ui-notification[data-ending-style] {
|
|
296
|
+
opacity: 0;
|
|
297
|
+
transform: translateY(6px);
|
|
298
|
+
}
|
|
299
|
+
.ui-notification[data-limited] {
|
|
300
|
+
display: none;
|
|
301
|
+
}
|
|
302
|
+
.sr-only {
|
|
303
|
+
position: absolute;
|
|
304
|
+
width: 1px;
|
|
305
|
+
height: 1px;
|
|
306
|
+
padding: 0;
|
|
307
|
+
margin: -1px;
|
|
308
|
+
overflow: hidden;
|
|
309
|
+
clip-path: inset(50%);
|
|
310
|
+
white-space: nowrap;
|
|
311
|
+
border: 0;
|
|
312
|
+
}
|
|
313
|
+
@media (prefers-reduced-motion: reduce) {
|
|
314
|
+
*,
|
|
315
|
+
*::before,
|
|
316
|
+
*::after {
|
|
317
|
+
transition: none !important;
|
|
318
|
+
animation: none !important;
|
|
319
|
+
scroll-behavior: auto !important;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.ui-button:not([data-static]):active:not(:disabled):not([data-disabled]) {
|
|
324
|
+
scale: 0.96;
|
|
325
|
+
}
|
|
326
|
+
.ui-select {
|
|
327
|
+
font-variant-numeric: tabular-nums;
|
|
328
|
+
}
|
|
329
|
+
.copy-status-icon {
|
|
330
|
+
position: relative;
|
|
331
|
+
width: 16px;
|
|
332
|
+
height: 16px;
|
|
333
|
+
flex-shrink: 0;
|
|
334
|
+
}
|
|
335
|
+
.copy-status-icon > span {
|
|
336
|
+
position: absolute;
|
|
337
|
+
inset: 0;
|
|
338
|
+
display: grid;
|
|
339
|
+
place-items: center;
|
|
340
|
+
opacity: 1;
|
|
341
|
+
scale: 1;
|
|
342
|
+
filter: blur(0px);
|
|
343
|
+
transition:
|
|
344
|
+
opacity 300ms cubic-bezier(0.2, 0, 0, 1),
|
|
345
|
+
scale 300ms cubic-bezier(0.2, 0, 0, 1),
|
|
346
|
+
filter 300ms cubic-bezier(0.2, 0, 0, 1);
|
|
347
|
+
}
|
|
348
|
+
.copy-prompt:not([data-copied]) .copy-status-icon .copy-done,
|
|
349
|
+
.copy-prompt[data-copied] .copy-status-icon .copy-idle {
|
|
350
|
+
opacity: 0;
|
|
351
|
+
scale: 0.25;
|
|
352
|
+
filter: blur(4px);
|
|
353
|
+
}
|
|
354
|
+
.copy-status-label {
|
|
355
|
+
display: grid;
|
|
356
|
+
text-align: start;
|
|
357
|
+
}
|
|
358
|
+
.copy-status-label > span {
|
|
359
|
+
grid-area: 1 / 1;
|
|
360
|
+
}
|
|
361
|
+
.copy-prompt:not([data-copied]) .copy-status-label .copy-done,
|
|
362
|
+
.copy-prompt[data-copied] .copy-status-label .copy-idle {
|
|
363
|
+
visibility: hidden;
|
|
364
|
+
}
|
|
365
|
+
.ui-button.copy-prompt {
|
|
366
|
+
padding-inline-start: 12px;
|
|
367
|
+
}
|
|
368
|
+
@media (prefers-reduced-motion: reduce) {
|
|
369
|
+
.ui-button {
|
|
370
|
+
scale: 1 !important;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.search-field { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 440px; flex: 1; min-height: var(--control-hit-size); padding: 0 10px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--control-radius); color: var(--muted); font-size: var(--body-size); line-height: var(--body-leading); }
|
|
375
|
+
.search-field:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 3px color-mix(in srgb, var(--focus-ring) 25%, transparent); }
|
|
376
|
+
.search-field input { border: 0; background: none; outline: none; box-shadow: none; width: 100%; min-width: 0; padding: 5px 0; }
|
|
377
|
+
.search-field input::placeholder { color: var(--muted); }
|
|
378
|
+
@media (forced-colors: active) {
|
|
379
|
+
.search-field:focus-within { outline: 1px solid Highlight; outline-offset: -1px; }
|
|
380
|
+
}
|
|
381
|
+
@media (max-width: 620px) { .search-field { min-width: 0; flex-basis: 100%; } }
|
|
382
|
+
.ui-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-top: 24px; }
|
|
383
|
+
.ui-tab { position: relative; appearance: none; border: 0; border-radius: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--label-size); line-height: var(--label-leading); font-weight: 500; cursor: pointer; }
|
|
384
|
+
.ui-tab::after { content: ''; position: absolute; height: 2px; left: 0; right: 0; bottom: -1px; background: transparent; }
|
|
385
|
+
.ui-tab:hover, .ui-tab[data-active] { color: var(--ink); }
|
|
386
|
+
.ui-tab:hover::after { background: var(--line-strong); }
|
|
387
|
+
.ui-tab[data-active]::after { background: var(--ink); }
|
|
388
|
+
.ui-tab:focus-visible { outline-offset: -3px; border-radius: 4px; }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import type { RenderArtifact } from '../shared/types';
|
|
3
|
+
import { usePdf } from './Pdf';
|
|
4
|
+
|
|
5
|
+
type Preview = { artifact?: RenderArtifact; pdfUrl?: string };
|
|
6
|
+
|
|
7
|
+
/** Keep the last complete PDF and its geometry together while the next loads. */
|
|
8
|
+
export function useReaderPreview(id: string, next: Preview) {
|
|
9
|
+
const [shown, setShown] = useState(next);
|
|
10
|
+
const loading = usePdf(id, next.artifact?.hash, true, 'documents', next.pdfUrl);
|
|
11
|
+
const previous = usePdf(id, shown.artifact?.hash, true, 'documents', shown.pdfUrl);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (loading.pdf) setShown(next);
|
|
14
|
+
}, [loading.pdf, next.artifact, next.pdfUrl]);
|
|
15
|
+
const error = loading.error;
|
|
16
|
+
return loading.pdf
|
|
17
|
+
? { pdf: loading.pdf, artifact: next.artifact, error: '', loading: false, retry: loading.retry }
|
|
18
|
+
: { pdf: previous.pdf, artifact: shown.artifact, error, loading: !error, retry: loading.retry };
|
|
19
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import type { DocumentState } from '../shared/types';
|
|
3
|
+
import type { TextEditPreview } from '../shared/selection';
|
|
4
|
+
import { api } from './api';
|
|
5
|
+
import {
|
|
6
|
+
createSession, createSessionStore, materializeTarget, pendingEdits,
|
|
7
|
+
rebaseSession, redo, sessionForDocument, undo, updateComponent, type EditSession,
|
|
8
|
+
} from './editSession';
|
|
9
|
+
|
|
10
|
+
const drafts = createSessionStore(() => window.sessionStorage);
|
|
11
|
+
const memoryDrafts = new Map<string, EditSession>();
|
|
12
|
+
type SaveReceipt = { id: string; revision: number };
|
|
13
|
+
const receipts = new Map<string, SaveReceipt>();
|
|
14
|
+
function readReceipt(id: string): SaveReceipt | undefined {
|
|
15
|
+
if (receipts.has(id)) return receipts.get(id);
|
|
16
|
+
try {
|
|
17
|
+
const receipt = JSON.parse(sessionStorage.getItem(`opendoc:saved-draft:${id}`) ?? 'null');
|
|
18
|
+
return typeof receipt?.id === 'string' && Number.isInteger(receipt.revision) ? receipt : undefined;
|
|
19
|
+
} catch { return undefined; }
|
|
20
|
+
}
|
|
21
|
+
function keepReceipt(id: string, receipt?: SaveReceipt) {
|
|
22
|
+
if (receipt) receipts.set(id, receipt); else receipts.delete(id);
|
|
23
|
+
try { if (receipt) sessionStorage.setItem(`opendoc:saved-draft:${id}`, JSON.stringify(receipt)); else sessionStorage.removeItem(`opendoc:saved-draft:${id}`); } catch { /* The current tab retains its receipt. */ }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Draft PDFs and source saves deliberately have separate lifetimes. */
|
|
27
|
+
export function useTextEditing(state: DocumentState, connected: boolean, onState: (state: DocumentState) => void) {
|
|
28
|
+
const [storedSession, setSession] = useState<EditSession | null>(() => memoryDrafts.get(state.id) ?? drafts.read(state.id)?.session ?? null);
|
|
29
|
+
const session = sessionForDocument(storedSession, { revision: state.revision, hash: state.artifact?.hash });
|
|
30
|
+
const current = useRef(storedSession);
|
|
31
|
+
const [preview, setPreview] = useState<TextEditPreview | null>(null);
|
|
32
|
+
const [previewing, setPreviewing] = useState(false);
|
|
33
|
+
const [error, setError] = useState('');
|
|
34
|
+
const [saving, setSaving] = useState(() => !!readReceipt(state.id));
|
|
35
|
+
const [savedId, setSavedId] = useState<string | null>(() => readReceipt(state.id)?.id ?? null);
|
|
36
|
+
const [undoing, setUndoing] = useState(false);
|
|
37
|
+
const [saved, setSaved] = useState(false);
|
|
38
|
+
const requestVersion = useRef(0);
|
|
39
|
+
const previewAbort = useRef<AbortController | null>(null);
|
|
40
|
+
const previewTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
41
|
+
const busy = useRef(!!readReceipt(state.id));
|
|
42
|
+
const submitted = useRef<SaveReceipt | null>(readReceipt(state.id) ?? null);
|
|
43
|
+
const restoredSave = useRef(!!readReceipt(state.id));
|
|
44
|
+
const [persistenceFailed, setPersistenceFailed] = useState(false);
|
|
45
|
+
const changes = session ? pendingEdits(session) : [];
|
|
46
|
+
const count = changes.length;
|
|
47
|
+
const stale = !!session && (count > 0 || !!session.future.length) && (session.hash !== state.artifact?.hash || session.revision !== state.revision) && !savedId;
|
|
48
|
+
const previewKey = session ? JSON.stringify([session.hash, session.revision, changes]) : '';
|
|
49
|
+
|
|
50
|
+
function keep(next: EditSession | null) {
|
|
51
|
+
current.current = next;
|
|
52
|
+
setSession(next);
|
|
53
|
+
if (next) { memoryDrafts.set(state.id, next); setPersistenceFailed(!drafts.write(state.id, next)); }
|
|
54
|
+
else { memoryDrafts.delete(state.id); drafts.clear(state.id); setPersistenceFailed(false); }
|
|
55
|
+
setSaved(false);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const version = ++requestVersion.current;
|
|
60
|
+
const controller = new AbortController();
|
|
61
|
+
previewAbort.current = controller;
|
|
62
|
+
if (!count) { setPreview(null); setPreviewing(false); return; }
|
|
63
|
+
if (stale || !connected || savedId) { setPreviewing(false); return; }
|
|
64
|
+
setPreviewing(true);
|
|
65
|
+
const timer = previewTimer.current = setTimeout(() => {
|
|
66
|
+
void api<TextEditPreview>(`/api/documents/${state.id}/edits/preview`, {
|
|
67
|
+
method: 'POST', body: JSON.stringify({ revision: session!.revision, hash: session!.hash, edits: changes }), signal: controller.signal,
|
|
68
|
+
}).then(next => {
|
|
69
|
+
if (version !== requestVersion.current) return;
|
|
70
|
+
setPreview(next); setError('');
|
|
71
|
+
}).catch((failure: Error) => {
|
|
72
|
+
if (!controller.signal.aborted && version === requestVersion.current) setError(failure.message);
|
|
73
|
+
}).finally(() => { if (version === requestVersion.current) setPreviewing(false); });
|
|
74
|
+
}, 450);
|
|
75
|
+
return () => { clearTimeout(timer); controller.abort(); };
|
|
76
|
+
}, [previewKey, stale, connected, savedId, state.id]);
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!savedId || (!restoredSave.current && state.revision <= (submitted.current?.revision ?? -1)) || state.status === 'rendering') return;
|
|
80
|
+
restoredSave.current = false;
|
|
81
|
+
if (state.manualEdit?.id !== savedId) {
|
|
82
|
+
keep(null); keepReceipt(state.id); setPreview(null); setSavedId(null); setSaving(false); busy.current = false;
|
|
83
|
+
setError('Your changes were saved. The document has since changed; you are viewing its latest version.');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (state.status === 'ready') {
|
|
87
|
+
keep(null); keepReceipt(state.id); setPreview(null); setSavedId(null); setSaving(false); setError(''); setSaved(true); busy.current = false;
|
|
88
|
+
} else if (state.status === 'error') {
|
|
89
|
+
setSaving(false); busy.current = false;
|
|
90
|
+
setError('Your changes were saved, but the PDF could not update. Undo the saved changes or ask your agent to repair the document.');
|
|
91
|
+
}
|
|
92
|
+
}, [savedId, state.status, state.revision, state.manualEdit?.id]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!persistenceFailed || !count) return;
|
|
95
|
+
const protect = (event: BeforeUnloadEvent) => { event.preventDefault(); event.returnValue = ''; };
|
|
96
|
+
window.addEventListener('beforeunload', protect);
|
|
97
|
+
return () => window.removeEventListener('beforeunload', protect);
|
|
98
|
+
}, [persistenceFailed, count]);
|
|
99
|
+
useEffect(() => { if (!saved) return; const timer = setTimeout(() => setSaved(false), 2500); return () => clearTimeout(timer); }, [saved]);
|
|
100
|
+
|
|
101
|
+
function target(id: string | undefined) {
|
|
102
|
+
if (!id) return undefined;
|
|
103
|
+
const active = sessionForDocument(current.current, { revision: state.revision, hash: state.artifact?.hash });
|
|
104
|
+
return active ? materializeTarget(active, id) : state.artifact?.textTargets?.find(item => item.id === id);
|
|
105
|
+
}
|
|
106
|
+
function change(targetId: string, text: string) {
|
|
107
|
+
if (busy.current || savedId) return 'Wait for the current save to finish.';
|
|
108
|
+
const base = sessionForDocument(current.current, { revision: state.revision, hash: state.artifact?.hash })
|
|
109
|
+
?? createSession({ revision: state.revision, hash: state.artifact!.hash, targets: state.artifact?.textTargets ?? [] });
|
|
110
|
+
const result = updateComponent(base, targetId, text);
|
|
111
|
+
if (!result.error) { keep(result.session); setError(''); }
|
|
112
|
+
return result.error;
|
|
113
|
+
}
|
|
114
|
+
function discard() {
|
|
115
|
+
if (busy.current || savedId) return;
|
|
116
|
+
++requestVersion.current; keep(null); setPreview(null); setPreviewing(false); setError('');
|
|
117
|
+
}
|
|
118
|
+
function undoDraft() { if (session && !busy.current && !savedId) { keep(undo(session)); setError(''); } }
|
|
119
|
+
function redoDraft() { if (session && !busy.current && !savedId) { keep(redo(session)); setError(''); } }
|
|
120
|
+
function refresh() {
|
|
121
|
+
if (!current.current || !state.artifact || state.status !== 'ready' || busy.current) return;
|
|
122
|
+
const result = rebaseSession(current.current, { revision: state.revision, hash: state.artifact.hash, targets: state.artifact.textTargets ?? [] });
|
|
123
|
+
if (result.error) setError(result.error);
|
|
124
|
+
else { keep(result.session); setError(''); }
|
|
125
|
+
}
|
|
126
|
+
async function save() {
|
|
127
|
+
const draft = current.current;
|
|
128
|
+
if (!draft || !pendingEdits(draft).length || busy.current || !connected || stale || state.status !== 'ready') return false;
|
|
129
|
+
busy.current = true; setSaving(true); setSaved(false); setError(''); ++requestVersion.current;
|
|
130
|
+
clearTimeout(previewTimer.current); previewAbort.current?.abort(); setPreviewing(false);
|
|
131
|
+
try {
|
|
132
|
+
const next = await api<DocumentState>(`/api/documents/${state.id}/edits`, {
|
|
133
|
+
method: 'POST', body: JSON.stringify({ revision: draft.revision, hash: draft.hash, edits: pendingEdits(draft) }),
|
|
134
|
+
});
|
|
135
|
+
if (!next.manualEdit) throw new Error('OpenDoc could not confirm this save. Your draft is still here.');
|
|
136
|
+
submitted.current = { id: next.manualEdit.id, revision: draft.revision };
|
|
137
|
+
keepReceipt(state.id, submitted.current);
|
|
138
|
+
setSavedId(next.manualEdit.id); onState(next);
|
|
139
|
+
return true;
|
|
140
|
+
} catch (failure) { setError((failure as Error).message); setSaving(false); busy.current = false; return false; }
|
|
141
|
+
}
|
|
142
|
+
async function undoSaved() {
|
|
143
|
+
if (!state.manualEdit?.canUndo || busy.current || !connected || (count && !savedId)) return false;
|
|
144
|
+
busy.current = true; setUndoing(true); setError('');
|
|
145
|
+
try {
|
|
146
|
+
const next = await api<DocumentState>(`/api/documents/${state.id}/edits/${state.manualEdit.id}/undo`, { method: 'POST', body: '{}' });
|
|
147
|
+
keep(null); keepReceipt(state.id); setPreview(null); setSavedId(null); setSaving(false); onState(next); return true;
|
|
148
|
+
} catch (failure) { setError((failure as Error).message); return false; }
|
|
149
|
+
finally { busy.current = false; setUndoing(false); }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return { session, preview, previewing, error, count, stale, saving, savedId, undoing, saved, persistenceFailed, dismissError: () => setError(''),
|
|
153
|
+
canUndo: !!session?.past.length, canRedo: !!session?.future.length,
|
|
154
|
+
target, change, discard, undoDraft, redoDraft, refresh, save, undoSaved };
|
|
155
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { constants, lstatSync, readFileSync, renameSync } from 'node:fs';
|
|
2
|
+
import { lstat, open, readFile, realpath, unlink, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
import { AssetError, assertAssetId, assetHash, safeAssetPath } from './files';
|
|
7
|
+
|
|
8
|
+
export function documentAssetAdapterSource(themeId: string) {
|
|
9
|
+
assertAssetId(themeId);
|
|
10
|
+
return `import { theme as base } from '../../themes/${themeId}';
|
|
11
|
+
import { withDocumentAssets, type DocumentAssets } from 'opendoc/assets';
|
|
12
|
+
import assets from './assets.json';
|
|
13
|
+
|
|
14
|
+
export const theme = withDocumentAssets(base, assets as DocumentAssets);
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
const unsupported = () => new AssetError('This template uses a custom or ambiguous theme import. Ask your agent to pass withDocumentAssets(baseTheme, savedAssets) into its template factory before binding fonts. No source was changed.', 409);
|
|
18
|
+
const conflict = () => new AssetError('This document changed while preparing its asset choices. Reload it before binding fonts. Your source was not overwritten.', 409);
|
|
19
|
+
|
|
20
|
+
/** Upgrade recognized legacy imports without evaluating source or rewriting document content. */
|
|
21
|
+
export async function ensureDocumentAssetAdapter(workspace: string, documentId: string): Promise<{ changed: boolean; theme?: string }> {
|
|
22
|
+
assertAssetId(documentId);
|
|
23
|
+
const root = await realpath(workspace), folder = resolve(root, 'documents', documentId);
|
|
24
|
+
safeAssetPath(root, folder, true);
|
|
25
|
+
const entry = safeAssetPath(root, resolve(folder, 'index.tsx'));
|
|
26
|
+
const initial = await lstat(entry);
|
|
27
|
+
if (initial.size > 1_000_000) throw new AssetError('This document entry is too large to adapt automatically. Ask your agent to use withDocumentAssets in its theme import.');
|
|
28
|
+
const contents = await readFile(entry, 'utf8'), digest = assetHash(contents);
|
|
29
|
+
const source = ts.createSourceFile(entry, contents, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
30
|
+
const imports = source.statements.filter(ts.isImportDeclaration).filter(node => ts.isStringLiteral(node.moduleSpecifier));
|
|
31
|
+
const pathFor = (node: ts.ImportDeclaration) => (node.moduleSpecifier as ts.StringLiteral).text;
|
|
32
|
+
const existing = imports.find(node => /^\.\/theme(?:\.tsx?)?$/.test(pathFor(node)) && !node.importClause?.isTypeOnly);
|
|
33
|
+
if (existing) {
|
|
34
|
+
const candidates = /\.tsx?$/.test(pathFor(existing)) ? [resolve(folder, pathFor(existing))] : [resolve(folder, 'theme.ts'), resolve(folder, 'theme.tsx')];
|
|
35
|
+
let file: string | undefined;
|
|
36
|
+
for (const candidate of candidates) { try { file = safeAssetPath(root, candidate); break; } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error; } }
|
|
37
|
+
if (!file) throw new AssetError('This document is missing its local theme adapter. Restore that file before binding fonts.', 409);
|
|
38
|
+
const adapter = ts.createSourceFile(file, await readFile(file, 'utf8'), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
39
|
+
const helpers = new Set<string>();
|
|
40
|
+
for (const statement of adapter.statements) if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && /^(?:opendoc\/assets|\.\.\/\.\.\/src\/assets(?:\/index(?:\.ts)?)?)$/.test(statement.moduleSpecifier.text) && !statement.importClause?.isTypeOnly && statement.importClause?.namedBindings && ts.isNamedImports(statement.importClause.namedBindings)) {
|
|
41
|
+
for (const name of statement.importClause.namedBindings.elements) if (!name.isTypeOnly && (name.propertyName ?? name.name).text === 'withDocumentAssets') helpers.add(name.name.text);
|
|
42
|
+
}
|
|
43
|
+
let adapted = false;
|
|
44
|
+
const visit = (node: ts.Node) => { if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && helpers.has(node.expression.text)) adapted = true; ts.forEachChild(node, visit); };
|
|
45
|
+
visit(adapter);
|
|
46
|
+
if (!adapted) throw unsupported();
|
|
47
|
+
return { changed: false };
|
|
48
|
+
}
|
|
49
|
+
const selected: { declaration: ts.ImportDeclaration; theme: string; specifiers: ts.ImportSpecifier[] }[] = [];
|
|
50
|
+
let unsupportedThemeImport = false;
|
|
51
|
+
for (const declaration of imports) {
|
|
52
|
+
const path = pathFor(declaration), direct = /^\.\.\/\.\.\/themes\/([a-z0-9]+(?:-[a-z0-9]+)*)(?:\/index(?:\.ts)?)?$/.exec(path)?.[1];
|
|
53
|
+
const registry = /^(?:opendoc\/themes|\.\.\/\.\.\/themes(?:\/index(?:\.ts)?)?)$/.test(path);
|
|
54
|
+
if ((!direct && !registry) || declaration.importClause?.isTypeOnly) continue;
|
|
55
|
+
const clause = declaration.importClause;
|
|
56
|
+
if (!clause?.namedBindings || !ts.isNamedImports(clause.namedBindings) || clause.name) { unsupportedThemeImport = true; continue; }
|
|
57
|
+
const themes = new Map<string, ts.ImportSpecifier[]>();
|
|
58
|
+
for (const specifier of clause.namedBindings.elements) {
|
|
59
|
+
if (specifier.isTypeOnly) continue;
|
|
60
|
+
const imported = (specifier.propertyName ?? specifier.name).text;
|
|
61
|
+
const theme = direct ? imported === 'theme' || imported === direct ? direct : undefined : imported === 'neutral' ? imported : undefined;
|
|
62
|
+
if (theme) themes.set(theme, [...(themes.get(theme) ?? []), specifier]);
|
|
63
|
+
}
|
|
64
|
+
for (const [theme, specifiers] of themes) selected.push({ declaration, theme, specifiers });
|
|
65
|
+
}
|
|
66
|
+
const template = imports.some(node => !node.importClause?.isTypeOnly && /^(?:opendoc\/template$|\.\.\/\.\.\/(?:templates|src\/template)(?:\/|$))/.test(pathFor(node)));
|
|
67
|
+
if (unsupportedThemeImport || new Set(selected.map(item => item.theme)).size > 1 || (!selected.length && template)) throw unsupported();
|
|
68
|
+
// Ordinary legacy documents with no explicit theme use Document's runtime adapter.
|
|
69
|
+
if (!selected.length) return { changed: false };
|
|
70
|
+
const theme = selected[0].theme;
|
|
71
|
+
safeAssetPath(root, resolve(root, 'themes', theme, 'index.ts'));
|
|
72
|
+
if (await lstat(resolve(folder, 'theme.ts')).catch(error => { if (error.code === 'ENOENT') return null; throw error; })) throw new AssetError('This document already has a theme.ts that would shadow the asset adapter. Ask your agent to integrate its saved assets; the existing file was preserved.', 409);
|
|
73
|
+
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed, removeComments: true });
|
|
74
|
+
const replacements = selected.map(item => {
|
|
75
|
+
const clause = item.declaration.importClause!, names = clause.namedBindings as ts.NamedImports;
|
|
76
|
+
const remaining = names.elements.filter(name => !item.specifiers.includes(name));
|
|
77
|
+
const themeImport = ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined,
|
|
78
|
+
ts.factory.createNamedImports(item.specifiers.map(name => ts.factory.createImportSpecifier(false, name.name.text === 'theme' ? undefined : ts.factory.createIdentifier('theme'), ts.factory.createIdentifier(name.name.text))))), ts.factory.createStringLiteral('./theme'));
|
|
79
|
+
const rest = remaining.length ? ts.factory.updateImportDeclaration(item.declaration, item.declaration.modifiers,
|
|
80
|
+
ts.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, ts.factory.createNamedImports(remaining)), item.declaration.moduleSpecifier, item.declaration.attributes) : undefined;
|
|
81
|
+
return { start: item.declaration.getStart(source), end: item.declaration.end, text: [rest, themeImport].filter(Boolean).map(node => printer.printNode(ts.EmitHint.Unspecified, node!, source)).join('\n') };
|
|
82
|
+
});
|
|
83
|
+
let updated = contents;
|
|
84
|
+
for (const replacement of replacements.sort((a, b) => b.start - a.start)) updated = updated.slice(0, replacement.start) + replacement.text + updated.slice(replacement.end);
|
|
85
|
+
const adapterFile = resolve(folder, 'theme.tsx'), adapterSource = documentAssetAdapterSource(theme);
|
|
86
|
+
const created = new Map<string, { ino: number; digest: string }>();
|
|
87
|
+
const pending = resolve(folder, `.asset-adapter-${randomUUID()}.tmp`);
|
|
88
|
+
const folderInfo = await lstat(folder);
|
|
89
|
+
function assertCurrent() {
|
|
90
|
+
safeAssetPath(root, folder, true); safeAssetPath(root, entry);
|
|
91
|
+
const currentFolder = lstatSync(folder), current = lstatSync(entry);
|
|
92
|
+
if (currentFolder.dev !== folderInfo.dev || currentFolder.ino !== folderInfo.ino || current.dev !== initial.dev || current.ino !== initial.ino || assetHash(readFileSync(entry)) !== digest) throw conflict();
|
|
93
|
+
}
|
|
94
|
+
async function createCompanion(file: string, value: string, acceptsExisting: boolean) {
|
|
95
|
+
assertCurrent();
|
|
96
|
+
let handle;
|
|
97
|
+
try { handle = await open(file, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o644); }
|
|
98
|
+
catch (error) {
|
|
99
|
+
if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;
|
|
100
|
+
safeAssetPath(root, file);
|
|
101
|
+
if (!acceptsExisting && await readFile(file, 'utf8') !== value) throw new AssetError('This document already has a custom theme.tsx. Ask your agent to integrate its saved assets; the existing file was preserved.', 409);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
try { const info = await handle.stat(); created.set(file, { ino: info.ino, digest: assetHash(value) }); await handle.writeFile(value); }
|
|
105
|
+
finally { await handle.close(); }
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
// An empty manifest keeps a first-time upgrade renderable until the caller
|
|
109
|
+
// publishes its exact choices. Existing choices are never replaced here.
|
|
110
|
+
await createCompanion(resolve(folder, 'assets.json'), '{"version":1}\n', true);
|
|
111
|
+
await createCompanion(adapterFile, adapterSource, false);
|
|
112
|
+
await writeFile(pending, updated, { flag: 'wx', mode: initial.mode & 0o777 });
|
|
113
|
+
assertCurrent();
|
|
114
|
+
renameSync(pending, entry);
|
|
115
|
+
return { changed: true, theme };
|
|
116
|
+
} catch (error) {
|
|
117
|
+
for (const [file, identity] of created) {
|
|
118
|
+
try { if ((await lstat(file)).ino === identity.ino && assetHash(await readFile(file)) === identity.digest) await unlink(file); } catch { /* Preserve a companion changed by another writer. */ }
|
|
119
|
+
}
|
|
120
|
+
throw error;
|
|
121
|
+
} finally { await unlink(pending).catch(() => {}); }
|
|
122
|
+
}
|