Skip to content

Commit 9540e78

Browse files
authored
Merge branch 'master' into migration-build-flags
2 parents 5bd2a63 + 9657a47 commit 9540e78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+389
-150
lines changed

src/.vuepress/components/guide/contributing/translations-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ export const repos = [
1717
{ lang: 'ja', owner: 'vuejs-jp', repo: 'ja.vuejs.org', branch: 'lang-ja', url: 'https://v3.ja.vuejs.org/' },
1818
{ lang: 'ko', owner: 'vuejs-kr', repo: 'docs-next', branch: 'rootKoKr', url: 'https://v3.ko.vuejs.org/' },
1919
{ lang: 'pt-br', owner: 'vuejs-br', repo: 'docs-next', branch: 'master', url: 'https://vuejsbr-docs-next.netlify.app/' },
20-
{ lang: 'ru', owner: 'translation-gang', repo: 'docs-next', branch: 'master' },
20+
{ lang: 'ru', owner: 'translation-gang', repo: 'docs-next', branch: 'master', url: 'https://v3.ru.vuejs.org/' },
2121
{ lang: 'zh-cn', owner: 'vuejs', repo: 'docs-next-zh-cn', branch: 'master', url: 'https://v3.cn.vuejs.org/' }
2222
]

src/.vuepress/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const sidebar = {
66
children: [
77
'/cookbook/',
88
'/cookbook/editable-svg-icons',
9-
'/cookbook/debugging-in-vscode'
9+
'/cookbook/debugging-in-vscode',
10+
'/cookbook/automatic-global-registration-of-base-components'
1011
]
1112
}
1213
],
@@ -202,6 +203,7 @@ const sidebar = {
202203
'/guide/migration/slots-unification',
203204
'/guide/migration/suspense',
204205
'/guide/migration/transition',
206+
'/guide/migration/transition-as-root',
205207
'/guide/migration/transition-group',
206208
'/guide/migration/v-on-native-modifier-removed',
207209
'/guide/migration/v-model',
@@ -435,6 +437,10 @@ module.exports = {
435437
text: '日本語',
436438
link: 'https://v3.ja.vuejs.org/'
437439
},
440+
{
441+
text: 'Русский',
442+
link: 'https://v3.ru.vuejs.org/'
443+
},
438444
{
439445
text: 'More Translations',
440446
link: '/guide/contributing/translations#community-translations'

src/.vuepress/theme/styles/index.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ul, ol
115115
padding-left 1.2em
116116

117117
strong
118-
font-weight 500
118+
font-weight 600
119119

120120
h1, h2, h3, h4, h5, h6
121121
font-weight 500

src/api/application-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ setTimeout(() => app.unmount(), 5000)
329329
export default {
330330
install(app) {
331331
const version = Number(app.version.split('.')[0])
332-
332+
333333
if (version < 3) {
334334
console.warn('This plugin requires Vue 3')
335335
}
336-
336+
337337
// ...
338338
}
339339
}
340340
```
341-
341+
342342
- **See also**: [Global API - version](/api/global-api.html#version)

src/api/built-in-components.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { KeepAlive, Teleport, Transition, TransitionGroup } = Vue
1414
import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
1515
```
1616

17-
`<component>` and `<slot>` are component-like features of template syntax. They are not true components and they can't be imported like the components shown above.
17+
`<component>` and `<slot>` are component-like features of template syntax. They are not true components and they can't be imported like the components shown above.
1818

1919
## component
2020

@@ -45,13 +45,13 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
4545

4646
```js
4747
const { Transition, TransitionGroup } = Vue
48-
48+
4949
const Component = {
5050
components: {
5151
Transition,
5252
TransitionGroup
5353
},
54-
54+
5555
template: `
5656
<component :is="isGroup ? 'TransitionGroup' : 'Transition'">
5757
...
@@ -60,7 +60,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
6060
}
6161
```
6262

63-
Registration is not required if you pass the component itself to `is` rather than its name.
63+
Registration is not required if you pass the component itself to `is` rather than its name.
6464

6565
- **See also:** [Dynamic Components](../guide/component-dynamic-async.html)
6666

@@ -180,7 +180,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
180180

181181
When wrapped around a dynamic component, `<keep-alive>` caches the inactive component instances without destroying them. Similar to `<transition>`, `<keep-alive>` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain.
182182

183-
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly.
183+
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly, providing an alternative to `mounted` and `unmounted`, which are not called. (This applies to the direct child of `<keep-alive>` as well as to all of its descendants.)
184184

185185
Primarily used to preserve component state or avoid re-rendering.
186186

src/api/composition-api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ The component instance context is also set during the synchronous execution of l
117117
- `errorCaptured` -> `onErrorCaptured`
118118
- `renderTracked` -> `onRenderTracked`
119119
- `renderTriggered` -> `onRenderTriggered`
120+
- `activated` -> `onActivated`
121+
- `deactivated` -> `onDeactivated`
122+
120123

121124
- **See also**: [Composition API lifecycle hooks](../guide/composition-api-lifecycle-hooks.html)
122125

src/api/global-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Accepts three arguments: `type`, `props` and `children`
9696
9797
- **Details:**
9898
99-
An HTML tag name, a component or an async component. Using function returning null would render a comment. This parameter is required
99+
An HTML tag name, a component, an async component, or a functional component. Using function returning null would render a comment. This parameter is required
100100
101101
#### props
102102

src/api/instance-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
- **Option: deep**
123123

124124
To also detect nested value changes inside Objects, you need to pass in `deep: true` in the options argument. This option also can be used to watch array mutations.
125-
125+
126126
> Note: when mutating (rather than replacing) an Object or an Array and watch with deep option, the old value will be the same as new value because they reference the same Object/Array. Vue doesn't keep a copy of the pre-mutate value.
127127
128128
```js

src/api/options-assets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
A hash of directives to be made available to the component instance.
1010

1111
- **Usage:**
12+
1213
```js
1314
const app = createApp({})
1415

@@ -35,6 +36,7 @@
3536
A hash of components to be made available to the component instance.
3637

3738
- **Usage:**
39+
3840
```js
3941
const Foo = {
4042
template: `<div>Foo</div>`

src/api/refs-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ isReactive(foo.value) // false
217217

218218
## `triggerRef`
219219

220-
Execute any effects tied to a [`shallowRef`](#shallowref) manually.
220+
Execute any effects tied to a [`shallowRef`](#shallowref) manually.
221221

222222
```js
223223
const shallow = shallowRef({

src/coc/index.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
# Code Of Conduct
2-
3-
## Our Pledge
4-
5-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.
6-
7-
## Our Standards
8-
9-
Examples of behavior that contributes to creating a positive environment include:
10-
11-
- Using welcoming and inclusive language
12-
- Being respectful of differing viewpoints and experiences
13-
- Gracefully accepting constructive criticism
14-
- Focusing on what is best for the community
15-
- Showing empathy towards other community members
16-
17-
Examples of unacceptable behavior by participants include:
18-
19-
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20-
- Trolling, insulting/derogatory comments, and personal or political attacks
21-
- Public or private harassment
22-
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23-
- Other conduct which could reasonably be considered inappropriate in a professional setting
24-
25-
## Our Responsibilities
26-
27-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28-
29-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30-
31-
## Scope
32-
33-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34-
35-
## Enforcement
36-
37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@vuejs.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38-
39-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40-
41-
## Attribution
42-
43-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44-
45-
[homepage]: https://www.contributor-covenant.org
1+
# Code Of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@vuejs.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44+
45+
[homepage]: https://www.contributor-covenant.org

src/community/partners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Vue Partners are premium shops that provide first-class Vue consulting and devel
44

55
## Active Partners
66

7-
<community-partners-index/>
7+
<community-partners-index/>

src/community/team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Meet the Team
22

3-
<community-team-index/>
3+
<community-team-index/>

src/community/themes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Themes
22

3-
<community-themes-index/>
3+
<community-themes-index/>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Automatic Global Registration of Base Components
2+
3+
## Base Example
4+
5+
Many of your components will be relatively generic, possibly only wrapping an element like an input or a button. We sometimes refer to these as [base components](../style-guide/#base-component-names-strongly-recommended) and they tend to be used very frequently across your components.
6+
7+
The result is that many components may include long lists of base components:
8+
9+
```js
10+
import BaseButton from './BaseButton.vue'
11+
import BaseIcon from './BaseIcon.vue'
12+
import BaseInput from './BaseInput.vue'
13+
export default {
14+
components: {
15+
BaseButton,
16+
BaseIcon,
17+
BaseInput
18+
}
19+
}
20+
```
21+
22+
Just to support relatively little markup in a template:
23+
24+
```html
25+
<BaseInput v-model="searchText" @keydown.enter="search" />
26+
<BaseButton @click="search">
27+
<BaseIcon name="search" />
28+
</BaseButton>
29+
```
30+
31+
Fortunately, if you're using webpack (or [Vue CLI](https://github.com/vuejs/vue-cli), which uses webpack internally), you can use `require.context` to globally register only these very common base components. Here's an example of the code you might use to globally import base components in your app's entry file (e.g. `src/main.js`):
32+
33+
```js
34+
import { createApp } from 'vue'
35+
import upperFirst from 'lodash/upperFirst'
36+
import camelCase from 'lodash/camelCase'
37+
import App from './App.vue'
38+
39+
const app = createApp(App)
40+
41+
const requireComponent = require.context(
42+
// The relative path of the components folder
43+
'./components',
44+
// Whether or not to look in subfolders
45+
false,
46+
// The regular expression used to match base component filenames
47+
/Base[A-Z]\w+\.(vue|js)$/
48+
)
49+
50+
requireComponent.keys().forEach(fileName => {
51+
// Get component config
52+
const componentConfig = requireComponent(fileName)
53+
54+
// Get PascalCase name of component
55+
const componentName = upperFirst(
56+
camelCase(
57+
// Gets the file name regardless of folder depth
58+
fileName
59+
.split('/')
60+
.pop()
61+
.replace(/\.\w+$/, '')
62+
)
63+
)
64+
65+
app.component(
66+
componentName,
67+
// Look for the component options on `.default`, which will
68+
// exist if the component was exported with `export default`,
69+
// otherwise fall back to module's root.
70+
componentConfig.default || componentConfig
71+
)
72+
})
73+
74+
app.mount('#app')
75+
```

src/guide/a11y-resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The World Health Organization estimates that 15% of the world's population has s
4040
There are a huge range of disabilities, which can be divided roughly into four categories:
4141

4242
- _[Visual](https://webaim.org/articles/visual/)_ - These users can benefit from the use of screen readers, screen magnification, controlling screen contrast, or braille display.
43-
- _[Auditory](https://webaim.org/articles/auditory/)_ - These users can benefit from captioning, transcripts or sign language video.
43+
- _[Auditory](https://webaim.org/articles/auditory/)_ - These users can benefit from captioning, transcripts or sign language video.
4444
- _[Motor](https://webaim.org/articles/motor/)_ - These users can benefit from a range of [assistive technologies for motor impairments](https://webaim.org/articles/motor/assistive): voice recognition software, eye tracking, single-switch access, head wand, sip and puff switch, oversized trackball mouse, adaptive keyboard or other assistive technologies.
4545
- _[Cognitive](https://webaim.org/articles/cognitive/)_ - These users can benefit from supplemental media, structural organization of content, clear and simple writing.
4646

src/guide/class-and-style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ The array syntax for `:style` allows you to apply multiple style objects to the
230230

231231
### Auto-prefixing
232232

233-
When you use a CSS property that requires [vendor prefixes](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) in `:style`, for example `transform`, Vue will automatically detect and add appropriate prefixes to the applied styles.
233+
When you use a CSS property that requires a [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) in `:style`, Vue will automatically add the appropriate prefix. Vue does this by checking at runtime to see which style properties are supported in the current browser. If the browser doesn't support a particular property then various prefixed variants will be tested to try to find one that is supported.
234234

235235
### Multiple Values
236236

src/guide/component-basics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Components can be reused as many times as you want:
5454
</div>
5555
```
5656

57-
<common-codepen-snippet title="Component basics: reusing components" slug="rNVqYvM" tab="html,result" :preview="false" />
57+
<common-codepen-snippet title="Component basics: reusing components" slug="rNVqYvM" tab="result" :preview="false" />
5858

5959
Notice that when clicking on the buttons, each one maintains its own, separate `count`. That's because each time you use a component, a new **instance** of it is created.
6060

@@ -111,7 +111,7 @@ Once a prop is registered, you can pass data to it as a custom attribute, like t
111111
</div>
112112
```
113113

114-
<common-codepen-snippet title="Component basics: passing props" slug="PoqyOaX" tab="html,result" :preview="false" />
114+
<common-codepen-snippet title="Component basics: passing props" slug="PoqyOaX" tab="result" :preview="false" />
115115

116116
In a typical app, however, you'll likely have an array of posts in `data`:
117117

@@ -227,7 +227,7 @@ Then the child component can emit an event on itself by calling the built-in [**
227227

228228
Thanks to the `@enlarge-text="postFontSize += 0.1"` listener, the parent will receive the event and update the value of `postFontSize`.
229229

230-
<common-codepen-snippet title="Component basics: emitting events" slug="KKpGyrp" tab="html,result" :preview="false" />
230+
<common-codepen-snippet title="Component basics: emitting events" slug="KKpGyrp" tab="result" :preview="false" />
231231

232232
We can list emitted events in the component's `emits` option:
233233

0 commit comments

Comments
 (0)