@ryan_nookpi/pi-skill-excalidraw 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryan_nookpi/pi-skill-excalidraw",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Pi skill that writes .excalidraw diagrams and opens them in a live-synced local Excalidraw window.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: excalidraw
3
- description: "플로우차트, 아키텍처도, 시퀀스·상태 다이어그램, 마인드맵, 와이어프레임, 개념도처럼 '그려줘', '그림으로 보여줘', '다이어그램 만들어줘' 요청이나 Excalidraw·손그림·화이트보드 스타일 요청에 사용한다. .excalidraw 파일을 만들고 실시간 동기화되는 로컬 Excalidraw 창(Chrome)으로 연다. 기존 .excalidraw 파일 수정에도 사용한다. 문서에 넣을 Mermaid 코드나 데이터 차트를 명시적으로 요청한 경우에는 사용하지 않는다."
3
+ description: "플로우차트·아키텍처도·개념도 같은 다이어그램을 그려 달라는 요청에 사용한다."
4
4
  ---
5
5
 
6
6
  # excalidraw
@@ -20,7 +20,7 @@
20
20
 
21
21
  - 일반 노드 `200×72`, 긴 라벨 노드 `240×80`, 판단 다이아몬드 `220×120`, 시작/끝 타원 `160×64`.
22
22
  - 라벨 폰트 20, 제목 28–36, 보조 설명 16.
23
- - 라벨 폭 추정: 한글 한 글자 ≈ fontSize, 영문 ≈ 0.55×fontSize. 좌우 여백 24px를 더한 값이 `width`보다 크면 너비를 늘리거나 `\n`으로 줄을 나눈다.
23
+ - 라벨 폭 추정: 한글 한 글자 ≈ fontSize, 영문 ≈ 0.55×fontSize. 좌우 여백 48px를 더한 값이 `width`보다 크면 너비를 늘리거나 `\n`으로 줄을 나눈다. 높이는 줄 수 × fontSize × 1.25 + 32px 이상, 다이아몬드는 모서리가 좁으니 1.5배로 잡는다. 실제 폰트는 추정보다 넓게 그려지므로 빠듯하게 맞추지 않는다.
24
24
  - 노드 사이 간격: 라벨 없는 화살표 60px 이상, 라벨 있는 화살표 120px 이상(라벨이 화살표 위에 올라간다).
25
25
  - 좌표는 20의 배수로 맞춘다. 같은 열의 노드는 `x`를, 같은 행은 `y`를 똑같이 둔다.
26
26
 
@@ -263,10 +263,14 @@ function lint(file) {
263
263
  }
264
264
  }
265
265
  if (isSkel(e) && SHAPES.has(e.type) && e.label?.text && typeof e.width === "number") {
266
- const need = textWidthEstimate(e.label.text, e.label.fontSize ?? 20) + 24;
267
- if (need > e.width)
266
+ // Fonts render wider than the estimate; diamonds need extra room around their text.
267
+ const fontSize = e.label.fontSize ?? 20;
268
+ const scale = e.type === "diamond" ? 1.5 : 1;
269
+ const needW = (textWidthEstimate(e.label.text, fontSize) + 48) * scale;
270
+ const needH = (fontSize * 1.25 * e.label.text.split("\n").length + 32) * scale;
271
+ if (needW > e.width || (typeof e.height === "number" && needH > e.height))
268
272
  warns.push(
269
- `${e.id}: 라벨 "${e.label.text.split("\n")[0]}"이 너비 ${e.width}보다 길어 보임 (약 ${Math.round(need)}px 필요)`,
273
+ `${e.id}: 라벨 "${e.label.text.split("\n")[0]}"이 ${e.width}×${e.height}에 빠듯해 보임 (약 ${Math.round(needW)}×${Math.round(needH)}px 필요)`,
270
274
  );
271
275
  }
272
276
  }