@baklavue/mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/data/component-categories.d.ts +7 -0
- package/dist/data/component-categories.js +48 -0
- package/dist/data/loaders.d.ts +22 -0
- package/dist/data/loaders.js +346 -0
- package/dist/docs/components/accordion.md +601 -0
- package/dist/docs/components/alert.md +233 -0
- package/dist/docs/components/badge.md +100 -0
- package/dist/docs/components/banner.md +231 -0
- package/dist/docs/components/button.md +324 -0
- package/dist/docs/components/checkbox.md +343 -0
- package/dist/docs/components/chip.md +199 -0
- package/dist/docs/components/datepicker.md +243 -0
- package/dist/docs/components/dialog.md +224 -0
- package/dist/docs/components/drawer.md +188 -0
- package/dist/docs/components/dropdown.md +291 -0
- package/dist/docs/components/file-upload.md +248 -0
- package/dist/docs/components/icon.md +142 -0
- package/dist/docs/components/image.md +161 -0
- package/dist/docs/components/index.md +151 -0
- package/dist/docs/components/input.md +407 -0
- package/dist/docs/components/link.md +249 -0
- package/dist/docs/components/notification.md +179 -0
- package/dist/docs/components/pagination.md +168 -0
- package/dist/docs/components/radio.md +221 -0
- package/dist/docs/components/scroll-to-top.md +90 -0
- package/dist/docs/components/select.md +239 -0
- package/dist/docs/components/skeleton.md +79 -0
- package/dist/docs/components/spinner.md +93 -0
- package/dist/docs/components/split-button.md +165 -0
- package/dist/docs/components/stepper.md +337 -0
- package/dist/docs/components/switch.md +144 -0
- package/dist/docs/components/tab.md +140 -0
- package/dist/docs/components/table.md +362 -0
- package/dist/docs/components/tag.md +243 -0
- package/dist/docs/components/textarea.md +190 -0
- package/dist/docs/components/tooltip.md +155 -0
- package/dist/docs/composables/alert.md +87 -0
- package/dist/docs/composables/asyncState.md +74 -0
- package/dist/docs/composables/base64.md +72 -0
- package/dist/docs/composables/breakpoints.md +129 -0
- package/dist/docs/composables/clipboard.md +108 -0
- package/dist/docs/composables/colorScheme.md +110 -0
- package/dist/docs/composables/confirmDialog.md +105 -0
- package/dist/docs/composables/containerScroll.md +89 -0
- package/dist/docs/composables/cookie.md +137 -0
- package/dist/docs/composables/debounce.md +69 -0
- package/dist/docs/composables/disclosure.md +69 -0
- package/dist/docs/composables/elementSize.md +84 -0
- package/dist/docs/composables/fetch.md +257 -0
- package/dist/docs/composables/fieldArray.md +104 -0
- package/dist/docs/composables/file.md +343 -0
- package/dist/docs/composables/focusTrap.md +87 -0
- package/dist/docs/composables/formPersistence.md +69 -0
- package/dist/docs/composables/formState.md +71 -0
- package/dist/docs/composables/formValidation.md +355 -0
- package/dist/docs/composables/format.md +107 -0
- package/dist/docs/composables/id.md +54 -0
- package/dist/docs/composables/index.md +112 -0
- package/dist/docs/composables/infiniteQuery.md +104 -0
- package/dist/docs/composables/intersectionObserver.md +64 -0
- package/dist/docs/composables/lazyQuery.md +68 -0
- package/dist/docs/composables/loading.md +91 -0
- package/dist/docs/composables/mutation.md +83 -0
- package/dist/docs/composables/notification.md +169 -0
- package/dist/docs/composables/pagination.md +109 -0
- package/dist/docs/composables/polling.md +76 -0
- package/dist/docs/composables/previous.md +58 -0
- package/dist/docs/composables/query.md +248 -0
- package/dist/docs/composables/raf.md +78 -0
- package/dist/docs/composables/scrollLock.md +46 -0
- package/dist/docs/composables/scrollToError.md +291 -0
- package/dist/docs/composables/scrollVisibility.md +60 -0
- package/dist/docs/composables/share.md +78 -0
- package/dist/docs/composables/slug.md +58 -0
- package/dist/docs/composables/stepper.md +117 -0
- package/dist/docs/composables/stepperForm.md +74 -0
- package/dist/docs/composables/sticky.md +91 -0
- package/dist/docs/composables/storage.md +193 -0
- package/dist/docs/composables/theme.md +252 -0
- package/dist/docs/composables/themePreset.md +62 -0
- package/dist/docs/composables/throttle.md +76 -0
- package/dist/docs/composables/timer.md +78 -0
- package/dist/docs/composables/toggle.md +55 -0
- package/dist/docs/guide/contributing.md +364 -0
- package/dist/docs/guide/design-tokens.md +29 -0
- package/dist/docs/guide/getting-started.md +181 -0
- package/dist/docs/guide/installation.md +287 -0
- package/dist/docs/guide/localization.md +132 -0
- package/dist/docs/guide/mcp.md +141 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +177 -0
- package/package.json +48 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
This guide covers installation of BaklaVue in various setups: new projects, existing Vue 3 apps, Vite, Nuxt, and Vue CLI. It also includes configuration requirements and troubleshooting.
|
|
4
|
+
|
|
5
|
+
## Package Installation
|
|
6
|
+
|
|
7
|
+
### Core Packages
|
|
8
|
+
|
|
9
|
+
BaklaVue is split into two packages:
|
|
10
|
+
|
|
11
|
+
| Package | Description |
|
|
12
|
+
| ------- | ----------- |
|
|
13
|
+
| `@baklavue/ui` | Vue 3 components wrapping Baklava web components |
|
|
14
|
+
| `@baklavue/composables` | Vue composables (theme, notifications, CSV, scroll-to-error, etc.) |
|
|
15
|
+
|
|
16
|
+
Install both:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @baklavue/ui @baklavue/composables
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or with other package managers:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @baklavue/ui @baklavue/composables
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm add @baklavue/ui @baklavue/composables
|
|
30
|
+
|
|
31
|
+
# bun
|
|
32
|
+
bun add @baklavue/ui @baklavue/composables
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Peer Dependencies
|
|
36
|
+
|
|
37
|
+
BaklaVue expects these peer dependencies in your project:
|
|
38
|
+
|
|
39
|
+
| Dependency | Version | Notes |
|
|
40
|
+
| ---------- | ------- | ----- |
|
|
41
|
+
| `vue` | ^3.5.21 | Required for components |
|
|
42
|
+
| `typescript` | ^5.9.2 | Recommended for type support |
|
|
43
|
+
|
|
44
|
+
These are usually already present in a Vue 3 project. If not:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install vue@^3.5.21 typescript@^5.9.2
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Transitive Dependencies
|
|
51
|
+
|
|
52
|
+
BaklaVue brings in:
|
|
53
|
+
|
|
54
|
+
- `@trendyol/baklava` ^3.4.2 — Core design system
|
|
55
|
+
- `@trendyol/baklava-icons` ^1.1.0 — Icons (used by components)
|
|
56
|
+
- `papaparse` — Used by `useFile` for CSV/TSV (in `@baklavue/composables` only)
|
|
57
|
+
- `xlsx` — Used by `useFile` for Excel (in `@baklavue/composables` only)
|
|
58
|
+
|
|
59
|
+
You do not need to install these manually.
|
|
60
|
+
|
|
61
|
+
## Framework Integration
|
|
62
|
+
|
|
63
|
+
### Vite + Vue 3
|
|
64
|
+
|
|
65
|
+
BaklaVue works out of the box with Vite. Create a new project and add BaklaVue:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm create vue@latest my-app
|
|
69
|
+
cd my-app
|
|
70
|
+
npm install @baklavue/ui @baklavue/composables
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Required Vite config:** BaklaVue components render Baklava web components (`bl-*` custom elements). Vue must treat these as custom elements, not Vue components. Add this to `vite.config.ts`:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
// vite.config.ts
|
|
77
|
+
import { defineConfig } from "vite";
|
|
78
|
+
import vue from "@vitejs/plugin-vue";
|
|
79
|
+
|
|
80
|
+
export default defineConfig({
|
|
81
|
+
plugins: [
|
|
82
|
+
vue({
|
|
83
|
+
template: {
|
|
84
|
+
compilerOptions: {
|
|
85
|
+
isCustomElement: (tag) => tag.startsWith("bl-"),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Without this, Vue may warn: `Failed to resolve component: bl-*`.
|
|
94
|
+
|
|
95
|
+
### Nuxt 3
|
|
96
|
+
|
|
97
|
+
For Nuxt 3:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx nuxi@latest init my-app
|
|
101
|
+
cd my-app
|
|
102
|
+
npm install @baklavue/ui @baklavue/composables
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Configure Nuxt to treat `bl-*` as custom elements. Create or edit `nuxt.config.ts`:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// nuxt.config.ts
|
|
109
|
+
export default defineNuxtConfig({
|
|
110
|
+
vue: {
|
|
111
|
+
compilerOptions: {
|
|
112
|
+
isCustomElement: (tag) => tag.startsWith("bl-"),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Optional:** For tree-shaking and a smaller bundle, you can auto-import components via a Nuxt module or `components/` directory. The default approach is to import components explicitly where needed.
|
|
119
|
+
|
|
120
|
+
### Vue CLI
|
|
121
|
+
|
|
122
|
+
For Vue CLI projects:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
vue create my-app
|
|
126
|
+
cd my-app
|
|
127
|
+
npm install @baklavue/ui @baklavue/composables
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Add custom element configuration in `vue.config.js`:
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
// vue.config.js
|
|
134
|
+
const { defineConfig } = require("@vue/cli-service");
|
|
135
|
+
|
|
136
|
+
module.exports = defineConfig({
|
|
137
|
+
chainWebpack: (config) => {
|
|
138
|
+
config.module
|
|
139
|
+
.rule("vue")
|
|
140
|
+
.use("vue-loader")
|
|
141
|
+
.tap((options) => {
|
|
142
|
+
options.compilerOptions = {
|
|
143
|
+
...options.compilerOptions,
|
|
144
|
+
isCustomElement: (tag) => tag.startsWith("bl-"),
|
|
145
|
+
};
|
|
146
|
+
return options;
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Vite Configuration (Detailed)
|
|
153
|
+
|
|
154
|
+
### Custom Element Detection
|
|
155
|
+
|
|
156
|
+
Baklava components are implemented as web components with tags like `bl-button`, `bl-input`, `bl-dialog`. Vue’s template compiler must not resolve these as Vue components. The `isCustomElement` option tells Vue to leave them as native custom elements:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
vue({
|
|
160
|
+
template: {
|
|
161
|
+
compilerOptions: {
|
|
162
|
+
isCustomElement: (tag) => tag.startsWith("bl-"),
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Path Aliases (Optional)
|
|
169
|
+
|
|
170
|
+
If you use `@` for `src`:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// vite.config.ts
|
|
174
|
+
import { resolve } from "path";
|
|
175
|
+
|
|
176
|
+
export default defineConfig({
|
|
177
|
+
resolve: {
|
|
178
|
+
alias: {
|
|
179
|
+
"@": resolve(__dirname, "src"),
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
BaklaVue does not require path aliases; imports from `@baklavue/ui` and `@baklavue/composables` work as-is.
|
|
186
|
+
|
|
187
|
+
## TypeScript Configuration
|
|
188
|
+
|
|
189
|
+
For TypeScript, ensure your `tsconfig.json` supports module resolution and includes Vue types:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"compilerOptions": {
|
|
194
|
+
"moduleResolution": "bundler",
|
|
195
|
+
"types": ["vite/client"],
|
|
196
|
+
"strict": true
|
|
197
|
+
},
|
|
198
|
+
"include": ["src/**/*.ts", "src/**/*.vue"]
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
BaklaVue types are distributed with the packages; no extra `@types` packages are needed.
|
|
203
|
+
|
|
204
|
+
## Importing Styles
|
|
205
|
+
|
|
206
|
+
BaklaVue components load Baklava styles automatically when they mount. In typical usage you do not need to import anything manually.
|
|
207
|
+
|
|
208
|
+
If you prefer to load styles yourself (e.g. in the entry file):
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// main.ts or main.js
|
|
212
|
+
import "@trendyol/baklava/dist/themes/default.css";
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
When using the CDN (via `loadBaklavaResources`), styles are injected from jsDelivr; no manual import is needed.
|
|
216
|
+
|
|
217
|
+
## Verify Installation
|
|
218
|
+
|
|
219
|
+
Create a simple test component:
|
|
220
|
+
|
|
221
|
+
```vue
|
|
222
|
+
<template>
|
|
223
|
+
<BvButton variant="primary">Test Button</BvButton>
|
|
224
|
+
</template>
|
|
225
|
+
|
|
226
|
+
<script setup>
|
|
227
|
+
import { BvButton } from "@baklavue/ui";
|
|
228
|
+
</script>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
If the button renders with correct styling, installation is working.
|
|
232
|
+
|
|
233
|
+
## Troubleshooting
|
|
234
|
+
|
|
235
|
+
### "Failed to resolve component: bl-*" warning
|
|
236
|
+
|
|
237
|
+
**Cause:** Vue is trying to resolve `bl-*` tags as Vue components.
|
|
238
|
+
|
|
239
|
+
**Fix:** Add `isCustomElement` so Vue treats them as custom elements. See [Vite Configuration](#vite-configuration-detailed) above.
|
|
240
|
+
|
|
241
|
+
### Components not rendering or look unstyled
|
|
242
|
+
|
|
243
|
+
**Possible causes:**
|
|
244
|
+
|
|
245
|
+
1. **Baklava CSS not loaded** — Components load it on mount. If you render before components mount, styles may be missing. Ensure at least one BaklaVue component is mounted, or call `loadBaklavaResources()` manually.
|
|
246
|
+
2. **Wrong Vue version** — BaklaVue requires Vue 3.0+. Check with `npm list vue`.
|
|
247
|
+
3. **Incorrect imports** — Use `BvButton`, not `Button`, and import from `@baklavue/ui`.
|
|
248
|
+
|
|
249
|
+
### TypeScript errors
|
|
250
|
+
|
|
251
|
+
1. **Module not found** — Ensure `@baklavue/ui` and `@baklavue/composables` are installed.
|
|
252
|
+
2. **Type errors** — Use TypeScript 5.9.2+. Run `npm list typescript`.
|
|
253
|
+
3. **Vue types** — If using Vite, include `"types": ["vite/client"]` in `tsconfig.json`.
|
|
254
|
+
|
|
255
|
+
### Build errors
|
|
256
|
+
|
|
257
|
+
1. **Peer dependency warnings** — Install `vue` and `typescript` at the versions above.
|
|
258
|
+
2. **Version conflicts** — Try a clean install:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
rm -rf node_modules
|
|
262
|
+
rm package-lock.json # or bun.lock, pnpm-lock.yaml
|
|
263
|
+
npm install
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
3. **Custom element errors** — Confirm `isCustomElement` is configured for your bundler.
|
|
267
|
+
|
|
268
|
+
### SSR (Nuxt, etc.)
|
|
269
|
+
|
|
270
|
+
BaklaVue components rely on Baklava web components, which are client-side. For SSR:
|
|
271
|
+
|
|
272
|
+
- Use `<ClientOnly>` (or equivalent) around BaklaVue components that must not run on the server.
|
|
273
|
+
- Or defer mounting until the client; the documentation site uses this approach.
|
|
274
|
+
|
|
275
|
+
## Version Compatibility
|
|
276
|
+
|
|
277
|
+
| BaklaVue | Vue | Baklava | Node |
|
|
278
|
+
| -------- | --- | ------- | ---- |
|
|
279
|
+
| 1.x | ^3.5.21 | ^3.4.2 | 18+ |
|
|
280
|
+
|
|
281
|
+
See the [GitHub releases](https://github.com/erbilnas/baklavue/releases) for specific version notes.
|
|
282
|
+
|
|
283
|
+
## Next Steps
|
|
284
|
+
|
|
285
|
+
- [Getting Started](/guide/getting-started) — First steps with BaklaVue
|
|
286
|
+
- [Components](/components/) — Component catalog
|
|
287
|
+
- [API Reference](/api/) — Full API docs
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Localization
|
|
2
|
+
|
|
3
|
+
Baklava (the underlying design system) has built-in localization support via [lit-localize](https://lit.dev/docs/localization/). It reads the `lang` attribute from the `<html>` element and uses a mutation observer to dynamically update localized components when the language changes. This includes components like Datepicker (month names, weekday labels) and Pagination (Previous/Next labels).
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Initialize localization by calling `init()` from Baklava's localization module in your app entry point (e.g., `main.ts` or `App.vue`):
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { init } from "@trendyol/baklava/dist/localization.js";
|
|
11
|
+
|
|
12
|
+
// Call before or when your app loads
|
|
13
|
+
init();
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
If you load Baklava via CDN (as BaklaVue does by default), ensure the localization init runs after Baklava scripts have loaded. For example:
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup>
|
|
20
|
+
import { onMounted } from "vue";
|
|
21
|
+
import { loadBaklavaResources } from "@baklavue/ui";
|
|
22
|
+
|
|
23
|
+
onMounted(async () => {
|
|
24
|
+
loadBaklavaResources();
|
|
25
|
+
// Wait for Baklava to load, then init localization
|
|
26
|
+
const { init } = await import(
|
|
27
|
+
"@trendyol/baklava/dist/localization.js"
|
|
28
|
+
);
|
|
29
|
+
await init();
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Setting the Locale
|
|
35
|
+
|
|
36
|
+
Baklava reads the `lang` attribute from the root `<html>` element. To change the locale:
|
|
37
|
+
|
|
38
|
+
**Option 1: Set in your HTML**
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<html lang="tr">
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Option 2: Set programmatically**
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
document.documentElement.lang = "tr";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
When `lang` changes, Baklava's mutation observer automatically updates all localized components. No page reload is required.
|
|
51
|
+
|
|
52
|
+
## Supported Locales
|
|
53
|
+
|
|
54
|
+
Baklava supports the following locales (see [Baklava translations](https://github.com/Trendyol/baklava/tree/next/translations)):
|
|
55
|
+
|
|
56
|
+
| Code | Language |
|
|
57
|
+
| ---- | --------- |
|
|
58
|
+
| `en` | English |
|
|
59
|
+
| `tr` | Turkish |
|
|
60
|
+
| `ar` | Arabic |
|
|
61
|
+
| `ro` | Romanian |
|
|
62
|
+
|
|
63
|
+
If no `lang` attribute is set, Baklava defaults to English.
|
|
64
|
+
|
|
65
|
+
## Live Example
|
|
66
|
+
|
|
67
|
+
Use the locale switcher below to see the Datepicker and Pagination update in real time. Notice how month names and weekday labels change when you switch from English to Turkish or Arabic.
|
|
68
|
+
|
|
69
|
+
<div class="component-demo">
|
|
70
|
+
|
|
71
|
+
<LocalizationDemo />
|
|
72
|
+
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<template>
|
|
77
|
+
<div>
|
|
78
|
+
<div class="locale-buttons">
|
|
79
|
+
<BvButton
|
|
80
|
+
v-for="loc in locales"
|
|
81
|
+
:key="loc.code"
|
|
82
|
+
:variant="currentLocale === loc.code ? 'primary' : 'secondary'"
|
|
83
|
+
size="small"
|
|
84
|
+
@click="setLocale(loc.code)"
|
|
85
|
+
>
|
|
86
|
+
{{ loc.label }}
|
|
87
|
+
</BvButton>
|
|
88
|
+
</div>
|
|
89
|
+
<BvDatepicker v-model="date" label="Select date" placeholder="Pick a date" />
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup>
|
|
94
|
+
import { ref } from "vue";
|
|
95
|
+
import { BvButton, BvDatepicker } from "@baklavue/ui";
|
|
96
|
+
|
|
97
|
+
const date = ref("");
|
|
98
|
+
const currentLocale = ref("en");
|
|
99
|
+
|
|
100
|
+
const locales = [
|
|
101
|
+
{ code: "en", label: "English" },
|
|
102
|
+
{ code: "tr", label: "Türkçe" },
|
|
103
|
+
{ code: "ar", label: "العربية" },
|
|
104
|
+
{ code: "ro", label: "Română" },
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
function setLocale(code) {
|
|
108
|
+
document.documentElement.lang = code;
|
|
109
|
+
currentLocale.value = code;
|
|
110
|
+
// For Arabic, consider also: document.documentElement.dir = "rtl";
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## RTL Support
|
|
116
|
+
|
|
117
|
+
For Arabic (`ar`) and other right-to-left languages, set the `dir` attribute on the document for proper layout:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
document.documentElement.lang = "ar";
|
|
121
|
+
document.documentElement.dir = "rtl";
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Baklava has [built-in RTL support](https://baklava.design) using CSS logical properties. When switching back to LTR languages, reset `dir`:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
document.documentElement.dir = "ltr";
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Contributing Translations
|
|
131
|
+
|
|
132
|
+
To add new translations or improve existing ones, submit a pull request to the [Baklava repository](https://github.com/Trendyol/baklava). Translations live in the [translations](https://github.com/Trendyol/baklava/tree/next/translations) folder.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# MCP (Model Context Protocol) Support
|
|
2
|
+
|
|
3
|
+
Baklavue provides an MCP server that lets AI assistants (Cursor, Claude, Windsurf, etc.) access component documentation, composables, and usage examples directly. This helps AI tools generate accurate Baklavue code when you're building Vue applications.
|
|
4
|
+
|
|
5
|
+
## What is MCP?
|
|
6
|
+
|
|
7
|
+
[Model Context Protocol (MCP)](https://modelcontextprotocol.io) is a standardized protocol that enables AI assistants to access external data and tools. The Baklavue MCP server exposes structured data about components, composables, and documentation so AI tools can assist with Baklavue development.
|
|
8
|
+
|
|
9
|
+
## Available Tools
|
|
10
|
+
|
|
11
|
+
The Baklavue MCP server provides these tools:
|
|
12
|
+
|
|
13
|
+
| Tool | Description |
|
|
14
|
+
| ---- | ----------- |
|
|
15
|
+
| `list_components` | List all Bv* components with category and basic info |
|
|
16
|
+
| `get_component` | Full component docs: props, events, slots, types, usage examples |
|
|
17
|
+
| `get_component_metadata` | Lightweight: props, events, slots only |
|
|
18
|
+
| `list_composables` | List composables (useNotification, useTheme, etc.) |
|
|
19
|
+
| `get_composable` | Composable API and usage documentation |
|
|
20
|
+
| `search_components_by_category` | Filter by category (form, feedback, layout, etc.) |
|
|
21
|
+
| `get_documentation_page` | Get guide pages (installation, getting-started, design-tokens) |
|
|
22
|
+
| `list_documentation_pages` | List all available guide pages |
|
|
23
|
+
|
|
24
|
+
## Low Budget: Run Locally (No Hosted Service)
|
|
25
|
+
|
|
26
|
+
The Baklavue MCP server runs **entirely on your machine**—no cloud service, no API keys, no monthly fees. Your AI client (Cursor, Claude Desktop, etc.) spawns the server process locally and talks to it over stdin/stdout. This is the intended and free way to use it.
|
|
27
|
+
|
|
28
|
+
**What you need:**
|
|
29
|
+
- Bun or Node.js installed
|
|
30
|
+
- Baklavue repo cloned locally, or `@baklavue/mcp` as a dependency
|
|
31
|
+
|
|
32
|
+
**How it works:** When you open a project, your AI client runs `bun run mcp` (or `npx @baklavue/mcp`) and keeps that process alive. All data stays on your machine. No external servers are involved.
|
|
33
|
+
|
|
34
|
+
**Quick start (local only):**
|
|
35
|
+
|
|
36
|
+
1. Clone Baklavue or add `@baklavue/mcp` to your project.
|
|
37
|
+
2. Add the MCP config to `.cursor/mcp.json` (see [Cursor setup](#cursor) below).
|
|
38
|
+
3. Restart your AI client. The server runs on your machine when needed.
|
|
39
|
+
|
|
40
|
+
**For teams:** Each developer runs the server locally from their own clone or from the published package. There is no central MCP host—everyone uses their own local process.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Setup
|
|
45
|
+
|
|
46
|
+
### Cursor
|
|
47
|
+
|
|
48
|
+
1. The Baklavue repo includes a project-level MCP config at `.cursor/mcp.json`
|
|
49
|
+
2. If you're using Baklavue in your own project, add to your `.cursor/mcp.json`:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"Baklavue": {
|
|
55
|
+
"command": "bun",
|
|
56
|
+
"args": ["run", "mcp"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or when running from the Baklavue repo:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"Baklavue": {
|
|
68
|
+
"command": "bun",
|
|
69
|
+
"args": ["run", "--cwd", "packages/mcp", "start"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
3. Restart Cursor to load the MCP server
|
|
76
|
+
|
|
77
|
+
### Claude Desktop
|
|
78
|
+
|
|
79
|
+
Add to your Claude config (`claude_desktop_config.json`):
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"baklavue": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["@baklavue/mcp"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Windsurf
|
|
93
|
+
|
|
94
|
+
Add to your MCP config:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"Baklavue": {
|
|
100
|
+
"type": "stdio",
|
|
101
|
+
"command": "bun",
|
|
102
|
+
"args": ["run", "--cwd", "/path/to/baklavue", "mcp"]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Usage Examples
|
|
109
|
+
|
|
110
|
+
Once configured, you can ask your AI assistant:
|
|
111
|
+
|
|
112
|
+
- "List all Baklavue components"
|
|
113
|
+
- "Get BvButton component documentation"
|
|
114
|
+
- "What props does BvInput accept?"
|
|
115
|
+
- "Find form-related components"
|
|
116
|
+
- "Show me useNotification composable usage"
|
|
117
|
+
- "Get installation guide"
|
|
118
|
+
|
|
119
|
+
The AI will use the MCP server to fetch structured data and provide accurate Baklavue code and guidance.
|
|
120
|
+
|
|
121
|
+
## Running Locally
|
|
122
|
+
|
|
123
|
+
The MCP server communicates over stdio and is designed to be spawned by your AI client. You can also run it manually for testing:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# From repo root
|
|
127
|
+
bun run mcp
|
|
128
|
+
|
|
129
|
+
# Or from packages/mcp
|
|
130
|
+
cd packages/mcp && bun run start
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
No HTTP server or port is required—everything runs over stdin/stdout on your machine. See [Low Budget: Run Locally](#low-budget-run-locally-no-hosted-service) for the full setup.
|
|
134
|
+
|
|
135
|
+
## Package
|
|
136
|
+
|
|
137
|
+
The MCP server lives in `packages/mcp`. When published, it will be available as `@baklavue/mcp`:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npx @baklavue/mcp
|
|
141
|
+
```
|
package/dist/index.d.ts
ADDED