Skip to content

AI-native design editor. Open-source Figma alternative.

Add Arabic and RTL support

Danila Poyarkovfd0124b6f889
diff --cc CHANGELOG.md
index 2b4f909f2,19997832b..5b4a47e35
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -20,11 -20,8 +20,12 @@@
- New CLI commands: `open-pencil convert` for document conversion, `open-pencil formats` to inspect readable/writable/exportable formats, and `open-pencil lint` for design consistency, structure, and accessibility checks
- CLI export now supports `.fig` output and routes PNG/JPG/WEBP/SVG/JSX/`.fig` through the shared IO layer
- `Open…` now supports `.pen` Pencil documents through the shared document reader pipeline while keeping `.fig` as the native save format
+- Display‑P3 document color space pipeline — documents now default to Display‑P3, `.fig` import/export preserves document color profiles, the live canvas requests P3 surfaces with sRGB fallback, and raster/SVG export paths accept explicit color-space targets
+- Color picker overhaul — unified `RGB` / `HSL` / `HSB` / `OkHCL` field formats, slider-space-aware track/thumb previews, and better neutral-color editing behavior for fills, strokes, gradient stops, and component fills
+- OkHCL metadata now round-trips through `.fig` plugin data and integrates directly into the main fill/stroke color workflow with preview gamut diagnostics
+- Vue SDK now exposes reusable color-picker model helpers and solid fill/stroke commit helpers for custom editor shells
- Update built-in Z.ai and MiniMax model lists — Z.ai now uses the Anthropic-compatible endpoint for GLM coding models, adds GLM-5.1, and MiniMax adds M2.7 / M2.7-highspeed
+ - Arabic and RTL support across text rendering, editing, layout, export, and AI tooling — text nodes support `Auto`/`LTR`/`RTL`, auto-layout frames support `Auto`/`LTR`/`RTL` flow, and JSX/AI prompts/tools can now generate and edit both explicitly
### Fixes
diff --cc packages/core/src/renderer/text.ts
index e7c0380c9,36f1f3fa3..036e4970d
--- a/packages/core/src/renderer/text.ts
+++ b/packages/core/src/renderer/text.ts
@@@ -1,6 -1,6 +1,7 @@@
--import { DEFAULT_FONT_SIZE, DEFAULT_FONT_FAMILY } from '../constants'
- import { isFontLoaded, getCJKFallbackFamilies } from '../fonts'
+import { resolveRGBAForPreview } from '../color-management'
++import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE } from '../constants'
+ import { resolveNodeTextDirection } from '../direction'
+ import { getArabicFallbackFamilies, getCJKFallbackFamilies, isFontLoaded } from '../fonts'
import type { SceneNode } from '../scene-graph'
import type { CanvasKit, FontWeight, Paragraph, TypefaceFontProvider } from 'canvaskit-wasm'
diff --cc packages/vue/src/controls/useLayout.ts
index b20e1a019,7910435d3..7ac5695a2
--- a/packages/vue/src/controls/useLayout.ts
+++ b/packages/vue/src/controls/useLayout.ts
@@@ -2,15 -2,15 +2,9 @@@ import { computed, ref } from 'vue
import { useEditor } from '@open-pencil/vue/context/editorContext'
import { useSceneComputed } from '@open-pencil/vue/internal/useSceneComputed'
++import { useI18n } from '@open-pencil/vue/i18n'
--import type {
-- SceneNode,
-- LayoutSizing,
-- LayoutAlign,
-- LayoutCounterAlign,
-- GridTrack,
-- GridTrackSizing
--} from '@open-pencil/core'
++import type { SceneNode, LayoutSizing, LayoutAlign, LayoutCounterAlign, GridTrack } from '@open-pencil/core'
type AlignCell = { primary: LayoutAlign; counter: LayoutCounterAlign }
@@@ -38,11 -38,11 +32,13 @@@ const ALIGN_VERTICAL: AlignCell[] =
{ primary: 'MAX', counter: 'MAX' }
]
--const TRACK_SIZING_OPTIONS: { value: GridTrackSizing; label: string }[] = [
-- { value: 'FR', label: 'Fill (fr)' },
-- { value: 'FIXED', label: 'Fixed (px)' },
-- { value: 'AUTO', label: 'Auto' }
--]
++function createTrackSizingOptions(panels: ReturnType<typeof useI18n>['panels']['value']) {
++ return [
++ { value: 'FR' as const, label: panels.sizingFillFr },
++ { value: 'FIXED' as const, label: panels.sizingFixedPx },
++ { value: 'AUTO' as const, label: panels.auto }
++ ]
++}
/**
* Returns layout-related state and actions for the current selection.
@@@ -52,8 -52,9 +48,10 @@@
*/
export function useLayout() {
const editor = useEditor()
++ const { panels } = useI18n()
const node = useSceneComputed<SceneNode | null>(() => editor.getSelectedNode() ?? null)
+ const layoutDirection = computed<SceneNode['layoutDirection']>(() => node.value?.layoutDirection ?? 'AUTO')
const isInAutoLayout = computed(() => {
const n = node.value
@@@ -85,16 -86,16 +83,20 @@@
})
const widthSizingOptions = computed(() => {
-- const options: { value: LayoutSizing; label: string }[] = [{ value: 'FIXED', label: 'Fixed' }]
-- if (isFlex.value) options.push({ value: 'HUG', label: 'Hug' })
-- if (isInAutoLayout.value || isFlex.value) options.push({ value: 'FILL', label: 'Fill' })
++ const options: { value: LayoutSizing; label: string }[] = [
++ { value: 'FIXED', label: panels.value.sizingFixed }
++ ]
++ if (isFlex.value) options.push({ value: 'HUG', label: panels.value.sizingHug })
++ if (isInAutoLayout.value || isFlex.value) options.push({ value: 'FILL', label: panels.value.sizingFill })
return options
})
const heightSizingOptions = computed(() => {
-- const options: { value: LayoutSizing; label: string }[] = [{ value: 'FIXED', label: 'Fixed' }]
-- if (isFlex.value) options.push({ value: 'HUG', label: 'Hug' })
-- if (isInAutoLayout.value || isFlex.value) options.push({ value: 'FILL', label: 'Fill' })
++ const options: { value: LayoutSizing; label: string }[] = [
++ { value: 'FIXED', label: panels.value.sizingFixed }
++ ]
++ if (isFlex.value) options.push({ value: 'HUG', label: panels.value.sizingHug })
++ if (isInAutoLayout.value || isFlex.value) options.push({ value: 'FILL', label: panels.value.sizingFill })
return options
})
@@@ -232,7 -239,7 +240,7 @@@
alignGrid,
showIndividualPadding,
hasUniformPadding,
-- trackSizingOptions: TRACK_SIZING_OPTIONS,
++ trackSizingOptions: createTrackSizingOptions(panels.value),
updateProp,
commitProp,
setWidthSizing,
diff --cc packages/vue/src/i18n/messages.ts
index 9d152bc56,66f7aaa19..c95acc1b6
--- a/packages/vue/src/i18n/messages.ts
+++ b/packages/vue/src/i18n/messages.ts
@@@ -148,18 -148,7 +148,28 @@@ export const panelMessages = i18n('pane
addStop: 'Add stop',
alignCenter: 'Align center',
- alignMiddle: 'Align middle'
+ alignMiddle: 'Align middle',
+ clipContent: 'Clip content',
+ colorFormatRgb: 'RGB',
+ colorFormatHsl: 'HSL',
+ colorFormatHsb: 'HSB',
+ colorFormatOkhcl: 'OkHCL',
+ colorHintHsl: 'H hue · S saturation · L lightness',
+ colorHintHsb: 'H hue · S saturation · B brightness',
+ colorHintOkhcl: 'H hue · C chroma · L lightness · A alpha',
+ colorPreviewClipped: params('Clipped to {space} preview gamut'),
+ rulers: 'Rulers',
- multiplayerCursors: 'Multiplayer cursors'
++ multiplayerCursors: 'Multiplayer cursors',
++ direction: 'Direction',
++ flow: 'Flow',
++ auto: 'Auto',
++ columns: 'Columns',
++ rows: 'Rows',
++ sizingFixed: 'Fixed',
++ sizingHug: 'Hug',
++ sizingFill: 'Fill',
++ sizingFillFr: 'Fill (fr)',
++ sizingFixedPx: 'Fixed (px)'
})
export const pageMessages = i18n('pages', {
diff --cc packages/vue/src/locales/de.json
index d1d293b6b,dd55f7f98..902bd242c
--- a/packages/vue/src/locales/de.json
+++ b/packages/vue/src/locales/de.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Auto-Layout",
"alignment": "Ausrichtung",
"appearance": "Darstellung",
-- "fill": "Füllung",
++ "sizingFill": "Füllung",
"stroke": "Kontur",
"effects": "Effekte",
"export": "Export",
@@@ -131,9 -131,7 +131,19 @@@
"mixedFillsHelp": "Klicke auf +, um gemischte Füllungen zu ersetzen",
"mixedStrokesHelp": "Klicke auf +, um gemischte Konturen zu ersetzen",
"mixedEffectsHelp": "Klicke auf +, um gemischte Effekte zu ersetzen",
- "strokeSides": "Konturseiten"
+ "strokeSides": "Konturseiten",
+ "rulers": "Lineale",
- "multiplayerCursors": "Cursor anderer Teilnehmer"
++ "multiplayerCursors": "Cursor anderer Teilnehmer",
++ "direction": "Richtung",
++ "flow": "Fluss",
++ "auto": "Automatisch",
++ "columns": "Spalten",
++ "rows": "Zeilen",
++ "sizingFixed": "Fest",
++ "sizingHug": "An Inhalt anpassen",
++ "sizingFill": "Füllen",
++ "sizingFillFr": "Füllen (fr)",
++ "sizingFixedPx": "Fest (px)"
},
"pages": {
"newPage": "Neue Seite",
diff --cc packages/vue/src/locales/es.json
index 2d9bfc969,2de58b9ad..6fc64b6f1
--- a/packages/vue/src/locales/es.json
+++ b/packages/vue/src/locales/es.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Auto-layout",
"alignment": "Alineación",
"appearance": "Apariencia",
-- "fill": "Relleno",
++ "sizingFill": "Relleno",
"stroke": "Trazo",
"effects": "Efectos",
"export": "Exportar",
@@@ -131,9 -131,7 +131,19 @@@
"mixedFillsHelp": "Haz clic en + para reemplazar rellenos mixtos",
"mixedStrokesHelp": "Haz clic en + para reemplazar trazos mixtos",
"mixedEffectsHelp": "Haz clic en + para reemplazar efectos mixtos",
- "strokeSides": "Lados del trazo"
+ "strokeSides": "Lados del trazo",
+ "rulers": "Reglas",
- "multiplayerCursors": "Cursores de otros participantes"
++ "multiplayerCursors": "Cursores de otros participantes",
++ "direction": "Dirección",
++ "flow": "Flujo",
++ "auto": "Auto",
++ "columns": "Columnas",
++ "rows": "Filas",
++ "sizingFixed": "Fijo",
++ "sizingHug": "Ajustar al contenido",
++ "sizingFill": "Rellenar",
++ "sizingFillFr": "Rellenar (fr)",
++ "sizingFixedPx": "Fijo (px)"
},
"pages": {
"newPage": "Nueva página",
diff --cc packages/vue/src/locales/fr.json
index ae7318454,78a37165f..b8306f238
--- a/packages/vue/src/locales/fr.json
+++ b/packages/vue/src/locales/fr.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Auto-layout",
"alignment": "Alignement",
"appearance": "Apparence",
-- "fill": "Remplissage",
++ "sizingFill": "Remplissage",
"stroke": "Contour",
"effects": "Effets",
"export": "Export",
@@@ -131,9 -131,7 +131,19 @@@
"mixedFillsHelp": "Cliquez sur + pour remplacer les remplissages mixtes",
"mixedStrokesHelp": "Cliquez sur + pour remplacer les contours mixtes",
"mixedEffectsHelp": "Cliquez sur + pour remplacer les effets mixtes",
- "strokeSides": "Côtés du contour"
+ "strokeSides": "Côtés du contour",
+ "rulers": "Règles",
- "multiplayerCursors": "Curseurs des participants"
++ "multiplayerCursors": "Curseurs des participants",
++ "direction": "Direction",
++ "flow": "Flux",
++ "auto": "Auto",
++ "columns": "Colonnes",
++ "rows": "Lignes",
++ "sizingFixed": "Fixe",
++ "sizingHug": "Ajuster au contenu",
++ "sizingFill": "Remplir",
++ "sizingFillFr": "Remplir (fr)",
++ "sizingFixedPx": "Fixe (px)"
},
"pages": {
"newPage": "Nouvelle page",
diff --cc packages/vue/src/locales/it.json
index 03ce5abd9,e00f86ff4..2ab7c3767
--- a/packages/vue/src/locales/it.json
+++ b/packages/vue/src/locales/it.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Auto-layout",
"alignment": "Allineamento",
"appearance": "Aspetto",
-- "fill": "Riempimento",
++ "sizingFill": "Riempimento",
"stroke": "Contorno",
"effects": "Effetti",
"export": "Esporta",
@@@ -131,9 -131,7 +131,19 @@@
"mixedFillsHelp": "Fai clic su + per sostituire i riempimenti misti",
"mixedStrokesHelp": "Fai clic su + per sostituire i contorni misti",
"mixedEffectsHelp": "Fai clic su + per sostituire gli effetti misti",
- "strokeSides": "Lati del contorno"
+ "strokeSides": "Lati del contorno",
+ "rulers": "Righelli",
- "multiplayerCursors": "Cursori degli altri partecipanti"
++ "multiplayerCursors": "Cursori degli altri partecipanti",
++ "direction": "Direzione",
++ "flow": "Flusso",
++ "auto": "Auto",
++ "columns": "Colonne",
++ "rows": "Righe",
++ "sizingFixed": "Fisso",
++ "sizingHug": "Adatta al contenuto",
++ "sizingFill": "Riempi",
++ "sizingFillFr": "Riempi (fr)",
++ "sizingFixedPx": "Fisso (px)"
},
"pages": {
"newPage": "Nuova pagina",
diff --cc packages/vue/src/locales/pl.json
index dd81dc3c1,ec9bebf7d..df0df6f8f
--- a/packages/vue/src/locales/pl.json
+++ b/packages/vue/src/locales/pl.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Auto-layout",
"alignment": "Wyrównanie",
"appearance": "Wygląd",
-- "fill": "Wypełnienie",
++ "sizingFill": "Wypełnienie",
"stroke": "Obrys",
"effects": "Efekty",
"export": "Eksport",
@@@ -131,9 -131,7 +131,19 @@@
"mixedFillsHelp": "Kliknij +, aby zastąpić mieszane wypełnienia",
"mixedStrokesHelp": "Kliknij +, aby zastąpić mieszane obrysy",
"mixedEffectsHelp": "Kliknij +, aby zastąpić mieszane efekty",
- "strokeSides": "Boki obrysu"
+ "strokeSides": "Boki obrysu",
+ "rulers": "Linijki",
- "multiplayerCursors": "Kursory innych uczestników"
++ "multiplayerCursors": "Kursory innych uczestników",
++ "direction": "Kierunek",
++ "flow": "Przepływ",
++ "auto": "Auto",
++ "columns": "Kolumny",
++ "rows": "Wiersze",
++ "sizingFixed": "Stały",
++ "sizingHug": "Dopasuj do zawartości",
++ "sizingFill": "Wypełnij",
++ "sizingFillFr": "Wypełnij (fr)",
++ "sizingFixedPx": "Stały (px)"
},
"pages": {
"newPage": "Nowa strona",
diff --cc packages/vue/src/locales/ru.json
index 855bb7cee,90dcb3b69..9bb37ad56
--- a/packages/vue/src/locales/ru.json
+++ b/packages/vue/src/locales/ru.json
@@@ -81,7 -81,7 +81,7 @@@
"autoLayout": "Автораскладка",
"alignment": "Выравнивание",
"appearance": "Внешний вид",
-- "fill": "Заливка",
++ "sizingFill": "Заливка",
"stroke": "Обводка",
"effects": "Эффекты",
"export": "Экспорт",
@@@ -135,18 -135,7 +135,28 @@@
"alignRight": "По правому краю",
"alignTop": "По верхнему краю",
"alignMiddle": "По середине",
- "alignBottom": "По нижнему краю"
+ "alignBottom": "По нижнему краю",
+ "clipContent": "Обрезать содержимое",
+ "colorFormatRgb": "RGB",
+ "colorFormatHsl": "HSL",
+ "colorFormatHsb": "HSB",
+ "colorFormatOkhcl": "OkHCL",
+ "colorHintHsl": "H тон · S насыщенность · L светлота",
+ "colorHintHsb": "H тон · S насыщенность · B яркость",
+ "colorHintOkhcl": "H тон · C хрома · L светлота · A альфа",
+ "colorPreviewClipped": "Обрезано до гаммы предпросмотра {space}",
+ "rulers": "Линейки",
- "multiplayerCursors": "Курсоры участников"
++ "multiplayerCursors": "Курсоры участников",
++ "direction": "Направление",
++ "flow": "Поток",
++ "auto": "Авто",
++ "columns": "Столбцы",
++ "rows": "Строки",
++ "sizingFixed": "Фиксированный",
++ "sizingHug": "По содержимому",
++ "sizingFill": "Заполнить",
++ "sizingFillFr": "Заполнить (fr)",
++ "sizingFixedPx": "Фиксированный (px)"
},
"pages": {
"newPage": "Новая страница",
diff --cc src/components/properties/LayoutSection.vue
index c9b16ee94,b21a4315e..3a38b84f8
--- a/src/components/properties/LayoutSection.vue
+++ b/src/components/properties/LayoutSection.vue
@@@ -109,6 -109,19 +109,19 @@@ const { panels } = useI18n(
</button>
</div>
+ <div v-if="ctx.isFlex" class="mt-2">
- <label class="mb-1 block text-[11px] text-muted">Flow</label>
++ <label class="mb-1 block text-[11px] text-muted">{{ panels.flow }}</label>
+ <AppSelect
+ :model-value="ctx.layoutDirection"
+ :options="[
- { value: 'AUTO', label: 'Auto' },
++ { value: 'AUTO', label: panels.auto },
+ { value: 'LTR', label: 'LTR' },
+ { value: 'RTL', label: 'RTL' }
+ ]"
+ @update:model-value="ctx.setLayoutDirection($event as 'AUTO' | 'LTR' | 'RTL')"
+ />
+ </div>
+
<template v-if="ctx.isGrid">
<div
v-for="trackProp in ['gridTemplateColumns', 'gridTemplateRows'] as const"
@@@ -117,7 -130,7 +130,7 @@@
>
<div class="mb-1 flex items-center justify-between">
<label class="text-[11px] text-muted">{{
-- trackProp === 'gridTemplateColumns' ? 'Columns' : 'Rows'
++ trackProp === 'gridTemplateColumns' ? panels.columns : panels.rows
}}</label>
<button
class="cursor-pointer rounded border-none bg-transparent px-1 text-xs leading-none text-muted hover:bg-hover hover:text-surface"
diff --cc src/components/properties/TypographySection.vue
index adccc426c,513102d19..b6884ac77
--- a/src/components/properties/TypographySection.vue
+++ b/src/components/properties/TypographySection.vue
@@@ -83,6 -83,19 +83,19 @@@ const { panels } = useI18n(
</ScrubInput>
</div>
+ <div class="mb-1.5">
- <label class="mb-1 block text-[11px] text-muted">Direction</label>
++ <label class="mb-1 block text-[11px] text-muted">{{ panels.direction }}</label>
+ <AppSelect
+ :model-value="ctx.node.value.textDirection"
+ :options="[
- { value: 'AUTO', label: 'Auto' },
++ { value: 'AUTO', label: panels.auto },
+ { value: 'LTR', label: 'LTR' },
+ { value: 'RTL', label: 'RTL' }
+ ]"
+ @update:model-value="ctx.setDirection($event as 'AUTO' | 'LTR' | 'RTL')"
+ />
+ </div>
+
<div class="flex items-center gap-3">
<ToggleGroupRoot
type="single"
diff --cc tests/fixtures/fonts/NotoNaskhArabic-Regular.ttf
index 000000000,1c522ff28..c728c0cd9
mode 000000,100644..100644
Binary files differ