Skip to content

Commit d73f268

Browse files
authored
Merge pull request #140 from vuejs-translations/api/types-custom-renderer
Api/types custom renderer
2 parents f8043fa + 9235e99 commit d73f268

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed

.vitepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,15 @@ export const sidebar: ThemeConfig['sidebar'] = {
418418
items: [
419419
{ text: 'مواصفات الصيغة', link: '/api/sfc-spec' },
420420
{ text: '<script setup>', link: '/api/sfc-script-setup' },
421-
{ text: 'CSSميزات ال', link: '/api/sfc-css-features' }
421+
{ text: 'ميزات الـCSS', link: '/api/sfc-css-features' }
422422
]
423423
},
424424
{
425425
text: 'الواجهة البرمجية المتقدمة',
426426
items: [
427427
{ text: 'دالة التصيير', link: '/api/render-function' },
428428
{ text: 'التصيير من الخادم', link: '/api/ssr' },
429-
{ text: 'TypeScriptأدوات النوع ل', link: '/api/utility-types' },
429+
{ text: 'الأنواع المساعدة (Typescript)', link: '/api/utility-types' },
430430
{ text: 'مصير مخصص', link: '/api/custom-renderer' }
431431
]
432432
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"editor.formatOnSave": false
2+
"editor.formatOnSave": false,
33
}

