* docs: polish localized documentation - Rewrite Russian documentation for natural terminology and current source parity\n- Continue the Polish editorial pass across guides and SDK references\n- Refresh shared localized SDK API data imports * docs(pl): complete editorial pass - Rewrite the remaining advanced Vue SDK references\n- Refresh the Figma compatibility matrix against the canonical source\n- Align terminology and behavior across every Polish documentation page * docs(de): complete editorial pass - Rewrite German guides, automation docs, and Vue SDK references\n- Restore current AI, export, component, and variable behavior\n- Refresh the Penpot comparison and Figma compatibility matrix * docs(es): complete editorial pass - Rewrite Spanish guides, automation docs, and Vue SDK references\n- Restore current AI, export, component, and variable behavior\n- Refresh the Penpot comparison and Figma compatibility matrix * docs(fr): complete editorial pass - Rewrite French guides, automation docs, and Vue SDK references\n- Restore current AI, export, component, and variable behavior\n- Refresh the Penpot comparison and Figma compatibility matrix * docs: correct localized terminology - Replace unnecessary English prose with natural localized terminology\n- Derive documentation aliases from named directory roots\n- Preserve English only for identifiers, APIs, and exact product terms * docs(it): continue editorial pass - Rewrite Italian user guides and automation documentation\n- Update Vue SDK composables and component references\n- Restore current AI, export, component, and variable behavior * docs(it): complete editorial pass - Finish Italian advanced SDK and reference documentation\n- Refresh the Penpot comparison and Figma compatibility matrix\n- Replace literal machine translations with natural technical prose * docs(pl): refine property panel terminology * docs: refine remaining localized prose - Replace overfitted English prose in Polish feature documentation\n- Rewrite the Russian property-list reference in natural terminology * docs(ru): rewrite Penpot comparison naturally - Replace remaining English prose with natural Russian\n- Preserve code identifiers and library names only where required * docs: rewrite localized feature overviews naturally - Replace avoidable English prose in German, Spanish, and French\n- Keep identifiers and product names unchanged * docs(de): refine property panel terminology * docs: refine Spanish and French SDK terminology * docs(ru): continue full prose audit - Rewrite homepage, setup, navigation, and guide index naturally\n- Restore missing zoom shortcuts * docs(ru): audit user and automation guides - Rewrite selection, collaboration, and automation prose naturally\n- Preserve API identifiers while localizing ordinary terminology * docs(ru): audit CLI inspection and analysis * docs(ru): audit Vue SDK overview and guides * docs(ru): audit Vue SDK API prose - Localize ordinary component and composable terminology\n- Preserve API symbols and code identifiers * docs(ru): audit advanced and gradient API references * docs(ru): finish advanced API prose audit * docs(ru): audit JSX renderer guide * docs(ru): audit CLI export and scripting guides * docs(pl): audit Penpot comparison prose * docs(pl): audit selection and automation guides * docs(pl): audit homepage and variable guides * docs(pl): audit vector, layers, and Pen guides * docs(pl): audit Auto layout and shape guides * docs(pl): audit context menu and export guides * docs(pl): audit JSX and analysis guides * docs(pl): audit AI Chat guide * docs(pl): audit components and CLI inspection * docs(pl): audit scripting and SDK overview prose * docs(pl): audit SDK API indexes * docs(pl): audit SDK component references * docs(pl): audit SDK composable references * docs(ru): refine usePosition terminology * docs(pl): audit advanced SDK references * docs(pl): audit Figma compatibility matrix * docs(pl): finish residual SDK terminology audit * docs(pl): finish component terminology audit * docs(pl): finish SDK guide terminology audit * docs(de): begin full user guide prose audit * docs(de): audit navigation, Pen, and layers guides * docs(de): audit Auto Layout, shapes, menu, and export * docs(de): audit components, text, and vector guides * docs(de): audit variables and automation overview * docs(de): audit AI Chat and collaboration guides * docs(de): audit CLI inspection, analysis, and export * docs(de): audit scripting and JSX guides * docs(de): audit Vue SDK overview and guides * docs(de): audit SDK API indexes * docs(de): audit SDK component references * docs(de): audit SDK composable references * docs(de): audit advanced SDK references * docs(de): audit Penpot comparison prose * docs(de): audit Figma compatibility reference * docs(es): begin full user guide prose audit * docs(es): audit document organization guides * docs(es): audit editing workflow guides * docs(es): audit automation and collaboration prose * docs(es): audit CLI inspection and export guides * docs(es): audit CLI scripting guide * docs(es): audit JSX and feature overview prose * docs(es): audit Penpot comparison prose * docs(es): audit SDK overview and guides * docs(es): begin SDK component reference audit * docs(es): audit SDK navigation component references * docs(es): audit SDK color and layout components * docs(es): begin SDK composable reference audit * docs(es): audit SDK property composable references * docs(es): audit SDK editor composable references * docs(es): begin advanced SDK reference audit * docs(es): audit advanced SDK state references * docs(es): complete advanced SDK reference audit * docs(es): audit Figma compatibility reference * docs(es): complete residual terminology sweep * docs(fr): begin full prose second audit * docs(fr): audit AI and variables prose * docs(fr): audit core user guide prose * docs(fr): audit editing workflow guides * docs(fr): audit CLI and JSX prose * docs(fr): audit Penpot comparison prose * docs(fr): audit SDK overview and guides * docs(fr): begin SDK API reference audit * docs(fr): audit SDK navigation component references * docs(fr): audit SDK color and layout components * docs(fr): begin SDK composable reference audit * docs(fr): audit SDK property composable references * docs(fr): audit editor composables and advanced APIs * docs(fr): audit advanced SDK state references * docs(fr): complete advanced SDK reference audit * docs(fr): audit Figma compatibility reference * docs(fr): complete residual terminology sweep * docs(it): begin full prose second audit * docs(it): audit document workflow guides * docs(it): audit editing and automation prose * docs(it): audit CLI and JSX prose * docs(it): audit Penpot comparison and SDK guides * docs(it): begin SDK API reference audit * docs(it): audit SDK component and state references * docs(it): audit residual SDK references * docs(it): audit Figma compatibility reference * docs(it): complete residual terminology sweep * docs(i18n): verify residual locale terminology
183 lines
9.3 KiB
Markdown
183 lines
9.3 KiB
Markdown
# OpenPencil e Penpot: architettura e prestazioni
|
||
|
||
OpenPencil e Penpot sono strumenti di design open source, ma adottano obiettivi e architetture differenti.
|
||
|
||
::: info Motore WASM di Penpot
|
||
Penpot 2.x include il motore Rust/Skia WASM `render-wasm/v1`, attivabile tramite opzioni del server o `?wasm=true`. Il motore SVG rimane quello predefinito. Il confronto considera entrambe le modalità.
|
||
:::
|
||
|
||
## 1. Dimensione del codice
|
||
|
||
| Metrica | OpenPencil | Penpot |
|
||
|---------|------------|--------|
|
||
| Righe di codice | **circa 26.000** | **circa 299.000** |
|
||
| File sorgente | circa 143 | circa 2.900 |
|
||
| Linguaggi | TypeScript, Vue | Clojure, ClojureScript, Rust, JavaScript, SQL, SCSS |
|
||
| Motore di rendering | circa 3.200 righe, TypeScript | 22.000 righe, Rust/Skia WASM |
|
||
| Interfaccia | circa 4.500 righe | circa 175.000 righe, CLJS e SCSS |
|
||
| Server | Nessuno, architettura locale | 32.600 righe e 151 file SQL |
|
||
| Rapporto | **1×** | **circa 11×** |
|
||
|
||
OpenPencil è circa undici volte più piccolo. La differenza dipende soprattutto dall’architettura, non soltanto dal numero di funzioni.
|
||
|
||
## 2. Architettura
|
||
|
||
### OpenPencil: un solo processo client
|
||
|
||
```text
|
||
┌─────────────────────────────────┐
|
||
│ Tauri native shell │
|
||
│ ┌───────────────────────────┐ │
|
||
│ │ Vue 3 + TypeScript │ │
|
||
│ │ Editor + Kiwi codec │ │
|
||
│ │ SceneGraph in TypeScript │ │
|
||
│ │ CanvasKit + Yoga WASM │ │
|
||
│ └───────────────────────────┘ │
|
||
└─────────────────────────────────┘
|
||
```
|
||
|
||
Editor, SceneGraph, codec dei file e motore di rendering vengono eseguiti nello stesso processo. Non servono server, database o Docker. SceneGraph è una `Map<string, SceneNode>`. TypeScript chiama direttamente CanvasKit e Yoga WASM calcola la disposizione in modo sincrono.
|
||
|
||
### Penpot: piattaforma client-server
|
||
|
||
```text
|
||
┌───────────────────────────────────────────────────────┐
|
||
│ Docker Compose │
|
||
│ ClojureScript frontend │ Clojure/JVM backend │
|
||
│ Rust/Skia WASM │ PostgreSQL, Valkey, MinIO │
|
||
│ Chromium exporter │ MCP server │
|
||
└───────────────────────────────────────────────────────┘
|
||
```
|
||
|
||
Un’installazione completa di Penpot comprende interfaccia, server JVM, PostgreSQL, Valkey, MinIO e un esportatore basato su Chromium senza interfaccia. L’ambiente di sviluppo richiede Docker Compose, JVM, Node e strumenti Rust.
|
||
|
||
OpenPencil evita latenza di rete, serializzazione tra servizi, orchestrazione dei contenitori e query al database per le normali operazioni. Penpot è pensato come piattaforma multiutente ospitata su server; OpenPencil privilegia l’editing locale a bassa latenza.
|
||
|
||
## 3. Flusso di rendering
|
||
|
||
### OpenPencil: TypeScript → CanvasKit WASM
|
||
|
||
```typescript
|
||
renderSceneToCanvas(canvas, graph, pageId) {
|
||
this.fillPaint.setColor(...)
|
||
canvas.drawRRect(rrect, this.fillPaint)
|
||
}
|
||
```
|
||
|
||
- Passaggio diretto da TypeScript a WASM.
|
||
- SceneGraph rimane nell’heap JavaScript e non viene serializzato prima del rendering.
|
||
- Il motore comprende circa 3.200 righe distribuite in moduli specializzati.
|
||
|
||
### Penpot: ClojureScript → Rust WASM → Skia
|
||
|
||
```text
|
||
ClojureScript → JavaScript
|
||
→ scomposizione e codifica binaria nella memoria WASM
|
||
→ Rust WASM tramite Emscripten C FFI
|
||
→ skia-safe
|
||
→ Skia/WebGL
|
||
```
|
||
|
||
Senza WASM, ogni forma viene renderizzata come elemento SVG DOM tramite React/Reagent. Con WASM, UUID, trasformazioni, riempimenti e contorni vengono codificati in strutture binarie. Il motore usa cache a riquadri, aree di interesse, undici superfici e stato globale mutabile tramite `unsafe`.
|
||
|
||
La cache può conservare fino a 1.024 texture. OpenPencil ridisegna invece l’intera area visibile.
|
||
|
||
| Aspetto | OpenPencil | Penpot |
|
||
|---------|------------|--------|
|
||
| JavaScript → WASM | Chiamate dirette con oggetti TypeScript | Strutture binarie |
|
||
| Modello | Ridisegno del viewport visibile | Cache a riquadri |
|
||
| Superfici | 1 | 11 |
|
||
| Cache aggiuntiva | Nessuna | Fino a 1.024 riquadri |
|
||
| Dimensione del motore | circa 3.200 righe | 22.000 righe |
|
||
| Codice non sicuro | Nessuno | Stato globale tramite `unsafe` |
|
||
|
||
Il percorso diretto di CanvasKit richiede meno elaborazione intermedia nei documenti piccoli e medi. La cache di Penpot può essere vantaggiosa oltre 100.000 forme quando è visibile solo una piccola area.
|
||
|
||
## 4. SceneGraph e modello dati
|
||
|
||
```typescript
|
||
nodes: Map<string, SceneNode>
|
||
```
|
||
|
||
OpenPencil offre ricerca per ID in O(1), 29 tipi di oggetto dallo schema Kiwi, circa 390 campi in `NodeChange`, tipi TypeScript rigorosi e GUID nel formato Figma `sessionID:localID`.
|
||
|
||
Penpot mantiene definizioni proprie in Clojure/ClojureScript e Rust. Moduli separati gestiscono colori, componenti, contenitori, riempimenti, griglia, modificatori, pagine e percorsi. Malli convalida gli schemi durante l’esecuzione e i dati di rendering attraversano il confine CLJS → Rust.
|
||
|
||
## 5. Motore di disposizione
|
||
|
||
OpenPencil usa Yoga WASM in modo sincrono:
|
||
|
||
```typescript
|
||
const root = Yoga.Node.create()
|
||
root.setFlexDirection(FlexDirection.Row)
|
||
root.calculateLayout()
|
||
```
|
||
|
||
Penpot mantiene implementazioni proprie di Flex e Grid sia in ClojureScript sia in Rust WASM. OpenPencil usa Yoga, compresa una variante con supporto Grid; Penpot mantiene migliaia di righe di codice di disposizione in due linguaggi.
|
||
|
||
## 6. Formati e Figma
|
||
|
||
OpenPencil usa il formato binario Kiwi di Figma, importa direttamente `.fig`, legge i dati Kiwi dagli appunti ed è compatibile con il protocollo multiplayer di Figma.
|
||
|
||
Un file `.penpot` è invece un archivio ZIP con manifesti JSON, dati, risorse binarie e miniature. Penpot non importa `.fig` in modo nativo e gestisce diverse generazioni del formato tramite migrazioni.
|
||
|
||
## 7. Stato e annullamento
|
||
|
||
OpenPencil usa comandi inversi: le funzioni di applicazione e annullamento conservano solo lo stato necessario e le operazioni possono essere raggruppate.
|
||
|
||
Penpot usa Potok. `UpdateEvent` cambia lo stato, `WatchEvent` esegue gli effetti tramite RxJS e la cronologia conserva vettori inversi, fino a 50 voci, raggruppando le modifiche rapide in transazioni.
|
||
|
||
## 8. Sviluppo
|
||
|
||
| Metrica | OpenPencil | Penpot |
|
||
|---------|------------|--------|
|
||
| Preparazione | `bun install && bun dev` | Docker Compose, JVM, Node e Rust |
|
||
| Aggiornamento rapido | Vite | shadow-cljs |
|
||
| Tipi | TypeScript rigoroso | Schemi Malli durante l’esecuzione |
|
||
| Desktop | Tauri v2 | Browser |
|
||
| Tecnologie principali | TypeScript e Vue | Clojure, ClojureScript, Rust e Docker |
|
||
|
||
## 9. Prestazioni
|
||
|
||
| Scenario | OpenPencil | Penpot |
|
||
|----------|------------|--------|
|
||
| Avvio | meno di 2 s con WASM | oltre 10 s per server, client e WASM |
|
||
| Operazione comune | Nello stesso processo | Possibile passaggio di rete |
|
||
| Fotogramma | Chiamata diretta a Skia | CLJS → JS → WASM FFI → Skia |
|
||
| Memoria di base | circa 50 MB nella scheda | JVM, database, cache e browser |
|
||
| Senza rete | Completo | Richiede il server |
|
||
| 10.000 forme | Una passata | Renderer a riquadri con 11 superfici |
|
||
|
||
## 10. Vantaggi di Penpot
|
||
|
||
1. **Collaborazione tramite server:** account, controllo degli accessi e archiviazione centrale.
|
||
2. **Export PDF:** esportatore Chromium dedicato.
|
||
3. **Sistema di plugin:** esecuzione isolata e API dei plugin.
|
||
4. **Token di design:** supporto integrato.
|
||
5. **CSS Grid:** implementazione propria; OpenPencil usa una variante di Yoga con Grid.
|
||
6. **Installazione autonoma:** piattaforma di gruppo distribuibile con Docker.
|
||
7. **Maturità:** diversi anni di uso in produzione.
|
||
|
||
## 11. Script ed estensibilità
|
||
|
||
Il comando [`eval`](/programmable/cli/scripting) fornisce un’API compatibile con i plugin Figma per script senza interfaccia, operazioni in serie e test automatizzati. Chat AI, server MCP e CLI offrono inoltre 90 strumenti per lettura, creazione, modifica, struttura, variabili, tracciati vettoriali, analisi, differenze, operazioni booleane e disposizione.
|
||
|
||
Penpot offre plugin isolati, ma non un’API equivalente per script senza interfaccia o integrazione MCP.
|
||
|
||
## Riepilogo
|
||
|
||
| Area | Vantaggio | Motivo |
|
||
|------|-----------|--------|
|
||
| Semplicità | OpenPencil | Un processo invece di più servizi |
|
||
| Rendering | OpenPencil | Percorso CanvasKit diretto |
|
||
| Codice | OpenPencil | Circa 26.000 contro 299.000 righe |
|
||
| Compatibilità Figma | OpenPencil | Kiwi e `.fig` nativi |
|
||
| Sviluppo | OpenPencil | TypeScript e Vue anziché Clojure, Rust e Docker |
|
||
| Applicazione desktop | OpenPencil | Tauri nativo |
|
||
| Disposizione | OpenPencil | Yoga anziché due implementazioni proprie |
|
||
| Collaborazione | Punti di forza diversi | Penpot: server e accessi; OpenPencil: P2P senza hosting |
|
||
| Installazione autonoma | Penpot | Distribuzione Docker |
|
||
| Maturità | Penpot | Anni di uso in produzione |
|
||
|
||
OpenPencil è un editor compatto in un solo processo con CanvasKit e supporto nativo `.fig`. Penpot è una piattaforma client-server completa con Clojure, ClojureScript, Rust, database e servizi Docker. Entrambi supportano la collaborazione con modelli diversi.
|