Skip to content

Commit c030a1b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into main
2 parents 4918342 + dae18b9 commit c030a1b

File tree

17 files changed

+148
-25
lines changed

17 files changed

+148
-25
lines changed

src/about/team/members-partner.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@
1616
"twitter": "MariaLamardo"
1717
}
1818
},
19+
{
20+
"name": "Daniel Roe",
21+
"title": "Framework Architect",
22+
"company": "Nuxt",
23+
"projects": [
24+
{
25+
"label": "nuxt",
26+
"url": "https://github.com/nuxt"
27+
},
28+
{
29+
"label": "typed-vuex",
30+
"url": "https://github.com/danielroe/typed-vuex"
31+
}
32+
],
33+
"location": "United Kingdom",
34+
"languages": ["English"],
35+
"socials": {
36+
"github": "danielroe",
37+
"twitter": "danielcroe",
38+
"linkedin": "daniel-roe"
39+
}
40+
},
1941
{
2042
"name": "Pratik Patel",
2143
"avatarPic": "https://pbs.twimg.com/profile_images/1541624512/profile-pic-09-11-2011_400x400.png",

src/api/ApiIndex.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ const filtered = computed(() => {
3131
return item
3232
}
3333
// filter headers
34-
const matchedHeaders = item.headers.filter(matches)
34+
const matchedHeaders = item.headers.filter(
35+
({ text, anchor }) => matches(text) || matches(anchor)
36+
)
3537
return matchedHeaders.length
3638
? { text: item.text, link: item.link, headers: matchedHeaders }
3739
: null
@@ -92,8 +94,8 @@ function slugify(text: string): string {
9294
>
9395
<h3>{{ item.text }}</h3>
9496
<ul>
95-
<li v-for="h of item.headers" :key="h">
96-
<a :href="item.link + '.html#' + slugify(h)">{{ h }}</a>
97+
<li v-for="h of item.headers" :key="h.anchor">
98+
<a :href="item.link + '.html#' + slugify(h.anchor)">{{ h.anchor }}</a>
9799
</li>
98100
</ul>
99101
</div>

src/api/api.data.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ import fs from 'fs'
44
import path from 'path'
55
import { sidebar } from '../../.vitepress/config'
66

7+
interface APIHeader {
8+
anchor: string
9+
text: string
10+
}
11+
712
export interface APIGroup {
813
text: string
914
items: {
1015
text: string
1116
link: string
12-
headers: string[]
17+
headers: APIHeader[]
1318
}[]
1419
}
1520

@@ -34,7 +39,7 @@ export default {
3439
const headersCache = new Map<
3540
string,
3641
{
37-
headers: string[]
42+
headers: APIHeader[]
3843
timestamp: number
3944
}
4045
>()
@@ -50,15 +55,19 @@ function parsePageHeaders(link: string) {
5055

5156
const src = fs.readFileSync(fullPath, 'utf-8')
5257
const h2s = src.match(/^## [^\n]+/gm)
53-
let headers: string[] = []
58+
let headers: APIHeader[] = []
5459
if (h2s) {
55-
headers = h2s.map((h) =>
56-
h
57-
.slice(2)
58-
.replace(/<sup class=.*/, '')
59-
.replace(/\\</g, '<')
60-
.replace(/`([^`]+)`/g, '$1')
61-
.trim()
60+
headers = h2s.map((h) => {
61+
const text = h
62+
.slice(2)
63+
.replace(/<sup class=.*/, '')
64+
.replace(/\\</g, '<')
65+
.replace(/`([^`]+)`/g, '$1')
66+
.replace(/\{#([a-zA-Z0-9-]+)\}/g, '') // hidden anchor tag
67+
.trim()
68+
const anchor = h.match(/\{#([a-zA-Z0-9-]+)\}/)?.[1] ?? text
69+
return { text, anchor }
70+
}
6271
)
6372
}
6473
headersCache.set(fullPath, {

src/api/general.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ A type helper for defining a Vue component with type inference.
122122
type FooInstance = InstanceType<typeof Foo>
123123
```
124124

125+
### Note on webpack Treeshaking
126+
127+
Because `defineComponent()` is a function call, it could look like that it would produce side-effects to some build tools, e.g. webpack. This will prevent the component from being tree-shaken even when the component is never used.
128+
129+
To tell webpack that this function call is safe to be tree-shaken, you can add a `/*#__PURE__*/` comment notation before the function call:
130+
131+
```js
132+
export default /*#__PURE__*/ defineComponent(/* ... */)
133+
```
134+
135+
Note this is not necessary if you are using Vite, because Rollup (the underlying production bundler used by Vite) is smart enough to determine that `defineComponent()` is in fact side-effect-free without the need for manual annotations.
136+
125137
- **See also:** [Guide - Using Vue with TypeScript](/guide/typescript/overview.html#general-usage-notes)
126138

127139
## defineAsyncComponent()

src/ecosystem/themes/themes.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@
165165
"url": "https://www.primefaces.org/layouts/diamond-vue?af_id=4218",
166166
"image": "https://www.primefaces.org/vue-templates/diamond.jpg"
167167
},
168+
{
169+
"name": "Poseidon",
170+
"price": 59,
171+
"description": "PrimeOne Design Admin Template",
172+
"url": "https://www.primefaces.org/layouts/poseidon-vue?af_id=4218",
173+
"image": "https://www.primefaces.org/vue-templates/poseidon.jpg"
174+
},
175+
{
176+
"name": "Verona",
177+
"price": 49,
178+
"description": "PrimeOne Design Admin Template",
179+
"url": "https://www.primefaces.org/layouts/verona-vue?af_id=4218",
180+
"image": "https://www.primefaces.org/vue-templates/verona.jpg"
181+
},
168182
{
169183
"name": "Sapphire",
170184
"price": 49,

src/guide/essentials/computed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Now when you run `fullName.value = 'John Doe'`, the setter will be invoked and `
263263

264264
### Getters should be side-effect free
265265

266-
It is important to remember that computed getter functions should only perform pure computation and be free of side effects. For example, don't make async requests or mutate the DOM inside a computed getter! Think of a computed property as declaratively describing how to derive a value based on other values - its only responsibility should be computing and returning that value. Later in the guide we will discuss how we can perform side effects in reaction to state changes with [watchers](./watchers).
266+
It is important to remember that computed getter functions should only perform pure computation and be free of side effects. For example, **don't make async requests or mutate the DOM inside a computed getter!** Think of a computed property as declaratively describing how to derive a value based on other values - its only responsibility should be computing and returning that value. Later in the guide we will discuss how we can perform side effects in reaction to state changes with [watchers](./watchers).
267267

268268
### Avoid mutating computed value
269269

src/guide/extras/web-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464

6565
### Passing DOM Properties
6666

67-
Since DOM attributes can only be strings, we need to pass complex data to custom elements as DOM properties. When setting props on a custom element, Vue 3 automatically checks DOM-property presence using the `in` operator and will prefer setting the value as a DOM property if the key is present. This means that, in most cases, you won't need to think about this if the custom element follows the [recommended best practices](https://web.dev/index.md/).
67+
Since DOM attributes can only be strings, we need to pass complex data to custom elements as DOM properties. When setting props on a custom element, Vue 3 automatically checks DOM-property presence using the `in` operator and will prefer setting the value as a DOM property if the key is present. This means that, in most cases, you won't need to think about this if the custom element follows the [recommended best practices](https://web.dev/custom-elements-best-practices/).
6868

6969
However, there could be rare cases where the data must be passed as a DOM property, but the custom element does not properly define/reflect the property (causing the `in` check to fail). In this case, you can force a `v-bind` binding to be set as a DOM property using the `.prop` modifier:
7070

src/guide/scaling-up/sfc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Introduction
44

5-
Vue Single-File Components (aka `*.vue` files, abbreviated as **SFC**) is a special file format that allows us to encapsulate the template, logic, **and** styling of a Vue component in a single file. Here's an example SFC:
5+
Vue Single-File Components (a.k.a. `*.vue` files, abbreviated as **SFC**) is a special file format that allows us to encapsulate the template, logic, **and** styling of a Vue component in a single file. Here's an example SFC:
66

77
```vue
88
<script>
@@ -27,14 +27,14 @@ export default {
2727
</style>
2828
```
2929

30-
As we can see, Vue SFC is a natural extension of the classic trio of HTML, CSS and JavaScript. The `<template>`, `<script>`, and `<style>` blocks encapsulates and collocates the view, logic and styling of a component in the same file. The full syntax is defined in the [SFC Syntax Specification](/api/sfc-spec).
30+
As we can see, Vue SFC is a natural extension of the classic trio of HTML, CSS and JavaScript. The `<template>`, `<script>`, and `<style>` blocks encapsulate and colocate the view, logic and styling of a component in the same file. The full syntax is defined in the [SFC Syntax Specification](/api/sfc-spec).
3131

3232
## Why SFC
3333

3434
While SFCs require a build step, there are numerous benefits in return:
3535

3636
- Author modularized components using familiar HTML, CSS and JavaScript syntax
37-
- [Collocation of inherently coupled concerns](#what-about-separation-of-concerns)
37+
- [Colocation of inherently coupled concerns](#what-about-separation-of-concerns)
3838
- Pre-compiled templates
3939
- [Component-scoped CSS](/api/sfc-css-features)
4040
- [More ergonomic syntax when working with Composition API](/api/sfc-script-setup)
@@ -48,7 +48,7 @@ SFC is a defining feature of Vue as a framework, and is the recommended approach
4848
- Static Site Generation (SSG)
4949
- Any non-trivial frontend where a build step can be justified for better development experience (DX).
5050

51-
That said, we do realize there are scenarios where SFCs can feel like overkill. This is why Vue can still be used via plain JavaScript without a build step. If you are just looking for enhancing largely static HTML with light interactions, you can also check out [petite-vue](https://github.com/vuejs/petite-vue), a 6kb subset of Vue optimized for progressive enhancement.
51+
That said, we do realize there are scenarios where SFCs can feel like overkill. This is why Vue can still be used via plain JavaScript without a build step. If you are just looking for enhancing largely static HTML with light interactions, you can also check out [petite-vue](https://github.com/vuejs/petite-vue), a 6 kB subset of Vue optimized for progressive enhancement.
5252

5353
## How It Works
5454

@@ -74,8 +74,8 @@ In actual projects, we typically integrate the SFC compiler with a build tool su
7474

7575
Some users coming from a traditional web development background may have the concern that SFCs are mixing different concerns in the same place - which HTML/CSS/JS were supposed to separate!
7676

77-
To answer this question, it is important for us to agree that **separation of concerns is not equal to the separation of file types.** The ultimate goal of engineering principles is to improve the maintainability of codebases. Separation of concerns, when applied dogmatically as separation of file types, does not help us reach that goal in the context of increasingly complex frontend applications.
77+
To answer this question, it is important for us to agree that **separation of concerns is not equal to the separation of file types**. The ultimate goal of engineering principles is to improve the maintainability of codebases. Separation of concerns, when applied dogmatically as separation of file types, does not help us reach that goal in the context of increasingly complex frontend applications.
7878

79-
In modern UI development, we have found that instead of dividing the codebase into three huge layers that interweave with one another, it makes much more sense to divide them into loosely-coupled components and compose them. Inside a component, its template, logic, and styles are inherently coupled, and collocating them actually makes the component more cohesive and maintainable.
79+
In modern UI development, we have found that instead of dividing the codebase into three huge layers that interweave with one another, it makes much more sense to divide them into loosely-coupled components and compose them. Inside a component, its template, logic, and styles are inherently coupled, and colocating them actually makes the component more cohesive and maintainable.
8080

8181
Note even if you don't like the idea of Single-File Components, you can still leverage its hot-reloading and pre-compilation features by separating your JavaScript and CSS into separate files using [Src Imports](/api/sfc-spec.html#src-imports).

src/guide/typescript/overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ export default defineComponent({
129129
})
130130
```
131131

132-
See also: [type tests for `defineComponent`](https://github.com/vuejs/core/blob/main/test-dts/defineComponent.test-d.tsx)
132+
See also:
133+
134+
- [Note on webpack Treeshaking](/api/general.html#note-on-webpack-treeshaking)
135+
- [type tests for `defineComponent`](https://github.com/vuejs/core/blob/main/test-dts/defineComponent.test-d.tsx)
133136

134137
:::tip
135138
`defineComponent()` also enables type inference for components defined in plain JavaScript.

src/partners/components/PartnerCard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ h3 {
9898
.partner-card.hero .big {
9999
display: inline-block;
100100
margin-left: auto;
101-
width: 60%;
101+
max-width: 60%;
102102
max-height: 360px;
103103
object-fit: cover;
104104
}
@@ -115,6 +115,7 @@ h3 {
115115
}
116116
.partner-card.hero .big {
117117
width: 100%;
118+
max-width: 100%;
118119
}
119120
}
120121

0 commit comments

Comments
 (0)