Skip to content

Commit 146fdfb

Browse files
committed
use plain element badges + updated outline frontmatter option
1 parent 86cd245 commit 146fdfb

36 files changed

+103
-55
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"dependencies": {
88
"@vue/repl": "^0.4.9",
9-
"@vue/theme": "^0.1.39",
9+
"@vue/theme": "^0.1.41",
1010
"dynamics.js": "^1.1.5",
1111
"gsap": "^3.9.0",
1212
"vitepress": "^0.21.5",

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/about/contribution-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
# Vue Contribution Guide

src/about/releases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Releases <Badge text="WIP" />
1+
# Releases <sup class="vt-badge">WIP</sup>
22

33
## Release Notes
44

src/about/v2-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Vue 2 vs. Vue 3 FAQ <Badge text="WIP" />
1+
# Vue 2 vs. Vue 3 FAQ <sup class="vt-badge">WIP</sup>

src/api/api.data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ function parsePageHeaders(link: string) {
5555
headers = h2s.map((h) =>
5656
h
5757
.slice(2)
58-
.replace(/<Badge.*/, '')
58+
.replace(/<sup class=.*/, '')
59+
.replace(/\\</g, '<')
5960
.replace(/`([^`]+)`/g, '$1')
6061
.trim()
6162
)

src/api/built-in-components.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
pageClass: api
3+
---
4+
15
# Built-in Components
26

37
:::info Registration and Usage
@@ -297,7 +301,7 @@ Renders its slot content to another part of the DOM.
297301

298302
- **See also:** [Guide - Teleport](/guide/built-ins/teleport.html)
299303

300-
## `<Suspense>` <Badge type="warning" text="experimental" />
304+
## `<Suspense>` <sup class="vt-badge warning">experimental</sup>
301305

302306
Used for orchestrating nested async dependencies in a component tree.
303307

src/api/built-in-directives.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ Dynamically bind one or more attributes, or a component prop to an expression.
266266
- **Modifiers:**
267267

268268
- `.camel` - transform the kebab-case attribute name into camelCase.
269-
- `.prop` - force a binding to be set as a DOM property. <Badge text="3.2+"/>
270-
- `.attr` - force a binding to be set as a DOM attribute. <Badge text="3.2+"/>
269+
- `.prop` - force a binding to be set as a DOM property. <sup class="vt-badge">3.2+</sup>
270+
- `.attr` - force a binding to be set as a DOM attribute. <sup class="vt-badge">3.2+</sup>
271271

272272
- **Usage:**
273273

@@ -463,7 +463,7 @@ Render the element and component once only, and skip future updates.
463463
- [Data Binding Syntax - interpolations](/guide/essentials/template-syntax.html#text)
464464
- [v-memo](#v-memo)
465465

466-
## v-memo <Badge text="3.2+"/>
466+
## v-memo <sup class="vt-badge">3.2+</sup>
467467

468468
- **Expects:** `any[]`
469469

src/api/built-in-special-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Used for binding [dynamic components](/guide/essentials/component-basics.html#dy
8888

8989
- **Expects:** `string | Component`
9090

91-
- **Usage on native elements** <Badge text="3.1+" />
91+
- **Usage on native elements** <sup class="vt-badge">3.1+</sup>
9292

9393
When the `is` attribute is used on a native HTML element, it will be interpreted as a [Customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example), which is a native web platform feature.
9494

src/api/composition-api-lifecycle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Registers a hook to be called when an error propagating from a descendent compon
220220

221221
- An `errorCaptured` hook can return `false` to prevent the error from propagating further. This is essentially saying "this error has been handled and should be ignored." It will prevent any additional `errorCaptured` hooks or `app.config.errorHandler` from being invoked for this error.
222222

223-
## onRenderTracked() <Badge type="warning" text="Dev only" />
223+
## onRenderTracked() <sup class="vt-badge warning">Dev only</sup>
224224

225225
Registers a debug hook to be called when a reactive dependency has been tracked by the component's render effect.
226226

@@ -243,7 +243,7 @@ Registers a debug hook to be called when a reactive dependency has been tracked
243243

244244
- **See also:** [Reactivity in Depth](/guide/extras/reactivity-in-depth.html)
245245

246-
## onRenderTriggered() <Badge type="warning" text="Dev only" />
246+
## onRenderTriggered() <sup class="vt-badge warning">Dev only</sup>
247247

248248
Registers a debug hook to be called when a reactive dependency triggers the component's render effect to be re-run.
249249

@@ -297,7 +297,7 @@ Registers a callback to be called after the component instance is removed from t
297297

298298
- **See also:** [Guide - Lifecycle of Cached Instance](/guide/built-ins/keep-alive.html#lifecycle-of-cached-instance)
299299

300-
## onServerPrefetch() <Badge text="SSR only" />
300+
## onServerPrefetch() <sup class="vt-badge">SSR only</sup>
301301

302302
Registers a async function to be resolved before the component instance is to be rendered on the server.
303303

src/api/options-lifecycle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Called when an error propagating from a descendent component has been captured.
209209

210210
- An `errorCaptured` hook can return `false` to prevent the error from propagating further. This is essentially saying "this error has been handled and should be ignored." It will prevent any additional `errorCaptured` hooks or `app.config.errorHandler` from being invoked for this error.
211211

212-
## renderTracked <Badge type="warning" text="Dev only" />
212+
## renderTracked <sup class="vt-badge warning">Dev only</sup>
213213

214214
Called when a reactive dependency has been tracked by the component's render effect.
215215

@@ -230,7 +230,7 @@ Called when a reactive dependency has been tracked by the component's render eff
230230
231231
- **See also:** [Reactivity in Depth](/guide/extras/reactivity-in-depth.html)
232232
233-
## renderTriggered <Badge type="warning" text="Dev only" />
233+
## renderTriggered <sup class="vt-badge warning">Dev only</sup>
234234
235235
Called when a reactive dependency triggers the component's render effect to be re-run.
236236
@@ -286,7 +286,7 @@ Called after the component instance is removed from the DOM as part of a tree ca
286286

287287
- **See also:** [Guide - Lifecycle of Cached Instance](/guide/built-ins/keep-alive.html#lifecycle-of-cached-instance)
288288

289-
## serverPrefetch <Badge text="SSR only" />
289+
## serverPrefetch <sup class="vt-badge">SSR only</sup>
290290

291291
Async function to be resolved before the component instance is to be rendered on the server.
292292

src/api/options-state.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ A function that returns the initial reactive state for the component instance.
88

99
```ts
1010
interface ComponentOptions {
11-
data?(this: ComponentPublicInstance, vm: ComponentPublicInstance): object
11+
data?(
12+
this: ComponentPublicInstance,
13+
vm: ComponentPublicInstance
14+
): object
1215
}
1316
```
1417

@@ -142,7 +145,10 @@ Declare computed properties to be exposed on the component instance.
142145
vm: ComponentPublicInstance
143146
) => T
144147

145-
type ComputedSetter<T> = (this: ComponentPublicInstance, value: T) => void
148+
type ComputedSetter<T> = (
149+
this: ComponentPublicInstance,
150+
value: T
151+
) => void
146152

147153
type WritableComputedOptions<T> = {
148154
get: ComputedGetter<T>
@@ -424,3 +430,40 @@ Declare the custom events emitted by the component.
424430
```
425431

426432
* **See also:** [Fallthrough Attributes](/guide/components/attrs.html)
433+
434+
## expose
435+
436+
Declare exposed public properties when the component instance is accessed by a parent via template refs.
437+
438+
- **Type**
439+
440+
```ts
441+
interface ComponentOptions {
442+
expose?: string[]
443+
}
444+
```
445+
446+
- **Details**
447+
448+
By default, a component instance exposes all instance properties to the parent when accessed via `$parent`, `$root`, or template refs. This can be undesirable since a component most likely have internal state or methods that should be kept private to avoid tight coupling.
449+
450+
The `expose` option expects a list of property name strings. When `expose` is used, only the properties explicitly listed will be exposed on the component's public instance.
451+
452+
`expose` only affects user-defined properties - it does not filter out built-in component instance properties.
453+
454+
- **Example**
455+
456+
```js
457+
export default {
458+
// only `publicMethod` will be available on the pubic instance
459+
expose: ['publicMethod'],
460+
methods: {
461+
publicMethod() {
462+
// ...
463+
},
464+
privateMethod() {
465+
// ...
466+
}
467+
}
468+
}
469+
```

src/api/sfc-script-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ In addition, the awaited expression will be automatically compiled in a format t
230230
`async setup()` must be used in combination with `Suspense`, which is currently still an experimental feature. We plan to finalize and document it in a future release - but if you are curious now, you can refer to its [tests](https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/__tests__/components/Suspense.spec.ts) to see how it works.
231231
:::
232232

233-
## TypeScript-only Features <Badge type="ts" text="TS" />
233+
## TypeScript-only Features <sup class="vt-badge ts">TS</sup>
234234

235235
### Type-only props/emit declarations
236236

src/guide/best-practices/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
# Performance

src/guide/built-ins/suspense.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
# Suspense

src/guide/components/attrs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
# Fallthrough Attributes

src/guide/components/events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const emit = defineEmits<{
146146
</script>
147147
```
148148

149-
More details: [Typing Component Emits](/guide/typescript/composition-api.html#typing-component-emits) <Badge type="ts" text="TS" />
149+
More details: [Typing Component Emits](/guide/typescript/composition-api.html#typing-component-emits) <sup class="vt-badge ts">TS</sup>
150150

151151
</div>
152152
<div class="options-api">
@@ -162,7 +162,7 @@ export default {
162162
}
163163
```
164164

165-
See also: [Typing Component Emits](/guide/typescript/options-api.html#typing-component-emits) <Badge type="ts" text="TS" />
165+
See also: [Typing Component Emits](/guide/typescript/options-api.html#typing-component-emits) <sup class="vt-badge ts">TS</sup>
166166

167167
</div>
168168

src/guide/components/props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ This not only documents your component, but will also warn other developers usin
9292

9393
<div class="options-api">
9494

95-
See also: [Typing Component Props](/guide/typescript/options-api.html#typing-component-props) <Badge type="ts" text="TS" />
95+
See also: [Typing Component Props](/guide/typescript/options-api.html#typing-component-props) <sup class="vt-badge ts">TS</sup>
9696

9797
</div>
9898

@@ -109,7 +109,7 @@ defineProps<{
109109
</script>
110110
```
111111

112-
More details: [Typing Component Props](/guide/typescript/composition-api.html#typing-component-props) <Badge type="ts" text="TS" />
112+
More details: [Typing Component Props](/guide/typescript/composition-api.html#typing-component-props) <sup class="vt-badge ts">TS</sup>
113113

114114
</div>
115115

src/guide/components/provide-inject.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ import { myInjectionKey } from './keys.js'
350350
const injected = inject(myInjectionKey)
351351
```
352352

353-
See also: [Typing Provide / Inject](/guide/typescript/composition-api.html#typing-provide-inject) <Badge type="ts" text="TS" />
353+
See also: [Typing Provide / Inject](/guide/typescript/composition-api.html#typing-provide-inject) <sup class="vt-badge ts">TS</sup>
354354

355355
</div>
356356

src/guide/essentials/component-basics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const props = defineProps(['title'])
219219
console.log(props.title)
220220
```
221221

222-
See also: [Typing Component Props](/guide/typescript/composition-api.html#typing-component-props) <Badge type="ts" text="TS" />
222+
See also: [Typing Component Props](/guide/typescript/composition-api.html#typing-component-props) <sup class="vt-badge ts">TS</sup>
223223

224224
If you are not using `<script setup>`, props should be declared using the `props` option, and the props object will be passed to `setup()` as the first argument:
225225

@@ -430,7 +430,7 @@ const emit = defineEmits(['enlarge-text'])
430430
emit('enlarge-text')
431431
```
432432

433-
See also: [Typing Component Emits](/guide/typescript/composition-api.html#typing-component-emits) <Badge type="ts" text="TS" />
433+
See also: [Typing Component Emits](/guide/typescript/composition-api.html#typing-component-emits) <sup class="vt-badge ts">TS</sup>
434434

435435
If you are not using `<script setup>`, you can declare emitted events using the `emits` option. You can access the `emit` function as a property of the setup context (passed to `setup()` as the second argument):
436436

src/guide/essentials/computed.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Try to change the value of the `books` array in the application `data` and you w
8989

9090
You can data-bind to computed properties in templates just like a normal property. Vue is aware that `this.publishedBooksMessage` depends on `this.author.books`, so it will update any bindings that depend on `this.publishedBooksMessage` when `this.author.books` changes.
9191

92-
See also: [Typing Computed Properties](/guide/typescript/options-api.html#typing-computed) <Badge type="ts" text="TS" />
92+
See also: [Typing Computed Properties](/guide/typescript/options-api.html#typing-computed) <sup class="vt-badge ts">TS</sup>
9393

9494
</div>
9595

@@ -126,7 +126,7 @@ Here we have declared a computed property `publishedBooksMessage`. The `computed
126126

127127
A computed property automatically tracks its reactive dependencies. Vue is aware that the computation of `publishedBooksMessage` depends on `author.books`, so it will update any bindings that depend on `publishedBooksMessage` when `author.books` changes.
128128

129-
See also: [Typing Computed](/guide/typescript/composition-api.html#typing-computed) <Badge type="ts" text="TS" />
129+
See also: [Typing Computed](/guide/typescript/composition-api.html#typing-computed) <sup class="vt-badge ts">TS</sup>
130130

131131
</div>
132132

src/guide/essentials/event-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ A method handler automatically receives the native DOM Event object that trigger
112112

113113
<div class="composition-api">
114114

115-
See also: [Typing Event Handlers](/guide/typescript/composition-api.html#typing-event-handlers) <Badge type="ts" text="TS" />
115+
See also: [Typing Event Handlers](/guide/typescript/composition-api.html#typing-event-handlers) <sup class="vt-badge ts">TS</sup>
116116

117117
</div>
118118
<div class="options-api">
119119

120-
See also: [Typing Event Handlers](/guide/typescript/options-api.html#typing-event-handlers) <Badge type="ts" text="TS" />
120+
See also: [Typing Event Handlers](/guide/typescript/options-api.html#typing-event-handlers) <sup class="vt-badge ts">TS</sup>
121121

122122
</div>
123123

src/guide/essentials/forms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
<script setup>

src/guide/essentials/reactivity-fundamentals.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
aside: deep
2+
outline: deep
33
---
44

55
# Reactivity Fundamentals
@@ -77,7 +77,7 @@ const state = reactive({ count: 0 })
7777

7878
Reactive objects are [JavaScript Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and behave just like normal objects. The difference is that Vue is able to track the property access and mutations of a reactive object. If you are curious about the details, we explain how Vue's reactivity system works in [Reactivity in Depth](/guide/extras/reactivity-in-depth.html) - but we recommend reading it after you have finished the main guide.
7979

80-
See also: [Typing Reactive](/guide/typescript/composition-api.html#typing-reactive) <Badge type="ts" text="TS" />
80+
See also: [Typing Reactive](/guide/typescript/composition-api.html#typing-reactive) <sup class="vt-badge ts">TS</sup>
8181

8282
To use reactive state in a component's template, declare and return them from a component's `setup()` function:
8383

@@ -388,7 +388,7 @@ count.value++
388388
console.log(count.value) // 1
389389
```
390390

391-
See also: [Typing Refs](/guide/typescript/composition-api.html#typing-ref) <Badge type="ts" text="TS" />
391+
See also: [Typing Refs](/guide/typescript/composition-api.html#typing-ref) <sup class="vt-badge ts">TS</sup>
392392

393393
Similar to properties on a reactive object, the `.value` property of a ref is reactive. In addition, when holding object types, ref automatically converts its `.value` with `reactive()`.
394394

@@ -555,7 +555,7 @@ export default {
555555

556556
<div class="composition-api">
557557

558-
## Reactivity Transform <Badge type="warning" text="experimental" /> \*\*
558+
## Reactivity Transform <sup class="vt-badge warning">experimental</sup> \*\*
559559

560560
Having to use `.value` with refs is a drawback imposed by the language constraints of JavaScript. However, with compile-time transforms we can improve the ergonomics by automatically appending `.value` in appropriate locations. Vue provides a compile-time transform that allows us to write the ealier "counter" example like this:
561561

0 commit comments

Comments
 (0)