From 6533c31704ed41dc81eb59369f14cbac86e2660c Mon Sep 17 00:00:00 2001 From: minsung Date: Mon, 12 Oct 2026 18:57:54 +0900 Subject: [PATCH] docs: README and third-party notices for the React app - README: setup with the HMDesign submodule/workspace, scripts, source layout (engine copied as is vs. new React components). - THIRD-PARTY-NOTICES (root + served /licenses copy): acadrust MPL-2.0 section unchanged; intro points at this app's dist/ and the in-app entry points; adds the UI runtime that @hm-design/ui brings in (React, Radix UI, lucide-react, class-variance-authority, shadcn CSS, Noto Sans KR) and HMDesign itself (#1). Co-Authored-By: Claude Opus 5.5 --- README.md | 63 +++++++++++++++++++++ THIRD-PARTY-NOTICES.md | 78 ++++++++++++++++++++++++++ public/licenses/THIRD-PARTY-NOTICES.md | 18 ++++-- 3 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 THIRD-PARTY-NOTICES.md diff --git a/README.md b/README.md index e69de29..fab2f19 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,63 @@ +# dwg-dxf-viewer-hm + +`dwg-dxf-viewer-sample`(vanilla TS + Three.js)의 DWG/DXF 2D 뷰어를 **React 19 + HMDesign(`@hm-design/ui`)** 로 +다시 만든 앱입니다. 뷰어 엔진(Viewer2D, acadrust-dwg WASM, dxf-parser …)은 원본 그대로 쓰고, UI만 HMDesign +컴포넌트로 새로 구성했습니다. + +## 실행 + +Node 20.19+ / 22.12+ (확인: Node 24.11.1, npm 11.7.0). + +```bash +git clone --recurse-submodules dwg-dxf-viewer-hm +cd dwg-dxf-viewer-hm +# submodule 없이 clone 했다면: git submodule update --init --recursive +npm install # postinstall 이 @hm-design/ui dist 를 빌드한다 +npm run dev # http://localhost:5173 +``` + +| 명령 | 내용 | +|---|---| +| `npm run build` | `tsc` + `vite build` → `dist/` | +| `npm run preview` | 빌드 결과 미리보기 (4173) | +| `npm run hm:build` | HMDesign 갱신 후 `@hm-design/ui` dist 강제 재빌드 | +| `npm run guard` | HMDesign AI Generation Guard (`--scope FULL_SCREEN --mode GNB_ONLY`) | + +`?model=/samples/civil.dwg` 처럼 주소에 붙이면 시작할 때 자동으로 엽니다. + +## HMDesign 연결 + +- `vendor/HMDesign` = git submodule (`https://gitea.hmac.kr/b25027/HMDesign.git`, `main`) +- 그 안의 `packages/ui` 를 이 저장소의 npm workspace 로 등록 → `@hm-design/ui` 가 submodule 을 가리킨다 +- `scripts/setup-hmdesign.mjs` (postinstall): `vendor/HMDesign/node_modules` → 이 저장소 `node_modules` junction + (HMDesign 빌드 스크립트가 자기 루트의 typescript/shadcn 을 읽기 때문) 후 package dist 빌드. submodule 내용은 수정하지 않는다 +- `@hm-design/center-graphic` 은 쓰지 않는다 + +## 구조 + +``` +src/ + engine/ ← dwg-dxf-viewer-sample 에서 그대로 복사 (로직·import 경로 변경 없음) + viewer2d/* Viewer2D.js, 파서, acadrust-dwg WASM, cadSpaces, slugText … + layerPanel.ts LayerPanelManager (레이어 표시 상태) + panelUtils.ts 창 드래그 / 접기 + propertyInspector.ts formatEntityProperties + optionsStore.ts IndexedDB hmw-viewer/options + components/ + DwgViewerCanvas.tsx Viewer2D React 래퍼 (useRef + useEffect, 옵션 → setter 단방향) + AppHeader.tsx GNB (샘플 도면 메뉴, 파일 열기, 정보) + ViewerToolbar.tsx Model/Layout, 맞춤 보기, 2.5D, 캔버스 테마, 창 토글 + FloatingPanel.tsx 드래그·접기·크기조절 창 (HM Card) + LayersPanel.tsx / PropertiesPanel.tsx / OptionsPanel.tsx + StageOverlays.tsx 빈 화면, 로딩(Progress + LoadingScreen), 드롭 안내 + StatusBar.tsx 상태 문구, Zoom, CAD 좌표(우하단), 오픈소스 고지 링크 + AboutDialog.tsx 모듈 구성 + 오픈소스 고지 (acadrust MPL-2.0, local patch) + lib/ main.ts 의 파서 조합·좌표 포맷, topProgress.ts 의 fetch/paint 헬퍼 +public/ NanumGothic, 샘플 도면, 라이선스 원문·패치, 모듈 지도 +``` + +## 라이선스 + +acadrust 0.4.1(MPL-2.0, `read_mesh` 로컬 패치 수정본)이 WASM 으로 포함됩니다. +고지·원문·패치: [`THIRD-PARTY-NOTICES.md`](./THIRD-PARTY-NOTICES.md), `public/licenses/` (배포 시 `/licenses/…`). +앱에서는 GNB 정보 버튼과 상태 표시줄의 "오픈소스 고지"에서 열립니다. diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..a5a4eae --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,78 @@ +# Third-party notices + +This viewer (dwg-dxf-viewer-hm — the React/HMDesign rebuild of +dwg-dxf-viewer-sample) bundles third-party code. The notices below apply to the +source tree **and** to the built site (`dist/`), because the build embeds the +components listed here. In the app they are reachable from the GNB info button +and the status-bar link "오픈소스 고지". + +Served copies of the license texts live under +[`public/licenses/`](./public/licenses/) → `/licenses/…` on the deployed site. + +--- + +## acadrust 0.4.1 — Mozilla Public License 2.0 — **MODIFIED** + +| | | +|---|---| +| Component | `acadrust` (DWG/DXF parser, Rust) | +| Version | 0.4.1 | +| License | MPL-2.0 — full text: [`public/licenses/acadrust-MPL-2.0.txt`](./public/licenses/acadrust-MPL-2.0.txt) (`/licenses/acadrust-MPL-2.0.txt`) | +| Upstream | https://github.com/hakanaktt/acadrust · https://crates.io/crates/acadrust/0.4.1 | +| Upstream commit | `f249c2f816acf36ee51cd5533716bdd443c2517e` (from the crate's `.cargo_vcs_info.json`) | +| Author | Hakan AK | +| Shipped as | compiled into `assets/acadrust_dwg_bg-*.wasm` (Executable Form) | + +**This copy is modified.** One file differs from the published crate: + +``` +src/io/dwg/dwg_stream_readers/object_reader/entities.rs (read_mesh array-count bounds) +``` + +The modification bounds `read_mesh`'s array counts by the bits remaining in the +object stream instead of the blanket 100 000-item guard, which truncated and +thereby corrupted large SubD meshes. + +### How to obtain the Source Code Form (MPL-2.0 §3.2) + +1. Get the unmodified crate source — `cargo vendor`, or + `https://crates.io/api/v1/crates/acadrust/0.4.1/download`, or the upstream + commit above. +2. Apply [`public/licenses/acadrust-0.4.1-read_mesh.patch`](./public/licenses/acadrust-0.4.1-read_mesh.patch) + (`/licenses/acadrust-0.4.1-read_mesh.patch` on the deployed site): + + ```bash + tar xf acadrust-0.4.1.crate && cd acadrust-0.4.1 + patch -p1 < acadrust-0.4.1-read_mesh.patch + ``` + +The result is the exact Source Code Form of the acadrust code compiled into the +shipped `.wasm`. Both the original and the modified file remain under MPL-2.0. + +--- + +## dwg-wasm — MIT + +The wasm-bindgen wrapper that turns acadrust output into this viewer's +`parseResult` (`hmwebviewer/rust/dwg-wasm/`). Our own code, MIT. MPL-2.0 §3.3 +permits distributing this Larger Work under different terms as long as the +MPL-covered files above keep their license — which they do. + +--- + +## Other components + +| Component | License | +|---|---| +| three.js | MIT | +| dxf-parser | MIT | +| opentype.js | MIT | +| NanumGothic (`public/fonts/`) | SIL Open Font License 1.1 | +| Viewer2D / sample glue / React app code | MIT | +| React, React DOM, scheduler | MIT | +| Radix UI (`radix-ui`), sonner, cmdk, vaul, embla-carousel, react-day-picker, react-resizable-panels, @tanstack/react-table, cn, tw-animate-css (via `@hm-design/ui`) | MIT | +| lucide-react | ISC | +| class-variance-authority | Apache-2.0 | +| shadcn/ui CSS vendored by `@hm-design/ui` (`dist/vendor/shadcn-tailwind.css`) | MIT | +| Noto Sans KR (HMDesign theme font, `dist/fonts/`) | SIL Open Font License 1.1 | +| HMDesign (`@hm-design/ui`, git submodule `vendor/HMDesign`) | Internal design system; its package declares no license (see the submodule) | diff --git a/public/licenses/THIRD-PARTY-NOTICES.md b/public/licenses/THIRD-PARTY-NOTICES.md index a3ecaef..a5a4eae 100644 --- a/public/licenses/THIRD-PARTY-NOTICES.md +++ b/public/licenses/THIRD-PARTY-NOTICES.md @@ -1,9 +1,10 @@ # Third-party notices -This viewer bundles third-party code. The notices below apply to the source -tree **and** to the built site (`dist2/`, deployed at -`https://dwg-dxf-viewer-sample.pages.dev/`), because the build embeds the -components listed here. +This viewer (dwg-dxf-viewer-hm — the React/HMDesign rebuild of +dwg-dxf-viewer-sample) bundles third-party code. The notices below apply to the +source tree **and** to the built site (`dist/`), because the build embeds the +components listed here. In the app they are reachable from the GNB info button +and the status-bar link "오픈소스 고지". Served copies of the license texts live under [`public/licenses/`](./public/licenses/) → `/licenses/…` on the deployed site. @@ -67,4 +68,11 @@ MPL-covered files above keep their license — which they do. | dxf-parser | MIT | | opentype.js | MIT | | NanumGothic (`public/fonts/`) | SIL Open Font License 1.1 | -| Viewer2D / sample glue | MIT | +| Viewer2D / sample glue / React app code | MIT | +| React, React DOM, scheduler | MIT | +| Radix UI (`radix-ui`), sonner, cmdk, vaul, embla-carousel, react-day-picker, react-resizable-panels, @tanstack/react-table, cn, tw-animate-css (via `@hm-design/ui`) | MIT | +| lucide-react | ISC | +| class-variance-authority | Apache-2.0 | +| shadcn/ui CSS vendored by `@hm-design/ui` (`dist/vendor/shadcn-tailwind.css`) | MIT | +| Noto Sans KR (HMDesign theme font, `dist/fonts/`) | SIL Open Font License 1.1 | +| HMDesign (`@hm-design/ui`, git submodule `vendor/HMDesign`) | Internal design system; its package declares no license (see the submodule) |