redraft-local 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -113
- package/dist/assets/{arc-CaJ1uOH6.js → arc-D_Swy6PV.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-CpU7R7PI.js → architectureDiagram-3BPJPVTR-J646oipM.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-CXO0-nFn.js → blockDiagram-GPEHLZMM-DOdO14l2.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-zmJaTZ8Z.js → c4Diagram-AAUBKEIU-Btu8_53J.js} +1 -1
- package/dist/assets/channel-DsxWmGmy.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-CmM4vNrj.js → chunk-2J33WTMH-CRr8ljiS.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-Wr-9vcnK.js → chunk-4BX2VUAB-Dc7UNDIA.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-BUorSZqR.js → chunk-55IACEB6-BfqLx6kn.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-AWCXeLzZ.js → chunk-727SXJPM-C2mHpI3-.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-D_7ks4Lb.js → chunk-AQP2D5EJ-D_U-g8Xd.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-DSiZo6dK.js → chunk-FMBD7UC4-B6MVhVK5.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-CcDlDqsx.js → chunk-ND2GUHAM-C3u4VP3b.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-CijTg3JL.js → chunk-QZHKN3VN-JqZBybaW.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-B6NkHsrH.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-B6NkHsrH.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-BMUz7Rha.js → cose-bilkent-S5V4N54A-D2tVyZ8S.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-BBWtzQJK.js → dagre-BM42HDAG-CGU7PNkH.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-CP907EHA.js → diagram-2AECGRRQ-DF4PZWry.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-BvXR26t-.js → diagram-5GNKFQAL-D-fJ-UP1.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-DGvFqlr6.js → diagram-KO2AKTUF-DnRsU6WY.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-Bt1WUQ5A.js → diagram-LMA3HP47-DXRZxkPL.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-BVUYXbR0.js → diagram-OG6HWLK6-BtyoDI0y.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-Dav8qbPM.js → erDiagram-TEJ5UH35-CQ8Xm3L1.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-CR_uJZI1.js → flowDiagram-I6XJVG4X-DJogWRB6.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-Cz2KGCbK.js → ganttDiagram-6RSMTGT7-CwDVu3wX.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-wjD1C0-O.js → gitGraphDiagram-PVQCEYII-BFkYOL0u.js} +1 -1
- package/dist/assets/{graph-BH1ppu6M.js → graph-C0lIiNQ9.js} +1 -1
- package/dist/assets/{index-CNynpHjm.js → index-2r7Da6NH.js} +1 -1
- package/dist/assets/{index-ChC8IjYy.js → index-B7DpboJP.js} +1 -1
- package/dist/assets/{index-DyWAg2Wz.js → index-BOQbNa5E.js} +1 -1
- package/dist/assets/{index-BtneeKRJ.js → index-Bn4ghHLK.js} +1 -1
- package/dist/assets/{index-CHrrBAmh.js → index-C4vOGYpd.js} +1 -1
- package/dist/assets/{index-BWhSzQ2P.js → index-C9ljCBwi.js} +1 -1
- package/dist/assets/{index-BknWPT91.js → index-CIGZhCtG.js} +1 -1
- package/dist/assets/{index-CLieNenF.js → index-CQbg0sEq.js} +1 -1
- package/dist/assets/{index-Dfi8MpDt.js → index-CRFD0qqc.js} +1 -1
- package/dist/assets/{index-ccM_ASH6.js → index-CYsrmKy8.js} +1 -1
- package/dist/assets/{index-B8tchZT_.js → index-Cd1BLBtA.js} +1 -1
- package/dist/assets/{index-D9gxrvl_.js → index-CkrGHD_o.js} +1 -1
- package/dist/assets/{index-C5ViESlu.js → index-CrBROreI.js} +1 -1
- package/dist/assets/{index-CIGchag1.js → index-Cv28RZnd.js} +1 -1
- package/dist/assets/{index-C8JJA8rk.js → index-Cz3YNsrm.js} +1 -1
- package/dist/assets/{index-DUorzw6K.js → index-D9Hy07J8.js} +1 -1
- package/dist/assets/{index-BuM5CW2q.js → index-DTHcUELS.js} +1 -1
- package/dist/assets/{index-BExu_Njm.js → index-DsOSy8xC.js} +1 -1
- package/dist/assets/{index-BnLxvR-o.js → index-P0HG7ml-.js} +1 -1
- package/dist/assets/{index-BUfQfTAz.js → index-ZBBDPj7P.js} +113 -114
- package/dist/assets/{index-jVtjXnRY.js → index-lcWNRlm8.js} +1 -1
- package/dist/assets/{index-zlEBol_7.js → index-nIt909SX.js} +1 -1
- package/dist/assets/{index-ies6hSeA.js → index-yCoA0NsD.js} +1 -1
- package/dist/assets/{infoDiagram-5YYISTIA-BFQagwXF.js → infoDiagram-5YYISTIA-Ccd7RoQl.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-BOUtWgX5.js → ishikawaDiagram-YF4QCWOH-D-gEvZZ_.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-rgHGmS_a.js → journeyDiagram-JHISSGLW-DS177kP9.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-CWTHy9kC.js → kanban-definition-UN3LZRKU-BdTzJI_S.js} +1 -1
- package/dist/assets/{layout-CzY9YSg6.js → layout-CglVrgpW.js} +1 -1
- package/dist/assets/{linear-HHemqxs0.js → linear-CUEJW0YE.js} +1 -1
- package/dist/assets/{mindmap-definition-RKZ34NQL-C530duTE.js → mindmap-definition-RKZ34NQL-CAQpOzG8.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-D13No-jk.js → pieDiagram-4H26LBE5-DcNdoCUO.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-GoipHHsg.js → quadrantDiagram-W4KKPZXB-__i9Z3ji.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-CCQ5o96h.js → requirementDiagram-4Y6WPE33-mIW4fwkc.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP--zydGSNU.js → sankeyDiagram-5OEKKPKP-wS1BI3xo.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-DaDG9heu.js → sequenceDiagram-3UESZ5HK-DAHQ72aY.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-DylJyhAJ.js → stateDiagram-AJRCARHV-CezbFLSl.js} +1 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-BHPGn4U6.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-CTCMO2DA.js → timeline-definition-PNZ67QCA-DUssVPNj.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-UBv3cfOp.js → vennDiagram-CIIHVFJN-MnU-vX8K.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-CajzPnn_.js → wardley-L42UT6IY-c1R-eeRO.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-DuYAvD4W.js → wardleyDiagram-YWT4CUSO-Cf_Ur_xL.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-CrYuSwlM.js → xychartDiagram-2RQKCTM6-4EQ_jtu_.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-D0htmpx4.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-C3o9NFsi.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-C3o9NFsi.js +0 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-D8YnqXeb.js +0 -1
package/README.md
CHANGED
|
@@ -1,160 +1,126 @@
|
|
|
1
|
-
<
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/hero.png" alt="ReDraft — GitHub-based document review workspace">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Collaborative markdown review — powered by a branch in your repo.</strong>
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/redraft-local"><img src="https://img.shields.io/npm/v/redraft-local?style=flat&colorA=222222&colorB=CB3837" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/redraft-local"><img src="https://img.shields.io/npm/dm/redraft-local?style=flat&colorA=222222&colorB=CB3837" alt="npm downloads"></a>
|
|
12
|
+
<a href="https://github.com/tcamise-gpsw/redraft/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/tcamise-gpsw/redraft/ci.yml?style=flat&colorA=222222&colorB=3FB950" alt="CI"></a>
|
|
13
|
+
<a href="https://redraft-docs.dev"><img src="https://img.shields.io/badge/site-redraft--docs.dev-58A6FF?style=flat&colorA=222222" alt="Site"></a>
|
|
14
|
+
<a href="https://www.typescriptlang.org"><img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&colorA=222222&logo=typescript&logoColor=white" alt="TypeScript"></a>
|
|
15
|
+
</p>
|
|
9
16
|
|
|
10
|
-
ReDraft
|
|
17
|
+
ReDraft turns any Git repository into a review workspace for markdown documents. Select text, leave a comment, reply in threads, resolve feedback — all without leaving the browser. No database, no platform migration, no new accounts. Your documents stay as `.md` files. Review threads live on a sidecar branch. That's it.
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
**Built for everyone on the team.** Non-technical reviewers use the WYSIWYG editor — no markdown syntax required. Engineers switch to raw mode for full control. AI agents edit files directly on disk. Everyone works on the same documents in the same review threads, each in the mode that fits them.
|
|
13
20
|
|
|
14
|
-
-
|
|
15
|
-
- Renders markdown documents with comments, activity, and Mermaid diagrams
|
|
16
|
-
- Supports inline comment threads, replies, and resolution
|
|
17
|
-
- Lets different users work in the mode that fits them best
|
|
18
|
-
|
|
19
|
-
| Mode | Best for | Data source | Editing style |
|
|
20
|
-
| ------------------- | ------------------------- | ------------------- | -------------------------------- |
|
|
21
|
-
| **Remote WYSIWYG** | Non-technical reviewers | GitHub repository | Rich-text editing in the browser |
|
|
22
|
-
| **Remote Markdown** | Technical contributors | GitHub repository | Raw markdown + preview |
|
|
23
|
-
| **Local + AI** | Power users and AI agents | Local files on disk | Browser UI + direct file edits |
|
|
21
|
+
**Remote and local are the same UI.** Use [redraft-docs.dev](https://redraft-docs.dev) to review any GitHub repo in the browser, or run `npx redraft-local` to serve your local checkout. Local mode lets you edit with your own tools — your editor, your scripts, your AI agents — and see changes reflected live. ReDraft ships with [built-in skills](.agents/skills/redraft-review/) for walking comment threads, drafting replies, and revising documents, so agents work alongside human reviewers out of the box.
|
|
24
22
|
|
|
25
23
|
---
|
|
26
24
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
Remote mode is the hosted GitHub-backed experience. You connect ReDraft to a repository and browse any markdown document in that repo.
|
|
30
|
-
|
|
31
|
-
### For non-technical reviewers
|
|
32
|
-
|
|
33
|
-
Use **View** and **WYSIWYG** modes when you want to read, comment, and make light edits without working directly in markdown syntax.
|
|
25
|
+
## Get started
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
### Remote
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
2. Enter a fine-grained GitHub PAT and `owner/repo`.
|
|
39
|
-
3. Choose a document from the tree.
|
|
40
|
-
4. Read in **View** mode or switch to **WYSIWYG**.
|
|
41
|
-
5. Select text, add comments, reply to threads, and resolve feedback.
|
|
29
|
+
Visit [redraft-docs.dev](https://redraft-docs.dev), enter a fine-grained GitHub PAT (`Contents: Read/Write` + `Metadata: Read`), point it at any repo, and start reviewing. Nothing to install.
|
|
42
30
|
|
|
43
|
-
###
|
|
31
|
+
### Local (advanced)
|
|
44
32
|
|
|
45
|
-
|
|
33
|
+
For power users and AI agents who want to work with local tools:
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
```bash
|
|
36
|
+
npx redraft-local --open
|
|
37
|
+
```
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
2. Open a document from the tree.
|
|
51
|
-
3. Switch between **View**, **WYSIWYG**, and **Raw** as needed.
|
|
52
|
-
4. Edit markdown directly in **Raw** mode.
|
|
53
|
-
5. Save changes back to GitHub with SHA-based conflict protection.
|
|
39
|
+
Launches a local server and opens the browser automatically. Every `.md` file in your working directory is ready for review — no signup, no PAT, no config. Edit files in your own editor or with AI agents and see changes live in the browser.
|
|
54
40
|
|
|
55
|
-
|
|
41
|
+
---
|
|
56
42
|
|
|
57
|
-
|
|
43
|
+
## How it works
|
|
58
44
|
|
|
59
|
-
|
|
60
|
-
- **Metadata: Read**
|
|
45
|
+
ReDraft stores nothing outside your repository. Documents are plain `.md` files on any branch — pick the branch you want to review from the branch selector. Comment threads live as structured JSON on a dedicated sidecar branch (`redraft` by default) under `.redraft/comments/`. The sidecar branch never touches your working tree — no merge conflicts, no noise in diffs.
|
|
61
46
|
|
|
62
|
-
|
|
47
|
+
```
|
|
48
|
+
your-repo/
|
|
49
|
+
├── any branch (your documents)
|
|
50
|
+
│ ├── proposals/api-design.md
|
|
51
|
+
│ ├── rfcs/rfc-001.md
|
|
52
|
+
│ └── docs/architecture.md
|
|
53
|
+
│
|
|
54
|
+
└── redraft (sidecar branch — created automatically)
|
|
55
|
+
└── .redraft/comments/<document-branch>/
|
|
56
|
+
├── proposals/api-design.comments.json
|
|
57
|
+
└── rfcs/rfc-001.comments.json
|
|
58
|
+
```
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
- Comment threads live under `.redraft/comments/<mirrored-path>.comments.json`
|
|
66
|
-
- Document content and comment files are written with SHA checks for conflict detection
|
|
60
|
+
One React frontend serves both modes. In remote mode, it talks to the GitHub REST API. In local mode, it talks to a local server that mirrors the same API shape against your filesystem. The code path is identical — only the transport changes.
|
|
67
61
|
|
|
68
62
|
---
|
|
69
63
|
|
|
70
|
-
##
|
|
64
|
+
## 01 · Browse, review, and comment
|
|
71
65
|
|
|
72
|
-
|
|
66
|
+
Open any markdown document in the repository. The left sidebar shows the full document tree and highlights documents with active review threads under **Under Review**. The center panel renders the document with full formatting. The right sidebar shows comment threads anchored to the text they reference.
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
Select text to anchor a comment. Threads support replies, resolution, and deletion. Comments stay anchored even when the document changes — ReDraft uses surrounding context to relocate anchors after edits. If the anchor text is gone entirely, the thread moves to an **Orphaned** section instead of silently disappearing.
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+

|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
npx redraft-local
|
|
80
|
-
```
|
|
72
|
+
## 02 · Three editing modes
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
npm install -g redraft-local
|
|
86
|
-
redraft-local
|
|
87
|
-
```
|
|
74
|
+
Switch between **View**, **WYSIWYG**, and **Raw** depending on how you work.
|
|
88
75
|
|
|
89
|
-
|
|
76
|
+
| Mode | Editor | Best for |
|
|
77
|
+
| ----------- | --------------------------- | ------------------------------------ |
|
|
78
|
+
| **View** | Read-only rendered markdown | Reading and commenting |
|
|
79
|
+
| **WYSIWYG** | Milkdown rich-text editor | Non-technical reviewers, light edits |
|
|
80
|
+
| **Raw** | Plain textarea | Power users who think in markdown |
|
|
90
81
|
|
|
91
|
-
|
|
82
|
+

|
|
92
83
|
|
|
93
|
-
|
|
94
|
-
redraft [directory] [options]
|
|
95
|
-
redraft serve [directory] [options]
|
|
84
|
+
## 03 · Mermaid diagrams, code blocks, and full markdown
|
|
96
85
|
|
|
97
|
-
|
|
98
|
-
--host <string> Bind address (default: 127.0.0.1)
|
|
99
|
-
--open Open the browser automatically
|
|
100
|
-
--no-ui API-only mode, skip serving the frontend
|
|
101
|
-
```
|
|
86
|
+
ReDraft renders the full CommonMark spec plus Mermaid diagrams, fenced code blocks with syntax highlighting, tables, blockquotes, and task lists. What you see in the browser is what your markdown looks like — no surprises.
|
|
102
87
|
|
|
103
|
-
|
|
88
|
+

|
|
104
89
|
|
|
105
|
-
|
|
90
|
+
## 04 · Local mode — just files on disk
|
|
106
91
|
|
|
107
92
|
```bash
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
npm run serve
|
|
93
|
+
npx redraft-local # serve current directory
|
|
94
|
+
npx redraft-local ./proposals # serve a specific path
|
|
111
95
|
```
|
|
112
96
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
What local mode gives you:
|
|
97
|
+
Everything is plain text. Documents are `.md` files. Comments are `.json` sidecars on a Git branch. Use any tool you want — your editor, `sed`, a Python script, an AI agent. ReDraft watches the filesystem and updates the browser live.
|
|
116
98
|
|
|
117
|
-
-
|
|
118
|
-
- Direct read/write access to local `.md` files
|
|
119
|
-
- Structured review threads stored on a Git sidecar branch (not in the working tree)
|
|
120
|
-
- Live UI updates when files change on disk
|
|
121
|
-
- Optional git convenience endpoints for status and commits
|
|
99
|
+
ReDraft ships with a [redraft-review skill](.agents/skills/redraft-review/) that lets AI agents walk unresolved threads, draft replies, resolve feedback, and revise documents through a structured API.
|
|
122
100
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Local mode is the intended environment for AI-assisted document workflows.
|
|
126
|
-
|
|
127
|
-
The design target is:
|
|
101
|
+
**Options:**
|
|
128
102
|
|
|
129
|
-
|
|
130
|
-
-
|
|
103
|
+
```
|
|
104
|
+
npx redraft-local [directory] [options]
|
|
105
|
+
npx redraft-local serve [directory] [options]
|
|
106
|
+
|
|
107
|
+
--port <number> Port to listen on (default: 4200)
|
|
108
|
+
--host <string> Bind address (default: 127.0.0.1)
|
|
109
|
+
--open Open the browser automatically
|
|
110
|
+
--sidecar-branch <string> Git branch for comments (default: redraft)
|
|
111
|
+
--no-ui API-only mode, skip serving the frontend
|
|
112
|
+
```
|
|
131
113
|
|
|
132
|
-
|
|
114
|
+
## 05 · Zero infrastructure
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
- Draft or post replies
|
|
136
|
-
- Resolve completed threads
|
|
137
|
-
- Revise a document based on accumulated feedback
|
|
138
|
-
- Summarize open discussions across the repo
|
|
116
|
+
There is no database. No object store. No Redis. No account system. Your data is markdown files and JSON sidecars in a Git repository you already own. Remote mode is a static site on GitHub Pages. Local mode is a single Node process.
|
|
139
117
|
|
|
140
118
|
---
|
|
141
119
|
|
|
142
|
-
##
|
|
143
|
-
|
|
144
|
-
ReDraft uses one React frontend across all modes.
|
|
145
|
-
|
|
146
|
-
- In **remote mode**, the browser talks to the GitHub REST API.
|
|
147
|
-
- In **local mode**, the browser talks to a local server that mimics the GitHub contents API while reading and writing the filesystem.
|
|
148
|
-
- Comment threads are stored separately from document markdown under `.redraft/comments/`, so review discussion remains structured and portable.
|
|
149
|
-
|
|
150
|
-
For architecture details, see `docs/architecture.md`.
|
|
151
|
-
|
|
152
|
-
---
|
|
120
|
+
## Development
|
|
153
121
|
|
|
154
|
-
|
|
122
|
+
See [docs/development.md](docs/development.md) for build, test, and deployment details.
|
|
155
123
|
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
- `docs/plans/` — implementation plans and execution notes
|
|
160
|
-
- `AGENTS.md` — repository guidance for coding agents
|
|
124
|
+
- [docs/architecture.md](docs/architecture.md) — system architecture and data flow
|
|
125
|
+
- [docs/specs/](docs/specs/) — design specs and technical decisions
|
|
126
|
+
- [AGENTS.md](AGENTS.md) — repository guidance for coding agents
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a8 as ln,a9 as an,aa as g,ab as tn,ac as G,ad as j,ae as _,af as un,ag as rn,ah as K,ai as o,aj as z,ak as sn,al as on,am as fn}from"./index-
|
|
1
|
+
import{a8 as ln,a9 as an,aa as g,ab as tn,ac as G,ad as j,ae as _,af as un,ag as rn,ah as K,ai as o,aj as z,ak as sn,al as on,am as fn}from"./index-ZBBDPj7P.js";function cn(l){return l.innerRadius}function gn(l){return l.outerRadius}function yn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,A,B,a){var I=E-l,i=q-h,n=B-v,d=a-A,u=d*I-n*i;if(!(u*u<g))return u=(n*(h-A)-d*(l-v))/u,[l+u*I,h+u*i]}function V(l,h,E,q,v,A,B){var a=l-E,I=h-q,i=(B?A:-A)/K(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,C=(u+f)/2,t=(s+c)/2,m=f-u,y=c-s,R=m*m+y*y,T=v-A,P=u*c-f*s,O=(y<0?-1:1)*K(fn(0,T*T*R-P*P)),S=(P*y-m*O)/R,k=(-P*m-y*O)/R,w=(P*y+m*O)/R,p=(-P*m+y*O)/R,x=S-C,e=k-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&(S=w,k=p),{cx:S,cy:k,x01:-n,y01:-d,x11:S*(v/T-1),y11:k*(v/T-1)}}function hn(){var l=cn,h=gn,E=z(0),q=null,v=yn,A=dn,B=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,C=un(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>g))a.moveTo(0,0);else if(C>tn-g)a.moveTo(s*G(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*G(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=C,O=C,S=B.apply(this,arguments)/2,k=S>g&&(q?+q.apply(this,arguments):K(u*u+s*s)),w=_(un(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(k>g){var F=sn(k/u*j(S)),L=sn(k/s*j(S));(P-=F*2)>g?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(O-=L*2)>g?(L*=t?1:-1,m+=L,y-=L):(O=0,m=y=(f+c)/2)}var H=s*G(m),J=s*j(m),M=u*G(T),N=u*j(T);if(w>g){var Q=s*G(y),U=s*j(y),W=u*G(R),X=u*j(R),D;if(C<rn)if(D=pn(H,J,W,X,Q,U,M,N)){var Y=H-D[0],Z=J-D[1],$=Q-D[0],b=U-D[1],nn=1/j(on((Y*$+Z*b)/(K(Y*Y+Z*Z)*K($*$+b*b)))/2),en=K(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>g?x>g?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(H,J),a.arc(0,0,s,m,y,!t)):a.moveTo(H,J),!(u>g)||!(P>g)?a.lineTo(M,N):p>g?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[G(d)*n,j(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:z(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:z(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|