Pintora
Pintora هي مكتبة لتحويل النصوص إلى مخططات تدعم أنواعاً متعددة من المخططات عبر لغة وصفية موجزة وسهلة القراءة. تستلهم من PlantUML و Mermaid ولكنها تقدم صيغتها الخاصة ومجموعة متنامية من أنواع المخططات.
في Moraya، ضع تعريف Pintora داخل كتلة أكواد محاطة بعلامة اللغة pintora، وسيقوم المحرر بعرض المخطط تلقائياً.
للاطلاع على المرجع الكامل للصيغة، راجع وثائق Pintora الرسمية.
أنواع المخططات المدعومة
| النوع | الكلمة المفتاحية | حالة الاستخدام |
|---|---|---|
| مخطط التسلسل | sequenceDiagram | التفاعلات بين الخدمات/المكونات عبر الزمن |
| مخطط الأنشطة | activityDiagram | سير العمل، أشجار القرار، تدفقات العمليات |
| مخطط المكونات | componentDiagram | بنية النظام وتبعيات المكونات |
| مخطط ER | erDiagram | نماذج كيان-علاقة لقواعد البيانات |
| خريطة ذهنية | mindmap | تنظيم الأفكار بشكل هرمي |
| مخطط جانت | gantt | الجداول الزمنية للمشاريع وجدولة المهام |
| مخطط DOT | dotDiagram | عرض رسوم بيانية للأغراض العامة |
أمثلة
مخطط التسلسل — تدفق طلب HTTP
نمذجة استدعاء REST API نموذجي من المتصفح عبر بوابة API إلى الخدمات الخلفية.
```pintora
sequenceDiagram
participant Browser
participant Gateway
participant AuthService
participant API
participant DB
Browser ->> Gateway: POST /api/orders
Gateway ->> AuthService: Validate JWT token
AuthService -->> Gateway: Token valid, user_id=42
Gateway ->> API: Forward request (user_id=42)
API ->> DB: INSERT INTO orders (...)
DB -->> API: order_id=1001
API -->> Gateway: 201 Created { id: 1001 }
Gateway -->> Browser: 201 Created { id: 1001 }
```
مخطط التسلسل مع كتل بديلة
تسلسل يُظهر المنطق الشرطي لتدفق المصادقة.
```pintora
sequenceDiagram
participant Client
participant Server
participant Database
Client ->> Server: POST /login
Server ->> Database: SELECT user by email
Database -->> Server: user record
alt password matches
Server -->> Client: 200 OK (token)
else password mismatch
Server -->> Client: 401 Unauthorized
end
```
مخطط الأنشطة — تدفق تسجيل الدخول
سير عمل تسجيل دخول كامل مع تفرعات لنتائج المصادقة المختلفة.
```pintora
activityDiagram
start
:User opens login page;
:Enter email and password;
:Submit form;
if (Credentials valid?) then
:Generate session token;
if (2FA enabled?) then
:Send OTP to phone;
:User enters OTP;
if (OTP correct?) then
:Grant access;
else
:Show error message;
:Log failed attempt;
end
endif
else
:Grant access;
endif
:Redirect to dashboard;
else
:Increment failure counter;
if (Failures >= 5?) then
:Lock account for 15 min;
:Send alert email;
else
:Show error message;
endif
endif
end
```
مخطط المكونات
يوضح بنية منصة تجارة إلكترونية قائمة على الخدمات المصغّرة.
```pintora
componentDiagram
package "Frontend" {
[Web App]
[Mobile App]
}
package "API Layer" {
[API Gateway]
[Auth Service]
}
package "Core Services" {
[Order Service]
[Product Service]
[Payment Service]
[Notification Service]
}
package "Data Stores" {
[PostgreSQL]
[Redis]
[Elasticsearch]
[S3]
}
[Web App] --> [API Gateway]
[Mobile App] --> [API Gateway]
[API Gateway] --> [Auth Service]
[API Gateway] --> [Order Service]
[API Gateway] --> [Product Service]
[Order Service] --> [Payment Service]
[Order Service] --> [Notification Service]
[Order Service] --> [PostgreSQL]
[Product Service] --> [PostgreSQL]
[Product Service] --> [Elasticsearch]
[Product Service] --> [S3]
[Payment Service] --> [PostgreSQL]
[Notification Service] --> [Redis]
[Auth Service] --> [Redis]
```
مخطط ER
نمذجة مخطط قاعدة البيانات لتطبيق إدارة المشاريع.
```pintora
erDiagram
users {
int id PK
varchar username
varchar email
timestamp created_at
}
projects {
int id PK
varchar name
text description
int owner_id FK
enum status
timestamp deadline
}
tasks {
int id PK
int project_id FK
int assignee_id FK
varchar title
text description
enum priority
enum status
timestamp due_date
}
comments {
int id PK
int task_id FK
int author_id FK
text body
timestamp created_at
}
labels {
int id PK
varchar name
varchar color
}
users ||--o{ projects : "owns"
users ||--o{ tasks : "assigned to"
projects ||--o{ tasks : "contains"
tasks ||--o{ comments : "has"
users ||--o{ comments : "writes"
tasks }o--o{ labels : "tagged with"
```
خريطة ذهنية
تسلسل هرمي معرفي لتعلم تقنيات تطوير الويب.
```pintora
mindmap
+ Web Development
+ Frontend
+ HTML / CSS
+ JavaScript
+ React
+ Svelte
+ Backend
+ Node.js
+ Rust
+ Go
+ DevOps
+ Docker
+ CI/CD
+ Databases
+ PostgreSQL
+ Redis
```
مخطط جانت
جدول زمني لمشروع تطوير وإطلاق تطبيق جوال بالحد الأدنى من المنتج القابل للتطبيق.
```pintora
gantt
title Mobile App MVP Timeline
dateFormat YYYY-MM-DD
section Planning
Requirements gathering : 2026-03-01, 7d
Technical design : 2026-03-08, 5d
UI/UX wireframes : 2026-03-08, 7d
section Development
Auth module : 2026-03-15, 10d
Core features : 2026-03-15, 20d
API integration : 2026-03-25, 10d
Push notifications : 2026-04-01, 5d
section Testing
Unit tests : 2026-03-25, 15d
Integration testing : 2026-04-05, 7d
UAT : 2026-04-10, 5d
Bug fixes : 2026-04-10, 10d
section Launch
App store submission : 2026-04-20, 3d
Marketing prep : 2026-04-15, 8d
Public release : 2026-04-23, 1d
```