openpencil/src/utils
Danila Poyarkov fd44d7b853 Deduplicate: 47 → 28 clones, 1.37% → 0.61% duplication
Extracted shared helpers to eliminate copy-pasted code:

Core:
- computeAbsoluteBounds() in geometry.ts — replaces 4 bounding box loops
- makeDocumentNodeChange/makeCanvasNodeChange in kiwi-serialize.ts
- parseFigBuffer/parseFigKiwiContainer in kiwi/fig-parse-core.ts
  (fig-parse-worker.ts: 103 → 11 lines)
- createDefaultEditorState() — shared between core + app store
- calcClusterConfidence() in tools/analyze.ts
- retryWithNormalizedFamily() in fonts.ts
- getVectorNode() in tools/vector.ts
- renderFills() helper in renderer/scene.ts
- withNodeBounds() helper in renderer/overlays.ts
- drawNodeHighlightRect() in renderer/highlight-rect.ts
- isInViewport() in renderer/label-cache.ts

App:
- decodeTauriStderr() in utils/tauri.ts
- printNodeResults() in cli format.ts

Remaining 28 clones are: text-editor cursor movement (inherent),
xpath DOM traversal (inherent), small 5-line patterns too
context-specific to extract.
2026-03-17 11:10:11 +03:00
..
layer-icons.ts Refactor LayerTree: Atlaskit DnD, split LayerRow, shared icons 2026-03-17 08:46:23 +03:00
tauri.ts Deduplicate: 47 → 28 clones, 1.37% → 0.61% duplication 2026-03-17 11:10:11 +03:00
text.ts feat: mobile layout, PWA support (#27) (#27) 2026-03-05 19:51:51 +03:00
tools.ts Refactor mobile drawer: use VueUse composables, unify panels 2026-03-05 22:13:24 +03:00