Skip to content

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

refactor(ui): localize tooltip labels

Danila Poyarkov3a85632f3867
diff --git a/lint/plugin.js b/lint/plugin.js
index 4feb50f31..f7404e38b 100644
--- a/lint/plugin.js
+++ b/lint/plugin.js
@@ -198,6 +198,56 @@ const noVueStyleBlocks = {
}
}
+const noNativeTitleAttributesInVue = {
+ meta: {
+ docs: {
+ description: 'Disallow native title attributes in Vue components — use Tip/Reka tooltip'
+ }
+ },
+ create(context) {
+ const file = normalizedFilename(context)
+ if (!file.endsWith('.vue')) return {}
+ if (!file.includes('/src/') && !file.includes('/packages/vue/src/')) return {}
+
+ return {
+ Program(node) {
+ const source = context.sourceCode.getText()
+ if (/\s:?title=/.test(source)) {
+ context.report({
+ node,
+ message: 'Use the shared tooltip UI instead of native title attributes.'
+ })
+ }
+ }
+ }
+ }
+}
+
+const noHardcodedTipLabelsInVue = {
+ meta: {
+ docs: {
+ description: 'Disallow hardcoded Tip labels — use localized i18n messages'
+ }
+ },
+ create(context) {
+ const file = normalizedFilename(context)
+ if (!file.endsWith('.vue')) return {}
+ if (!file.includes('/src/') && !file.includes('/packages/vue/src/')) return {}
+
+ return {
+ Program(node) {
+ const source = context.sourceCode.getText()
+ if (/<Tip\b[^>]*\slabel=["']/.test(source)) {
+ context.report({
+ node,
+ message: 'Use a localized binding for Tip labels, not a hardcoded string.'
+ })
+ }
+ }
+ }
+ }
+}
+
const TEST_ID_FORMAT = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/
const noRawTestIdStringProps = {
@@ -1579,6 +1629,8 @@ const plugin = {
'no-inline-named-types': noInlineNamedTypes,
'no-structuredclone-scene-arrays': noStructuredCloneSceneArrays,
'no-vue-style-blocks': noVueStyleBlocks,
+ 'no-native-title-attributes-in-vue': noNativeTitleAttributesInVue,
+ 'no-hardcoded-tip-labels-in-vue': noHardcodedTipLabelsInVue,
'no-raw-test-id-string-props': noRawTestIdStringProps,
'no-dynamic-data-test-id-in-vue': noDynamicDataTestIdInVue,
'no-test-id-helper-bind-in-vue': noTestIdHelperBindInVue,
diff --git a/oxlint.json b/oxlint.json
index 89bb99680..49e4c8c58 100644
--- a/oxlint.json
+++ b/oxlint.json
@@ -149,6 +149,8 @@
],
"open-pencil/no-structuredclone-scene-arrays": "error",
"open-pencil/no-vue-style-blocks": "error",
+ "open-pencil/no-native-title-attributes-in-vue": "error",
+ "open-pencil/no-hardcoded-tip-labels-in-vue": "error",
"open-pencil/no-raw-test-id-string-props": "error",
"open-pencil/no-dynamic-data-test-id-in-vue": "error",
"open-pencil/no-test-id-helper-bind-in-vue": "error",
diff --git a/packages/vue/src/i18n/messages.ts b/packages/vue/src/i18n/messages.ts
index 68b4caf5c..b85ed2a34 100644
--- a/packages/vue/src/i18n/messages.ts
+++ b/packages/vue/src/i18n/messages.ts
@@ -61,6 +61,7 @@ export const menuMessages = i18n('menu', {
bold: 'Bold',
italic: 'Italic',
underline: 'Underline',
+ strikethrough: 'Strikethrough',
pasteHere: 'Paste here',
pasteToReplace: 'Paste to replace',
@@ -164,6 +165,14 @@ export const panelMessages = i18n('panels', {
addStroke: 'Add stroke',
addEffect: 'Add effect',
addExport: 'Add export',
+ removeFill: 'Remove fill',
+ removeStroke: 'Remove stroke',
+ removeEffect: 'Remove effect',
+ removeExport: 'Remove export',
+ effectSettings: 'Effect settings',
+ expandEffectSettings: 'Expand effect settings',
+ collapseEffectSettings: 'Collapse effect settings',
+ toggleExportPreview: 'Toggle export preview',
dropShadow: 'Drop shadow',
innerShadow: 'Inner shadow',
@@ -287,6 +296,8 @@ export const dialogMessages = i18n('dialogs', {
ok: 'OK',
copy: 'Copy',
copied: 'Copied',
+ copiedExclamation: 'Copied!',
+ copyMessage: 'Copy message',
createCollection: 'Create collection',
renameCollection: 'Rename collection',
deleteCollection: 'Delete collection',
@@ -299,6 +310,15 @@ export const dialogMessages = i18n('dialogs', {
deleteMode: 'Delete mode',
setDefaultMode: 'Set as default',
selectLayerForJSX: 'Select a layer to see its JSX code',
+ copyJSXReference: 'Copy JSX prop reference to clipboard',
+ newTab: 'New tab',
+ closeTab: params('Close {name}'),
+ showUI: params('Show UI ({shortcut})'),
+ fontSettings: 'Font settings',
+ you: 'You',
+ youSuffix: 'you',
+ followingPeerStop: params('Following {name} (click to stop)'),
+ clickToFollowPeer: params('Click to follow {name}'),
connectAIProvider: 'Connect an AI provider to start chatting.',
connect: 'Connect',
getAPIKey: params('Get an {provider} API key →'),
diff --git a/packages/vue/src/locales/de.json b/packages/vue/src/locales/de.json
index e07b988a6..6fa1c794b 100644
--- a/packages/vue/src/locales/de.json
+++ b/packages/vue/src/locales/de.json
@@ -41,7 +41,8 @@
"copyNodeId": "Knoten-ID kopieren",
"copyXPath": "XPath kopieren",
"checkUpdates": "Nach Updates suchen…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Durchstreichen"
},
"commands": {
"undo": "Rückgängig",
@@ -220,7 +221,15 @@
"description": "Beschreibung",
"documentation": "Dokumentation",
"openDocs": "Dokumentation öffnen",
- "properties": "Eigenschaften"
+ "properties": "Eigenschaften",
+ "removeFill": "Füllung entfernen",
+ "removeStroke": "Kontur entfernen",
+ "removeEffect": "Effekt entfernen",
+ "removeExport": "Export entfernen",
+ "effectSettings": "Effekteinstellungen",
+ "expandEffectSettings": "Effekteinstellungen erweitern",
+ "collapseEffectSettings": "Effekteinstellungen einklappen",
+ "toggleExportPreview": "Exportvorschau umschalten"
},
"pages": {
"newPage": "Neue Seite",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "Kopiert!",
+ "copyMessage": "Nachricht kopieren",
+ "copyJSXReference": "JSX-Prop-Referenz in die Zwischenablage kopieren",
+ "newTab": "Neuer Tab",
+ "closeTab": "{name} schließen",
+ "showUI": "UI anzeigen ({shortcut})",
+ "fontSettings": "Schrifteinstellungen",
+ "you": "Du",
+ "youSuffix": "du",
+ "followingPeerStop": "Folge {name} (zum Stoppen klicken)",
+ "clickToFollowPeer": "Klicken, um {name} zu folgen"
},
"variableTypes": {
"color": "Farbe",
diff --git a/packages/vue/src/locales/es.json b/packages/vue/src/locales/es.json
index 2a614456f..3afd3d6ac 100644
--- a/packages/vue/src/locales/es.json
+++ b/packages/vue/src/locales/es.json
@@ -41,7 +41,8 @@
"copyNodeId": "Copiar ID del nodo",
"copyXPath": "Copiar XPath",
"checkUpdates": "Buscar actualizaciones…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Tachado"
},
"commands": {
"undo": "Deshacer",
@@ -220,7 +221,15 @@
"description": "Descripción",
"documentation": "Documentación",
"openDocs": "Abrir docs",
- "properties": "Propiedades"
+ "properties": "Propiedades",
+ "removeFill": "Eliminar relleno",
+ "removeStroke": "Eliminar trazo",
+ "removeEffect": "Eliminar efecto",
+ "removeExport": "Eliminar exportación",
+ "effectSettings": "Ajustes del efecto",
+ "expandEffectSettings": "Expandir ajustes del efecto",
+ "collapseEffectSettings": "Contraer ajustes del efecto",
+ "toggleExportPreview": "Alternar vista previa de exportación"
},
"pages": {
"newPage": "Nueva página",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "¡Copiado!",
+ "copyMessage": "Copiar mensaje",
+ "copyJSXReference": "Copiar referencia de props JSX al portapapeles",
+ "newTab": "Nueva pestaña",
+ "closeTab": "Cerrar {name}",
+ "showUI": "Mostrar interfaz ({shortcut})",
+ "fontSettings": "Ajustes de fuentes",
+ "you": "Tú",
+ "youSuffix": "tú",
+ "followingPeerStop": "Siguiendo a {name} (haz clic para detener)",
+ "clickToFollowPeer": "Haz clic para seguir a {name}"
},
"variableTypes": {
"color": "Color",
diff --git a/packages/vue/src/locales/fr.json b/packages/vue/src/locales/fr.json
index 6eb71a705..15c382a0f 100644
--- a/packages/vue/src/locales/fr.json
+++ b/packages/vue/src/locales/fr.json
@@ -41,7 +41,8 @@
"copyNodeId": "Copier l'ID du nœud",
"copyXPath": "Copier le XPath",
"checkUpdates": "Rechercher des mises à jour…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Barré"
},
"commands": {
"undo": "Annuler",
@@ -220,7 +221,15 @@
"description": "Description",
"documentation": "Documentation",
"openDocs": "Ouvrir la doc",
- "properties": "Propriétés"
+ "properties": "Propriétés",
+ "removeFill": "Supprimer le remplissage",
+ "removeStroke": "Supprimer le contour",
+ "removeEffect": "Supprimer l’effet",
+ "removeExport": "Supprimer l’export",
+ "effectSettings": "Réglages de l’effet",
+ "expandEffectSettings": "Développer les réglages de l’effet",
+ "collapseEffectSettings": "Réduire les réglages de l’effet",
+ "toggleExportPreview": "Afficher/masquer l’aperçu d’export"
},
"pages": {
"newPage": "Nouvelle page",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "Copié !",
+ "copyMessage": "Copier le message",
+ "copyJSXReference": "Copier la référence des props JSX dans le presse-papiers",
+ "newTab": "Nouvel onglet",
+ "closeTab": "Fermer {name}",
+ "showUI": "Afficher l’interface ({shortcut})",
+ "fontSettings": "Réglages des polices",
+ "you": "Vous",
+ "youSuffix": "vous",
+ "followingPeerStop": "Suit {name} (cliquer pour arrêter)",
+ "clickToFollowPeer": "Cliquer pour suivre {name}"
},
"variableTypes": {
"color": "Couleur",
diff --git a/packages/vue/src/locales/it.json b/packages/vue/src/locales/it.json
index 1e8d8bc21..e25376108 100644
--- a/packages/vue/src/locales/it.json
+++ b/packages/vue/src/locales/it.json
@@ -41,7 +41,8 @@
"copyNodeId": "Copia ID nodo",
"copyXPath": "Copia XPath",
"checkUpdates": "Controlla aggiornamenti…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Barrato"
},
"commands": {
"undo": "Annulla",
@@ -220,7 +221,15 @@
"description": "Descrizione",
"documentation": "Documentazione",
"openDocs": "Apri documentazione",
- "properties": "Proprietà"
+ "properties": "Proprietà",
+ "removeFill": "Rimuovi riempimento",
+ "removeStroke": "Rimuovi traccia",
+ "removeEffect": "Rimuovi effetto",
+ "removeExport": "Rimuovi esportazione",
+ "effectSettings": "Impostazioni effetto",
+ "expandEffectSettings": "Espandi impostazioni effetto",
+ "collapseEffectSettings": "Comprimi impostazioni effetto",
+ "toggleExportPreview": "Mostra/nascondi anteprima esportazione"
},
"pages": {
"newPage": "Nuova pagina",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "Copiato!",
+ "copyMessage": "Copia messaggio",
+ "copyJSXReference": "Copia riferimento props JSX negli appunti",
+ "newTab": "Nuova scheda",
+ "closeTab": "Chiudi {name}",
+ "showUI": "Mostra interfaccia ({shortcut})",
+ "fontSettings": "Impostazioni font",
+ "you": "Tu",
+ "youSuffix": "tu",
+ "followingPeerStop": "Segui {name} (clic per interrompere)",
+ "clickToFollowPeer": "Fai clic per seguire {name}"
},
"variableTypes": {
"color": "Colore",
diff --git a/packages/vue/src/locales/pl.json b/packages/vue/src/locales/pl.json
index 1bbb275ab..f593ef5fa 100644
--- a/packages/vue/src/locales/pl.json
+++ b/packages/vue/src/locales/pl.json
@@ -41,7 +41,8 @@
"copyNodeId": "Kopiuj ID węzła",
"copyXPath": "Kopiuj XPath",
"checkUpdates": "Sprawdź aktualizacje…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Przekreślenie"
},
"commands": {
"undo": "Cofnij",
@@ -220,7 +221,15 @@
"description": "Opis",
"documentation": "Dokumentacja",
"openDocs": "Otwórz dokumentację",
- "properties": "Właściwości"
+ "properties": "Właściwości",
+ "removeFill": "Usuń wypełnienie",
+ "removeStroke": "Usuń obrys",
+ "removeEffect": "Usuń efekt",
+ "removeExport": "Usuń eksport",
+ "effectSettings": "Ustawienia efektu",
+ "expandEffectSettings": "Rozwiń ustawienia efektu",
+ "collapseEffectSettings": "Zwiń ustawienia efektu",
+ "toggleExportPreview": "Przełącz podgląd eksportu"
},
"pages": {
"newPage": "Nowa strona",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "Skopiowano!",
+ "copyMessage": "Kopiuj wiadomość",
+ "copyJSXReference": "Skopiuj referencję propsów JSX do schowka",
+ "newTab": "Nowa karta",
+ "closeTab": "Zamknij {name}",
+ "showUI": "Pokaż interfejs ({shortcut})",
+ "fontSettings": "Ustawienia czcionek",
+ "you": "Ty",
+ "youSuffix": "ty",
+ "followingPeerStop": "Obserwujesz {name} (kliknij, aby zatrzymać)",
+ "clickToFollowPeer": "Kliknij, aby obserwować {name}"
},
"variableTypes": {
"color": "Kolor",
diff --git a/packages/vue/src/locales/ru.json b/packages/vue/src/locales/ru.json
index 0df036bf8..eca61adf3 100644
--- a/packages/vue/src/locales/ru.json
+++ b/packages/vue/src/locales/ru.json
@@ -41,7 +41,8 @@
"copyNodeId": "Копировать ID узла",
"copyXPath": "Копировать XPath",
"checkUpdates": "Проверить обновления…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "Зачёркивание"
},
"commands": {
"undo": "Отменить",
@@ -220,7 +221,15 @@
"description": "Описание",
"documentation": "Документация",
"openDocs": "Открыть документацию",
- "properties": "Свойства"
+ "properties": "Свойства",
+ "removeFill": "Удалить заливку",
+ "removeStroke": "Удалить обводку",
+ "removeEffect": "Удалить эффект",
+ "removeExport": "Удалить экспорт",
+ "effectSettings": "Настройки эффекта",
+ "expandEffectSettings": "Развернуть настройки эффекта",
+ "collapseEffectSettings": "Свернуть настройки эффекта",
+ "toggleExportPreview": "Показать/скрыть предпросмотр экспорта"
},
"pages": {
"newPage": "Новая страница",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "Скопировано!",
+ "copyMessage": "Скопировать сообщение",
+ "copyJSXReference": "Скопировать справку по JSX-свойствам в буфер",
+ "newTab": "Новая вкладка",
+ "closeTab": "Закрыть {name}",
+ "showUI": "Показать интерфейс ({shortcut})",
+ "fontSettings": "Настройки шрифтов",
+ "you": "Вы",
+ "youSuffix": "вы",
+ "followingPeerStop": "Следите за {name} (нажмите, чтобы остановить)",
+ "clickToFollowPeer": "Нажмите, чтобы следить за {name}"
},
"variableTypes": {
"color": "Цвет",
diff --git a/packages/vue/src/locales/zh-CN.json b/packages/vue/src/locales/zh-CN.json
index 9e4a4d5ae..77f5a3c76 100644
--- a/packages/vue/src/locales/zh-CN.json
+++ b/packages/vue/src/locales/zh-CN.json
@@ -41,7 +41,8 @@
"copyNodeId": "复制节点 ID",
"copyXPath": "复制 XPath",
"checkUpdates": "检查更新…",
- "booleanOperations": "Boolean operations"
+ "booleanOperations": "Boolean operations",
+ "strikethrough": "删除线"
},
"commands": {
"undo": "撤销",
@@ -220,7 +221,15 @@
"description": "描述",
"documentation": "文档",
"openDocs": "打开文档",
- "properties": "属性"
+ "properties": "属性",
+ "removeFill": "移除填充",
+ "removeStroke": "移除描边",
+ "removeEffect": "移除效果",
+ "removeExport": "移除导出",
+ "effectSettings": "效果设置",
+ "expandEffectSettings": "展开效果设置",
+ "collapseEffectSettings": "收起效果设置",
+ "toggleExportPreview": "切换导出预览"
},
"pages": {
"newPage": "新建页面",
@@ -297,7 +306,18 @@
"getPexelsAPIKey": "Get free Pexels API key →",
"getUnsplashAccessKey": "Get free Unsplash access key →",
"completions": "Completions",
- "responses": "Responses"
+ "responses": "Responses",
+ "copiedExclamation": "已复制!",
+ "copyMessage": "复制消息",
+ "copyJSXReference": "将 JSX 属性参考复制到剪贴板",
+ "newTab": "新标签页",
+ "closeTab": "关闭 {name}",
+ "showUI": "显示界面({shortcut})",
+ "fontSettings": "字体设置",
+ "you": "你",
+ "youSuffix": "你",
+ "followingPeerStop": "正在跟随 {name}(点击停止)",
+ "clickToFollowPeer": "点击跟随 {name}"
},
"variableTypes": {
"color": "颜色",
diff --git a/playwright.config.ts b/playwright.config.ts
index 44a3e4758..bd8fa684a 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -30,6 +30,14 @@ export default defineConfig({
testDir: './tests/e2e',
fullyParallel: false
},
+ {
+ name: 'openpencil-webkit',
+ testDir: './tests/e2e',
+ testMatch: '**/*.webkit.spec.ts',
+ use: {
+ browserName: 'webkit'
+ }
+ },
{
name: 'figma',
testDir: './tests/figma'
diff --git a/src/components/AppToast.vue b/src/components/AppToast.vue
index fbfd0b548..b547b9f92 100644
--- a/src/components/AppToast.vue
+++ b/src/components/AppToast.vue
@@ -6,8 +6,10 @@ import { useClipboard } from '@vueuse/core'
import Tip from '@/components/ui/Tip.vue'
import { toast } from '@/app/shell/ui'
import { useToastUI } from '@/components/ui/toast'
+import { useI18n } from '@open-pencil/vue'
const { copy, copied } = useClipboard({ copiedDuring: 1500 })
+const { dialogs } = useI18n()
</script>
<template>
@@ -29,7 +31,10 @@ const { copy, copied } = useClipboard({ copiedDuring: 1500 })
<ToastDescription class="min-w-0 flex-1 select-text">
{{ t.message }}<span v-if="t.count > 1" class="ml-1.5 opacity-70">×{{ t.count }}</span>
</ToastDescription>
- <Tip v-if="t.variant !== 'default'" :label="copied ? 'Copied!' : 'Copy message'">
+ <Tip
+ v-if="t.variant !== 'default'"
+ :label="copied ? dialogs.copiedExclamation : dialogs.copyMessage"
+ >
<button
data-test-id="toast-copy-message"
class="mt-0.5 shrink-0 cursor-pointer rounded p-0.5 opacity-70 hover:opacity-100"
diff --git a/src/components/CodePanel.vue b/src/components/CodePanel.vue
index 9d49578af..88c00b6c7 100644
--- a/src/components/CodePanel.vue
+++ b/src/components/CodePanel.vue
@@ -72,7 +72,7 @@ function copyReference() {
</AppTextButton>
</div>
<div class="flex items-center gap-1">
- <Tip label="Copy JSX prop reference to clipboard">
+ <Tip :label="dialogs.copyJSXReference">
<AppTextButton
test-id="code-panel-copy-ref"
:ui="{
diff --git a/src/components/CollabPanel/CollabAvatarStack.vue b/src/components/CollabPanel/CollabAvatarStack.vue
index dda522253..c5f3491d1 100644
--- a/src/components/CollabPanel/CollabAvatarStack.vue
+++ b/src/components/CollabPanel/CollabAvatarStack.vue
@@ -4,19 +4,21 @@ import { colorToCSS } from '@open-pencil/core/color'
import Tip from '@/components/ui/Tip.vue'
import { initials } from '@/app/shell/ui'
import { useCollabPanelContext } from '@/components/CollabPanel/context'
+import { useI18n } from '@open-pencil/vue'
const collab = useCollabPanelContext()
+const { dialogs } = useI18n()
</script>
<template>
<div class="flex -space-x-1.5">
- <Tip :label="`${collab.state.localName || 'You'} (you)`">
+ <Tip :label="`${collab.state.localName || dialogs.you} (${dialogs.youSuffix})`">
<div
data-test-id="collab-local-avatar"
class="flex size-6 items-center justify-center rounded-full border-2 border-panel text-[10px] font-semibold text-white"
:style="{ background: colorToCSS(collab.state.localColor) }"
>
- {{ initials(collab.state.localName || 'You') }}
+ {{ initials(collab.state.localName || dialogs.you) }}
</div>
</Tip>
@@ -25,8 +27,8 @@ const collab = useCollabPanelContext()
:key="peer.clientId"
:label="
collab.followingPeer === peer.clientId
- ? `Following ${peer.name} (click to stop)`
- : `Click to follow ${peer.name}`
+ ? dialogs.followingPeerStop({ name: peer.name })
+ : dialogs.clickToFollowPeer({ name: peer.name })
"
>
<div
diff --git a/src/components/FontSettings/FontSettingsPopover.vue b/src/components/FontSettings/FontSettingsPopover.vue
index b66529572..bd48864f8 100644
--- a/src/components/FontSettings/FontSettingsPopover.vue
+++ b/src/components/FontSettings/FontSettingsPopover.vue
@@ -4,10 +4,12 @@ import { onMounted } from 'vue'
import { isTauri } from '@/app/tauri/env'
import { useFontSettings } from '@/components/FontSettings/use'
+import { useI18n } from '@open-pencil/vue'
import Tip from '@/components/ui/Tip.vue'
import { useButtonUI } from '@/components/ui/button'
import { usePopoverUI } from '@/components/ui/popover'
+const { dialogs } = useI18n()
const cls = usePopoverUI({ content: 'isolate z-[51] w-80 p-3' })
const trigger = useButtonUI({
tone: 'ghost',
@@ -52,7 +54,7 @@ onMounted(() => {
<template>
<PopoverRoot @update:open="$event && refreshSummary()">
- <Tip label="Font settings">
+ <Tip :label="dialogs.fontSettings">
<PopoverTrigger data-test-id="font-settings-trigger" :class="trigger.base">
<icon-lucide-settings class="size-3.5" />
</PopoverTrigger>
@@ -75,7 +77,7 @@ onMounted(() => {
<icon-lucide-type class="size-4" />
</div>
<div>
- <h3 class="text-[11px] font-semibold text-surface">Font settings</h3>
+ <h3 class="text-[11px] font-semibold text-surface">{{ dialogs.fontSettings }}</h3>
<p class="mt-0.5 text-[10px] leading-relaxed text-muted">
{{
showDownloadedFonts
diff --git a/src/components/MobileHud/MobileUndoRedo.vue b/src/components/MobileHud/MobileUndoRedo.vue
index e66dd10d5..867069c53 100644
--- a/src/components/MobileHud/MobileUndoRedo.vue
+++ b/src/components/MobileHud/MobileUndoRedo.vue
@@ -1,13 +1,16 @@
<script setup lang="ts">
import Tip from '@/components/ui/Tip.vue'
import { useMobileHudContext } from '@/components/MobileHud/context'
+import { useI18n } from '@open-pencil/vue'
+
+const { commands } = useI18n()
const hud = useMobileHudContext()
</script>
<template>
<div class="flex gap-1.5">
- <Tip label="Undo">
+ <Tip :label="commands.undo">
<button
class="flex size-8 cursor-pointer items-center justify-center rounded-full border border-white/10 bg-panel/70 shadow-md backdrop-blur-xl select-none active:bg-hover"
@click="hud.undo"
@@ -15,7 +18,7 @@ const hud = useMobileHudContext()
<icon-lucide-undo-2 class="size-3.5 text-surface" />
</button>
</Tip>
- <Tip label="Redo">
+ <Tip :label="commands.redo">
<button
class="flex size-8 cursor-pointer items-center justify-center rounded-full border border-white/10 bg-panel/70 shadow-md backdrop-blur-xl select-none active:bg-hover"
@click="hud.redo"
diff --git a/src/components/TabBar.vue b/src/components/TabBar.vue
index eca6e2af5..e0c9836df 100644
--- a/src/components/TabBar.vue
+++ b/src/components/TabBar.vue
@@ -4,6 +4,9 @@ import { TabsList, TabsRoot, TabsTrigger } from 'reka-ui'
import Tip from '@/components/ui/Tip.vue'
import { useTabsStore, createTab } from '@/app/tabs'
+import { useI18n } from '@open-pencil/vue'
+
+const { dialogs } = useI18n()
const { tabs, activeTabId, switchTab, closeTab } = useTabsStore()
@@ -43,12 +46,12 @@ function onClose(e: MouseEvent, tabId: string) {
>
<icon-lucide-file class="size-3 shrink-0 opacity-50" />
<span class="min-w-0 flex-1 truncate">{{ tab.name }}</span>
- <Tip :label="`Close ${tab.name}`">
+ <Tip :label="dialogs.closeTab({ name: tab.name })">
<button
data-test-id="tabbar-close"
class="flex size-4 shrink-0 cursor-pointer items-center justify-center rounded opacity-0 transition-opacity group-hover/tab:opacity-100 hover:bg-hover data-[state=active]:opacity-100"
:class="tab.isActive ? 'opacity-100' : ''"
- :aria-label="`Close ${tab.name}`"
+ :aria-label="dialogs.closeTab({ name: tab.name })"
tabindex="-1"
@click="onClose($event, tab.id)"
>
@@ -57,11 +60,11 @@ function onClose(e: MouseEvent, tabId: string) {
</Tip>
</TabsTrigger>
</TabsList>
- <Tip label="New tab">
+ <Tip :label="dialogs.newTab">
<button
data-test-id="tabbar-new"
class="flex size-9 shrink-0 cursor-pointer items-center justify-center text-muted transition-colors hover:text-surface"
- aria-label="New tab"
+ :aria-label="dialogs.newTab"
@click="createTab()"
>
<icon-lucide-plus class="size-3.5" />
diff --git a/src/components/chat/ProviderSettings/ProviderSettings.vue b/src/components/chat/ProviderSettings/ProviderSettings.vue
index a76721f63..0740d6205 100644
--- a/src/components/chat/ProviderSettings/ProviderSettings.vue
+++ b/src/components/chat/ProviderSettings/ProviderSettings.vue
@@ -40,14 +40,16 @@ function onInteractOutside(e: Event) {
</script>
<template>
- <PopoverRoot @update:open="popoverOpen = $event">
- <TooltipRoot :open="popoverOpen ? false : undefined">
+ <TooltipRoot :open="popoverOpen ? false : undefined">
+ <PopoverRoot v-model:open="popoverOpen">
<TooltipTrigger as-child>
- <PopoverTrigger
- data-test-id="provider-settings-trigger"
- class="rounded p-0.5 text-muted hover:bg-hover hover:text-surface"
- >
- <icon-lucide-settings class="size-3" />
+ <PopoverTrigger as-child>
+ <button
+ data-test-id="provider-settings-trigger"
+ class="rounded p-0.5 text-muted hover:bg-hover hover:text-surface"
+ >
+ <icon-lucide-settings class="size-3" />
+ </button>
</PopoverTrigger>
</TooltipTrigger>
<TooltipPortal>
@@ -55,36 +57,36 @@ function onInteractOutside(e: Event) {
{{ dialogs.providerSettings }}
</TooltipContent>
</TooltipPortal>
- </TooltipRoot>
- <PopoverPortal>
- <PopoverContent
- side="top"
- :side-offset="8"
- align="end"
- :collision-padding="16"
- :avoid-collisions="true"
- :class="cls.content"
- @interact-outside="onInteractOutside"
- >
- <div class="flex flex-col gap-2.5">
- <h3 class="text-[11px] font-semibold text-surface">{{ dialogs.aiProvider }}</h3>
- <ProviderSelectField test-id="provider-settings-provider" />
- <MaxTokensSection />
- <StockPhotoKeysSection />
- <CustomEndpointSection />
- <ApiTypeSection />
- <ApiKeySection />
+ <PopoverPortal>
+ <PopoverContent
+ side="top"
+ :side-offset="8"
+ align="end"
+ :collision-padding="16"
+ :avoid-collisions="true"
+ :class="cls.content"
+ @interact-outside="onInteractOutside"
+ >
+ <div class="flex flex-col gap-2.5">
+ <h3 class="text-[11px] font-semibold text-surface">{{ dialogs.aiProvider }}</h3>
+ <ProviderSelectField test-id="provider-settings-provider" />
+ <MaxTokensSection />
+ <StockPhotoKeysSection />
+ <CustomEndpointSection />
+ <ApiTypeSection />
+ <ApiKeySection />
- <PopoverClose
- class="mt-1 w-full rounded bg-accent px-2 py-1 text-center text-[11px] font-medium text-white hover:bg-accent/90"
- data-test-id="provider-settings-done"
- @click="providerSettings.save"
- >
- {{ dialogs.done }}
- </PopoverClose>
- </div>
- </PopoverContent>
- </PopoverPortal>
- </PopoverRoot>
+ <PopoverClose
+ class="mt-1 w-full rounded bg-accent px-2 py-1 text-center text-[11px] font-medium text-white hover:bg-accent/90"
+ data-test-id="provider-settings-done"
+ @click="providerSettings.save"
+ >
+ {{ dialogs.done }}
+ </PopoverClose>
+ </div>
+ </PopoverContent>
+ </PopoverPortal>
+ </PopoverRoot>
+ </TooltipRoot>
</template>
diff --git a/src/components/properties/ColorStyleRow.vue b/src/components/properties/ColorStyleRow.vue
index c6f13dbfa..2b79225de 100644
--- a/src/components/properties/ColorStyleRow.vue
+++ b/src/components/properties/ColorStyleRow.vue
@@ -2,6 +2,7 @@
import ScrubInput from '@/components/ScrubInput.vue'
import BoundVariableButton from '@/components/properties/BoundVariableButton.vue'
import VariablePickerPopover from '@/components/properties/VariablePickerPopover.vue'
+import Tip from '@/components/ui/Tip.vue'
import { useIconButtonUI } from '@/components/ui/icon-button'
import { vTestId, useI18n } from '@open-pencil/vue'
@@ -24,7 +25,8 @@ const {
visibilityTestId,
applyVariableTestId,
unbindTestId,
- variableColor
+ variableColor,
+ removeLabel
} = defineProps<{
item: { opacity: number; visible: boolean }
index: number
@@ -34,6 +36,7 @@ const {
applyVariableTestId?: string
unbindTestId?: string
variableColor?: Color
+ removeLabel: string
}>()
const emit = defineEmits<{
@@ -98,18 +101,22 @@ const { panels, dialogs } = useI18n()
@detach="bindingApi.unbindVariable(activeNodeId, index)"
/>
- <button
- v-test-id="visibilityTestId"
- :data-visible="item.visible ? 'true' : 'false'"
- class="shrink-0 cursor-pointer border-none bg-transparent p-0 text-muted hover:text-surface"
- @click="emit('toggleVisibility')"
- >
- <icon-lucide-eye v-if="item.visible" data-test-id="visibility-icon-on" class="size-3.5" />
- <icon-lucide-eye-off v-else data-test-id="visibility-icon-off" class="size-3.5" />
- </button>
+ <Tip :label="panels.toggleVisibility">
+ <button
+ v-test-id="visibilityTestId"
+ :data-visible="item.visible ? 'true' : 'false'"
+ class="shrink-0 cursor-pointer border-none bg-transparent p-0 text-muted hover:text-surface"
+ @click="emit('toggleVisibility')"
+ >
+ <icon-lucide-eye v-if="item.visible" data-test-id="visibility-icon-on" class="size-3.5" />
+ <icon-lucide-eye-off v-else data-test-id="visibility-icon-off" class="size-3.5" />
+ </button>
+ </Tip>
- <button :class="useIconButtonUI({ ui: { base: 'shrink-0' } }).base" @click="emit('remove')">
- −
- </button>
+ <Tip :label="removeLabel">
+ <button :class="useIconButtonUI({ ui: { base: 'shrink-0' } }).base" @click="emit('remove')">
+ −
+ </button>
+ </Tip>
</div>
</template>
diff --git a/src/components/properties/EffectsSection.vue b/src/components/properties/EffectsSection.vue
index 708b7a9d3..d5413316f 100644
--- a/src/components/properties/EffectsSection.vue
+++ b/src/components/properties/EffectsSection.vue
@@ -2,6 +2,7 @@
import AppSelect from '@/components/ui/AppSelect.vue'
import ColorInput from '@/components/ColorPicker/ColorInput.vue'
import ScrubInput from '@/components/ScrubInput.vue'
+import Tip from '@/components/ui/Tip.vue'
import { useIconButtonUI } from '@/components/ui/icon-button'
import { useSectionUI } from '@/components/ui/section'
import { PropertyListRoot, vTestId, useEffectsControls, useI18n } from '@open-pencil/vue'
@@ -24,13 +25,15 @@ const sectionCls = useSectionUI()
<div data-test-id="effects-section" :class="sectionCls.wrapper">
<div class="flex items-center justify-between">
<label :class="sectionCls.label">{{ panels.effects }}</label>
- <button
- data-test-id="effects-section-add"
- :class="useIconButtonUI().base"
- @click="actions.add(effectsCtx.createDefaultEffect())"
- >
- +
- </button>
+ <Tip :label="panels.addEffect">
+ <button
+ data-test-id="effects-section-add"
+ :class="useIconButtonUI().base"
+ @click="actions.add(effectsCtx.createDefaultEffect())"
+ >
+ +
+ </button>
+ </Tip>
</div>
<p v-if="isMixed" class="text-[11px] text-muted">{{ panels.mixedEffectsHelp }}</p>
@@ -42,19 +45,27 @@ const sectionCls = useSectionUI()
:data-test-index="i"
>
<div class="group flex items-center gap-1.5 py-0.5">
- <button
- v-if="effectsCtx.isShadow(effect.type)"
- class="size-5 shrink-0 cursor-pointer rounded border border-border"
- :style="{ background: colorToCSS(effect.color) }"
- @click="effectsCtx.toggleExpand(i)"
- />
- <button
- v-else
- class="flex size-5 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input"
- @click="effectsCtx.toggleExpand(i)"
+ <Tip
+ :label="
+ effectsCtx.expandedIndex.value === i
+ ? panels.collapseEffectSettings
+ : panels.expandEffectSettings
+ "
>
- <icon-lucide-blend class="size-3 text-muted" />
- </button>
+ <button
+ v-if="effectsCtx.isShadow(effect.type)"
+ class="size-5 shrink-0 cursor-pointer rounded border border-border"
+ :style="{ background: colorToCSS(effect.color) }"
+ @click="effectsCtx.toggleExpand(i)"
+ />
+ <button
+ v-else
+ class="flex size-5 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input"
+ @click="effectsCtx.toggleExpand(i)"
+ >
+ <icon-lucide-blend class="size-3 text-muted" />
+ </button>
+ </Tip>
<AppSelect
:model-value="effect.type"
@@ -64,25 +75,29 @@ const sectionCls = useSectionUI()
"
/>
- <button
- v-test-id="`effect-visibility-${i}`"
- :data-visible="effect.visible ? 'true' : 'false'"
- class="cursor-pointer border-none bg-transparent p-0 text-muted hover:text-surface"
- @click="actions.toggleVisibility(i)"
- >
- <icon-lucide-eye
- v-if="effect.visible"
- data-test-id="visibility-icon-on"
- class="size-3.5"
- />
- <icon-lucide-eye-off v-else data-test-id="visibility-icon-off" class="size-3.5" />
- </button>
- <button
- :class="useIconButtonUI().base"
- @click="effectsCtx.handleRemove(actions.remove, i)"
- >
- −
- </button>
+ <Tip :label="panels.toggleVisibility">
+ <button
+ v-test-id="`effect-visibility-${i}`"
+ :data-visible="effect.visible ? 'true' : 'false'"
+ class="cursor-pointer border-none bg-transparent p-0 text-muted hover:text-surface"
+ @click="actions.toggleVisibility(i)"
+ >
+ <icon-lucide-eye
+ v-if="effect.visible"
+ data-test-id="visibility-icon-on"
+ class="size-3.5"
+ />
+ <icon-lucide-eye-off v-else data-test-id="visibility-icon-off" class="size-3.5" />
+ </button>
+ </Tip>
+ <Tip :label="panels.removeEffect">
+ <button
+ :class="useIconButtonUI().base"
+ @click="effectsCtx.handleRemove(actions.remove, i)"
+ >
+ −
+ </button>
+ </Tip>
</div>
<div class="flex flex-col gap-1.5 py-1.5">
diff --git a/src/components/properties/ExportSection.vue b/src/components/properties/ExportSection.vue
index 4e6442f87..32fbaf7ae 100644
--- a/src/components/properties/ExportSection.vue
+++ b/src/components/properties/ExportSection.vue
@@ -2,6 +2,7 @@
import { ref, computed, watch, onScopeDispose } from 'vue'
import AppSelect from '@/components/ui/AppSelect.vue'
+import Tip from '@/components/ui/Tip.vue'
import { useIconButtonUI } from '@/components/ui/icon-button'
import { useSectionUI } from '@/components/ui/section'
import { useEditorStore } from '@/app/editor/active-store'
@@ -131,9 +132,15 @@ onScopeDispose(() => {
<div data-test-id="export-section" :class="sectionCls.wrapper">
<div class="flex items-center justify-between">
<label :class="sectionCls.label">{{ panels.export }}</label>
- <button data-test-id="export-section-add" :class="useIconButtonUI().base" @click="addSetting">
- +
- </button>
+ <Tip :label="panels.addExport">
+ <button
+ data-test-id="export-section-add"
+ :class="useIconButtonUI().base"
+ @click="addSetting"
+ >
+ +
+ </button>
+ </Tip>
</div>
<div
@@ -154,9 +161,14 @@ onScopeDispose(() => {
:options="FORMAT_OPTIONS"
@update:model-value="updateFormat(i, $event as ExportFormatId)"
/>
- <button :class="useIconButtonUI({ ui: { base: 'shrink-0' } }).base" @click="removeSetting(i)">
- −
- </button>
+ <Tip :label="panels.removeExport">
+ <button
+ :class="useIconButtonUI({ ui: { base: 'shrink-0' } }).base"
+ @click="removeSetting(i)"
+ >
+ −
+ </button>
+ </Tip>
</div>
<button
@@ -169,16 +181,17 @@ onScopeDispose(() => {
{{ panels.export }} {{ activeName }}
</button>
- <button
- v-if="activeSettings.length > 0"
- data-test-id="export-preview-toggle"
- class="mt-1 flex w-full cursor-pointer items-center gap-1 rounded border-none bg-transparent px-0 py-1 text-[11px] text-muted hover:text-surface"
- @click="showPreview = !showPreview"
- >
- <icon-lucide-chevron-down v-if="showPreview" class="size-3" />
- <icon-lucide-chevron-right v-else class="size-3" />
- {{ panels.exportPreview }}
- </button>
+ <Tip v-if="activeSettings.length > 0" :label="panels.toggleExportPreview">
+ <button
+ data-test-id="export-preview-toggle"
+ class="mt-1 flex w-full cursor-pointer items-center gap-1 rounded border-none bg-transparent px-0 py-1 text-[11px] text-muted hover:text-surface"
+ @click="showPreview = !showPreview"
+ >
+ <icon-lucide-chevron-down v-if="showPreview" class="size-3" />
+ <icon-lucide-chevron-right v-else class="size-3" />
+ {{ panels.exportPreview }}
+ </button>
+ </Tip>
<div v-if="showPreview && previewUrl" class="mt-1 overflow-hidden rounded border border-border">
<img
diff --git a/src/components/properties/FillSection.vue b/src/components/properties/FillSection.vue
index 784b365ba..c7c978dc8 100644
--- a/src/components/properties/FillSection.vue
+++ b/src/components/properties/FillSection.vue
@@ -2,6 +2,7 @@
import { PropertyListRoot, useFillControls, useOkHCL, useI18n } from '@open-pencil/vue'
import FillPicker from '@/components/FillPicker.vue'
+import Tip from '@/components/ui/Tip.vue'
import ColorStyleRow from '@/components/properties/ColorStyleRow.vue'
import {
boundVariableSwatchBackground,
@@ -41,13 +42,15 @@ function updateFill(
<div data-test-id="fill-section" :class="sectionCls.wrapper">
<div class="flex items-center justify-between">
<label :class="sectionCls.label">{{ panels.fill }}</label>
- <button
- data-test-id="fill-section-add"
- :class="useIconButtonUI().base"
- @click="actions.add({ ...fillCtx.defaultFill })"
- >
- +
- </button>
+ <Tip :label="panels.addFill">
+ <button
+ data-test-id="fill-section-add"
+ :class="useIconButtonUI().base"
+ @click="actions.add({ ...fillCtx.defaultFill })"
+ >
+ +
+ </button>
+ </Tip>
</div>
<p v-if="isMixed" class="text-[11px] text-muted">{{ panels.mixedFillsHelp }}</p>
<ColorStyleRow
@@ -63,6 +66,7 @@ function updateFill(
unbind-test-id="fill-unbind-variable"
data-test-id="fill-item"
:data-test-index="i"
+ :remove-label="panels.removeFill"
@patch="actions.patch(i, $event)"
@toggle-visibility="actions.toggleVisibility(i)"
@remove="actions.remove(i)"
diff --git a/src/components/properties/StrokeSection.vue b/src/components/properties/StrokeSection.vue
index da23c3db1..9ca94f1bc 100644
--- a/src/components/properties/StrokeSection.vue
+++ b/src/components/properties/StrokeSection.vue
@@ -91,13 +91,15 @@ function setGap(stroke: Stroke | undefined, patch: StrokePatch, value: number) {
<div data-test-id="stroke-section" :class="sectionCls.wrapper">
<div class="flex items-center justify-between">
<label :class="sectionCls.label">{{ panels.stroke }}</label>
- <button
- data-test-id="stroke-section-add"
- :class="useIconButtonUI().base"
- @click="actions.add(strokeCtx.defaultStroke)"
- >
- +
- </button>
+ <Tip :label="panels.addStroke">
+ <button
+ data-test-id="stroke-section-add"
+ :class="useIconButtonUI().base"
+ @click="actions.add(strokeCtx.defaultStroke)"
+ >
+ +
+ </button>
+ </Tip>
</div>
<p v-if="isMixed" class="text-[11px] text-muted">{{ panels.mixedStrokesHelp }}</p>
@@ -115,6 +117,7 @@ function setGap(stroke: Stroke | undefined, patch: StrokePatch, value: number) {
unbind-test-id="stroke-unbind-variable"
data-test-id="stroke-item"
:data-test-index="i"
+ :remove-label="panels.removeStroke"
@patch="actions.patch(i, $event)"
@toggle-visibility="actions.toggleVisibility(i)"
@remove="actions.remove(i)"
@@ -197,27 +200,29 @@ function setGap(stroke: Stroke | undefined, patch: StrokePatch, value: number) {
v-if="!isMixed && (items as unknown[]).length > 0"
class="mt-1.5 flex items-center gap-1.5"
>
- <button
- data-test-id="stroke-dash-toggle"
- :aria-label="panels.strokeDash"
- class="flex h-[26px] shrink-0 cursor-pointer items-center gap-1 rounded border bg-input px-1.5 text-[11px]"
- :class="
- dashState((items as Stroke[])[0]).on
- ? '!border-accent !text-accent'
- : 'border-border text-muted hover:bg-hover hover:text-surface'
- "
- @click="toggleDash((items as Stroke[])[0], actions.patch)"
- >
- <svg
- class="size-3"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- stroke-width="1.5"
+ <Tip :label="panels.strokeDash">
+ <button
+ data-test-id="stroke-dash-toggle"
+ :aria-label="panels.strokeDash"
+ class="flex h-[26px] shrink-0 cursor-pointer items-center gap-1 rounded border bg-input px-1.5 text-[11px]"
+ :class="
+ dashState((items as Stroke[])[0]).on
+ ? '!border-accent !text-accent'
+ : 'border-border text-muted hover:bg-hover hover:text-surface'
+ "
+ @click="toggleDash((items as Stroke[])[0], actions.patch)"
>
- <line x1="1" y1="6" x2="11" y2="6" stroke-dasharray="3 2" />
- </svg>
- </button>
+ <svg
+ class="size-3"
+ viewBox="0 0 12 12"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ >
+ <line x1="1" y1="6" x2="11" y2="6" stroke-dasharray="3 2" />
+ </svg>
+ </button>
+ </Tip>
<template v-if="dashState((items as Stroke[])[0]).on">
<ScrubInput
class="flex-1"
diff --git a/src/components/properties/TypographySection.vue b/src/components/properties/TypographySection.vue
index ff7aa71ad..341e83b60 100644
--- a/src/components/properties/TypographySection.vue
+++ b/src/components/properties/TypographySection.vue
@@ -154,7 +154,7 @@ const fontLoader = { load: loadFont }
<icon-lucide-underline class="size-3.5" />
</button>
</Tip>
- <Tip label="Strikethrough">
+ <Tip :label="menu.strikethrough">
<button
class="flex cursor-pointer items-center justify-center rounded border border-border bg-input px-2 py-1 text-muted hover:bg-hover hover:text-surface data-[state=on]:border-accent data-[state=on]:bg-accent data-[state=on]:text-white"
:data-state="ctx.activeFormatting.value.includes('strikethrough') ? 'on' : 'off'"
diff --git a/src/components/properties/VariablePickerPopover.vue b/src/components/properties/VariablePickerPopover.vue
index 94505c69a..a3cf6fa6b 100644
--- a/src/components/properties/VariablePickerPopover.vue
+++ b/src/components/properties/VariablePickerPopover.vue
@@ -14,7 +14,7 @@ import { computed, nextTick, ref, watch } from 'vue'
import { vTestId } from '@open-pencil/vue'
-import Tip from '@/components/ui/Tip.vue'
+import { useTooltipUI } from '@/components/ui/tooltip'
import type { Variable } from '@open-pencil/core/scene-graph'
@@ -52,10 +52,12 @@ const emit = defineEmits<{
}>()
const open = ref(false)
+const tooltipOpen = ref(false)
const creating = ref(false)
const createName = ref('')
const createInput = ref<HTMLInputElement | null>(null)
const canCreate = computed(() => createName.value.trim().length > 0)
+const tooltipCls = useTooltipUI({ content: 'animate-in zoom-in-95 fade-in' })
watch(open, (value) => {
if (!value) creating.value = false
@@ -80,16 +82,28 @@ function submitCreate() {
<template>
<PopoverRoot v-model:open="open">
- <Tip :label="triggerLabel" :disabled="open">
+ <div class="relative shrink-0">
<PopoverTrigger
v-test-id="triggerTestId"
:aria-label="triggerLabel"
class="shrink-0 cursor-pointer border-none bg-transparent p-0 text-muted hover:text-surface"
@pointerdown.prevent.stop
+ @mouseenter="tooltipOpen = true"
+ @mouseleave="tooltipOpen = false"
+ @focus="tooltipOpen = true"
+ @blur="tooltipOpen = false"
>
<icon-lucide-diamond-plus class="size-3.5" />
</PopoverTrigger>
- </Tip>
+ <div
+ v-if="tooltipOpen && !open"
+ role="tooltip"
+ :class="tooltipCls.content"
+ class="pointer-events-none absolute right-0 bottom-full z-50 mb-1 whitespace-nowrap"
+ >
+ {{ triggerLabel }}
+ </div>
+ </div>
<PopoverPortal>
<PopoverContent
side="left"
diff --git a/src/views/EditorView.vue b/src/views/EditorView.vue
index 976dc2ac7..8c4312299 100644
--- a/src/views/EditorView.vue
+++ b/src/views/EditorView.vue
@@ -5,7 +5,7 @@ import { useRoute } from 'vue-router'
import { useHead } from '@unhead/vue'
import { SplitterGroup, SplitterPanel, SplitterResizeHandle } from 'reka-ui'
-import { useViewportKind, formatShortcut } from '@open-pencil/vue'
+import { useViewportKind, formatShortcut, useI18n } from '@open-pencil/vue'
import { useKeyboard } from '@/app/shell/keyboard/use'
import { loadEditorLayout, saveEditorLayout } from '@/app/shell/layout-storage'
import { openFileFromPath, useMenu } from '@/app/shell/menu/use'
@@ -36,6 +36,7 @@ const showChrome = !('no-chrome' in params)
const createdInitialTab = tabCount() === 0
const firstTab = createdInitialTab ? createTab() : (activeTab.value ?? createTab())
const store = useEditorStore()
+const { dialogs } = useI18n()
const { isMobile } = useViewportKind()
if (createdInitialTab && route.meta.demo && !('test' in params)) {
@@ -193,7 +194,11 @@ onUnmounted(() => {
<span data-test-id="editor-document-name" class="text-xs text-surface">{{
store.state.documentName
}}</span>
- <Tip :label="`Show UI (${formatShortcut(appMenuShortcut('toggle-ui'))})`">
+ <Tip
+ :label="
+ dialogs.showUI({ shortcut: formatShortcut(appMenuShortcut('toggle-ui')) ?? '' })
+ "
+ >
<button
data-test-id="editor-show-ui"
class="ml-1 flex size-6 cursor-pointer items-center justify-center rounded text-muted transition-colors hover:bg-hover hover:text-surface"
diff --git a/tests/e2e/ui/tooltips.webkit.spec.ts b/tests/e2e/ui/tooltips.webkit.spec.ts
new file mode 100644
index 000000000..2928311b9
--- /dev/null
+++ b/tests/e2e/ui/tooltips.webkit.spec.ts
@@ -0,0 +1,42 @@
+import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
+
+const editor = useEditorSetup()
+
+test.skip(({ browserName }) => browserName !== 'webkit', 'WebKit tooltip smoke test')
+
+test('tooltips stay hoverable and clickable in WebKit', async () => {
+ await editor.canvas.clearCanvas()
+ await editor.canvas.drawRect(180, 180, 80, 80)
+
+ const strokeItems = editor.page.getByTestId('stroke-item')
+ const strokeCount = await strokeItems.count()
+ const strokeAdd = editor.page.getByTestId('stroke-section-add')
+ await strokeAdd.hover()
+ await expect(
+ editor.page.locator('[role=tooltip]').filter({ hasText: 'Add stroke' })
+ ).toBeVisible()
+ await strokeAdd.click()
+ await expect(strokeItems).toHaveCount(strokeCount + 1)
+
+ const effectAdd = editor.page.getByTestId('effects-section-add')
+ await effectAdd.hover()
+ await expect(
+ editor.page.locator('[role=tooltip]').filter({ hasText: 'Add effect' })
+ ).toBeVisible()
+ await effectAdd.click()
+ await expect(editor.page.getByTestId('effect-item')).toHaveCount(1)
+
+ await editor.page.keyboard.press('Meta+J')
+ await expect(editor.page.getByTestId('provider-setup')).toBeVisible()
+ await editor.page.getByTestId('api-key-input').fill('test-key')
+ await editor.page.getByTestId('api-key-save').click()
+ await expect(editor.page.getByTestId('chat-input')).toBeVisible()
+
+ const settings = editor.page.getByTestId('provider-settings-trigger')
+ await settings.hover()
+ await expect(
+ editor.page.locator('[role=tooltip]').filter({ hasText: 'Provider settings' })
+ ).toBeVisible()
+ await settings.click()
+ await expect(editor.page.getByTestId('provider-settings-provider')).toBeVisible()
+})