@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
package/src/app/Pdf.tsx
ADDED
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
import { Button } from "./ui";
|
|
2
|
+
import { Icon } from './ui/Icon';
|
|
3
|
+
import { InspectionLayer } from './InspectionLayer';
|
|
4
|
+
import {
|
|
5
|
+
memo,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
type CSSProperties,
|
|
12
|
+
type RefObject,
|
|
13
|
+
} from "react";
|
|
14
|
+
import type { PDFDocumentLoadingTask, PDFDocumentProxy, RenderTask, TextLayer } from "pdfjs-dist";
|
|
15
|
+
import worker from "pdfjs-dist/build/pdf.worker.min.mjs?url";
|
|
16
|
+
import { getBlock, type Fragment, type ArtifactSummary, type RenderArtifact } from "../shared/types";
|
|
17
|
+
import type { DocumentSelection } from "../shared/selection";
|
|
18
|
+
import { mapPdfTextSpans, pdfSpanRangeForSelection, type PdfSpanMapping } from "./pdfSelection";
|
|
19
|
+
import { loadPdfWithDeadline } from './pdfLoading';
|
|
20
|
+
|
|
21
|
+
let pdfJs: Promise<typeof import('pdfjs-dist')> | undefined;
|
|
22
|
+
function loadPdfJs() {
|
|
23
|
+
pdfJs ??= import('pdfjs-dist').then(module => {
|
|
24
|
+
module.GlobalWorkerOptions.workerSrc = worker;
|
|
25
|
+
return module;
|
|
26
|
+
}).catch(error => { pdfJs = undefined; throw error; });
|
|
27
|
+
return pdfJs;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const spanMappings = new WeakMap<HTMLElement, PdfSpanMapping>();
|
|
31
|
+
|
|
32
|
+
function rangeWithinSpan(element: HTMLElement, start: number, end: number): Range | null {
|
|
33
|
+
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
34
|
+
const range = document.createRange();
|
|
35
|
+
let cursor = 0, began = false;
|
|
36
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
37
|
+
const length = node.textContent?.length ?? 0;
|
|
38
|
+
if (!began && start <= cursor + length) {
|
|
39
|
+
range.setStart(node, Math.max(0, start - cursor));
|
|
40
|
+
began = true;
|
|
41
|
+
}
|
|
42
|
+
if (began && end <= cursor + length) {
|
|
43
|
+
range.setEnd(node, Math.max(0, end - cursor));
|
|
44
|
+
return range;
|
|
45
|
+
}
|
|
46
|
+
cursor += length;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CachedPdf = {
|
|
52
|
+
loading: Promise<PDFDocumentLoadingTask>;
|
|
53
|
+
ready: Promise<PDFDocumentProxy>;
|
|
54
|
+
readers: number;
|
|
55
|
+
release?: ReturnType<typeof setTimeout>;
|
|
56
|
+
};
|
|
57
|
+
const pdfs = new Map<string, CachedPdf>();
|
|
58
|
+
|
|
59
|
+
function acquirePdf(key: string) {
|
|
60
|
+
let entry = pdfs.get(key);
|
|
61
|
+
if (!entry) {
|
|
62
|
+
const loading = loadPdfJs().then(module => module.getDocument({ url: key }));
|
|
63
|
+
entry = { loading, ready: loadPdfWithDeadline(loading), readers: 0 };
|
|
64
|
+
pdfs.set(key, entry);
|
|
65
|
+
}
|
|
66
|
+
clearTimeout(entry.release);
|
|
67
|
+
entry.readers += 1;
|
|
68
|
+
return entry;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function releasePdf(key: string, entry: CachedPdf) {
|
|
72
|
+
entry.readers -= 1;
|
|
73
|
+
if (entry.readers) return;
|
|
74
|
+
// Keep the worker alive briefly when moving between a cover and its reader.
|
|
75
|
+
entry.release = setTimeout(() => {
|
|
76
|
+
if (entry.readers || pdfs.get(key) !== entry) return;
|
|
77
|
+
pdfs.delete(key);
|
|
78
|
+
void entry.loading.then(task => task.destroy()).catch(() => {});
|
|
79
|
+
}, 5_000);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function errorMessage(error: unknown) {
|
|
83
|
+
return error instanceof Error ? error.message : String(error);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function usePdf(id: string, hash?: string, enabled = true, collection: 'documents' | 'templates' | 'themes' = 'documents', sourceUrl?: string) {
|
|
87
|
+
const key =
|
|
88
|
+
enabled && hash
|
|
89
|
+
? sourceUrl ?? `/api/${collection}/${encodeURIComponent(id)}/pdf?hash=${encodeURIComponent(hash)}`
|
|
90
|
+
: "";
|
|
91
|
+
const [attempt, setAttempt] = useState(0);
|
|
92
|
+
const retry = useCallback(() => setAttempt(value => value + 1), []);
|
|
93
|
+
const [state, setState] = useState<{
|
|
94
|
+
key: string;
|
|
95
|
+
pdf: PDFDocumentProxy | null;
|
|
96
|
+
error: string;
|
|
97
|
+
}>({ key: "", pdf: null, error: "" });
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!key) {
|
|
100
|
+
setState({ key: "", pdf: null, error: "" });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let active = true;
|
|
104
|
+
setState({ key, pdf: null, error: "" });
|
|
105
|
+
const entry = acquirePdf(key);
|
|
106
|
+
entry.ready
|
|
107
|
+
.then((result) => {
|
|
108
|
+
if (active) setState({ key, pdf: result, error: "" });
|
|
109
|
+
})
|
|
110
|
+
.catch((error) => {
|
|
111
|
+
// A retry must acquire a fresh task rather than reuse a cached failure.
|
|
112
|
+
if (pdfs.get(key) === entry) {
|
|
113
|
+
pdfs.delete(key);
|
|
114
|
+
void entry.loading.then(task => task.destroy()).catch(() => {});
|
|
115
|
+
}
|
|
116
|
+
if (active) setState({ key, pdf: null, error: errorMessage(error) });
|
|
117
|
+
});
|
|
118
|
+
return () => {
|
|
119
|
+
active = false;
|
|
120
|
+
releasePdf(key, entry);
|
|
121
|
+
};
|
|
122
|
+
}, [key, attempt]);
|
|
123
|
+
return key && state.key === key
|
|
124
|
+
? { pdf: state.pdf, error: state.error, retry }
|
|
125
|
+
: { pdf: null, error: "", retry };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function useNearViewport(
|
|
129
|
+
ref: RefObject<HTMLDivElement | null>,
|
|
130
|
+
key: unknown,
|
|
131
|
+
rootMargin: string,
|
|
132
|
+
{ once = true, enabled = true }: { once?: boolean; enabled?: boolean } = {},
|
|
133
|
+
) {
|
|
134
|
+
const [visibility, setVisibility] = useState<{
|
|
135
|
+
key: unknown;
|
|
136
|
+
nearby: boolean;
|
|
137
|
+
} | null>(null);
|
|
138
|
+
const nearby =
|
|
139
|
+
!enabled || (visibility !== null && visibility.key === key && visibility.nearby);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
const element = ref.current;
|
|
142
|
+
if (!enabled || !element) return;
|
|
143
|
+
if (!("IntersectionObserver" in window)) {
|
|
144
|
+
setVisibility({ key, nearby: true });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
let active = true;
|
|
148
|
+
const observer = new IntersectionObserver(
|
|
149
|
+
(entries) => {
|
|
150
|
+
if (!active) return;
|
|
151
|
+
const intersects = entries.some((entry) => entry.isIntersecting);
|
|
152
|
+
if (intersects || !once) {
|
|
153
|
+
setVisibility((current) =>
|
|
154
|
+
current !== null && current.key === key && current.nearby === intersects
|
|
155
|
+
? current
|
|
156
|
+
: { key, nearby: intersects },
|
|
157
|
+
);
|
|
158
|
+
if (once) observer.disconnect();
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
root: element.closest(".reader-scroll, .page-rail"),
|
|
163
|
+
rootMargin,
|
|
164
|
+
},
|
|
165
|
+
);
|
|
166
|
+
observer.observe(element);
|
|
167
|
+
return () => {
|
|
168
|
+
active = false;
|
|
169
|
+
observer.disconnect();
|
|
170
|
+
};
|
|
171
|
+
}, [enabled, key, once, ref, rootMargin]);
|
|
172
|
+
return nearby;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type PdfPageProps = {
|
|
176
|
+
pdf: PDFDocumentProxy;
|
|
177
|
+
number: number;
|
|
178
|
+
width: number;
|
|
179
|
+
thumbnail?: boolean;
|
|
180
|
+
artifact?: RenderArtifact;
|
|
181
|
+
selected?: string | null;
|
|
182
|
+
selection?: DocumentSelection | null;
|
|
183
|
+
commented?: Set<string>;
|
|
184
|
+
onSelect?: (id: string, page: number) => void;
|
|
185
|
+
onComment?: (id: string, page: number) => void;
|
|
186
|
+
onTextClick?: (selection: DocumentSelection, rect: { left: number; top: number; width: number; height: number }) => void;
|
|
187
|
+
onNavigate?: (page: number) => void;
|
|
188
|
+
};
|
|
189
|
+
export const PdfPage = memo(function PdfPage({
|
|
190
|
+
pdf,
|
|
191
|
+
number,
|
|
192
|
+
width,
|
|
193
|
+
thumbnail,
|
|
194
|
+
artifact,
|
|
195
|
+
selected,
|
|
196
|
+
selection,
|
|
197
|
+
commented,
|
|
198
|
+
onSelect,
|
|
199
|
+
onComment,
|
|
200
|
+
onTextClick,
|
|
201
|
+
onNavigate,
|
|
202
|
+
}: PdfPageProps) {
|
|
203
|
+
const container = useRef<HTMLDivElement>(null);
|
|
204
|
+
const canvas = useRef<HTMLCanvasElement>(null);
|
|
205
|
+
const text = useRef<HTMLDivElement>(null);
|
|
206
|
+
const pointerStart = useRef({ x: 0, y: 0 });
|
|
207
|
+
const visibilityKey = useMemo(() => ({ pdf, number }), [pdf, number]);
|
|
208
|
+
const activated = useNearViewport(
|
|
209
|
+
container,
|
|
210
|
+
visibilityKey,
|
|
211
|
+
thumbnail ? "240px 0px" : "900px 0px",
|
|
212
|
+
);
|
|
213
|
+
const retained = useNearViewport(container, visibilityKey, "4000px 0px", {
|
|
214
|
+
once: false,
|
|
215
|
+
enabled: !thumbnail && pdf.numPages >= 25,
|
|
216
|
+
});
|
|
217
|
+
// Long documents retain several screens in each direction, without keeping
|
|
218
|
+
// every full-resolution canvas and text layer alive after a complete read.
|
|
219
|
+
const renderPage = activated && retained;
|
|
220
|
+
const [links, setLinks] = useState<
|
|
221
|
+
{ rect: number[]; url?: string; dest?: unknown }[]
|
|
222
|
+
>([]);
|
|
223
|
+
const [pageSize, setPageSize] = useState<{
|
|
224
|
+
pdf: PDFDocumentProxy;
|
|
225
|
+
number: number;
|
|
226
|
+
width: number;
|
|
227
|
+
height: number;
|
|
228
|
+
} | null>(null);
|
|
229
|
+
const [error, setError] = useState("");
|
|
230
|
+
const [rendered, setRendered] = useState(false);
|
|
231
|
+
const [textReady, setTextReady] = useState(false);
|
|
232
|
+
const [highlightState, setHighlightState] = useState<{ key: string; rects: { left: number; top: number; width: number; height: number }[] }>({ key: '', rects: [] });
|
|
233
|
+
const geometry =
|
|
234
|
+
artifact?.pages[number - 1] ??
|
|
235
|
+
(pageSize?.pdf === pdf && pageSize.number === number ? pageSize : null);
|
|
236
|
+
const scale = width / (geometry?.width ?? 595.28);
|
|
237
|
+
const height = scale * (geometry?.height ?? 841.89);
|
|
238
|
+
const highlightKey = JSON.stringify([artifact?.hash, selection?.renderHash, selection?.blockId, selection?.targetId, selection?.start, selection?.end, width, number]);
|
|
239
|
+
const preciseTarget = selection?.targetId && Number.isInteger(selection.start) && Number.isInteger(selection.end) && selection.end! > selection.start!
|
|
240
|
+
? artifact?.textTargets?.find(target => target.id === selection.targetId && target.blockId === selection.blockId) : undefined;
|
|
241
|
+
const fullTargetSelection = !!preciseTarget && selection?.start === 0 && selection?.end === preciseTarget.text.length;
|
|
242
|
+
const phraseHighlights = !fullTargetSelection && textReady && highlightState.key === highlightKey ? highlightState.rects : [];
|
|
243
|
+
const phraseOnPage = preciseTarget?.lines.some(line => line.page === number && line.end > selection!.start! && line.start < selection!.end!);
|
|
244
|
+
const showBlockSelection = !preciseTarget || (!fullTargetSelection && phraseOnPage && !phraseHighlights.length);
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
let active = true,
|
|
247
|
+
task: RenderTask | undefined,
|
|
248
|
+
layer: TextLayer | undefined;
|
|
249
|
+
setError("");
|
|
250
|
+
setRendered(false);
|
|
251
|
+
setTextReady(false);
|
|
252
|
+
setLinks([]);
|
|
253
|
+
text.current?.replaceChildren();
|
|
254
|
+
if (!renderPage || width <= 0) {
|
|
255
|
+
if (canvas.current) {
|
|
256
|
+
canvas.current.width = 0;
|
|
257
|
+
canvas.current.height = 0;
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
void (async () => {
|
|
262
|
+
const page = await pdf.getPage(number);
|
|
263
|
+
if (!active || !canvas.current) return;
|
|
264
|
+
const size = page.getViewport({ scale: 1 });
|
|
265
|
+
setPageSize((current) =>
|
|
266
|
+
current?.pdf === pdf &&
|
|
267
|
+
current.number === number &&
|
|
268
|
+
current.width === size.width &&
|
|
269
|
+
current.height === size.height
|
|
270
|
+
? current
|
|
271
|
+
: { pdf, number, width: size.width, height: size.height },
|
|
272
|
+
);
|
|
273
|
+
const viewport = page.getViewport({
|
|
274
|
+
scale: width / size.width,
|
|
275
|
+
});
|
|
276
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
277
|
+
const element = canvas.current;
|
|
278
|
+
element.width = Math.floor(viewport.width * dpr);
|
|
279
|
+
element.height = Math.floor(viewport.height * dpr);
|
|
280
|
+
const context = element.getContext("2d");
|
|
281
|
+
if (!context) throw new Error("The page canvas is unavailable.");
|
|
282
|
+
task = page.render({
|
|
283
|
+
canvasContext: context,
|
|
284
|
+
canvas: element,
|
|
285
|
+
viewport,
|
|
286
|
+
transform: [dpr, 0, 0, dpr, 0, 0],
|
|
287
|
+
});
|
|
288
|
+
await task.promise;
|
|
289
|
+
if (!active) return;
|
|
290
|
+
setRendered(true);
|
|
291
|
+
if (!thumbnail && text.current) {
|
|
292
|
+
const textElement = text.current;
|
|
293
|
+
const [content, annotations] = await Promise.all([
|
|
294
|
+
page.getTextContent(),
|
|
295
|
+
page.getAnnotations(),
|
|
296
|
+
]);
|
|
297
|
+
const { TextLayer } = await loadPdfJs();
|
|
298
|
+
if (!active) return;
|
|
299
|
+
layer = new TextLayer({
|
|
300
|
+
textContentSource: content,
|
|
301
|
+
container: textElement,
|
|
302
|
+
viewport,
|
|
303
|
+
});
|
|
304
|
+
await layer.render();
|
|
305
|
+
if (active) {
|
|
306
|
+
for (const span of layer.textDivs) {
|
|
307
|
+
span.dataset.pdfText = '';
|
|
308
|
+
span.dataset.pdfPage = String(number);
|
|
309
|
+
}
|
|
310
|
+
setTextReady(true);
|
|
311
|
+
}
|
|
312
|
+
if (active)
|
|
313
|
+
setLinks(
|
|
314
|
+
annotations
|
|
315
|
+
.filter((a) => a.subtype === "Link")
|
|
316
|
+
.map((a) => ({
|
|
317
|
+
rect: [
|
|
318
|
+
...viewport.convertToViewportPoint(a.rect[0], a.rect[1]),
|
|
319
|
+
...viewport.convertToViewportPoint(a.rect[2], a.rect[3]),
|
|
320
|
+
],
|
|
321
|
+
url: a.url,
|
|
322
|
+
dest: a.dest,
|
|
323
|
+
})),
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
})().catch((error) => {
|
|
327
|
+
if (active && error?.name !== "RenderingCancelledException")
|
|
328
|
+
setError(`Could not display this page: ${errorMessage(error)}`);
|
|
329
|
+
});
|
|
330
|
+
return () => {
|
|
331
|
+
active = false;
|
|
332
|
+
task?.cancel();
|
|
333
|
+
layer?.cancel();
|
|
334
|
+
};
|
|
335
|
+
}, [pdf, number, width, thumbnail, renderPage]);
|
|
336
|
+
|
|
337
|
+
useEffect(() => {
|
|
338
|
+
if (!textReady || !text.current || !container.current) return;
|
|
339
|
+
const pageRect = container.current.getBoundingClientRect();
|
|
340
|
+
const spans = Array.from(text.current.querySelectorAll<HTMLElement>('[data-pdf-text]'));
|
|
341
|
+
const mappings = mapPdfTextSpans(spans.map(span => {
|
|
342
|
+
const rect = span.getBoundingClientRect();
|
|
343
|
+
return { text: span.textContent ?? '', page: number, x: (rect.left - pageRect.left) / scale,
|
|
344
|
+
y: (rect.top - pageRect.top) / scale, width: rect.width / scale, height: rect.height / scale };
|
|
345
|
+
}), artifact?.textTargets ?? []);
|
|
346
|
+
spans.forEach((span, index) => {
|
|
347
|
+
spanMappings.delete(span);
|
|
348
|
+
if (mappings[index]) spanMappings.set(span, mappings[index]);
|
|
349
|
+
});
|
|
350
|
+
}, [artifact, number, scale, textReady]);
|
|
351
|
+
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
const rects: { left: number; top: number; width: number; height: number }[] = [];
|
|
354
|
+
if (textReady && text.current && container.current && selection?.targetId
|
|
355
|
+
&& (!selection.renderHash || selection.renderHash === artifact?.hash)) {
|
|
356
|
+
const pageRect = container.current.getBoundingClientRect();
|
|
357
|
+
for (const span of text.current.querySelectorAll<HTMLElement>('[data-pdf-text]')) {
|
|
358
|
+
const offsets = pdfSpanRangeForSelection(spanMappings.get(span), selection);
|
|
359
|
+
const range = offsets && rangeWithinSpan(span, offsets.start, offsets.end);
|
|
360
|
+
if (!range) continue;
|
|
361
|
+
for (const rect of range.getClientRects()) {
|
|
362
|
+
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
363
|
+
rects.push({ left: rect.left - pageRect.left, top: rect.top - pageRect.top, width: rect.width, height: rect.height });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
setHighlightState({ key: highlightKey, rects });
|
|
368
|
+
}, [artifact, highlightKey, selection, textReady]);
|
|
369
|
+
|
|
370
|
+
async function followDestination(dest: unknown) {
|
|
371
|
+
try {
|
|
372
|
+
const value =
|
|
373
|
+
typeof dest === "string" ? await pdf.getDestination(dest) : dest;
|
|
374
|
+
if (Array.isArray(value)) {
|
|
375
|
+
const index =
|
|
376
|
+
typeof value[0] === "number"
|
|
377
|
+
? value[0]
|
|
378
|
+
: await pdf.getPageIndex(value[0]);
|
|
379
|
+
if (Number.isInteger(index) && index >= 0 && index < pdf.numPages) {
|
|
380
|
+
onNavigate?.(index + 1);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
setError("This reference does not point to an available page.");
|
|
385
|
+
} catch {
|
|
386
|
+
setError("This reference could not be opened.");
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const fragments = useMemo(
|
|
390
|
+
() =>
|
|
391
|
+
renderPage && !thumbnail
|
|
392
|
+
? [...(artifact?.pages[number - 1]?.fragments ?? [])].sort(
|
|
393
|
+
(a, b) => b.width * b.height - a.width * a.height,
|
|
394
|
+
)
|
|
395
|
+
: [],
|
|
396
|
+
[artifact, number, renderPage, thumbnail],
|
|
397
|
+
);
|
|
398
|
+
const textComponents = useMemo(() => renderPage && !thumbnail ? (artifact?.textTargets ?? []).flatMap(target => {
|
|
399
|
+
const lines = target.lines.filter(line => line.page === number && line.width > 0 && line.height > 0);
|
|
400
|
+
if (!lines.length || !target.text) return [];
|
|
401
|
+
const x = Math.min(...lines.map(line => line.x));
|
|
402
|
+
const y = Math.min(...lines.map(line => line.y));
|
|
403
|
+
return [{ target, x, y, width: Math.max(...lines.map(line => line.x + line.width)) - x,
|
|
404
|
+
height: Math.max(...lines.map(line => line.y + line.height)) - y }];
|
|
405
|
+
}) : [], [artifact, number, renderPage, thumbnail]);
|
|
406
|
+
function rectStyle(f: Pick<Fragment, 'x' | 'y' | 'width' | 'height'>): CSSProperties {
|
|
407
|
+
return {
|
|
408
|
+
left: f.x * scale,
|
|
409
|
+
top: f.y * scale,
|
|
410
|
+
width: f.width * scale,
|
|
411
|
+
height: f.height * scale,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
return (
|
|
415
|
+
<div
|
|
416
|
+
ref={container}
|
|
417
|
+
className={`pdf-page ${thumbnail ? "thumbnail" : ""}`}
|
|
418
|
+
data-page={number}
|
|
419
|
+
data-render-hash={artifact?.hash}
|
|
420
|
+
data-rendered={rendered}
|
|
421
|
+
onPointerDownCapture={event => { pointerStart.current = { x: event.clientX, y: event.clientY }; }}
|
|
422
|
+
onClickCapture={event => {
|
|
423
|
+
if (event.detail > 0 && Math.hypot(event.clientX - pointerStart.current.x, event.clientY - pointerStart.current.y) > 4) {
|
|
424
|
+
event.preventDefault();
|
|
425
|
+
event.stopPropagation();
|
|
426
|
+
}
|
|
427
|
+
}}
|
|
428
|
+
style={
|
|
429
|
+
{
|
|
430
|
+
width,
|
|
431
|
+
height,
|
|
432
|
+
"--total-scale-factor": scale,
|
|
433
|
+
"--scale-round-x": "1px",
|
|
434
|
+
"--scale-round-y": "1px",
|
|
435
|
+
} as CSSProperties
|
|
436
|
+
}
|
|
437
|
+
>
|
|
438
|
+
<canvas
|
|
439
|
+
ref={canvas}
|
|
440
|
+
aria-label={`Page ${number}`}
|
|
441
|
+
style={{ width, height }}
|
|
442
|
+
/>
|
|
443
|
+
{renderPage && !thumbnail && (
|
|
444
|
+
<>
|
|
445
|
+
<div ref={text} className="textLayer" />
|
|
446
|
+
<div className="link-layer">
|
|
447
|
+
{links.map((link, index) => {
|
|
448
|
+
const [x1, y1, x2, y2] = link.rect;
|
|
449
|
+
const style = {
|
|
450
|
+
left: Math.min(x1, x2),
|
|
451
|
+
top: Math.min(y1, y2),
|
|
452
|
+
width: Math.abs(x2 - x1),
|
|
453
|
+
height: Math.abs(y2 - y1),
|
|
454
|
+
};
|
|
455
|
+
return link.url && /^(https?:|mailto:)/i.test(link.url) ? (
|
|
456
|
+
<a
|
|
457
|
+
key={index}
|
|
458
|
+
style={style}
|
|
459
|
+
href={link.url}
|
|
460
|
+
target="_blank"
|
|
461
|
+
rel="noopener noreferrer"
|
|
462
|
+
aria-label={`Open reference: ${link.url}`}
|
|
463
|
+
/>
|
|
464
|
+
) : link.dest ? (
|
|
465
|
+
<Button
|
|
466
|
+
static
|
|
467
|
+
key={index}
|
|
468
|
+
style={style}
|
|
469
|
+
onClick={() => void followDestination(link.dest)}
|
|
470
|
+
aria-label="Go to reference"
|
|
471
|
+
/>
|
|
472
|
+
) : null;
|
|
473
|
+
})}
|
|
474
|
+
</div>
|
|
475
|
+
<InspectionLayer key={`${artifact?.hash}:${width}`}>
|
|
476
|
+
{phraseHighlights.map((rect, index) => <div key={index} className="text-selection-highlight" aria-hidden="true" style={{ ...rect, pointerEvents: 'none' }} />)}
|
|
477
|
+
{fragments.map(fragment => {
|
|
478
|
+
const block = getBlock(artifact, fragment.id);
|
|
479
|
+
const hasText = textComponents.some(item => item.target.blockId === fragment.id);
|
|
480
|
+
return <Button static key={fragment.id} className={`block-target component-target ${selected === fragment.id && showBlockSelection ? 'selected' : ''}`}
|
|
481
|
+
data-block-id={fragment.id} style={rectStyle(fragment)} tabIndex={hasText ? -1 : 0}
|
|
482
|
+
aria-label={`Select ${block?.kind ?? 'document'} component: ${block?.text.slice(0, 90) || fragment.id}`}
|
|
483
|
+
onClick={() => onSelect?.(fragment.id, number)}>
|
|
484
|
+
<span className="block-label" aria-hidden="true">{block?.kind ?? 'Component'}</span>
|
|
485
|
+
</Button>;
|
|
486
|
+
})}
|
|
487
|
+
{textComponents.map(item => {
|
|
488
|
+
const block = getBlock(artifact, item.target.blockId);
|
|
489
|
+
const fullSelected = selection?.targetId === item.target.id && selection.start === 0 && selection.end === item.target.text.length;
|
|
490
|
+
return <Button static key={item.target.id} className={`block-target component-target text-component ${fullSelected ? 'selected' : ''}`}
|
|
491
|
+
data-text-target={item.target.id} style={rectStyle(item)}
|
|
492
|
+
aria-label={`Select ${block?.kind ?? 'text'}: ${item.target.text.slice(0, 90)}`}
|
|
493
|
+
onClick={event => {
|
|
494
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
495
|
+
onTextClick?.({ blockId: item.target.blockId, targetId: item.target.id, start: 0, end: item.target.text.length,
|
|
496
|
+
quote: item.target.text, page: number, renderHash: artifact?.hash },
|
|
497
|
+
{ left: rect.left, top: rect.top, width: rect.width, height: rect.height });
|
|
498
|
+
}}>
|
|
499
|
+
<span className="block-label" aria-hidden="true">{block?.kind ?? 'Text'}</span>
|
|
500
|
+
</Button>;
|
|
501
|
+
})}
|
|
502
|
+
{fragments.filter(fragment => commented?.has(fragment.id)).map(fragment => {
|
|
503
|
+
const block = getBlock(artifact, fragment.id);
|
|
504
|
+
return <Button static key={fragment.id} className="comment-marker"
|
|
505
|
+
aria-label={`View comments on ${block?.kind ?? 'block'}: ${block?.text.slice(0, 90) || fragment.id}`}
|
|
506
|
+
style={{ left: (fragment.x + fragment.width) * scale + 4, top: fragment.y * scale - 6, pointerEvents: 'auto' }}
|
|
507
|
+
onClick={() => (onComment ?? onSelect)?.(fragment.id, number)}><Icon name="comment" size={12} /></Button>;
|
|
508
|
+
})}
|
|
509
|
+
</InspectionLayer>
|
|
510
|
+
</>
|
|
511
|
+
)}
|
|
512
|
+
{error && (
|
|
513
|
+
<div className="page-error" role="alert">
|
|
514
|
+
{error}
|
|
515
|
+
</div>
|
|
516
|
+
)}
|
|
517
|
+
</div>
|
|
518
|
+
);
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
export function CoverPreview({
|
|
522
|
+
format = 'document',
|
|
523
|
+
id,
|
|
524
|
+
artifact,
|
|
525
|
+
compact = false,
|
|
526
|
+
}: {
|
|
527
|
+
id: string;
|
|
528
|
+
artifact?: ArtifactSummary;
|
|
529
|
+
format?: 'document' | 'presentation';
|
|
530
|
+
compact?: boolean;
|
|
531
|
+
}) {
|
|
532
|
+
const cover = useRef<HTMLDivElement>(null);
|
|
533
|
+
const nearby = useNearViewport(cover, `${id}:${artifact?.hash}`, "320px 0px");
|
|
534
|
+
const { pdf, error } = usePdf(id, artifact?.hash, nearby);
|
|
535
|
+
const page = artifact?.pages[0] ?? (format === 'presentation' ? {width:960,height:540} : undefined);
|
|
536
|
+
const [width, setWidth] = useState(compact ? 40 : 238);
|
|
537
|
+
useEffect(() => {
|
|
538
|
+
if (!cover.current) return;
|
|
539
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
540
|
+
if (entry.contentRect.width > 0) setWidth(entry.contentRect.width);
|
|
541
|
+
});
|
|
542
|
+
observer.observe(cover.current);
|
|
543
|
+
return () => observer.disconnect();
|
|
544
|
+
}, []);
|
|
545
|
+
return (
|
|
546
|
+
<div
|
|
547
|
+
ref={cover}
|
|
548
|
+
className="cover-preview"
|
|
549
|
+
aria-hidden="true"
|
|
550
|
+
style={{ '--cover-ratio': (page?.width ?? 595.28) / (page?.height ?? 841.89), aspectRatio: `${page?.width ?? 595.28} / ${page?.height ?? 841.89}`, width: compact ? Math.min(40, 56 * (page?.width ?? 595.28) / (page?.height ?? 841.89)) : undefined } as CSSProperties}
|
|
551
|
+
>
|
|
552
|
+
{pdf ? (
|
|
553
|
+
<PdfPage pdf={pdf} number={1} width={width} thumbnail />
|
|
554
|
+
) : (
|
|
555
|
+
<div className="cover-placeholder">
|
|
556
|
+
{compact ? <Icon name="document" size={18} /> : error ? "Preview unavailable" : "Preparing preview…"}
|
|
557
|
+
</div>
|
|
558
|
+
)}
|
|
559
|
+
</div>
|
|
560
|
+
);
|
|
561
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type FormEvent } from 'react';
|
|
2
|
+
import type { ThemeSummary } from '../shared/themes';
|
|
3
|
+
import type { Project } from '../shared/projects';
|
|
4
|
+
import { documentName, type DocumentSummary } from '../shared/types';
|
|
5
|
+
import { api } from './api';
|
|
6
|
+
import { Button, Dialog, Input, SelectControl } from './ui';
|
|
7
|
+
import { Icon } from './ui/Icon';
|
|
8
|
+
|
|
9
|
+
const noDefaultTheme = '__no_default__';
|
|
10
|
+
|
|
11
|
+
export function ProjectDialog({ open, project, documentCount, connected, themes, onOpenChange, onSaved, onDeleted }: {
|
|
12
|
+
open: boolean; project: Project | null; documentCount: number; connected: boolean;
|
|
13
|
+
themes: ThemeSummary[];
|
|
14
|
+
onOpenChange: (open: boolean) => void; onSaved: (project: Project) => void; onDeleted: () => void;
|
|
15
|
+
}) {
|
|
16
|
+
const [name, setName] = useState('');
|
|
17
|
+
const [theme, setTheme] = useState(noDefaultTheme);
|
|
18
|
+
const [busy, setBusy] = useState(false);
|
|
19
|
+
const [error, setError] = useState('');
|
|
20
|
+
const [confirmDelete, setConfirmDelete] = useState(false);
|
|
21
|
+
const nameInput = useRef<HTMLInputElement>(null);
|
|
22
|
+
const working = useRef(false);
|
|
23
|
+
const initialTheme = useRef<string | null>(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (open) { initialTheme.current = project?.defaultTheme ?? null; setName(project?.name ?? ''); setTheme(project?.defaultTheme ?? noDefaultTheme); setError(''); setConfirmDelete(false); }
|
|
26
|
+
}, [open, project?.id]);
|
|
27
|
+
async function save(event: FormEvent) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
if (!name.trim() || working.current || !connected) return;
|
|
30
|
+
working.current = true; setBusy(true); setError('');
|
|
31
|
+
try {
|
|
32
|
+
const defaultTheme = theme === noDefaultTheme ? null : theme;
|
|
33
|
+
const saved = await api<Project>(project ? `/api/projects/${project.id}` : '/api/projects', { method: project ? 'PATCH' : 'POST', body: JSON.stringify({ name: name.trim(), ...(!project || defaultTheme !== initialTheme.current ? { defaultTheme } : {}) }) });
|
|
34
|
+
onSaved(saved); onOpenChange(false);
|
|
35
|
+
} catch (error) { setError((error as Error).message); }
|
|
36
|
+
finally { working.current = false; setBusy(false); }
|
|
37
|
+
}
|
|
38
|
+
async function remove() {
|
|
39
|
+
if (!project || documentCount || working.current || !connected) return;
|
|
40
|
+
working.current = true; setBusy(true); setError('');
|
|
41
|
+
try { await api(`/api/projects/${project.id}`, { method: 'DELETE' }); onDeleted(); onOpenChange(false); }
|
|
42
|
+
catch (error) { setError((error as Error).message); }
|
|
43
|
+
finally { working.current = false; setBusy(false); }
|
|
44
|
+
}
|
|
45
|
+
const themeItems = [{ value: noDefaultTheme, label: 'No default theme' }, ...themes.filter(theme => !theme.error).map(theme => ({ value: theme.id, label: theme.name }))];
|
|
46
|
+
if (!themeItems.some(item => item.value === theme)) themeItems.push({ value: theme, label: `${theme} (unavailable)` });
|
|
47
|
+
return <Dialog.Root open={open} onOpenChange={value => { if (!working.current) onOpenChange(value); }}>
|
|
48
|
+
<Dialog.Portal><Dialog.Backdrop className="ui-dialog-backdrop" />
|
|
49
|
+
<Dialog.Popup className="help-dialog create-dialog" initialFocus={nameInput}>
|
|
50
|
+
<Dialog.Close render={<Button className="icon-button modal-close" aria-label="Close project dialog" disabled={busy} />}><Icon name="close" /></Dialog.Close>
|
|
51
|
+
<Dialog.Title>{project ? 'Project settings' : 'Create a project'}</Dialog.Title>
|
|
52
|
+
<Dialog.Description>{project ? 'Give this project a name and an optional theme for new documents.' : 'Bring related documents together. You can set a default theme now or later.'}</Dialog.Description>
|
|
53
|
+
<form onSubmit={event => void save(event)} aria-busy={busy}>
|
|
54
|
+
<label className="create-field" htmlFor="project-name"><span>Project name</span><Input ref={nameInput} id="project-name" value={name} onChange={event => { setName(event.target.value); setError(''); }} required maxLength={120} placeholder="For example, Studio work" disabled={busy} autoComplete="off" /></label>
|
|
55
|
+
<div className="create-field"><span>Default theme <span className="muted">(optional)</span></span><div className="purpose-select" inert={busy || undefined}><SelectControl label="Default theme" value={theme} onValueChange={setTheme} items={themeItems} /></div><p className="field-hint">Applies to new documents. Each document can use a different theme.</p></div>
|
|
56
|
+
{error && <p className="field-error" role="alert">{error}</p>}
|
|
57
|
+
<div className="dialog-actions"><Dialog.Close render={<Button disabled={busy} />}>Cancel</Dialog.Close><Button className="primary" type="submit" disabled={busy || !connected || !name.trim()}>{busy ? 'Saving…' : project ? 'Save changes' : 'Create project'}</Button></div>
|
|
58
|
+
</form>
|
|
59
|
+
{project && <div className="project-delete">
|
|
60
|
+
{confirmDelete ? <><p>Delete this empty project?</p><div className="dialog-actions"><Button onClick={() => setConfirmDelete(false)} disabled={busy}>Keep project</Button><Button onClick={() => void remove()} disabled={busy || !connected || documentCount > 0}>Delete project</Button></div></>
|
|
61
|
+
: <><Button className="text-button" onClick={() => setConfirmDelete(true)} disabled={busy || documentCount > 0}>Delete project</Button>{documentCount > 0 && <p className="field-hint">Move its documents to another project before deleting it.</p>}</>}
|
|
62
|
+
</div>}
|
|
63
|
+
</Dialog.Popup>
|
|
64
|
+
</Dialog.Portal>
|
|
65
|
+
</Dialog.Root>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function MoveDocumentDialog({ document, projects, connected, onClose, onMoved }: {
|
|
69
|
+
document: DocumentSummary | null; projects: Project[]; connected: boolean; onClose: () => void; onMoved: (projectId: string) => void;
|
|
70
|
+
}) {
|
|
71
|
+
const [destination, setDestination] = useState('');
|
|
72
|
+
const [error, setError] = useState('');
|
|
73
|
+
const [busy, setBusy] = useState(false);
|
|
74
|
+
const working = useRef(false);
|
|
75
|
+
useEffect(() => { setDestination(''); setError(''); }, [document?.id]);
|
|
76
|
+
const available = projects.filter(project => project.id !== document?.projectId);
|
|
77
|
+
async function move(event: FormEvent) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
if (!document || !destination || working.current || !connected) return;
|
|
80
|
+
working.current = true; setBusy(true); setError('');
|
|
81
|
+
try { await api(`/api/documents/${document.id}/project`, { method: 'PUT', body: JSON.stringify({ projectId: destination }) }); onMoved(destination); onClose(); }
|
|
82
|
+
catch (error) { setError((error as Error).message); }
|
|
83
|
+
finally { working.current = false; setBusy(false); }
|
|
84
|
+
}
|
|
85
|
+
return <Dialog.Root open={Boolean(document)} onOpenChange={open => { if (!open && !working.current) onClose(); }}>
|
|
86
|
+
<Dialog.Portal><Dialog.Backdrop className="ui-dialog-backdrop" />
|
|
87
|
+
<Dialog.Popup className="help-dialog create-dialog">
|
|
88
|
+
<Dialog.Close render={<Button className="icon-button modal-close" aria-label="Close move dialog" disabled={busy} />}><Icon name="close" /></Dialog.Close>
|
|
89
|
+
<Dialog.Title>Move to a project</Dialog.Title>
|
|
90
|
+
<Dialog.Description>{document ? documentName(document) : ''}</Dialog.Description>
|
|
91
|
+
<form onSubmit={event => void move(event)} aria-busy={busy}>
|
|
92
|
+
<div className="create-field"><span>Destination</span><div className="purpose-select" inert={busy || undefined}><SelectControl label="Destination project" value={destination} onValueChange={setDestination} items={[{ value: '', label: 'Choose a project' }, ...available.map(project => ({ value: project.id, label: project.name }))]} /></div><p className="field-hint">The document keeps its current theme, media, and comments.</p></div>
|
|
93
|
+
{!available.length && <p className="field-hint">Create another project first.</p>}
|
|
94
|
+
{error && <p role="alert" className="field-error">{error}</p>}
|
|
95
|
+
<div className="dialog-actions"><Dialog.Close render={<Button disabled={busy} />}>Cancel</Dialog.Close><Button className="primary" type="submit" disabled={busy || !connected || !available.some(project => project.id === destination)}>{busy ? 'Moving…' : 'Move document'}</Button></div>
|
|
96
|
+
</form>
|
|
97
|
+
</Dialog.Popup>
|
|
98
|
+
</Dialog.Portal>
|
|
99
|
+
</Dialog.Root>;
|
|
100
|
+
}
|