Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/upstream'
Browse files Browse the repository at this point in the history
mostafa-nematpour committed Jan 24, 2025
2 parents 001d4a6 + 3f4d223 commit fd22cc9
Showing 13 changed files with 681 additions and 303 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@ dist/
# vitepress build output
.vitepress/dist
.vitepress/cache
.vitepress/.temp

# Serverless directories
.serverless/
4 changes: 2 additions & 2 deletions .vitepress/inlined-scripts/restorePreference.js
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@
restore('vue-docs-prefer-composition', 'prefer-composition', true)
restore('vue-docs-prefer-sfc', 'prefer-sfc', true)

// window.__VUE_BANNER_ID__ = ''
// restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
window.__VUE_BANNER_ID__ = 'madvue2025_1'
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
})()
96 changes: 82 additions & 14 deletions .vitepress/theme/components/Banner.vue
Original file line number Diff line number Diff line change
@@ -22,16 +22,32 @@ function dismiss() {

<template>
<div class="banner" v-if="open">
<a target="_blank"></a>
<p class="vt-banner-text">
<span class="vt-text-primary">
<span style="color:#f97844">Mad</span>
<span>Vue</span>
</span>
<span class="vt-tagline"> · The Vue.js Event in Madrid</span>
<span class="vt-place"> · Spain</span>
<span class="vt-date"> · 29 May 2025</span>
<a target="_blank" class="vt-primary-action"
href="https://madvue.es/?utm_source=vuejs&utm_content=top_banner">
Register
</a>
</p>
<button @click="dismiss">
<VTIconPlus class="close" />
</button>
<p class="vt-banner-text vt-coupon">
<span class="vt-text-primary">Early bird</span> tickets available
<span class="vt-text-primary">Get 30% off</span>
</p>
</div>
</template>

<style>
html:not(.banner-dismissed) {
--vt-banner-height: 30px;
--vt-banner-height: 60px;
}
</style>

@@ -50,12 +66,10 @@ html:not(.banner-dismissed) {
font-weight: 600;
color: #fff;
background-color: var(--vt-c-green);
background: linear-gradient(
90deg,
rgba(66, 184, 131, 1) 0%,
rgba(39, 179, 137, 1) 19%,
rgba(100, 126, 255, 1) 100%
);
background: #0f172a;
display: flex;
justify-content: center;
align-items: center;
}
.banner-dismissed .banner {
@@ -70,7 +84,7 @@ button {
position: absolute;
right: 0;
top: 0;
padding: 5px;
padding: 20px 10px;
}
.close {
@@ -79,10 +93,64 @@ button {
fill: #fff;
transform: rotate(45deg);
}
/*
@media (max-width: 720px) {
a > span {
.vt-banner-text {
color: #fff;
font-size: 16px;
}
.vt-text-primary {
color: #c4d141;
}
.vt-primary-action {
background: #f97844;
color: #fff;
padding: 6px 12px;
border-radius: 5px;
font-size: 14px;
text-decoration: none;
margin: 0 20px;
font-weight: bold;
}
.vt-primary-action:hover {
text-decoration: none;
background: #c4d141;
}
@media (max-width: 1280px) {
.banner .vt-banner-text {
font-size: 14px;
}
.vt-tagline {
display: none;
}
} */
</style>
}
@media (max-width: 780px) {
.vt-tagline {
display: none;
}
.vt-coupon {
display: none;
}
.vt-primary-action {
margin: 0 10px;
padding: 5px 8px;
}
.vt-time-now {
display: none;
}
}
@media (max-width: 560px) {
.vt-place {
display: none;
}
}
</style>
2 changes: 1 addition & 1 deletion .vitepress/theme/components/SponsorsGroup.vue
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ function track(interest?: boolean) {
}
function resolveList(data: SponsorData) {
let currentTier = data[props.tier]
let currentTier = data[props.tier] || []
// in aside, treat platinum+priority as special
if (props.placement === 'aside') {
if (props.tier === 'platinum') {
4 changes: 2 additions & 2 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -10,14 +10,14 @@ import {
} from './components/preferences'
import SponsorsAside from './components/SponsorsAside.vue'
import VueSchoolLink from './components/VueSchoolLink.vue'
// import Banner from './components/Banner.vue'
import Banner from './components/Banner.vue'
// import TextAd from './components/TextAd.vue'

export default Object.assign({}, VPTheme, {
Layout: () => {
// @ts-ignore
return h(VPTheme.Layout, null, {
// banner: () => h(Banner),
banner: () => h(Banner),
'sidebar-top': () => h(PreferenceSwitch),
'sidebar-bottom': () => h(SecurityUpdateBtn),
'aside-mid': () => h(SponsorsAside)
824 changes: 560 additions & 264 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/api/component-instance.md
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@

```ts
interface ComponentPublicInstance {
$el: Node | undefined
$el: any
}
```

22 changes: 7 additions & 15 deletions src/api/custom-renderer.md
Original file line number Diff line number Diff line change
@@ -22,41 +22,33 @@
key: string,
prevValue: any,
nextValue: any,
// the rest is unused for most custom renderers
isSVG?: boolean,
prevChildren?: VNode<HostNode, HostElement>[],
namespace?: ElementNamespace,
parentComponent?: ComponentInternalInstance | null,
parentSuspense?: SuspenseBoundary | null,
unmountChildren?: UnmountChildrenFn
): void
insert(
el: HostNode,
parent: HostElement,
anchor?: HostNode | null
): void
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void
remove(el: HostNode): void
createElement(
type: string,
isSVG?: boolean,
namespace?: ElementNamespace,
isCustomizedBuiltIn?: string,
vnodeProps?: (VNodeProps & { [key: string]: any }) | null
vnodeProps?: (VNodeProps & { [key: string]: any }) | null,
): HostElement
createText(text: string): HostNode
createComment(text: string): HostNode
setText(node: HostNode, text: string): void
setElementText(node: HostElement, text: string): void
parentNode(node: HostNode): HostElement | null
nextSibling(node: HostNode): HostNode | null

// optional, DOM-specific
querySelector?(selector: string): HostElement | null
setScopeId?(el: HostElement, id: string): void
cloneNode?(node: HostNode): HostNode
insertStaticContent?(
content: string,
parent: HostElement,
anchor: HostNode | null,
isSVG: boolean
namespace: ElementNamespace,
start?: HostNode | null,
end?: HostNode | null,
): [HostNode, HostNode]
}
```
8 changes: 7 additions & 1 deletion src/api/options-lifecycle.md
Original file line number Diff line number Diff line change
@@ -214,7 +214,13 @@
- اگر هوک `errorCaptured` خودش خطایی ایجاد کند، هم این خطا و هم خطای اصلی که ثبت شده است به `app.config.errorHandler` ارسال می‌شوند.

- یک هوک `errorCaptured` می‌تواند `false` را برگرداند تا از انتشار بیشتر خطا جلوگیری کند. این اساسا می‌گوید "این خطا کنترل شده است و باید نادیده گرفته شود." این جلوگیری از فراخوانی هوک‌های `errorCaptured` یا `app.config.errorHandler` اضافی برای این خطاها جلوگیری می‌کند.


**احتیاط در ثبت خطاها**

- در کامپوننت‌هایی که از تابع async `setup()‎` (با `await` در سطح بالا) استفاده می‌کنند، Vue **همیشه** تلاش می‌کند تمپلیت (template) کامپوننت را رندر کند، حتی اگر `setup()‎` خطا دهد. این امر ممکن است خطاهای بیشتری ایجاد کند زیرا در حین رندر، تمپلیت کامپوننت ممکن است به پراپرتی‌هایی نیاز پیدا کند که در کانتکست `setup()‎` ناموفق وجود ندارند. هنگام ثبت خطاها در چنین کامپوننت‌هایی، آماده باشید تا با خطاهای ناشی از `setup()‎` ناموفق (که همیشه اول می‌آیند) و فرآیند رندر ناموفق روبرو شوید.

- <sup class="vt-badge" data-text="فقط SSR"></sup> جایگزینی کامپوننت فرزند دارای خطا در کامپوننت والد که داخل `<Suspense>` قرار دارد، باعث ناهماهنگی در هایدریشن (hydration) در SSR می‌شود. به جای این کار، سعی کنید منطق‌هایی که ممکن است خطا ایجاد کنند را از `setup()‎` کامپوننت فرزند به یک تابع جداگانه منتقل کنید و آن را در `setup()‎` کامپوننت والد اجرا کنید. در این حالت می‌توانید فرآیند اجرا را به‌طور ایمن با استفاده از `try/catch` مدیریت کنید و قبل از رندر کردن کامپوننت فرزند، در صورت نیاز جایگزینی انجام دهید.

## renderTracked <sup class="vt-badge dev-only" /> {#rendertracked}

زمانی فراخوانی می‌شود ک یک وابستگی reactive از اثر رندر کامپوننت یافته شده باشد.
2 changes: 1 addition & 1 deletion src/api/options-state.md
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@
- **`required`**: در این قسمت از کد، می‌توانید مشخص کنید که آیا یک پراپ مورد نیاز است یا خیر. در محیطی که در آن برنامه در حال توسعه است، اگر این مقدار حقیقی باشد و پراپ ارسال نشود، یک هشدار در کنسول نمایش داده خواهد شد.
- **`validator`**: در این قسمت از کد، یک تابع اعتبارسنجی سفارشی وجود دارد که مقدار پراپ را به عنوان تنها آرگومان دریافت می‌کند. در حالت توسعه، اگر این تابع یک مقدار غیرحقیقی (یعنی اعتبارسنجی ناموفق است) برگرداند، یک هشدار در کنسول نمایش داده خواهد شد.
- **`validator`**: در این قسمت از کد، یک تابع اعتبارسنجی سفارشی وجود دارد که مقدار پراپ و آبجکت props را به عنوان آرگومان دریافت می‌کند. در حالت توسعه، اگر این تابع یک مقدار غیرحقیقی (یعنی اعتبارسنجی ناموفق است) برگرداند، یک هشدار در کنسول نمایش داده خواهد شد.
- **نمونه**
2 changes: 1 addition & 1 deletion src/guide/best-practices/performance.md
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ Vue به گونه‌ای طراحی شده است که برای اکثر موا

ابتدا، دو جنبه اصلی performance وب را مرور می‌کنیم:

- **performance لود (load) صفحه**: سرعت نمایش محتوای برنامه و تعامل‌پذیر شدن آن در بازدید اولیه. این معمولاً با معیارهای حیاتی وب مانند [Largest Contentful Paint (LCP)](https://web.dev/lcp/) و [First Input Delay (FID)](https://web.dev/fid/) سنجیده می‌شود.
- **performance لود (load) صفحه**: سرعت نمایش محتوای برنامه و تعامل‌پذیر شدن آن در بازدید اولیه. این معمولاً با معیارهای حیاتی وب مانند [Largest Contentful Paint (LCP)](https://web.dev/lcp/) و [Interaction to Next Paint](https://web.dev/articles/inp) سنجیده می‌شود.

- **performance به‌روزرسانی**: سرعت به‌روزرسانی برنامه در پاسخ به ورودی کاربر. به عنوان مثال، سرعت به‌روزرسانی یک لیست وقتی کاربر چیزی در یک جعبه جستجو تایپ می‌کند، یا سرعت تعویض صفحه وقتی کاربر یک لینک پیمایش در یک برنامه تک‌صفحه‌ای (SPA) کلیک می‌کند.

2 changes: 1 addition & 1 deletion src/guide/essentials/component-basics.md
Original file line number Diff line number Diff line change
@@ -468,7 +468,7 @@ export default {

این کار با استفاده از المان سفارشی `<slot>` در Vue امکان‌پذیر است:

```vue{4}
```vue{5}
<!-- AlertBox.vue -->
<template>
<div class="alert-box">
15 changes: 15 additions & 0 deletions src/guide/extras/render-function.md
Original file line number Diff line number Diff line change
@@ -721,6 +721,21 @@ export default {
}
```

or (with version >= 3.5)

```js
import { h, useTemplateRef } from 'vue'

export default {
setup() {
const divEl = useTemplateRef('my-div')

// <div ref="divEl">
return () => h('div', { ref: 'my-div' })
}
}
```

</div>
<div class="options-api">

0 comments on commit fd22cc9

Please sign in to comment.