src/api/custom-renderer.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Custom Renderer API {#custom-renderer-api}
1+
# الواجهة البرمجية للمصير المخصص {#custom-renderer-api}
22

3-
## createRenderer() {#createrenderer}
3+
## ()createRenderer {#createrenderer}
44

5-
Creates a custom renderer. By providing platform-specific node creation and manipulation APIs, you can leverage Vue's core runtime to target non-DOM environments.
5+
تنشئ المصير المخصص. من خلال توفير منصة لإنشاء العقد والتلاعب بالـواجهة البرمجية، يمكنك الاستفادة من وحدة التشغيل الأساسية لـ Vue لاستهداف بيئات غير DOM.
66

7-
- **Type**
7+
- **النوع**
88

99
```ts
1010
function createRenderer<HostNode, HostElement>(
@@ -48,7 +48,7 @@ Creates a custom renderer. By providing platform-specific node creation and mani
4848
parentNode(node: HostNode): HostElement | null
4949
nextSibling(node: HostNode): HostNode | null
5050

51-
// optional, DOM-specific
51+
// اختيارية، خاصة بالـ DOM
5252
querySelector?(selector: string): HostElement | null
5353
setScopeId?(el: HostElement, id: string): void
5454
cloneNode?(node: HostNode): HostNode
@@ -61,7 +61,7 @@ Creates a custom renderer. By providing platform-specific node creation and mani
6161
}
6262
```
6363

64-
- **Example**
64+
- **مثال**
6565

6666
```js
6767
import { createRenderer } from '@vue/runtime-core'
@@ -74,12 +74,12 @@ Creates a custom renderer. By providing platform-specific node creation and mani
7474
// ...
7575
})
7676

77-
// `render` is the low-level API
78-
// `createApp` returns an app instance
77+
// `render` هي واجهة برمجية منخفضة المستوى
78+
// `createApp` تعيد نسخة تطبيق
7979
export { render, createApp }
8080

81-
// re-export Vue core APIs
81+
// إعادة تصدير الواجهة البرمجية للنواة الخاصة بـ Vue
8282
export * from '@vue/runtime-core'
8383
```
8484

85-
Vue's own `@vue/runtime-dom` is [implemented using the same API](https://github.com/vuejs/core/blob/main/packages/runtime-dom/src/index.ts). For a simpler implementation, check out [`@vue/runtime-test`](https://github.com/vuejs/core/blob/main/packages/runtime-test/src/index.ts) which is a private package for Vue's own unit testing.
85+
`vue/runtime-dom@` الخاص بـ Vue [مُنفذ باستخدام نفس الواجهة البرمجية](https://github.com/vuejs/core/blob/main/packages/runtime-dom/src/index.ts). للحصول على شيفرة تنفيذية أبسط، تحقق من [`vue/runtime-test@`](https://github.com/vuejs/core/blob/main/packages/runtime-test/src/index.ts) وهو حزمة خاصة لاختبار وحدات Vue.

src/api/utility-types.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Utility Types {#utility-types}
1+
# الأنواع المساعدة (Typescript) {#utility-types}
22

3-
:::info
4-
This page only lists a few commonly used utility types that may need explanation for their usage. For a full list of exported types, consult the [source code](https://github.com/vuejs/core/blob/main/packages/runtime-core/src/index.ts#L131).
3+
:::info
4+
هذه الصفحة تعرض فقط بعض الأنواع المساعدة المستخدمة بشكل شائع والتي قد تحتاج إلى شرح لاستخدامها. للحصول على قائمة كاملة بالأنواع المصدرة، استشر [الشيفرة المصدرية](https://github.com/vuejs/core/blob/main/packages/runtime-core/src/index.ts#L131).
55
:::
66

7-
## PropType\<T> {#proptype-t}
7+
## <PropType\<T {#proptype-t}
88

9-
Used to annotate a prop with more advanced types when using runtime props declarations.
9+
يستخدم لتوصيف الخاصية بأنواع أكثر تقدما عند استخدام تصريحات الخاصيات في وقت التشغيل.
1010

11-
- **Example**
11+
- **مثال**
1212

1313
```ts
1414
import type { PropType } from 'vue'
@@ -22,35 +22,35 @@ Used to annotate a prop with more advanced types when using runtime props declar
2222
export default {
2323
props: {
2424
book: {
25-
// provide more specific type to `Object`
25+
// توفير نوع أكثر تحديدا لـ `Object`
2626
type: Object as PropType<Book>,
2727
required: true
2828
}
2929
}
3030
}
3131
```
3232

33-
- **See also** [Guide - Typing Component Props](/guide/typescript/options-api#typing-component-props)
33+
- **اطلع أيضا على** [دليل - إضافة الأنواع لخاصيات المكون](/guide/typescript/options-api#typing-component-props)
3434

35-
## MaybeRef\<T> {#mayberef}
35+
## <MaybeRef\<T {#mayberef}
3636

37-
Alias for `T | Ref<T>`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).
37+
اسم بديل لـ `T | Ref<T>`. مفيد لتوصيف الوسائط لـ [الدوال التركيبية](/guide/reusability/composables.html).
3838

39-
- Only supported in 3.3+.
39+
- مدعوم فقط في 3.3+
4040

41-
## MaybeRefOrGetter\<T> {#maybereforgetter}
41+
## <MaybeRefOrGetter\<T {#maybereforgetter}
4242

43-
Alias for `T | Ref<T> | (() => T)`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).
43+
اسم بديل لـ `T | Ref<T> | (() => T)`. مفيد لتوصيف الوسائط لـ [الدوال التركيبية](/guide/reusability/composables.html).
4444

45-
- Only supported in 3.3+.
45+
- مدعوم فقط في 3.3+
4646

47-
## ExtractPropTypes\<T> {#extractproptypes}
47+
## <ExtractPropTypes\<T {#extractproptypes}
4848

49-
Extract prop types from a runtime props options object. The extracted types are internal facing - i.e. the resolved props received by the component. This means boolean props and props with default values are always defined, even if they are not required.
49+
تستخرج أنواع الخاصيات من كائن خيارات الخاصيات في وقت التشغيل. الأنواع المستخرجة هي الأنواع الداخلية - أي الخاصيات المستبيَنة التي يتلقاها المكون. هذا يعني أن الخاصيات المنطقية والخاصيات التي تحتوي على قيم افتراضية دائمًا ما تكون محددة، حتى لو لم تكن مطلوبة.
5050

51-
To extract public facing props, i.e. props that the parent is allowed to pass, use [`ExtractPublicPropTypes`](#extractpublicproptypes).
51+
من أجل استخراج الخاصيات العامة، أي الخاصيات التي يسمح للأب بتمريرها، استخدم [`ExtractPublicPropTypes`](#extractpublicproptypes).
5252

53-
- **Example**
53+
- **مثال**
5454

5555
```ts
5656
const propsOptions = {
@@ -75,11 +75,11 @@ To extract public facing props, i.e. props that the parent is allowed to pass, u
7575
// }
7676
```
7777
78-
## ExtractPublicPropTypes\<T> {#extractpublicproptypes}
78+
## <ExtractPublicPropTypes\<T {#extractpublicproptypes}
7979
80-
Extract prop types from a runtime props options object. The extracted types are public facing - i.e. the props that the parent is allowed to pass.
80+
تستخرج أنواع الخاصيات من كائن خيارات الخاصيات في وقت التشغيل. الأنواع المستخرجة هي الأنواع العامة - أي الخاصيات التي يسمح للأب بتمريرها.
8181
82-
- **Example**
82+
- **مثال**
8383
8484
```ts
8585
const propsOptions = {
@@ -106,9 +106,9 @@ Extract prop types from a runtime props options object. The extracted types are
106106
107107
## ComponentCustomProperties {#componentcustomproperties}
108108
109-
Used to augment the component instance type to support custom global properties.
109+
يستخدم لتوسيع نوع نسخة المكون لدعم الخاصيات العامة المخصصة.
110110
111-
- **Example**
111+
- **مثال**
112112
113113
```ts
114114
import axios from 'axios'
@@ -121,17 +121,17 @@ Used to augment the component instance type to support custom global properties.
121121
}
122122
```
123123

124-
:::tip
125-
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api#augmenting-global-properties) for more details.
124+
:::tip ملاحظة
125+
يجب وضع التوسيعات في ملف `.ts` أو `.d.ts` مستقل. اطلع على [مكان التوسيعات](/guide/typescript/options-api#augmenting-global-properties) للمزيد من التفاصيل.
126126
:::
127127

128-
- **See also** [Guide - Augmenting Global Properties](/guide/typescript/options-api#augmenting-global-properties)
128+
- **اطلع أيضا على** [دليل - توسيع الخاصيات العامة](/guide/typescript/options-api#augmenting-global-properties)
129129

130130
## ComponentCustomOptions {#componentcustomoptions}
131131

132-
Used to augment the component options type to support custom options.
132+
يستخدم لتوسيع نوع خيارات المكون لدعم الخيارات المخصصة.
133133

134-
- **Example**
134+
- **مثال**
135135

136136
```ts
137137
import { Route } from 'vue-router'
@@ -143,17 +143,17 @@ Used to augment the component options type to support custom options.
143143
}
144144
```
145145

146-
:::tip
147-
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api#augmenting-global-properties) for more details.
146+
:::tip ملاحظة
147+
يجب وضع التوسيعات في ملف `.ts` أو `.d.ts` مستقل. اطلع على [مكان التوسيعات](/guide/typescript/options-api#augmenting-global-properties) للمزيد من التفاصيل.
148148
:::
149149

150-
- **See also** [Guide - Augmenting Custom Options](/guide/typescript/options-api#augmenting-custom-options)
150+
- **اطلع أيضا على** [دليل - توسيع الخيارات المخصصة](/guide/typescript/options-api#augmenting-custom-options)
151151

152152
## ComponentCustomProps {#componentcustomprops}
153153

154-
Used to augment allowed TSX props in order to use non-declared props on TSX elements.
154+
يستخدم لتوسيع الخاصيات المسموح بها في TSX من أجل استخدام الخاصيات غير المصرح بها على عناصر TSX.
155155

156-
- **Example**
156+
- **مثال**
157157

158158
```ts
159159
declare module 'vue' {
@@ -166,21 +166,21 @@ Used to augment allowed TSX props in order to use non-declared props on TSX elem
166166
```
167167

168168
```tsx
169-
// now works even if hello is not a declared prop
169+
// يعمل الآن حتى لو لم يُصرح بـ hello كخاصية
170170
<MyComponent hello="world" />
171171
```
172172

173-
:::tip
174-
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api#augmenting-global-properties) for more details.
173+
:::tip ملاحظة
174+
يجب وضع التوسيعات في ملف `.ts` أو `.d.ts` مستقل. اطلع على [مكان التوسيعات](/guide/typescript/options-api#augmenting-global-properties) للمزيد من التفاصيل.
175175
:::
176176

177177
## CSSProperties {#cssproperties}
178178

179-
Used to augment allowed values in style property bindings.
179+
يستخدم لتوسيع القيم المسموح بها في ربط خاصية التنسيقات.
180180

181-
- **Example**
181+
- **مثال**
182182

183-
Allow any custom CSS property
183+
السماح بأي خاصية CSS مخصصة
184184

185185
```ts
186186
declare module 'vue' {
@@ -198,12 +198,12 @@ Used to augment allowed values in style property bindings.
198198
<div :style="{ '--bg-color': 'blue' }"></div>
199199
```
200200

201-
:::tip
202-
Augmentations must be placed in a module `.ts` or `.d.ts` file. See [Type Augmentation Placement](/guide/typescript/options-api#augmenting-global-properties) for more details.
201+
:::tip ملاحظة
202+
يجب وضع التوسيعات في ملف `.ts` أو `.d.ts` مستقل. اطلع على [مكان التوسيعات](/guide/typescript/options-api#augmenting-global-properties) للمزيد من التفاصيل.
203203
:::
204204

205-
:::info See also
206-
SFC `<style>` tags support linking CSS values to dynamic component state using the `v-bind` CSS function. This allows for custom properties without type augmentation.
205+
:::info اطلع أيضا على
206+
  تدعم علامات `<style>` في المكونات أحادية الملف ربط قيم CSS بحالة المكون الديناميكية باستخدام دالة `v-bind` الخاصة بـ CSS. هذا يسمح بالخاصيات المخصصة دون توسيع الأنواع.
207207

208-
- [v-bind() in CSS](/api/sfc-css-features#v-bind-in-css)
208+
- [()v-bind في CSS](/api/sfc-css-features#v-bind-in-css)
209209
:::

0 commit comments

Comments
 (0)