@vue/language-service 1.7.10 → 1.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/template/en.json +26 -26
- package/out/helpers.d.ts +4 -4
- package/out/helpers.js +7 -25
- package/out/ideFeatures/nameCasing.d.ts +5 -4
- package/out/ideFeatures/nameCasing.js +9 -15
- package/out/languageService.js +2 -2
- package/out/plugins/vue-template.js +9 -16
- package/out/types.js +2 -2
- package/package.json +7 -7
package/data/template/en.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Transition",
|
|
6
6
|
"description": {
|
|
7
7
|
"kind": "markdown",
|
|
8
|
-
"value": "\nProvides animated transition effects to a **single** element or component.\n\n- **Props**\n\n ```ts\n interface TransitionProps {\n /**\n * Used to automatically generate transition CSS class names.\n * e.g. `name: 'fade'` will auto expand to `.fade-enter`,\n * `.fade-enter-active`, etc.\n */\n name?: string\n /**\n * Whether to apply CSS transition classes.\n * Default: true\n */\n css?: boolean\n /**\n * Specifies the type of transition events to wait for to\n * determine transition end timing.\n * Default behavior is auto detecting the type that has\n * longer duration.\n */\n type?: 'transition' | 'animation'\n /**\n * Specifies explicit durations of the transition.\n * Default behavior is wait for the first `transitionend`\n * or `animationend` event on the root transition element.\n */\n duration?: number | { enter: number; leave: number }\n /**\n * Controls the timing sequence of leaving/entering transitions.\n * Default behavior is simultaneous.\n */\n mode?: 'in-out' | 'out-in' | 'default'\n /**\n * Whether to apply transition on initial render.\n * Default: false\n */\n appear?: boolean\n\n /**\n * Props for customizing transition classes.\n * Use kebab-case in templates, e.g. enter-from-class=\"xxx\"\n */\n enterFromClass?: string\n enterActiveClass?: string\n enterToClass?: string\n appearFromClass?: string\n appearActiveClass?: string\n appearToClass?: string\n leaveFromClass?: string\n leaveActiveClass?: string\n leaveToClass?: string\n }\n ```\n\n- **Events**\n\n - `@before-enter`\n - `@before-leave`\n - `@enter`\n - `@leave`\n - `@appear`\n - `@after-enter`\n - `@after-leave`\n - `@after-appear`\n - `@enter-cancelled`\n - `@leave-cancelled` (`v-show` only)\n - `@appear-cancelled`\n\n- **Example**\n\n Simple element:\n\n ```html\n <Transition>\n <div v-if=\"ok\">toggled content</div>\n </Transition>\n ```\n\n Forcing a transition by changing the `key` attribute:\n
|
|
8
|
+
"value": "\nProvides animated transition effects to a **single** element or component.\n\n- **Props**\n\n ```ts\n interface TransitionProps {\n /**\n * Used to automatically generate transition CSS class names.\n * e.g. `name: 'fade'` will auto expand to `.fade-enter`,\n * `.fade-enter-active`, etc.\n */\n name?: string\n /**\n * Whether to apply CSS transition classes.\n * Default: true\n */\n css?: boolean\n /**\n * Specifies the type of transition events to wait for to\n * determine transition end timing.\n * Default behavior is auto detecting the type that has\n * longer duration.\n */\n type?: 'transition' | 'animation'\n /**\n * Specifies explicit durations of the transition.\n * Default behavior is wait for the first `transitionend`\n * or `animationend` event on the root transition element.\n */\n duration?: number | { enter: number; leave: number }\n /**\n * Controls the timing sequence of leaving/entering transitions.\n * Default behavior is simultaneous.\n */\n mode?: 'in-out' | 'out-in' | 'default'\n /**\n * Whether to apply transition on initial render.\n * Default: false\n */\n appear?: boolean\n\n /**\n * Props for customizing transition classes.\n * Use kebab-case in templates, e.g. enter-from-class=\"xxx\"\n */\n enterFromClass?: string\n enterActiveClass?: string\n enterToClass?: string\n appearFromClass?: string\n appearActiveClass?: string\n appearToClass?: string\n leaveFromClass?: string\n leaveActiveClass?: string\n leaveToClass?: string\n }\n ```\n\n- **Events**\n\n - `@before-enter`\n - `@before-leave`\n - `@enter`\n - `@leave`\n - `@appear`\n - `@after-enter`\n - `@after-leave`\n - `@after-appear`\n - `@enter-cancelled`\n - `@leave-cancelled` (`v-show` only)\n - `@appear-cancelled`\n\n- **Example**\n\n Simple element:\n\n ```html\n <Transition>\n <div v-if=\"ok\">toggled content</div>\n </Transition>\n ```\n\n Forcing a transition by changing the `key` attribute:\n\n ```html\n <Transition>\n <div :key=\"text\">{{ text }}</div>\n </Transition>\n ```\n\n Dynamic component, with transition mode + animate on appear:\n\n ```html\n <Transition name=\"fade\" mode=\"out-in\" appear>\n <component :is=\"view\"></component>\n </Transition>\n ```\n\n Listening to transition events:\n\n ```html\n <Transition @after-enter=\"onTransitionComplete\">\n <div v-show=\"ok\">toggled content</div>\n </Transition>\n ```\n\n- **See also** [`<Transition>` Guide](https://vuejs.org/guide/built-ins/transition.html)\n"
|
|
9
9
|
},
|
|
10
10
|
"attributes": [],
|
|
11
11
|
"references": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"name": "TransitionGroup",
|
|
40
40
|
"description": {
|
|
41
41
|
"kind": "markdown",
|
|
42
|
-
"value": "\nProvides transition effects for **multiple** elements or components in a list.\n\n- **Props**\n\n `<TransitionGroup>` accepts the same props as `<Transition>` except `mode`, plus two additional props:\n\n ```ts\n interface TransitionGroupProps extends Omit<TransitionProps, 'mode'> {\n /**\n * If not defined, renders as a fragment.\n */\n tag?: string\n /**\n * For customizing the CSS class applied during move transitions.\n * Use kebab-case in templates, e.g. move-class=\"xxx\"\n */\n moveClass?: string\n }\n ```\n\n- **Events**\n\n `<TransitionGroup>` emits the same events as `<Transition>`.\n\n- **Details**\n\n By default, `<TransitionGroup>` doesn't render a wrapper DOM element, but one can be defined via the `tag` prop.\n\n Note that every child in a `<transition-group>` must be [**uniquely keyed**](https://vuejs.org/guide/essentials/list.html#maintaining-state-with-key) for the animations to work properly.\n\n `<TransitionGroup>` supports moving transitions via CSS transform. When a child's position on screen has changed after an update, it will get applied a moving CSS class (auto generated from the `name` attribute or configured with the `move-class` prop). If the CSS `transform` property is \"transition-able\" when the moving class is applied, the element will be smoothly animated to its destination using the [FLIP technique](https://aerotwist.com/blog/flip-your-animations/).\n\n- **Example**\n\n ```html\n <TransitionGroup tag=\"ul\" name=\"slide\">\n <li v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </li>\n </TransitionGroup>\n ```\n\n- **See also
|
|
42
|
+
"value": "\nProvides transition effects for **multiple** elements or components in a list.\n\n- **Props**\n\n `<TransitionGroup>` accepts the same props as `<Transition>` except `mode`, plus two additional props:\n\n ```ts\n interface TransitionGroupProps extends Omit<TransitionProps, 'mode'> {\n /**\n * If not defined, renders as a fragment.\n */\n tag?: string\n /**\n * For customizing the CSS class applied during move transitions.\n * Use kebab-case in templates, e.g. move-class=\"xxx\"\n */\n moveClass?: string\n }\n ```\n\n- **Events**\n\n `<TransitionGroup>` emits the same events as `<Transition>`.\n\n- **Details**\n\n By default, `<TransitionGroup>` doesn't render a wrapper DOM element, but one can be defined via the `tag` prop.\n\n Note that every child in a `<transition-group>` must be [**uniquely keyed**](https://vuejs.org/guide/essentials/list.html#maintaining-state-with-key) for the animations to work properly.\n\n `<TransitionGroup>` supports moving transitions via CSS transform. When a child's position on screen has changed after an update, it will get applied a moving CSS class (auto generated from the `name` attribute or configured with the `move-class` prop). If the CSS `transform` property is \"transition-able\" when the moving class is applied, the element will be smoothly animated to its destination using the [FLIP technique](https://aerotwist.com/blog/flip-your-animations/).\n\n- **Example**\n\n ```html\n <TransitionGroup tag=\"ul\" name=\"slide\">\n <li v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </li>\n </TransitionGroup>\n ```\n\n- **See also** [Guide - TransitionGroup](https://vuejs.org/guide/built-ins/transition-group.html)\n"
|
|
43
43
|
},
|
|
44
44
|
"attributes": [],
|
|
45
45
|
"references": [
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"name": "KeepAlive",
|
|
74
74
|
"description": {
|
|
75
75
|
"kind": "markdown",
|
|
76
|
-
"value": "\nCaches dynamically toggled components wrapped inside.\n\n- **Props**\n\n ```ts\n interface KeepAliveProps {\n /**\n * If specified, only components with names matched by\n * `include` will be cached.\n */\n include?: MatchPattern\n /**\n * Any component with a name matched by `exclude` will\n * not be cached.\n */\n exclude?: MatchPattern\n /**\n * The maximum number of component instances to cache.\n */\n max?: number | string\n }\n\n type MatchPattern = string | RegExp | (string | RegExp)[]\n ```\n\n- **Details**\n\n When wrapped around a dynamic component, `<KeepAlive>` caches the inactive component instances without destroying them.\n\n There can only be one active component instance as the direct child of `<KeepAlive>` at any time.\n\n When a component is toggled inside `<KeepAlive>`, 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 `<KeepAlive>` as well as to all of its descendants.\n\n- **Example**\n\n Basic usage:\n\n ```html\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n When used with `v-if` / `v-else` branches, there must be only one component rendered at a time:\n\n ```html\n <KeepAlive>\n <comp-a v-if=\"a > 1\"></comp-a>\n <comp-b v-else></comp-b>\n </KeepAlive>\n ```\n\n Used together with `<Transition>`:\n\n ```html\n <Transition>\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n </Transition>\n ```\n\n Using `include` / `exclude`:\n\n ```html\n <!-- comma-delimited string -->\n <KeepAlive include=\"a,b\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- regex (use `v-bind`) -->\n <KeepAlive :include=\"/a|b/\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- Array (use `v-bind`) -->\n <KeepAlive :include=\"['a', 'b']\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n Usage with `max`:\n\n ```html\n <KeepAlive :max=\"10\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n- **See also
|
|
76
|
+
"value": "\nCaches dynamically toggled components wrapped inside.\n\n- **Props**\n\n ```ts\n interface KeepAliveProps {\n /**\n * If specified, only components with names matched by\n * `include` will be cached.\n */\n include?: MatchPattern\n /**\n * Any component with a name matched by `exclude` will\n * not be cached.\n */\n exclude?: MatchPattern\n /**\n * The maximum number of component instances to cache.\n */\n max?: number | string\n }\n\n type MatchPattern = string | RegExp | (string | RegExp)[]\n ```\n\n- **Details**\n\n When wrapped around a dynamic component, `<KeepAlive>` caches the inactive component instances without destroying them.\n\n There can only be one active component instance as the direct child of `<KeepAlive>` at any time.\n\n When a component is toggled inside `<KeepAlive>`, 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 `<KeepAlive>` as well as to all of its descendants.\n\n- **Example**\n\n Basic usage:\n\n ```html\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n When used with `v-if` / `v-else` branches, there must be only one component rendered at a time:\n\n ```html\n <KeepAlive>\n <comp-a v-if=\"a > 1\"></comp-a>\n <comp-b v-else></comp-b>\n </KeepAlive>\n ```\n\n Used together with `<Transition>`:\n\n ```html\n <Transition>\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n </Transition>\n ```\n\n Using `include` / `exclude`:\n\n ```html\n <!-- comma-delimited string -->\n <KeepAlive include=\"a,b\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- regex (use `v-bind`) -->\n <KeepAlive :include=\"/a|b/\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- Array (use `v-bind`) -->\n <KeepAlive :include=\"['a', 'b']\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n Usage with `max`:\n\n ```html\n <KeepAlive :max=\"10\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n- **See also** [Guide - KeepAlive](https://vuejs.org/guide/built-ins/keep-alive.html)\n"
|
|
77
77
|
},
|
|
78
78
|
"attributes": [],
|
|
79
79
|
"references": [
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"name": "Teleport",
|
|
108
108
|
"description": {
|
|
109
109
|
"kind": "markdown",
|
|
110
|
-
"value": "\nRenders its slot content to another part of the DOM.\n\n- **Props**\n\n ```ts\n interface TeleportProps {\n /**\n * Required. Specify target container.\n * Can either be a selector or an actual element.\n */\n to: string | HTMLElement\n /**\n * When `true`, the content will remain in its original\n * location instead of moved into the target container.\n * Can be changed dynamically.\n */\n disabled?: boolean\n }\n ```\n\n- **Example**\n\n Specifying target container:\n\n ```html\n <teleport to=\"#some-id\" />\n <teleport to=\".some-class\" />\n <teleport to=\"[data-teleport]\" />\n ```\n\n Conditionally disabling:\n\n ```html\n <teleport to=\"#popup\" :disabled=\"displayVideoInline\">\n <video src=\"./my-movie.mp4\">\n </teleport>\n ```\n\n- **See also
|
|
110
|
+
"value": "\nRenders its slot content to another part of the DOM.\n\n- **Props**\n\n ```ts\n interface TeleportProps {\n /**\n * Required. Specify target container.\n * Can either be a selector or an actual element.\n */\n to: string | HTMLElement\n /**\n * When `true`, the content will remain in its original\n * location instead of moved into the target container.\n * Can be changed dynamically.\n */\n disabled?: boolean\n }\n ```\n\n- **Example**\n\n Specifying target container:\n\n ```html\n <teleport to=\"#some-id\" />\n <teleport to=\".some-class\" />\n <teleport to=\"[data-teleport]\" />\n ```\n\n Conditionally disabling:\n\n ```html\n <teleport to=\"#popup\" :disabled=\"displayVideoInline\">\n <video src=\"./my-movie.mp4\">\n </teleport>\n ```\n\n- **See also** [Guide - Teleport](https://vuejs.org/guide/built-ins/teleport.html)\n"
|
|
111
111
|
},
|
|
112
112
|
"attributes": [],
|
|
113
113
|
"references": [
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"name": "Suspense",
|
|
142
142
|
"description": {
|
|
143
143
|
"kind": "markdown",
|
|
144
|
-
"value": "\nUsed for orchestrating nested async dependencies in a component tree.\n\n- **Props**\n\n ```ts\n interface SuspenseProps {\n timeout?: string | number\n }\n ```\n\n- **Events**\n\n - `@resolve`\n - `@pending`\n - `@fallback`\n\n- **Details**\n\n `<Suspense>` accepts two slots: the `#default` slot and the `#fallback` slot. It will display the content of the fallback slot while rendering the default slot in memory.\n\n If it encounters async dependencies ([Async Components](https://vuejs.org/guide/components/async.html) and components with [`async setup()`](https://vuejs.org/guide/built-ins/suspense.html#async-setup)) while rendering the default slot, it will wait until all of them are resolved before displaying the default slot.\n\n- **See also
|
|
144
|
+
"value": "\nUsed for orchestrating nested async dependencies in a component tree.\n\n- **Props**\n\n ```ts\n interface SuspenseProps {\n timeout?: string | number\n }\n ```\n\n- **Events**\n\n - `@resolve`\n - `@pending`\n - `@fallback`\n\n- **Details**\n\n `<Suspense>` accepts two slots: the `#default` slot and the `#fallback` slot. It will display the content of the fallback slot while rendering the default slot in memory.\n\n If it encounters async dependencies ([Async Components](https://vuejs.org/guide/components/async.html) and components with [`async setup()`](https://vuejs.org/guide/built-ins/suspense.html#async-setup)) while rendering the default slot, it will wait until all of them are resolved before displaying the default slot.\n\n- **See also** [Guide - Suspense](https://vuejs.org/guide/built-ins/suspense.html)\n"
|
|
145
145
|
},
|
|
146
146
|
"attributes": [],
|
|
147
147
|
"references": [
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"name": "component",
|
|
176
176
|
"description": {
|
|
177
177
|
"kind": "markdown",
|
|
178
|
-
"value": "\nA \"meta component\" for rendering dynamic components or elements.\n\n- **Props**\n\n ```ts\n interface DynamicComponentProps {\n is: string | Component\n }\n ```\n\n- **Details**\n\n The actual component to render is determined by the `is` prop.\n\n - When `is` is a string, it could be either an HTML tag name or a component's registered name.\n\n - Alternatively, `is` can also be directly bound to the definition of a component.\n\n- **Example**\n\n Rendering components by registered name (Options API):\n\n ```vue\n <script>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n\n export default {\n components: { Foo, Bar },\n data() {\n return {\n view: 'Foo'\n }\n }\n }\n </script>\n\n <template>\n <component :is=\"view\" />\n </template>\n ```\n\n Rendering components by definition (Composition API with `<script setup>`):\n\n ```vue\n <script setup>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n </script>\n\n <template>\n <component :is=\"Math.random() > 0.5 ? Foo : Bar\" />\n </template>\n ```\n\n Rendering HTML elements:\n\n ```html\n <component :is=\"href ? 'a' : 'span'\"></component>\n ```\n\n The [built-in components](./built-in-components) can all be passed to `is`, but you must register them if you want to pass them by name. For example:\n\n ```vue\n <script>\n import { Transition, TransitionGroup } from 'vue'\n\n export default {\n components: {\n Transition,\n TransitionGroup\n }\n }\n </script>\n\n <template>\n <component :is=\"isGroup ? 'TransitionGroup' : 'Transition'\">\n ...\n </component>\n </template>\n ```\n\n Registration is not required if you pass the component itself to `is` rather than its name, e.g. in `<script setup>`.\n\n If `v-model` is used on a `<component>` tag, the template compiler will expand it to a `modelValue` prop and `update:modelValue` event listener, much like it would for any other component. However, this won't be compatible with native HTML elements, such as `<input>` or `<select>`. As a result, using `v-model` with a dynamically created native element won't work:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const tag = ref('input')\n const username = ref('')\n </script>\n\n <template>\n <!-- This won't work as 'input' is a native HTML element -->\n <component :is=\"tag\" v-model=\"username\" />\n </template>\n ```\n\n In practice, this edge case isn't common as native form fields are typically wrapped in components in real applications. If you do need to use a native element directly then you can split the `v-model` into an attribute and event manually.\n\n- **See also
|
|
178
|
+
"value": "\nA \"meta component\" for rendering dynamic components or elements.\n\n- **Props**\n\n ```ts\n interface DynamicComponentProps {\n is: string | Component\n }\n ```\n\n- **Details**\n\n The actual component to render is determined by the `is` prop.\n\n - When `is` is a string, it could be either an HTML tag name or a component's registered name.\n\n - Alternatively, `is` can also be directly bound to the definition of a component.\n\n- **Example**\n\n Rendering components by registered name (Options API):\n\n ```vue\n <script>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n\n export default {\n components: { Foo, Bar },\n data() {\n return {\n view: 'Foo'\n }\n }\n }\n </script>\n\n <template>\n <component :is=\"view\" />\n </template>\n ```\n\n Rendering components by definition (Composition API with `<script setup>`):\n\n ```vue\n <script setup>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n </script>\n\n <template>\n <component :is=\"Math.random() > 0.5 ? Foo : Bar\" />\n </template>\n ```\n\n Rendering HTML elements:\n\n ```html\n <component :is=\"href ? 'a' : 'span'\"></component>\n ```\n\n The [built-in components](./built-in-components) can all be passed to `is`, but you must register them if you want to pass them by name. For example:\n\n ```vue\n <script>\n import { Transition, TransitionGroup } from 'vue'\n\n export default {\n components: {\n Transition,\n TransitionGroup\n }\n }\n </script>\n\n <template>\n <component :is=\"isGroup ? 'TransitionGroup' : 'Transition'\">\n ...\n </component>\n </template>\n ```\n\n Registration is not required if you pass the component itself to `is` rather than its name, e.g. in `<script setup>`.\n\n If `v-model` is used on a `<component>` tag, the template compiler will expand it to a `modelValue` prop and `update:modelValue` event listener, much like it would for any other component. However, this won't be compatible with native HTML elements, such as `<input>` or `<select>`. As a result, using `v-model` with a dynamically created native element won't work:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const tag = ref('input')\n const username = ref('')\n </script>\n\n <template>\n <!-- This won't work as 'input' is a native HTML element -->\n <component :is=\"tag\" v-model=\"username\" />\n </template>\n ```\n\n In practice, this edge case isn't common as native form fields are typically wrapped in components in real applications. If you do need to use a native element directly then you can split the `v-model` into an attribute and event manually.\n\n- **See also** [Dynamic Components](https://vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
179
179
|
},
|
|
180
180
|
"attributes": [],
|
|
181
181
|
"references": [
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
"name": "slot",
|
|
210
210
|
"description": {
|
|
211
211
|
"kind": "markdown",
|
|
212
|
-
"value": "\nDenotes slot content outlets in templates.\n\n- **Props**\n\n ```ts\n interface SlotProps {\n /**\n * Any props passed to <slot> to passed as arguments\n * for scoped slots\n */\n [key: string]: any\n /**\n * Reserved for specifying slot name.\n */\n name?: string\n }\n ```\n\n- **Details**\n\n The `<slot>` element can use the `name` attribute to specify a slot name. When no `name` is specified, it will render the default slot. Additional attributes passed to the slot element will be passed as slot props to the scoped slot defined in the parent.\n\n The element itself will be replaced by its matched slot content.\n\n `<slot>` elements in Vue templates are compiled into JavaScript, so they are not to be confused with [native `<slot>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot).\n\n- **See also
|
|
212
|
+
"value": "\nDenotes slot content outlets in templates.\n\n- **Props**\n\n ```ts\n interface SlotProps {\n /**\n * Any props passed to <slot> to passed as arguments\n * for scoped slots\n */\n [key: string]: any\n /**\n * Reserved for specifying slot name.\n */\n name?: string\n }\n ```\n\n- **Details**\n\n The `<slot>` element can use the `name` attribute to specify a slot name. When no `name` is specified, it will render the default slot. Additional attributes passed to the slot element will be passed as slot props to the scoped slot defined in the parent.\n\n The element itself will be replaced by its matched slot content.\n\n `<slot>` elements in Vue templates are compiled into JavaScript, so they are not to be confused with [native `<slot>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot).\n\n- **See also** [Component - Slots](https://vuejs.org/guide/components/slots.html)\n"
|
|
213
213
|
},
|
|
214
214
|
"attributes": [],
|
|
215
215
|
"references": [
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"name": "template",
|
|
244
244
|
"description": {
|
|
245
245
|
"kind": "markdown",
|
|
246
|
-
"value": "\nThe `<template>` tag is used as a placeholder when we want to use a built-in directive without rendering an element in the DOM.\n\n- **Details
|
|
246
|
+
"value": "\nThe `<template>` tag is used as a placeholder when we want to use a built-in directive without rendering an element in the DOM.\n\n- **Details**\n\n The special handling for `<template>` is only triggered if it is used with one of these directives:\n\n - `v-if`, `v-else-if`, or `v-else`\n - `v-for`\n - `v-slot`\n\n If none of those directives are present then it will be rendered as a [native `<template>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) instead.\n\n A `<template>` with a `v-for` can also have a [`key` attribute](https://vuejs.org/api/built-in-special-attributes.html#key). All other attributes and directives will be discarded, as they aren't meaningful without a corresponding element.\n\n Single-file components use a [top-level `<template>` tag](https://vuejs.org/api/sfc-spec.html#language-blocks) to wrap the entire template. That usage is separate from the use of `<template>` described above. That top-level tag is not part of the template itself and doesn't support template syntax, such as directives.\n\n- **See also**\n - [Guide - `v-if` on `<template>`](https://vuejs.org/guide/essentials/conditional.html#v-if-on-template)\n - [Guide - `v-for` on `<template>`](https://vuejs.org/guide/essentials/list.html#v-for-on-template)\n - [Guide - Named slots](https://vuejs.org/guide/components/slots.html#named-slots)\n"
|
|
247
247
|
},
|
|
248
248
|
"attributes": [],
|
|
249
249
|
"references": [
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
"name": "v-text",
|
|
280
280
|
"description": {
|
|
281
281
|
"kind": "markdown",
|
|
282
|
-
"value": "\nUpdate the element's text content.\n\n- **Expects:** `string`\n\n- **Details**\n\n `v-text` works by setting the element's [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) property, so it will overwrite any existing content inside the element. If you need to update the part of `textContent`, you should use [mustache interpolations](https://vuejs.org/guide/essentials/template-syntax.html#text-interpolation) instead.\n\n- **Example**\n\n ```html\n <span v-text=\"msg\"></span>\n <!-- same as -->\n <span>{{msg}}</span>\n ```\n\n- **See also
|
|
282
|
+
"value": "\nUpdate the element's text content.\n\n- **Expects:** `string`\n\n- **Details**\n\n `v-text` works by setting the element's [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) property, so it will overwrite any existing content inside the element. If you need to update the part of `textContent`, you should use [mustache interpolations](https://vuejs.org/guide/essentials/template-syntax.html#text-interpolation) instead.\n\n- **Example**\n\n ```html\n <span v-text=\"msg\"></span>\n <!-- same as -->\n <span>{{msg}}</span>\n ```\n\n- **See also** [Template Syntax - Text Interpolation](https://vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n"
|
|
283
283
|
},
|
|
284
284
|
"references": [
|
|
285
285
|
{
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
"name": "v-html",
|
|
313
313
|
"description": {
|
|
314
314
|
"kind": "markdown",
|
|
315
|
-
"value": "\nUpdate the element's [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML).\n\n- **Expects:** `string`\n\n- **Details
|
|
315
|
+
"value": "\nUpdate the element's [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML).\n\n- **Expects:** `string`\n\n- **Details**\n\n Contents of `v-html` are inserted as plain HTML - Vue template syntax will not be processed. If you find yourself trying to compose templates using `v-html`, try to rethink the solution by using components instead.\n\n ::: warning Security Note\n Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use `v-html` on trusted content and **never** on user-provided content.\n :::\n\n In [Single-File Components](https://vuejs.org/guide/scaling-up/sfc.html), `scoped` styles will not apply to content inside `v-html`, because that HTML is not processed by Vue's template compiler. If you want to target `v-html` content with scoped CSS, you can instead use [CSS modules](./sfc-css-features#css-modules) or an additional, global `<style>` element with a manual scoping strategy such as BEM.\n\n- **Example**\n\n ```html\n <div v-html=\"html\"></div>\n ```\n\n- **See also** [Template Syntax - Raw HTML](https://vuejs.org/guide/essentials/template-syntax.html#raw-html)\n"
|
|
316
316
|
},
|
|
317
317
|
"references": [
|
|
318
318
|
{
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
"name": "v-show",
|
|
346
346
|
"description": {
|
|
347
347
|
"kind": "markdown",
|
|
348
|
-
"value": "\nToggle the element's visibility based on the truthy-ness of the expression value.\n\n- **Expects:** `any`\n\n- **Details**\n\n `v-show` works by setting the `display` CSS property via inline styles, and will try to respect the initial `display` value when the element is visible. It also triggers transitions when its condition changes.\n\n- **See also
|
|
348
|
+
"value": "\nToggle the element's visibility based on the truthy-ness of the expression value.\n\n- **Expects:** `any`\n\n- **Details**\n\n `v-show` works by setting the `display` CSS property via inline styles, and will try to respect the initial `display` value when the element is visible. It also triggers transitions when its condition changes.\n\n- **See also** [Conditional Rendering - v-show](https://vuejs.org/guide/essentials/conditional.html#v-show)\n"
|
|
349
349
|
},
|
|
350
350
|
"references": [
|
|
351
351
|
{
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
"name": "v-if",
|
|
379
379
|
"description": {
|
|
380
380
|
"kind": "markdown",
|
|
381
|
-
"value": "\nConditionally render an element or a template fragment based on the truthy-ness of the expression value.\n\n- **Expects:** `any`\n\n- **Details**\n\n When a `v-if` element is toggled, the element and its contained directives / components are destroyed and re-constructed. If the initial condition is falsy, then the inner content won't be rendered at all.\n\n Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n This directive triggers transitions when its condition changes.\n\n When used together, `v-if` has a higher priority than `v-for`. We don't recommend using these two directives together on one element — see the [list rendering guide](https://vuejs.org/guide/essentials/list.html#v-for-with-v-if) for details.\n\n- **See also
|
|
381
|
+
"value": "\nConditionally render an element or a template fragment based on the truthy-ness of the expression value.\n\n- **Expects:** `any`\n\n- **Details**\n\n When a `v-if` element is toggled, the element and its contained directives / components are destroyed and re-constructed. If the initial condition is falsy, then the inner content won't be rendered at all.\n\n Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n This directive triggers transitions when its condition changes.\n\n When used together, `v-if` has a higher priority than `v-for`. We don't recommend using these two directives together on one element — see the [list rendering guide](https://vuejs.org/guide/essentials/list.html#v-for-with-v-if) for details.\n\n- **See also** [Conditional Rendering - v-if](https://vuejs.org/guide/essentials/conditional.html#v-if)\n"
|
|
382
382
|
},
|
|
383
383
|
"references": [
|
|
384
384
|
{
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
"valueSet": "v",
|
|
413
413
|
"description": {
|
|
414
414
|
"kind": "markdown",
|
|
415
|
-
"value": "\nDenote the \"else block\" for `v-if` or a `v-if` / `v-else-if` chain.\n\n- **Does not expect expression**\n\n- **Details**\n\n - Restriction: previous sibling element must have `v-if` or `v-else-if`.\n\n - Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n- **Example**\n\n ```html\n <div v-if=\"Math.random() > 0.5\">\n Now you see me\n </div>\n <div v-else>\n Now you don't\n </div>\n ```\n\n- **See also
|
|
415
|
+
"value": "\nDenote the \"else block\" for `v-if` or a `v-if` / `v-else-if` chain.\n\n- **Does not expect expression**\n\n- **Details**\n\n - Restriction: previous sibling element must have `v-if` or `v-else-if`.\n\n - Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n- **Example**\n\n ```html\n <div v-if=\"Math.random() > 0.5\">\n Now you see me\n </div>\n <div v-else>\n Now you don't\n </div>\n ```\n\n- **See also** [Conditional Rendering - v-else](https://vuejs.org/guide/essentials/conditional.html#v-else)\n"
|
|
416
416
|
},
|
|
417
417
|
"references": [
|
|
418
418
|
{
|
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
"name": "v-else-if",
|
|
446
446
|
"description": {
|
|
447
447
|
"kind": "markdown",
|
|
448
|
-
"value": "\nDenote the \"else if block\" for `v-if`. Can be chained.\n\n- **Expects:** `any`\n\n- **Details**\n\n - Restriction: previous sibling element must have `v-if` or `v-else-if`.\n\n - Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n- **Example**\n\n ```html\n <div v-if=\"type === 'A'\">\n A\n </div>\n <div v-else-if=\"type === 'B'\">\n B\n </div>\n <div v-else-if=\"type === 'C'\">\n C\n </div>\n <div v-else>\n Not A/B/C\n </div>\n ```\n\n- **See also
|
|
448
|
+
"value": "\nDenote the \"else if block\" for `v-if`. Can be chained.\n\n- **Expects:** `any`\n\n- **Details**\n\n - Restriction: previous sibling element must have `v-if` or `v-else-if`.\n\n - Can be used on `<template>` to denote a conditional block containing only text or multiple elements.\n\n- **Example**\n\n ```html\n <div v-if=\"type === 'A'\">\n A\n </div>\n <div v-else-if=\"type === 'B'\">\n B\n </div>\n <div v-else-if=\"type === 'C'\">\n C\n </div>\n <div v-else>\n Not A/B/C\n </div>\n ```\n\n- **See also** [Conditional Rendering - v-else-if](https://vuejs.org/guide/essentials/conditional.html#v-else-if)\n"
|
|
449
449
|
},
|
|
450
450
|
"references": [
|
|
451
451
|
{
|
|
@@ -478,7 +478,7 @@
|
|
|
478
478
|
"name": "v-for",
|
|
479
479
|
"description": {
|
|
480
480
|
"kind": "markdown",
|
|
481
|
-
"value": "\nRender the element or template block multiple times based on the source data.\n\n- **Expects:** `Array | Object | number | string | Iterable`\n\n- **Details**\n\n The directive's value must use the special syntax `alias in expression` to provide an alias for the current element being iterated on:\n\n ```html\n <div v-for=\"item in items\">\n {{ item.text }}\n </div>\n ```\n\n Alternatively, you can also specify an alias for the index (or the key if used on an Object):\n\n ```html\n <div v-for=\"(item, index) in items\"></div>\n <div v-for=\"(value, key) in object\"></div>\n <div v-for=\"(value, name, index) in object\"></div>\n ```\n\n The default behavior of `v-for` will try to patch the elements in-place without moving them. To force it to reorder elements, you should provide an ordering hint with the `key` special attribute:\n\n ```html\n <div v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </div>\n ```\n\n `v-for` can also work on values that implement the [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), including native `Map` and `Set`.\n\n- **See also
|
|
481
|
+
"value": "\nRender the element or template block multiple times based on the source data.\n\n- **Expects:** `Array | Object | number | string | Iterable`\n\n- **Details**\n\n The directive's value must use the special syntax `alias in expression` to provide an alias for the current element being iterated on:\n\n ```html\n <div v-for=\"item in items\">\n {{ item.text }}\n </div>\n ```\n\n Alternatively, you can also specify an alias for the index (or the key if used on an Object):\n\n ```html\n <div v-for=\"(item, index) in items\"></div>\n <div v-for=\"(value, key) in object\"></div>\n <div v-for=\"(value, name, index) in object\"></div>\n ```\n\n The default behavior of `v-for` will try to patch the elements in-place without moving them. To force it to reorder elements, you should provide an ordering hint with the `key` special attribute:\n\n ```html\n <div v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </div>\n ```\n\n `v-for` can also work on values that implement the [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), including native `Map` and `Set`.\n\n- **See also**\n - [List Rendering](https://vuejs.org/guide/essentials/list.html)\n"
|
|
482
482
|
},
|
|
483
483
|
"references": [
|
|
484
484
|
{
|
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
"name": "v-on",
|
|
512
512
|
"description": {
|
|
513
513
|
"kind": "markdown",
|
|
514
|
-
"value": "\nAttach an event listener to the element.\n\n- **Shorthand:** `@`\n\n- **Expects:** `Function | Inline Statement | Object (without argument)`\n\n- **Argument:** `event` (optional if using Object syntax)\n\n- **Modifiers
|
|
514
|
+
"value": "\nAttach an event listener to the element.\n\n- **Shorthand:** `@`\n\n- **Expects:** `Function | Inline Statement | Object (without argument)`\n\n- **Argument:** `event` (optional if using Object syntax)\n\n- **Modifiers**\n\n - `.stop` - call `event.stopPropagation()`.\n - `.prevent` - call `event.preventDefault()`.\n - `.capture` - add event listener in capture mode.\n - `.self` - only trigger handler if event was dispatched from this element.\n - `.{keyAlias}` - only trigger handler on certain keys.\n - `.once` - trigger handler at most once.\n - `.left` - only trigger handler for left button mouse events.\n - `.right` - only trigger handler for right button mouse events.\n - `.middle` - only trigger handler for middle button mouse events.\n - `.passive` - attaches a DOM event with `{ passive: true }`.\n\n- **Details**\n\n The event type is denoted by the argument. The expression can be a method name, an inline statement, or omitted if there are modifiers present.\n\n When used on a normal element, it listens to [**native DOM events**](https://developer.mozilla.org/en-US/docs/Web/Events) only. When used on a custom element component, it listens to **custom events** emitted on that child component.\n\n When listening to native DOM events, the method receives the native event as the only argument. If using inline statement, the statement has access to the special `$event` property: `v-on:click=\"handle('ok', $event)\"`.\n\n `v-on` also supports binding to an object of event / listener pairs without an argument. Note when using the object syntax, it does not support any modifiers.\n\n- **Example**\n\n ```html\n <!-- method handler -->\n <button v-on:click=\"doThis\"></button>\n\n <!-- dynamic event -->\n <button v-on:[event]=\"doThis\"></button>\n\n <!-- inline statement -->\n <button v-on:click=\"doThat('hello', $event)\"></button>\n\n <!-- shorthand -->\n <button @click=\"doThis\"></button>\n\n <!-- shorthand dynamic event -->\n <button @[event]=\"doThis\"></button>\n\n <!-- stop propagation -->\n <button @click.stop=\"doThis\"></button>\n\n <!-- prevent default -->\n <button @click.prevent=\"doThis\"></button>\n\n <!-- prevent default without expression -->\n <form @submit.prevent></form>\n\n <!-- chain modifiers -->\n <button @click.stop.prevent=\"doThis\"></button>\n\n <!-- key modifier using keyAlias -->\n <input @keyup.enter=\"onEnter\" />\n\n <!-- the click event will be triggered at most once -->\n <button v-on:click.once=\"doThis\"></button>\n\n <!-- object syntax -->\n <button v-on=\"{ mousedown: doThis, mouseup: doThat }\"></button>\n ```\n\n Listening to custom events on a child component (the handler is called when \"my-event\" is emitted on the child):\n\n ```html\n <MyComponent @my-event=\"handleThis\" />\n\n <!-- inline statement -->\n <MyComponent @my-event=\"handleThis(123, $event)\" />\n ```\n\n- **See also**\n - [Event Handling](https://vuejs.org/guide/essentials/event-handling.html)\n - [Components - Custom Events](https://vuejs.org/guide/essentials/component-basics.html#listening-to-events)\n"
|
|
515
515
|
},
|
|
516
516
|
"references": [
|
|
517
517
|
{
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
"name": "v-bind",
|
|
545
545
|
"description": {
|
|
546
546
|
"kind": "markdown",
|
|
547
|
-
"value": "\nDynamically bind one or more attributes, or a component prop to an expression.\n\n- **Shorthand:** `:` or `.` (when using `.prop` modifier)\n\n- **Expects:** `any (with argument) | Object (without argument)`\n\n- **Argument:** `attrOrProp (optional)`\n\n- **Modifiers
|
|
547
|
+
"value": "\nDynamically bind one or more attributes, or a component prop to an expression.\n\n- **Shorthand:** `:` or `.` (when using `.prop` modifier)\n\n- **Expects:** `any (with argument) | Object (without argument)`\n\n- **Argument:** `attrOrProp (optional)`\n\n- **Modifiers**\n\n - `.camel` - transform the kebab-case attribute name into camelCase.\n - `.prop` - force a binding to be set as a DOM property. <sup class=\"vt-badge\">3.2+</sup>\n - `.attr` - force a binding to be set as a DOM attribute. <sup class=\"vt-badge\">3.2+</sup>\n\n- **Usage**\n\n When used to bind the `class` or `style` attribute, `v-bind` supports additional value types such as Array or Objects. See linked guide section below for more details.\n\n When setting a binding on an element, Vue by default checks whether the element has the key defined as a property using an `in` operator check. If the property is defined, Vue will set the value as a DOM property instead of an attribute. This should work in most cases, but you can override this behavior by explicitly using `.prop` or `.attr` modifiers. This is sometimes necessary, especially when [working with custom elements](https://vuejs.org/guide/extras/web-components.html#passing-dom-properties).\n\n When used for component prop binding, the prop must be properly declared in the child component.\n\n When used without an argument, can be used to bind an object containing attribute name-value pairs.\n\n- **Example**\n\n ```html\n <!-- bind an attribute -->\n <img v-bind:src=\"imageSrc\" />\n\n <!-- dynamic attribute name -->\n <button v-bind:[key]=\"value\"></button>\n\n <!-- shorthand -->\n <img :src=\"imageSrc\" />\n\n <!-- shorthand dynamic attribute name -->\n <button :[key]=\"value\"></button>\n\n <!-- with inline string concatenation -->\n <img :src=\"'/path/to/images/' + fileName\" />\n\n <!-- class binding -->\n <div :class=\"{ red: isRed }\"></div>\n <div :class=\"[classA, classB]\"></div>\n <div :class=\"[classA, { classB: isB, classC: isC }]\"></div>\n\n <!-- style binding -->\n <div :style=\"{ fontSize: size + 'px' }\"></div>\n <div :style=\"[styleObjectA, styleObjectB]\"></div>\n\n <!-- binding an object of attributes -->\n <div v-bind=\"{ id: someProp, 'other-attr': otherProp }\"></div>\n\n <!-- prop binding. \"prop\" must be declared in the child component. -->\n <MyComponent :prop=\"someThing\" />\n\n <!-- pass down parent props in common with a child component -->\n <MyComponent v-bind=\"$props\" />\n\n <!-- XLink -->\n <svg><a :xlink:special=\"foo\"></a></svg>\n ```\n\n The `.prop` modifier also has a dedicated shorthand, `.`:\n\n ```html\n <div :someProperty.prop=\"someObject\"></div>\n\n <!-- equivalent to -->\n <div .someProperty=\"someObject\"></div>\n ```\n\n The `.camel` modifier allows camelizing a `v-bind` attribute name when using in-DOM templates, e.g. the SVG `viewBox` attribute:\n\n ```html\n <svg :view-box.camel=\"viewBox\"></svg>\n ```\n\n `.camel` is not needed if you are using string templates, or pre-compiling the template with a build step.\n\n- **See also**\n - [Class and Style Bindings](https://vuejs.org/guide/essentials/class-and-style.html)\n - [Components - Prop Passing Details](https://vuejs.org/guide/components/props.html#prop-passing-details)\n"
|
|
548
548
|
},
|
|
549
549
|
"references": [
|
|
550
550
|
{
|
|
@@ -577,7 +577,7 @@
|
|
|
577
577
|
"name": "v-model",
|
|
578
578
|
"description": {
|
|
579
579
|
"kind": "markdown",
|
|
580
|
-
"value": "\nCreate a two-way binding on a form input element or a component.\n\n- **Expects:** varies based on value of form inputs element or output of components\n\n- **Limited to:**\n\n - `<input>`\n - `<select>`\n - `<textarea>`\n - components\n\n- **Modifiers
|
|
580
|
+
"value": "\nCreate a two-way binding on a form input element or a component.\n\n- **Expects:** varies based on value of form inputs element or output of components\n\n- **Limited to:**\n\n - `<input>`\n - `<select>`\n - `<textarea>`\n - components\n\n- **Modifiers**\n\n - [`.lazy`](https://vuejs.org/guide/essentials/forms.html#lazy) - listen to `change` events instead of `input`\n - [`.number`](https://vuejs.org/guide/essentials/forms.html#number) - cast valid input string to numbers\n - [`.trim`](https://vuejs.org/guide/essentials/forms.html#trim) - trim input\n\n- **See also**\n\n - [Form Input Bindings](https://vuejs.org/guide/essentials/forms.html)\n - [Component Events - Usage with `v-model`](https://vuejs.org/guide/components/v-model.html)\n"
|
|
581
581
|
},
|
|
582
582
|
"references": [
|
|
583
583
|
{
|
|
@@ -610,7 +610,7 @@
|
|
|
610
610
|
"name": "v-slot",
|
|
611
611
|
"description": {
|
|
612
612
|
"kind": "markdown",
|
|
613
|
-
"value": "\nDenote named slots or scoped slots that expect to receive props.\n\n- **Shorthand:** `#`\n\n- **Expects:** JavaScript expression that is valid in a function argument position, including support for destructuring. Optional - only needed if expecting props to be passed to the slot.\n\n- **Argument:** slot name (optional, defaults to `default`)\n\n- **Limited to:**\n\n - `<template>`\n - [components](https://vuejs.org/guide/components/slots.html#scoped-slots) (for a lone default slot with props)\n\n- **Example
|
|
613
|
+
"value": "\nDenote named slots or scoped slots that expect to receive props.\n\n- **Shorthand:** `#`\n\n- **Expects:** JavaScript expression that is valid in a function argument position, including support for destructuring. Optional - only needed if expecting props to be passed to the slot.\n\n- **Argument:** slot name (optional, defaults to `default`)\n\n- **Limited to:**\n\n - `<template>`\n - [components](https://vuejs.org/guide/components/slots.html#scoped-slots) (for a lone default slot with props)\n\n- **Example**\n\n ```html\n <!-- Named slots -->\n <BaseLayout>\n <template v-slot:header>\n Header content\n </template>\n\n <template v-slot:default>\n Default slot content\n </template>\n\n <template v-slot:footer>\n Footer content\n </template>\n </BaseLayout>\n\n <!-- Named slot that receives props -->\n <InfiniteScroll>\n <template v-slot:item=\"slotProps\">\n <div class=\"item\">\n {{ slotProps.item.text }}\n </div>\n </template>\n </InfiniteScroll>\n\n <!-- Default slot that receive props, with destructuring -->\n <Mouse v-slot=\"{ x, y }\">\n Mouse position: {{ x }}, {{ y }}\n </Mouse>\n ```\n\n- **See also**\n - [Components - Slots](https://vuejs.org/guide/components/slots.html)\n"
|
|
614
614
|
},
|
|
615
615
|
"references": [
|
|
616
616
|
{
|
|
@@ -643,7 +643,7 @@
|
|
|
643
643
|
"name": "v-pre",
|
|
644
644
|
"description": {
|
|
645
645
|
"kind": "markdown",
|
|
646
|
-
"value": "\nSkip compilation for this element and all its children.\n\n- **Does not expect expression**\n\n- **Details**\n\n Inside the element with `v-pre`, all Vue template syntax will be preserved and rendered as-is. The most common use case of this is displaying raw mustache tags.\n\n- **Example
|
|
646
|
+
"value": "\nSkip compilation for this element and all its children.\n\n- **Does not expect expression**\n\n- **Details**\n\n Inside the element with `v-pre`, all Vue template syntax will be preserved and rendered as-is. The most common use case of this is displaying raw mustache tags.\n\n- **Example**\n\n ```html\n <span v-pre>{{ this will not be compiled }}</span>\n ```\n"
|
|
647
647
|
},
|
|
648
648
|
"references": [
|
|
649
649
|
{
|
|
@@ -676,7 +676,7 @@
|
|
|
676
676
|
"name": "v-once",
|
|
677
677
|
"description": {
|
|
678
678
|
"kind": "markdown",
|
|
679
|
-
"value": "\nRender the element and component once only, and skip future updates.\n\n- **Does not expect expression**\n\n- **Details**\n\n On subsequent re-renders, the element/component and all its children will be treated as static content and skipped. This can be used to optimize update performance.\n\n ```html\n <!-- single element -->\n <span v-once>This will never change: {{msg}}</span>\n <!-- the element have children -->\n <div v-once>\n <h1>comment</h1>\n <p>{{msg}}</p>\n </div>\n <!-- component -->\n <MyComponent v-once :comment=\"msg\"></MyComponent>\n <!-- `v-for` directive -->\n <ul>\n <li v-for=\"i in list\" v-once>{{i}}</li>\n </ul>\n ```\n\n Since 3.2, you can also memoize part of the template with invalidation conditions using [`v-memo`](#v-memo).\n\n- **See also
|
|
679
|
+
"value": "\nRender the element and component once only, and skip future updates.\n\n- **Does not expect expression**\n\n- **Details**\n\n On subsequent re-renders, the element/component and all its children will be treated as static content and skipped. This can be used to optimize update performance.\n\n ```html\n <!-- single element -->\n <span v-once>This will never change: {{msg}}</span>\n <!-- the element have children -->\n <div v-once>\n <h1>comment</h1>\n <p>{{msg}}</p>\n </div>\n <!-- component -->\n <MyComponent v-once :comment=\"msg\"></MyComponent>\n <!-- `v-for` directive -->\n <ul>\n <li v-for=\"i in list\" v-once>{{i}}</li>\n </ul>\n ```\n\n Since 3.2, you can also memoize part of the template with invalidation conditions using [`v-memo`](#v-memo).\n\n- **See also**\n - [Data Binding Syntax - interpolations](https://vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n - [v-memo](#v-memo)\n"
|
|
680
680
|
},
|
|
681
681
|
"references": [
|
|
682
682
|
{
|
|
@@ -709,7 +709,7 @@
|
|
|
709
709
|
"name": "v-memo",
|
|
710
710
|
"description": {
|
|
711
711
|
"kind": "markdown",
|
|
712
|
-
"value": "\n- **Expects:** `any[]`\n\n- **Details**\n\n Memoize a sub-tree of the template. Can be used on both elements and components. The directive expects a fixed-length array of dependency values to compare for the memoization. If every value in the array was the same as last render, then updates for the entire sub-tree will be skipped. For example:\n\n ```html\n <div v-memo=\"[valueA, valueB]\">\n ...\n </div>\n ```\n\n When the component re-renders, if both `valueA` and `valueB` remain the same, all updates for this `<div>` and its children will be skipped. In fact, even the Virtual DOM VNode creation will also be skipped since the memoized copy of the sub-tree can be reused.\n\n It is important to specify the memoization array correctly, otherwise we may skip updates that should indeed be applied. `v-memo` with an empty dependency array (`v-memo=\"[]\"`) would be functionally equivalent to `v-once`.\n\n **Usage with `v-for`**\n\n `v-memo` is provided solely for micro optimizations in performance-critical scenarios and should be rarely needed. The most common case where this may prove helpful is when rendering large `v-for` lists (where `length > 1000`):\n\n ```html\n <div v-for=\"item in list\" :key=\"item.id\" v-memo=\"[item.id === selected]\">\n <p>ID: {{ item.id }} - selected: {{ item.id === selected }}</p>\n <p>...more child nodes</p>\n </div>\n ```\n\n When the component's `selected` state changes, a large amount of VNodes will be created even though most of the items remained exactly the same. The `v-memo` usage here is essentially saying \"only update this item if it went from non-selected to selected, or the other way around\". This allows every unaffected item to reuse its previous VNode and skip diffing entirely. Note we don't need to include `item.id` in the memo dependency array here since Vue automatically infers it from the item's `:key`.\n\n :::warning\n When using `v-memo` with `v-for`, make sure they are used on the same element. **`v-memo` does not work inside `v-for`.**\n :::\n\n `v-memo` can also be used on components to manually prevent unwanted updates in certain edge cases where the child component update check has been de-optimized. But again, it is the developer's responsibility to specify correct dependency arrays to avoid skipping necessary updates.\n\n- **See also
|
|
712
|
+
"value": "\n- **Expects:** `any[]`\n\n- **Details**\n\n Memoize a sub-tree of the template. Can be used on both elements and components. The directive expects a fixed-length array of dependency values to compare for the memoization. If every value in the array was the same as last render, then updates for the entire sub-tree will be skipped. For example:\n\n ```html\n <div v-memo=\"[valueA, valueB]\">\n ...\n </div>\n ```\n\n When the component re-renders, if both `valueA` and `valueB` remain the same, all updates for this `<div>` and its children will be skipped. In fact, even the Virtual DOM VNode creation will also be skipped since the memoized copy of the sub-tree can be reused.\n\n It is important to specify the memoization array correctly, otherwise we may skip updates that should indeed be applied. `v-memo` with an empty dependency array (`v-memo=\"[]\"`) would be functionally equivalent to `v-once`.\n\n **Usage with `v-for`**\n\n `v-memo` is provided solely for micro optimizations in performance-critical scenarios and should be rarely needed. The most common case where this may prove helpful is when rendering large `v-for` lists (where `length > 1000`):\n\n ```html\n <div v-for=\"item in list\" :key=\"item.id\" v-memo=\"[item.id === selected]\">\n <p>ID: {{ item.id }} - selected: {{ item.id === selected }}</p>\n <p>...more child nodes</p>\n </div>\n ```\n\n When the component's `selected` state changes, a large amount of VNodes will be created even though most of the items remained exactly the same. The `v-memo` usage here is essentially saying \"only update this item if it went from non-selected to selected, or the other way around\". This allows every unaffected item to reuse its previous VNode and skip diffing entirely. Note we don't need to include `item.id` in the memo dependency array here since Vue automatically infers it from the item's `:key`.\n\n :::warning\n When using `v-memo` with `v-for`, make sure they are used on the same element. **`v-memo` does not work inside `v-for`.**\n :::\n\n `v-memo` can also be used on components to manually prevent unwanted updates in certain edge cases where the child component update check has been de-optimized. But again, it is the developer's responsibility to specify correct dependency arrays to avoid skipping necessary updates.\n\n- **See also**\n - [v-once](#v-once)\n"
|
|
713
713
|
},
|
|
714
714
|
"references": [
|
|
715
715
|
{
|
|
@@ -742,7 +742,7 @@
|
|
|
742
742
|
"name": "v-cloak",
|
|
743
743
|
"description": {
|
|
744
744
|
"kind": "markdown",
|
|
745
|
-
"value": "\nUsed to hide un-compiled template until it is ready.\n\n- **Does not expect expression**\n\n- **Details**\n\n **This directive is only needed in no-build-step setups.**\n\n When using in-DOM templates, there can be a \"flash of un-compiled templates\": the user may see raw mustache tags until the mounted component replaces them with rendered content.\n\n `v-cloak` will remain on the element until the associated component instance is mounted. Combined with CSS rules such as `[v-cloak] { display: none }`, it can be used to hide the raw templates until the component is ready.\n\n- **Example
|
|
745
|
+
"value": "\nUsed to hide un-compiled template until it is ready.\n\n- **Does not expect expression**\n\n- **Details**\n\n **This directive is only needed in no-build-step setups.**\n\n When using in-DOM templates, there can be a \"flash of un-compiled templates\": the user may see raw mustache tags until the mounted component replaces them with rendered content.\n\n `v-cloak` will remain on the element until the associated component instance is mounted. Combined with CSS rules such as `[v-cloak] { display: none }`, it can be used to hide the raw templates until the component is ready.\n\n- **Example**\n\n ```css\n [v-cloak] {\n display: none;\n }\n ```\n\n ```html\n <div v-cloak>\n {{ message }}\n </div>\n ```\n\n The `<div>` will not be visible until the compilation is done.\n"
|
|
746
746
|
},
|
|
747
747
|
"references": [
|
|
748
748
|
{
|
|
@@ -775,7 +775,7 @@
|
|
|
775
775
|
"name": "key",
|
|
776
776
|
"description": {
|
|
777
777
|
"kind": "markdown",
|
|
778
|
-
"value": "\nThe `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify vnodes when diffing the new list of nodes against the old list.\n\n- **Expects:** `number | string | symbol`\n\n- **Details**\n\n Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed / destroyed.\n\n Children of the same common parent must have **unique keys**. Duplicate keys will cause render errors.\n\n The most common use case is combined with `v-for`:\n\n ```html\n <ul>\n <li v-for=\"item in items\" :key=\"item.id\">...</li>\n </ul>\n ```\n\n It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you want to:\n\n - Properly trigger lifecycle hooks of a component\n - Trigger transitions\n\n For example:\n\n ```html\n <transition>\n <span :key=\"text\">{{ text }}</span>\n </transition>\n ```\n\n When `text` changes, the `<span>` will always be replaced instead of patched, so a transition will be triggered.\n\n- **See also
|
|
778
|
+
"value": "\nThe `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify vnodes when diffing the new list of nodes against the old list.\n\n- **Expects:** `number | string | symbol`\n\n- **Details**\n\n Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed / destroyed.\n\n Children of the same common parent must have **unique keys**. Duplicate keys will cause render errors.\n\n The most common use case is combined with `v-for`:\n\n ```html\n <ul>\n <li v-for=\"item in items\" :key=\"item.id\">...</li>\n </ul>\n ```\n\n It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you want to:\n\n - Properly trigger lifecycle hooks of a component\n - Trigger transitions\n\n For example:\n\n ```html\n <transition>\n <span :key=\"text\">{{ text }}</span>\n </transition>\n ```\n\n When `text` changes, the `<span>` will always be replaced instead of patched, so a transition will be triggered.\n\n- **See also** [Guide - List Rendering - Maintaining State with `key`](https://vuejs.org/guide/essentials/list.html#maintaining-state-with-key)\n"
|
|
779
779
|
},
|
|
780
780
|
"references": [
|
|
781
781
|
{
|
|
@@ -808,7 +808,7 @@
|
|
|
808
808
|
"name": "ref",
|
|
809
809
|
"description": {
|
|
810
810
|
"kind": "markdown",
|
|
811
|
-
"value": "\nDenotes a [template ref](https://vuejs.org/guide/essentials/template-refs.html).\n\n- **Expects:** `string | Function`\n\n- **Details**\n\n `ref` is used to register a reference to an element or a child component.\n\n In Options API, the reference will be registered under the component's `this.$refs` object:\n\n ```html\n <!-- stored as this.$refs.p -->\n <p ref=\"p\">hello</p>\n ```\n\n In Composition API, the reference will be stored in a ref with matching name:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const p = ref()\n </script>\n\n <template>\n <p ref=\"p\">hello</p>\n </template>\n ```\n\n If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be the child component instance.\n\n Alternatively `ref` can accept a function value which provides full control over where to store the reference:\n\n ```html\n <ChildComponent :ref=\"(el) => child = el\" />\n ```\n\n An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you must wait until the component is mounted before accessing them.\n\n `this.$refs` is also non-reactive, therefore you should not attempt to use it in templates for data-binding.\n\n- **See also
|
|
811
|
+
"value": "\nDenotes a [template ref](https://vuejs.org/guide/essentials/template-refs.html).\n\n- **Expects:** `string | Function`\n\n- **Details**\n\n `ref` is used to register a reference to an element or a child component.\n\n In Options API, the reference will be registered under the component's `this.$refs` object:\n\n ```html\n <!-- stored as this.$refs.p -->\n <p ref=\"p\">hello</p>\n ```\n\n In Composition API, the reference will be stored in a ref with matching name:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const p = ref()\n </script>\n\n <template>\n <p ref=\"p\">hello</p>\n </template>\n ```\n\n If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be the child component instance.\n\n Alternatively `ref` can accept a function value which provides full control over where to store the reference:\n\n ```html\n <ChildComponent :ref=\"(el) => child = el\" />\n ```\n\n An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you must wait until the component is mounted before accessing them.\n\n `this.$refs` is also non-reactive, therefore you should not attempt to use it in templates for data-binding.\n\n- **See also**\n - [Guide - Template Refs](https://vuejs.org/guide/essentials/template-refs.html)\n - [Guide - Typing Template Refs](https://vuejs.org/guide/typescript/composition-api.html#typing-template-refs) <sup class=\"vt-badge ts\" />\n - [Guide - Typing Component Template Refs](https://vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs) <sup class=\"vt-badge ts\" />\n"
|
|
812
812
|
},
|
|
813
813
|
"references": [
|
|
814
814
|
{
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"name": "is",
|
|
842
842
|
"description": {
|
|
843
843
|
"kind": "markdown",
|
|
844
|
-
"value": "\nUsed for binding [dynamic components](https://vuejs.org/guide/essentials/component-basics.html#dynamic-components).\n\n- **Expects:** `string | Component`\n\n- **Usage on native elements** <sup class=\"vt-badge\">3.1+</sup>\n\n 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.\n\n There is, however, a use case where you may need Vue to replace a native element with a Vue component, as explained in [DOM Template Parsing Caveats](https://vuejs.org/guide/essentials/component-basics.html#dom-template-parsing-caveats). You can prefix the value of the `is` attribute with `vue:` so that Vue will render the element as a Vue component instead:\n\n ```html\n <table>\n <tr is=\"vue:my-row-component\"></tr>\n </table>\n ```\n\n- **See also
|
|
844
|
+
"value": "\nUsed for binding [dynamic components](https://vuejs.org/guide/essentials/component-basics.html#dynamic-components).\n\n- **Expects:** `string | Component`\n\n- **Usage on native elements** <sup class=\"vt-badge\">3.1+</sup>\n\n 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.\n\n There is, however, a use case where you may need Vue to replace a native element with a Vue component, as explained in [DOM Template Parsing Caveats](https://vuejs.org/guide/essentials/component-basics.html#dom-template-parsing-caveats). You can prefix the value of the `is` attribute with `vue:` so that Vue will render the element as a Vue component instead:\n\n ```html\n <table>\n <tr is=\"vue:my-row-component\"></tr>\n </table>\n ```\n\n- **See also**\n\n - [Built-in Special Element - `<component>`](https://vuejs.org/api/built-in-special-elements.html#component)\n - [Dynamic Components](https://vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
845
845
|
},
|
|
846
846
|
"references": [
|
|
847
847
|
{
|
package/out/helpers.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as vue from '@vue/language-core';
|
|
1
2
|
import * as embedded from '@volar/language-core';
|
|
2
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
|
-
export declare function checkPropsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string,
|
|
4
|
-
export declare function checkEventsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string,
|
|
5
|
-
export declare function checkComponentNames(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile,
|
|
6
|
-
export declare function checkNativeTags(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, tsLsHost: ts.LanguageServiceHost): Set<string>;
|
|
4
|
+
export declare function checkPropsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string, vueCompilerOptions: vue.VueCompilerOptions, requiredOnly?: boolean): string[];
|
|
5
|
+
export declare function checkEventsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string, vueCompilerOptions: vue.VueCompilerOptions): string[];
|
|
6
|
+
export declare function checkComponentNames(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, vueCompilerOptions: vue.VueCompilerOptions): string[];
|
|
7
7
|
export declare function getElementAttrs(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, tsLsHost: ts.LanguageServiceHost, tagName: string): string[];
|
|
8
8
|
type Tags = Map<string, {
|
|
9
9
|
offsets: number[];
|
package/out/helpers.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTemplateTagsAndAttrs = exports.getElementAttrs = exports.
|
|
3
|
+
exports.getTemplateTagsAndAttrs = exports.getElementAttrs = exports.checkComponentNames = exports.checkEventsOfTag = exports.checkPropsOfTag = void 0;
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
5
|
const embedded = require("@volar/language-core");
|
|
6
6
|
const reactivity_1 = require("@vue/reactivity");
|
|
7
7
|
const language_core_1 = require("@vue/language-core");
|
|
8
8
|
const shared_1 = require("@vue/shared");
|
|
9
|
-
function checkPropsOfTag(ts, tsLs, sourceFile, tag,
|
|
9
|
+
function checkPropsOfTag(ts, tsLs, sourceFile, tag, vueCompilerOptions, requiredOnly = false) {
|
|
10
10
|
const checker = tsLs.getProgram().getTypeChecker();
|
|
11
11
|
const components = getComponentsType(ts, tsLs, sourceFile);
|
|
12
12
|
if (!components)
|
|
13
13
|
return [];
|
|
14
14
|
const name = tag.split('.');
|
|
15
15
|
let componentSymbol = components.componentsType.getProperty(name[0]);
|
|
16
|
-
if (!componentSymbol && !nativeTags.
|
|
16
|
+
if (!componentSymbol && !vueCompilerOptions.nativeTags.includes(name[0])) {
|
|
17
17
|
componentSymbol = components.componentsType.getProperty((0, shared_1.camelize)(name[0]))
|
|
18
18
|
?? components.componentsType.getProperty((0, shared_1.capitalize)((0, shared_1.camelize)(name[0])));
|
|
19
19
|
}
|
|
@@ -61,14 +61,14 @@ function checkPropsOfTag(ts, tsLs, sourceFile, tag, nativeTags, requiredOnly = f
|
|
|
61
61
|
return [...result];
|
|
62
62
|
}
|
|
63
63
|
exports.checkPropsOfTag = checkPropsOfTag;
|
|
64
|
-
function checkEventsOfTag(ts, tsLs, sourceFile, tag,
|
|
64
|
+
function checkEventsOfTag(ts, tsLs, sourceFile, tag, vueCompilerOptions) {
|
|
65
65
|
const checker = tsLs.getProgram().getTypeChecker();
|
|
66
66
|
const components = getComponentsType(ts, tsLs, sourceFile);
|
|
67
67
|
if (!components)
|
|
68
68
|
return [];
|
|
69
69
|
const name = tag.split('.');
|
|
70
70
|
let componentSymbol = components.componentsType.getProperty(name[0]);
|
|
71
|
-
if (!componentSymbol && !nativeTags.
|
|
71
|
+
if (!componentSymbol && !vueCompilerOptions.nativeTags.includes(name[0])) {
|
|
72
72
|
componentSymbol = components.componentsType.getProperty((0, shared_1.camelize)(name[0]))
|
|
73
73
|
?? components.componentsType.getProperty((0, shared_1.capitalize)((0, shared_1.camelize)(name[0])));
|
|
74
74
|
}
|
|
@@ -110,34 +110,16 @@ function checkEventsOfTag(ts, tsLs, sourceFile, tag, nativeTags) {
|
|
|
110
110
|
return [...result];
|
|
111
111
|
}
|
|
112
112
|
exports.checkEventsOfTag = checkEventsOfTag;
|
|
113
|
-
function checkComponentNames(ts, tsLs, sourceFile,
|
|
113
|
+
function checkComponentNames(ts, tsLs, sourceFile, vueCompilerOptions) {
|
|
114
114
|
return getComponentsType(ts, tsLs, sourceFile)
|
|
115
115
|
?.componentsType
|
|
116
116
|
?.getProperties()
|
|
117
117
|
.map(c => c.name)
|
|
118
118
|
.filter(entry => entry.indexOf('$') === -1 && !entry.startsWith('_'))
|
|
119
|
-
.filter(entry => !nativeTags.
|
|
119
|
+
.filter(entry => !vueCompilerOptions.nativeTags.includes(entry))
|
|
120
120
|
?? [];
|
|
121
121
|
}
|
|
122
122
|
exports.checkComponentNames = checkComponentNames;
|
|
123
|
-
function checkNativeTags(ts, tsLs, tsLsHost) {
|
|
124
|
-
const sharedTypesFileName = tsLsHost.getCurrentDirectory() + '/' + language_core_1.sharedTypes.baseName;
|
|
125
|
-
const result = new Set();
|
|
126
|
-
let tsSourceFile;
|
|
127
|
-
if (tsSourceFile = tsLs.getProgram()?.getSourceFile(sharedTypesFileName)) {
|
|
128
|
-
const typeNode = tsSourceFile.statements.find((node) => ts.isTypeAliasDeclaration(node) && node.name.getText() === '__VLS_IntrinsicElements');
|
|
129
|
-
const checker = tsLs.getProgram()?.getTypeChecker();
|
|
130
|
-
if (checker && typeNode) {
|
|
131
|
-
const type = checker.getTypeFromTypeNode(typeNode.type);
|
|
132
|
-
const props = type.getProperties();
|
|
133
|
-
for (const prop of props) {
|
|
134
|
-
result.add(prop.name);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
exports.checkNativeTags = checkNativeTags;
|
|
141
123
|
function getElementAttrs(ts, tsLs, tsLsHost, tagName) {
|
|
142
124
|
const sharedTypesFileName = tsLsHost.getCurrentDirectory() + '/' + language_core_1.sharedTypes.baseName;
|
|
143
125
|
let tsSourceFile;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ServiceContext } from '@volar/language-service';
|
|
2
|
+
import * as vue from '@vue/language-core';
|
|
2
3
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
4
|
import { AttrNameCasing, TagNameCasing } from '../types';
|
|
4
5
|
import type { Provide } from 'volar-service-typescript';
|
|
5
|
-
export declare function convertTagName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext<Provide>, uri: string, casing: TagNameCasing): Promise<vscode.TextEdit[] | undefined>;
|
|
6
|
-
export declare function convertAttrName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, casing: AttrNameCasing): Promise<vscode.TextEdit[] | undefined>;
|
|
7
|
-
export declare function getNameCasing(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string): Promise<{
|
|
6
|
+
export declare function convertTagName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext<Provide>, uri: string, casing: TagNameCasing, vueCompilerOptions: vue.VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
|
|
7
|
+
export declare function convertAttrName(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, casing: AttrNameCasing, vueCompilerOptions: vue.VueCompilerOptions): Promise<vscode.TextEdit[] | undefined>;
|
|
8
|
+
export declare function getNameCasing(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: vue.VueCompilerOptions): Promise<{
|
|
8
9
|
tag: TagNameCasing;
|
|
9
10
|
attr: AttrNameCasing;
|
|
10
11
|
}>;
|
|
11
|
-
export declare function detect(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string): {
|
|
12
|
+
export declare function detect(ts: typeof import('typescript/lib/tsserverlibrary'), context: ServiceContext, uri: string, vueCompilerOptions: vue.VueCompilerOptions): {
|
|
12
13
|
tag: TagNameCasing[];
|
|
13
14
|
attr: AttrNameCasing[];
|
|
14
15
|
};
|
|
@@ -5,7 +5,7 @@ const shared_1 = require("@vue/shared");
|
|
|
5
5
|
const helpers_1 = require("../helpers");
|
|
6
6
|
const vue = require("@vue/language-core");
|
|
7
7
|
const types_1 = require("../types");
|
|
8
|
-
async function convertTagName(ts, context, uri, casing) {
|
|
8
|
+
async function convertTagName(ts, context, uri, casing, vueCompilerOptions) {
|
|
9
9
|
const rootFile = context.documents.getSourceByUri(uri)?.root;
|
|
10
10
|
if (!(rootFile instanceof vue.VueFile))
|
|
11
11
|
return;
|
|
@@ -13,12 +13,10 @@ async function convertTagName(ts, context, uri, casing) {
|
|
|
13
13
|
if (!desc.template)
|
|
14
14
|
return;
|
|
15
15
|
const languageService = context.inject('typescript/languageService');
|
|
16
|
-
const languageServiceHost = context.inject('typescript/languageServiceHost');
|
|
17
16
|
const template = desc.template;
|
|
18
17
|
const document = context.documents.getDocumentByFileName(rootFile.snapshot, rootFile.fileName);
|
|
19
18
|
const edits = [];
|
|
20
|
-
const
|
|
21
|
-
const components = (0, helpers_1.checkComponentNames)(ts, languageService, rootFile, nativeTags);
|
|
19
|
+
const components = (0, helpers_1.checkComponentNames)(ts, languageService, rootFile, vueCompilerOptions);
|
|
22
20
|
const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
|
|
23
21
|
for (const [tagName, { offsets }] of tags) {
|
|
24
22
|
const componentName = components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
|
|
@@ -39,7 +37,7 @@ async function convertTagName(ts, context, uri, casing) {
|
|
|
39
37
|
return edits;
|
|
40
38
|
}
|
|
41
39
|
exports.convertTagName = convertTagName;
|
|
42
|
-
async function convertAttrName(ts, context, uri, casing) {
|
|
40
|
+
async function convertAttrName(ts, context, uri, casing, vueCompilerOptions) {
|
|
43
41
|
const rootFile = context.documents.getSourceByUri(uri)?.root;
|
|
44
42
|
if (!(rootFile instanceof vue.VueFile))
|
|
45
43
|
return;
|
|
@@ -47,17 +45,15 @@ async function convertAttrName(ts, context, uri, casing) {
|
|
|
47
45
|
if (!desc.template)
|
|
48
46
|
return;
|
|
49
47
|
const languageService = context.inject('typescript/languageService');
|
|
50
|
-
const languageServiceHost = context.inject('typescript/languageServiceHost');
|
|
51
48
|
const template = desc.template;
|
|
52
49
|
const document = context.documents.getDocumentByFileName(rootFile.snapshot, rootFile.fileName);
|
|
53
50
|
const edits = [];
|
|
54
|
-
const
|
|
55
|
-
const components = (0, helpers_1.checkComponentNames)(ts, languageService, rootFile, nativeTags);
|
|
51
|
+
const components = (0, helpers_1.checkComponentNames)(ts, languageService, rootFile, vueCompilerOptions);
|
|
56
52
|
const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
|
|
57
53
|
for (const [tagName, { attrs }] of tags) {
|
|
58
54
|
const componentName = components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
|
|
59
55
|
if (componentName) {
|
|
60
|
-
const props = (0, helpers_1.checkPropsOfTag)(ts, languageService, rootFile, componentName,
|
|
56
|
+
const props = (0, helpers_1.checkPropsOfTag)(ts, languageService, rootFile, componentName, vueCompilerOptions);
|
|
61
57
|
for (const [attrName, { offsets }] of attrs) {
|
|
62
58
|
const propName = props.find(prop => prop === attrName || (0, shared_1.hyphenate)(prop) === attrName);
|
|
63
59
|
if (propName) {
|
|
@@ -79,8 +75,8 @@ async function convertAttrName(ts, context, uri, casing) {
|
|
|
79
75
|
return edits;
|
|
80
76
|
}
|
|
81
77
|
exports.convertAttrName = convertAttrName;
|
|
82
|
-
async function getNameCasing(ts, context, uri) {
|
|
83
|
-
const detected = detect(ts, context, uri);
|
|
78
|
+
async function getNameCasing(ts, context, uri, vueCompilerOptions) {
|
|
79
|
+
const detected = detect(ts, context, uri, vueCompilerOptions);
|
|
84
80
|
const [attr, tag] = await Promise.all([
|
|
85
81
|
context.env.getConfiguration?.('vue.complete.casing.props', uri),
|
|
86
82
|
context.env.getConfiguration?.('vue.complete.casing.tags', uri),
|
|
@@ -93,7 +89,7 @@ async function getNameCasing(ts, context, uri) {
|
|
|
93
89
|
};
|
|
94
90
|
}
|
|
95
91
|
exports.getNameCasing = getNameCasing;
|
|
96
|
-
function detect(ts, context, uri) {
|
|
92
|
+
function detect(ts, context, uri, vueCompilerOptions) {
|
|
97
93
|
const rootFile = context.documents.getSourceByUri(uri)?.root;
|
|
98
94
|
if (!(rootFile instanceof vue.VueFile)) {
|
|
99
95
|
return {
|
|
@@ -102,7 +98,6 @@ function detect(ts, context, uri) {
|
|
|
102
98
|
};
|
|
103
99
|
}
|
|
104
100
|
const languageService = context.inject('typescript/languageService');
|
|
105
|
-
const languageServiceHost = context.inject('typescript/languageServiceHost');
|
|
106
101
|
return {
|
|
107
102
|
tag: getTagNameCase(rootFile),
|
|
108
103
|
attr: getAttrNameCase(rootFile),
|
|
@@ -129,8 +124,7 @@ function detect(ts, context, uri) {
|
|
|
129
124
|
return result;
|
|
130
125
|
}
|
|
131
126
|
function getTagNameCase(file) {
|
|
132
|
-
const
|
|
133
|
-
const components = (0, helpers_1.checkComponentNames)(ts, languageService, file, nativeTags);
|
|
127
|
+
const components = (0, helpers_1.checkComponentNames)(ts, languageService, file, vueCompilerOptions);
|
|
134
128
|
const tagNames = (0, helpers_1.getTemplateTagsAndAttrs)(file);
|
|
135
129
|
const result = [];
|
|
136
130
|
let anyComponentUsed = false;
|
package/out/languageService.js
CHANGED
|
@@ -64,7 +64,7 @@ function resolvePlugins(services, vueCompilerOptions, settings) {
|
|
|
64
64
|
}
|
|
65
65
|
// fix #2458
|
|
66
66
|
if (source) {
|
|
67
|
-
casing ??= await (0, nameCasing_1.getNameCasing)(ts, _context, _context.env.fileNameToUri(source.fileName));
|
|
67
|
+
casing ??= await (0, nameCasing_1.getNameCasing)(ts, _context, _context.env.fileNameToUri(source.fileName), vueCompilerOptions);
|
|
68
68
|
if (casing.tag === types_1.TagNameCasing.Kebab) {
|
|
69
69
|
for (const item of result.items) {
|
|
70
70
|
item.filterText = (0, shared_1.hyphenate)(item.filterText ?? item.label);
|
|
@@ -106,7 +106,7 @@ function resolvePlugins(services, vueCompilerOptions, settings) {
|
|
|
106
106
|
item.textEdit.newText = newName;
|
|
107
107
|
const source = _context.documents.getVirtualFileByUri(itemData.uri)[1];
|
|
108
108
|
if (source) {
|
|
109
|
-
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, _context.env.fileNameToUri(source.fileName));
|
|
109
|
+
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, _context.env.fileNameToUri(source.fileName), vueCompilerOptions);
|
|
110
110
|
if (casing.tag === types_1.TagNameCasing.Kebab) {
|
|
111
111
|
item.textEdit.newText = (0, shared_1.hyphenate)(item.textEdit.newText);
|
|
112
112
|
}
|
|
@@ -78,16 +78,14 @@ exports.default = (options) => (_context, modules) => {
|
|
|
78
78
|
if (!enabled)
|
|
79
79
|
return;
|
|
80
80
|
const languageService = _context.inject('typescript/languageService');
|
|
81
|
-
const languageServiceHost = _context.inject('typescript/languageServiceHost');
|
|
82
81
|
const result = [];
|
|
83
82
|
for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
|
|
84
83
|
const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
|
|
85
84
|
const scanner = options.getScanner(htmlOrPugService, document);
|
|
86
85
|
if (virtualFile && virtualFile instanceof vue.VueFile && scanner) {
|
|
87
86
|
// visualize missing required props
|
|
88
|
-
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, map.sourceFileDocument.uri);
|
|
89
|
-
const
|
|
90
|
-
const components = (0, helpers_1.checkComponentNames)(ts, languageService, virtualFile, nativeTags);
|
|
87
|
+
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, map.sourceFileDocument.uri, options.vueCompilerOptions);
|
|
88
|
+
const components = (0, helpers_1.checkComponentNames)(ts, languageService, virtualFile, options.vueCompilerOptions);
|
|
91
89
|
const componentProps = {};
|
|
92
90
|
let token;
|
|
93
91
|
let current;
|
|
@@ -99,7 +97,7 @@ exports.default = (options) => (_context, modules) => {
|
|
|
99
97
|
: components.find(component => component === tagName || (0, shared_1.hyphenate)(component) === tagName);
|
|
100
98
|
const checkTag = tagName.indexOf('.') >= 0 ? tagName : component;
|
|
101
99
|
if (checkTag) {
|
|
102
|
-
componentProps[checkTag] ??= (0, helpers_1.checkPropsOfTag)(ts, languageService, virtualFile, checkTag,
|
|
100
|
+
componentProps[checkTag] ??= (0, helpers_1.checkPropsOfTag)(ts, languageService, virtualFile, checkTag, options.vueCompilerOptions, true);
|
|
103
101
|
current = {
|
|
104
102
|
unburnedRequiredProps: [...componentProps[checkTag]],
|
|
105
103
|
labelOffset: scanner.getTokenOffset() + scanner.getTokenLength(),
|
|
@@ -227,13 +225,11 @@ exports.default = (options) => (_context, modules) => {
|
|
|
227
225
|
if (!scanner)
|
|
228
226
|
return;
|
|
229
227
|
const languageService = _context.inject('typescript/languageService');
|
|
230
|
-
const languageServiceHost = _context.inject('typescript/languageServiceHost');
|
|
231
228
|
for (const [_, map] of _context.documents.getMapsByVirtualFileUri(document.uri)) {
|
|
232
229
|
const virtualFile = _context.documents.getSourceByUri(map.sourceFileDocument.uri)?.root;
|
|
233
230
|
if (!virtualFile || !(virtualFile instanceof vue.VueFile))
|
|
234
231
|
continue;
|
|
235
|
-
const
|
|
236
|
-
const templateScriptData = (0, helpers_1.checkComponentNames)(ts, languageService, virtualFile, nativeTags);
|
|
232
|
+
const templateScriptData = (0, helpers_1.checkComponentNames)(ts, languageService, virtualFile, options.vueCompilerOptions);
|
|
237
233
|
const components = new Set([
|
|
238
234
|
...templateScriptData,
|
|
239
235
|
...templateScriptData.map(shared_1.hyphenate),
|
|
@@ -271,7 +267,7 @@ exports.default = (options) => (_context, modules) => {
|
|
|
271
267
|
async function provideHtmlData(map, vueSourceFile) {
|
|
272
268
|
const languageService = _context.inject('typescript/languageService');
|
|
273
269
|
const languageServiceHost = _context.inject('typescript/languageServiceHost');
|
|
274
|
-
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, map.sourceFileDocument.uri);
|
|
270
|
+
const casing = await (0, nameCasing_1.getNameCasing)(ts, _context, map.sourceFileDocument.uri, options.vueCompilerOptions);
|
|
275
271
|
if (builtInData.tags) {
|
|
276
272
|
for (const tag of builtInData.tags) {
|
|
277
273
|
if (tag.name === 'slot')
|
|
@@ -288,14 +284,13 @@ exports.default = (options) => (_context, modules) => {
|
|
|
288
284
|
}
|
|
289
285
|
}
|
|
290
286
|
}
|
|
291
|
-
const nativeTags = (0, helpers_1.checkNativeTags)(ts, languageService, languageServiceHost);
|
|
292
287
|
options.updateCustomData(htmlOrPugService, [
|
|
293
288
|
html.newHTMLDataProvider('vue-template-built-in', builtInData),
|
|
294
289
|
{
|
|
295
290
|
getId: () => 'vue-template',
|
|
296
291
|
isApplicable: () => true,
|
|
297
292
|
provideTags: () => {
|
|
298
|
-
const components = (0, helpers_1.checkComponentNames)(ts, languageService, vueSourceFile,
|
|
293
|
+
const components = (0, helpers_1.checkComponentNames)(ts, languageService, vueSourceFile, options.vueCompilerOptions)
|
|
299
294
|
.filter(name => name !== 'Transition'
|
|
300
295
|
&& name !== 'TransitionGroup'
|
|
301
296
|
&& name !== 'KeepAlive'
|
|
@@ -331,8 +326,8 @@ exports.default = (options) => (_context, modules) => {
|
|
|
331
326
|
},
|
|
332
327
|
provideAttributes: (tag) => {
|
|
333
328
|
const attrs = (0, helpers_1.getElementAttrs)(ts, languageService, languageServiceHost, tag);
|
|
334
|
-
const props = new Set((0, helpers_1.checkPropsOfTag)(ts, languageService, vueSourceFile, tag,
|
|
335
|
-
const events = (0, helpers_1.checkEventsOfTag)(ts, languageService, vueSourceFile, tag,
|
|
329
|
+
const props = new Set((0, helpers_1.checkPropsOfTag)(ts, languageService, vueSourceFile, tag, options.vueCompilerOptions));
|
|
330
|
+
const events = (0, helpers_1.checkEventsOfTag)(ts, languageService, vueSourceFile, tag, options.vueCompilerOptions);
|
|
336
331
|
const attributes = [];
|
|
337
332
|
for (const prop of [...props, ...attrs]) {
|
|
338
333
|
const isGlobal = !props.has(prop);
|
|
@@ -411,10 +406,8 @@ exports.default = (options) => (_context, modules) => {
|
|
|
411
406
|
}
|
|
412
407
|
function afterHtmlCompletion(completionList, map, vueSourceFile) {
|
|
413
408
|
const languageService = _context.inject('typescript/languageService');
|
|
414
|
-
const languageServiceHost = _context.inject('typescript/languageServiceHost');
|
|
415
409
|
const replacement = getReplacement(completionList, map.sourceFileDocument);
|
|
416
|
-
const
|
|
417
|
-
const componentNames = new Set((0, helpers_1.checkComponentNames)(ts, languageService, vueSourceFile, nativeTags).map(shared_1.hyphenate));
|
|
410
|
+
const componentNames = new Set((0, helpers_1.checkComponentNames)(ts, languageService, vueSourceFile, options.vueCompilerOptions).map(shared_1.hyphenate));
|
|
418
411
|
if (replacement) {
|
|
419
412
|
const isEvent = replacement.text.startsWith('v-on:') || replacement.text.startsWith('@');
|
|
420
413
|
const isProp = replacement.text.startsWith('v-bind:') || replacement.text.startsWith(':');
|
package/out/types.js
CHANGED
|
@@ -19,12 +19,12 @@ var TagNameCasing;
|
|
|
19
19
|
(function (TagNameCasing) {
|
|
20
20
|
TagNameCasing[TagNameCasing["Kebab"] = 0] = "Kebab";
|
|
21
21
|
TagNameCasing[TagNameCasing["Pascal"] = 1] = "Pascal";
|
|
22
|
-
})(TagNameCasing
|
|
22
|
+
})(TagNameCasing || (exports.TagNameCasing = TagNameCasing = {}));
|
|
23
23
|
var AttrNameCasing;
|
|
24
24
|
(function (AttrNameCasing) {
|
|
25
25
|
AttrNameCasing[AttrNameCasing["Kebab"] = 0] = "Kebab";
|
|
26
26
|
AttrNameCasing[AttrNameCasing["Camel"] = 1] = "Camel";
|
|
27
|
-
})(AttrNameCasing
|
|
27
|
+
})(AttrNameCasing || (exports.AttrNameCasing = AttrNameCasing = {}));
|
|
28
28
|
// only export types of depend packages
|
|
29
29
|
__exportStar(require("@volar/language-service/out/types"), exports);
|
|
30
30
|
__exportStar(require("@vue/language-core/out/types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.12",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@volar/language-core": "1.7.
|
|
21
|
-
"@volar/language-service": "1.7.
|
|
22
|
-
"@volar/typescript": "1.7.
|
|
20
|
+
"@volar/language-core": "1.7.4",
|
|
21
|
+
"@volar/language-service": "1.7.4",
|
|
22
|
+
"@volar/typescript": "1.7.4",
|
|
23
23
|
"@vue/compiler-dom": "^3.3.0",
|
|
24
|
-
"@vue/language-core": "1.7.
|
|
24
|
+
"@vue/language-core": "1.7.12",
|
|
25
25
|
"@vue/reactivity": "^3.3.0",
|
|
26
26
|
"@vue/shared": "^3.3.0",
|
|
27
27
|
"volar-service-css": "0.0.7",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"vscode-languageserver-textdocument": "^1.0.8"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@volar/kit": "1.7.
|
|
39
|
+
"@volar/kit": "1.7.4",
|
|
40
40
|
"vscode-languageserver-protocol": "^3.17.3",
|
|
41
41
|
"vscode-uri": "^3.0.7"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9e712c2d603c690cd03502f5ec1a99bd80b800ac"
|
|
44
44
|
}
|