├── .editorconfig
├── .git-blame-ignore-revs
├── .github
├── CODE_OF_CONDUCT.md
├── COMMIT_CONVENTION.md
├── CONTRIBUTING.md
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ └── config.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── ci.yml
│ └── release-tag.yml
├── .gitignore
├── .prettierrc
├── BACKERS.md
├── CHANGELOG.md
├── LICENSE
├── README.md
├── api-extractor.json
├── api-extractor.tsconfig.json
├── benchmarks
├── big-table
│ ├── demo.css
│ ├── index.html
│ └── style.css
├── dbmon
│ ├── ENV.js
│ ├── app.js
│ ├── index.html
│ └── lib
│ │ ├── memory-stats.js
│ │ ├── monitor.js
│ │ └── styles.css
├── reorder-list
│ └── index.html
├── ssr
│ ├── README.md
│ ├── common.js
│ ├── renderToStream.js
│ └── renderToString.js
├── svg
│ └── index.html
└── uptime
│ └── index.html
├── compiler-sfc
├── index.d.ts
├── index.js
├── index.mjs
└── package.json
├── dist
├── vue.common.js
├── vue.runtime.common.js
└── vue.runtime.mjs
├── examples
├── classic
│ ├── commits
│ │ ├── app.js
│ │ └── index.html
│ ├── elastic-header
│ │ ├── index.html
│ │ └── style.css
│ ├── firebase
│ │ ├── app.js
│ │ ├── index.html
│ │ └── style.css
│ ├── grid
│ │ ├── grid.js
│ │ ├── index.html
│ │ └── style.css
│ ├── markdown
│ │ ├── index.html
│ │ └── style.css
│ ├── modal
│ │ ├── index.html
│ │ └── style.css
│ ├── move-animations
│ │ └── index.html
│ ├── select2
│ │ └── index.html
│ ├── svg
│ │ ├── index.html
│ │ ├── style.css
│ │ └── svg.js
│ ├── todomvc
│ │ ├── app.js
│ │ ├── index.html
│ │ └── readme.md
│ └── tree
│ │ ├── index.html
│ │ └── tree.js
└── composition
│ ├── commits.html
│ ├── grid.html
│ ├── markdown.html
│ ├── svg.html
│ ├── todomvc.html
│ └── tree.html
├── package.json
├── packages
├── compiler-sfc
│ ├── api-extractor.json
│ ├── package.json
│ ├── src
│ │ ├── babelUtils.ts
│ │ ├── compileScript.ts
│ │ ├── compileStyle.ts
│ │ ├── compileTemplate.ts
│ │ ├── cssVars.ts
│ │ ├── index.ts
│ │ ├── parse.ts
│ │ ├── parseComponent.ts
│ │ ├── prefixIdentifiers.ts
│ │ ├── rewriteDefault.ts
│ │ ├── stylePlugins
│ │ │ ├── scoped.ts
│ │ │ └── trim.ts
│ │ ├── stylePreprocessors.ts
│ │ ├── templateCompilerModules
│ │ │ ├── assetUrl.ts
│ │ │ ├── srcset.ts
│ │ │ └── utils.ts
│ │ ├── types.ts
│ │ └── warn.ts
│ └── test
│ │ ├── __snapshots__
│ │ ├── compileScript.spec.ts.snap
│ │ └── cssVars.spec.ts.snap
│ │ ├── compileScript.spec.ts
│ │ ├── compileStyle.spec.ts
│ │ ├── compileTemplate.spec.ts
│ │ ├── cssVars.spec.ts
│ │ ├── parseComponent.spec.ts
│ │ ├── prefixIdentifiers.spec.ts
│ │ ├── rewriteDefault.spec.ts
│ │ ├── stylePluginScoped.spec.ts
│ │ ├── tsconfig.json
│ │ └── util.ts
├── server-renderer
│ ├── README.md
│ ├── client-plugin.d.ts
│ ├── index.js
│ ├── package.json
│ ├── server-plugin.d.ts
│ ├── src
│ │ ├── bundle-renderer
│ │ │ ├── create-bundle-renderer.ts
│ │ │ ├── create-bundle-runner.ts
│ │ │ └── source-map-support.ts
│ │ ├── compiler.ts
│ │ ├── create-basic-renderer.ts
│ │ ├── create-renderer.ts
│ │ ├── directives
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── show.ts
│ │ ├── index-basic.ts
│ │ ├── index.ts
│ │ ├── modules
│ │ │ ├── attrs.ts
│ │ │ ├── class.ts
│ │ │ ├── dom-props.ts
│ │ │ ├── index.ts
│ │ │ └── style.ts
│ │ ├── optimizing-compiler
│ │ │ ├── codegen.ts
│ │ │ ├── index.ts
│ │ │ ├── modules.ts
│ │ │ ├── optimizer.ts
│ │ │ └── runtime-helpers.ts
│ │ ├── render-context.ts
│ │ ├── render-stream.ts
│ │ ├── render.ts
│ │ ├── template-renderer
│ │ │ ├── create-async-file-mapper.ts
│ │ │ ├── index.ts
│ │ │ ├── parse-template.ts
│ │ │ └── template-stream.ts
│ │ ├── util.ts
│ │ ├── webpack-plugin
│ │ │ ├── client.ts
│ │ │ ├── server.ts
│ │ │ └── util.ts
│ │ └── write.ts
│ ├── test
│ │ ├── async-loader.js
│ │ ├── compile-with-webpack.ts
│ │ ├── fixtures
│ │ │ ├── app.js
│ │ │ ├── async-bar.js
│ │ │ ├── async-foo.js
│ │ │ ├── cache-opt-out.js
│ │ │ ├── cache.js
│ │ │ ├── error.js
│ │ │ ├── nested-cache.js
│ │ │ ├── promise-rejection.js
│ │ │ ├── split.js
│ │ │ ├── test.css
│ │ │ ├── test.png
│ │ │ └── test.woff2
│ │ ├── ssr-basic-renderer.spec.ts
│ │ ├── ssr-bundle-render.spec.ts
│ │ ├── ssr-reactivity.spec.ts
│ │ ├── ssr-stream.spec.ts
│ │ ├── ssr-string.spec.ts
│ │ ├── ssr-template.spec.ts
│ │ ├── tsconfig.json
│ │ └── utils.ts
│ └── types
│ │ ├── index.d.ts
│ │ ├── plugin.d.ts
│ │ ├── test.ts
│ │ └── tsconfig.json
└── template-compiler
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── types
│ ├── index.d.ts
│ ├── test.ts
│ └── tsconfig.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── scripts
├── alias.js
├── build.js
├── config.js
├── feature-flags.js
├── gen-release-note.js
├── git-hooks
│ ├── commit-msg
│ └── pre-commit
├── release.js
└── verify-commit-msg.js
├── src
├── compiler
│ ├── codeframe.ts
│ ├── codegen
│ │ ├── events.ts
│ │ └── index.ts
│ ├── create-compiler.ts
│ ├── directives
│ │ ├── bind.ts
│ │ ├── index.ts
│ │ ├── model.ts
│ │ └── on.ts
│ ├── error-detector.ts
│ ├── helpers.ts
│ ├── index.ts
│ ├── optimizer.ts
│ ├── parser
│ │ ├── entity-decoder.ts
│ │ ├── filter-parser.ts
│ │ ├── html-parser.ts
│ │ ├── index.ts
│ │ └── text-parser.ts
│ └── to-function.ts
├── core
│ ├── components
│ │ ├── index.ts
│ │ └── keep-alive.ts
│ ├── config.ts
│ ├── global-api
│ │ ├── assets.ts
│ │ ├── extend.ts
│ │ ├── index.ts
│ │ ├── mixin.ts
│ │ └── use.ts
│ ├── index.ts
│ ├── instance
│ │ ├── events.ts
│ │ ├── index.ts
│ │ ├── init.ts
│ │ ├── inject.ts
│ │ ├── lifecycle.ts
│ │ ├── proxy.ts
│ │ ├── render-helpers
│ │ │ ├── bind-dynamic-keys.ts
│ │ │ ├── bind-object-listeners.ts
│ │ │ ├── bind-object-props.ts
│ │ │ ├── check-keycodes.ts
│ │ │ ├── index.ts
│ │ │ ├── render-list.ts
│ │ │ ├── render-slot.ts
│ │ │ ├── render-static.ts
│ │ │ ├── resolve-filter.ts
│ │ │ ├── resolve-scoped-slots.ts
│ │ │ └── resolve-slots.ts
│ │ ├── render.ts
│ │ └── state.ts
│ ├── observer
│ │ ├── array.ts
│ │ ├── dep.ts
│ │ ├── index.ts
│ │ ├── scheduler.ts
│ │ ├── traverse.ts
│ │ └── watcher.ts
│ ├── util
│ │ ├── debug.ts
│ │ ├── env.ts
│ │ ├── error.ts
│ │ ├── index.ts
│ │ ├── lang.ts
│ │ ├── next-tick.ts
│ │ ├── options.ts
│ │ ├── perf.ts
│ │ └── props.ts
│ └── vdom
│ │ ├── create-component.ts
│ │ ├── create-element.ts
│ │ ├── create-functional-component.ts
│ │ ├── helpers
│ │ ├── extract-props.ts
│ │ ├── get-first-component-child.ts
│ │ ├── index.ts
│ │ ├── is-async-placeholder.ts
│ │ ├── merge-hook.ts
│ │ ├── normalize-children.ts
│ │ ├── normalize-scoped-slots.ts
│ │ ├── resolve-async-component.ts
│ │ └── update-listeners.ts
│ │ ├── modules
│ │ ├── directives.ts
│ │ ├── index.ts
│ │ └── template-ref.ts
│ │ ├── patch.ts
│ │ └── vnode.ts
├── global.d.ts
├── platforms
│ └── web
│ │ ├── compiler
│ │ ├── directives
│ │ │ ├── html.ts
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── text.ts
│ │ ├── index.ts
│ │ ├── modules
│ │ │ ├── class.ts
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── style.ts
│ │ ├── options.ts
│ │ └── util.ts
│ │ ├── entry-compiler.ts
│ │ ├── entry-runtime-esm.ts
│ │ ├── entry-runtime-with-compiler-esm.ts
│ │ ├── entry-runtime-with-compiler.ts
│ │ ├── entry-runtime.ts
│ │ ├── runtime-with-compiler.ts
│ │ ├── runtime
│ │ ├── class-util.ts
│ │ ├── components
│ │ │ ├── index.ts
│ │ │ ├── transition-group.ts
│ │ │ └── transition.ts
│ │ ├── directives
│ │ │ ├── index.ts
│ │ │ ├── model.ts
│ │ │ └── show.ts
│ │ ├── index.ts
│ │ ├── modules
│ │ │ ├── attrs.ts
│ │ │ ├── class.ts
│ │ │ ├── dom-props.ts
│ │ │ ├── events.ts
│ │ │ ├── index.ts
│ │ │ ├── style.ts
│ │ │ └── transition.ts
│ │ ├── node-ops.ts
│ │ ├── patch.ts
│ │ └── transition-util.ts
│ │ └── util
│ │ ├── attrs.ts
│ │ ├── class.ts
│ │ ├── compat.ts
│ │ ├── element.ts
│ │ ├── index.ts
│ │ └── style.ts
├── shared
│ ├── constants.ts
│ └── util.ts
├── types
│ ├── compiler.ts
│ ├── component.ts
│ ├── global-api.ts
│ ├── modules.d.ts
│ ├── options.ts
│ ├── ssr.ts
│ ├── utils.ts
│ └── vnode.ts
└── v3
│ ├── apiAsyncComponent.ts
│ ├── apiInject.ts
│ ├── apiLifecycle.ts
│ ├── apiSetup.ts
│ ├── apiWatch.ts
│ ├── currentInstance.ts
│ ├── debug.ts
│ ├── h.ts
│ ├── index.ts
│ ├── reactivity
│ ├── computed.ts
│ ├── effect.ts
│ ├── effectScope.ts
│ ├── operations.ts
│ ├── reactive.ts
│ ├── readonly.ts
│ └── ref.ts
│ └── sfc-helpers
│ ├── useCssModule.ts
│ └── useCssVars.ts
├── test
├── e2e
│ ├── async-edge-cases.html
│ ├── async-edge-cases.spec.ts
│ ├── basic-ssr.html
│ ├── basic-ssr.spec.ts
│ ├── commits.mock.ts
│ ├── commits.spec.ts
│ ├── e2eUtils.ts
│ ├── grid.spec.ts
│ ├── markdown.spec.ts
│ ├── svg.spec.ts
│ ├── todomvc.spec.ts
│ └── tree.spec.ts
├── helpers
│ ├── classlist.ts
│ ├── shim-done.ts
│ ├── test-object-option.ts
│ ├── to-have-warned.ts
│ ├── trigger-event.ts
│ ├── vdom.ts
│ └── wait-for-update.ts
├── test-env.d.ts
├── transition
│ ├── helpers.ts
│ ├── karma.conf.js
│ ├── package.json
│ ├── transition-group.spec.ts
│ ├── transition-mode.spec.ts
│ ├── transition-with-keep-alive.spec.ts
│ └── transition.spec.ts
├── tsconfig.json
├── unit
│ ├── features
│ │ ├── component
│ │ │ ├── component-async.spec.ts
│ │ │ ├── component-keep-alive.spec.ts
│ │ │ ├── component-scoped-slot.spec.ts
│ │ │ ├── component-slot.spec.ts
│ │ │ └── component.spec.ts
│ │ ├── debug.spec.ts
│ │ ├── directives
│ │ │ ├── bind.spec.ts
│ │ │ ├── class.spec.ts
│ │ │ ├── cloak.spec.ts
│ │ │ ├── for.spec.ts
│ │ │ ├── html.spec.ts
│ │ │ ├── if.spec.ts
│ │ │ ├── model-checkbox.spec.ts
│ │ │ ├── model-component.spec.ts
│ │ │ ├── model-dynamic.spec.ts
│ │ │ ├── model-file.spec.ts
│ │ │ ├── model-parse.spec.ts
│ │ │ ├── model-radio.spec.ts
│ │ │ ├── model-select.spec.ts
│ │ │ ├── model-text.spec.ts
│ │ │ ├── on.spec.ts
│ │ │ ├── once.spec.ts
│ │ │ ├── pre.spec.ts
│ │ │ ├── show.spec.ts
│ │ │ ├── static-style-parser.spec.ts
│ │ │ ├── style.spec.ts
│ │ │ └── text.spec.ts
│ │ ├── error-handling.spec.ts
│ │ ├── filter
│ │ │ └── filter.spec.ts
│ │ ├── global-api
│ │ │ ├── assets.spec.ts
│ │ │ ├── compile.spec.ts
│ │ │ ├── config.spec.ts
│ │ │ ├── extend.spec.ts
│ │ │ ├── mixin.spec.ts
│ │ │ ├── observable.spec.ts
│ │ │ ├── set-delete.spec.ts
│ │ │ └── use.spec.ts
│ │ ├── instance
│ │ │ ├── init.spec.ts
│ │ │ ├── methods-data.spec.ts
│ │ │ ├── methods-events.spec.ts
│ │ │ ├── methods-lifecycle.spec.ts
│ │ │ ├── properties.spec.ts
│ │ │ └── render-proxy.spec.ts
│ │ ├── options
│ │ │ ├── _scopeId.spec.ts
│ │ │ ├── comments.spec.ts
│ │ │ ├── components.spec.ts
│ │ │ ├── computed.spec.ts
│ │ │ ├── data.spec.ts
│ │ │ ├── delimiters.spec.ts
│ │ │ ├── directives.spec.ts
│ │ │ ├── el.spec.ts
│ │ │ ├── errorCaptured.spec.ts
│ │ │ ├── extends.spec.ts
│ │ │ ├── functional.spec.ts
│ │ │ ├── inheritAttrs.spec.ts
│ │ │ ├── inject.spec.ts
│ │ │ ├── lifecycle.spec.ts
│ │ │ ├── methods.spec.ts
│ │ │ ├── mixins.spec.ts
│ │ │ ├── name.spec.ts
│ │ │ ├── parent.spec.ts
│ │ │ ├── props.spec.ts
│ │ │ ├── propsData.spec.ts
│ │ │ ├── render.spec.ts
│ │ │ ├── renderError.spec.ts
│ │ │ ├── template.spec.ts
│ │ │ └── watch.spec.ts
│ │ ├── template-ref.spec.ts
│ │ └── v3
│ │ │ ├── apiAsyncComponent.spec.ts
│ │ │ ├── apiInject.spec.ts
│ │ │ ├── apiLifecycle.spec.ts
│ │ │ ├── apiSetup.spec.ts
│ │ │ ├── apiWatch.spec.ts
│ │ │ ├── reactivity
│ │ │ ├── computed.spec.ts
│ │ │ ├── effectScope.spec.ts
│ │ │ ├── reactive.spec.ts
│ │ │ ├── readonly.spec.ts
│ │ │ ├── ref.spec.ts
│ │ │ ├── shallowReactive.spec.ts
│ │ │ └── shallowReadonly.spec.ts
│ │ │ ├── setupTemplateRef.spec.ts
│ │ │ └── useCssVars.spec.ts
│ └── modules
│ │ ├── compiler
│ │ ├── codeframe.spec.ts
│ │ ├── codegen.spec.ts
│ │ ├── compiler-options.spec.ts
│ │ ├── optimizer.spec.ts
│ │ └── parser.spec.ts
│ │ ├── observer
│ │ ├── dep.spec.ts
│ │ ├── observer.spec.ts
│ │ ├── scheduler.spec.ts
│ │ └── watcher.spec.ts
│ │ ├── server-compiler
│ │ └── compiler-options.spec.ts
│ │ ├── util
│ │ ├── error.spec.ts
│ │ ├── next-tick.spec.ts
│ │ └── toString.spec.ts
│ │ └── vdom
│ │ ├── create-component.spec.ts
│ │ ├── create-element.spec.ts
│ │ ├── modules
│ │ ├── attrs.spec.ts
│ │ ├── class.spec.ts
│ │ ├── directive.spec.ts
│ │ ├── dom-props.spec.ts
│ │ ├── events.spec.ts
│ │ └── style.spec.ts
│ │ └── patch
│ │ ├── children.spec.ts
│ │ ├── edge-cases.spec.ts
│ │ ├── element.spec.ts
│ │ ├── hooks.spec.ts
│ │ └── hydration.spec.ts
└── vitest.setup.ts
├── tsconfig.json
├── types
├── built-in-components.d.ts
├── common.d.ts
├── index.d.ts
├── jsx.d.ts
├── options.d.ts
├── plugin.d.ts
├── test
│ ├── async-component-test.ts
│ ├── augmentation-test.ts
│ ├── es-module.ts
│ ├── options-test.ts
│ ├── plugin-test.ts
│ ├── setup-helpers-test.ts
│ ├── umd-test.ts
│ ├── utils.ts
│ ├── v3
│ │ ├── define-async-component-test.tsx
│ │ ├── define-component-test.tsx
│ │ ├── inject-test.ts
│ │ ├── reactivity-test.ts
│ │ ├── setup-test.ts
│ │ ├── tsx-test.tsx
│ │ └── watch-test.ts
│ └── vue-test.ts
├── tsconfig.json
├── typings.json
├── umd.d.ts
├── v3-component-options.d.ts
├── v3-component-props.d.ts
├── v3-component-public-instance.d.ts
├── v3-define-async-component.d.ts
├── v3-define-component.d.ts
├── v3-directive.d.ts
├── v3-manual-apis.d.ts
├── v3-setup-context.d.ts
├── v3-setup-helpers.d.ts
├── vnode.d.ts
└── vue.d.ts
└── vitest.config.ts
/.editorconfig:
--------------------------------------------------------------------------------
1 | # https://editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | charset = utf-8
7 | indent_style = space
8 | indent_size = 2
9 | end_of_line = lf
10 | insert_final_newline = true
11 | trim_trailing_whitespace = true
12 |
13 | [*.md]
14 | insert_final_newline = false
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # chore: move to typescript
2 | af9fc2bcff31d5baa413039818a9b3e011deccaf
3 | # workflow: remove eslint, apply prettier
4 | 72aed6a149b94b5b929fb47370a7a6d4cb7491c5
5 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4 |
5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6 |
7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8 |
9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10 |
11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12 |
13 | This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
14 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [yyx990803, posva]
4 | patreon: evanyou
5 | open_collective: vuejs
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: npm/vue
8 | custom: # Replace with a single custom sponsorship URL
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Vue 2 has reached EOL!
4 | url: https://v2.vuejs.org/eol/
5 | about: Vue 2 has reached EOL and is no longer actively maintained. Click the link on the right for more details.
6 | - name: Vue 2 NES by HeroDevs
7 | url: https://www.herodevs.com/support/nes-vue?utm_source=vuejs-github&utm_medium=issue-form
8 | about: Learn more about Vue 2 NES if you have security or compliance requirements for continued Vue 2 usage.
9 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 | **What kind of change does this PR introduce?** (check at least one)
10 |
11 | - [ ] Bugfix
12 | - [ ] Feature
13 | - [ ] Code style update
14 | - [ ] Refactor
15 | - [ ] Build-related changes
16 | - [ ] Other, please describe:
17 |
18 | **Does this PR introduce a breaking change?** (check one)
19 |
20 | - [ ] Yes
21 | - [ ] No
22 |
23 | If yes, please describe the impact and migration path for existing applications:
24 |
25 | **The PR fulfills these requirements:**
26 |
27 | - [ ] It's submitted to the `main` branch for v2.x (or to a previous version branch)
28 | - [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix #xxx[,#xxx]`, where "xxx" is the issue number)
29 | - [ ] All tests are passing: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#development-setup
30 | - [ ] New/updated tests are included
31 |
32 | If adding a **new feature**, the PR's description includes:
33 | - [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)
34 |
35 | **Other information:**
36 |
--------------------------------------------------------------------------------
/.github/workflows/release-tag.yml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | tags:
4 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
5 |
6 | name: Create Release
7 |
8 | jobs:
9 | build:
10 | name: Create Release
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@master
15 | - name: Create Release for Tag
16 | id: release_tag
17 | uses: yyx990803/release-tag@master
18 | env:
19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 | with:
21 | tag_name: ${{ github.ref }}
22 | body: |
23 | Please refer to [CHANGELOG.md](https://github.com/vuejs/vue/blob/main/CHANGELOG.md) for details.
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | *.log
4 | explorations
5 | TODOs.md
6 | RELEASE_NOTE*.md
7 | packages/server-renderer/basic.js
8 | packages/server-renderer/build.dev.js
9 | packages/server-renderer/build.prod.js
10 | packages/server-renderer/server-plugin.js
11 | packages/server-renderer/client-plugin.js
12 | packages/template-compiler/build.js
13 | packages/template-compiler/browser.js
14 | .vscode
15 | dist
16 | temp
17 | types/v3-generated.d.ts
18 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | semi: false
2 | singleQuote: true
3 | printWidth: 80
4 | trailingComma: 'none'
5 | arrowParens: 'avoid'
6 |
--------------------------------------------------------------------------------
/BACKERS.md:
--------------------------------------------------------------------------------
1 |
Sponsors & Backers
2 |
3 | Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of the awesome sponsors and backers listed in this file. If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-present, Yuxi (Evan) You
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/api-extractor.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3 |
4 | "projectFolder": ".",
5 |
6 | "compiler": {
7 | "tsconfigFilePath": "api-extractor.tsconfig.json"
8 | },
9 |
10 | "mainEntryPointFilePath": "./temp/src/v3/index.d.ts",
11 |
12 | "dtsRollup": {
13 | "enabled": true,
14 | "untrimmedFilePath": "",
15 | "publicTrimmedFilePath": "./types/v3-generated.d.ts"
16 | },
17 |
18 | "apiReport": {
19 | "enabled": false
20 | },
21 |
22 | "docModel": {
23 | "enabled": false
24 | },
25 |
26 | "tsdocMetadata": {
27 | "enabled": false
28 | },
29 |
30 | "messages": {
31 | "compilerMessageReporting": {
32 | "default": {
33 | "logLevel": "warning"
34 | }
35 | },
36 |
37 | "extractorMessageReporting": {
38 | "default": {
39 | "logLevel": "warning",
40 | "addToApiReportFile": true
41 | },
42 |
43 | "ae-missing-release-tag": {
44 | "logLevel": "none"
45 | },
46 | "ae-internal-missing-underscore": {
47 | "logLevel": "none"
48 | },
49 | "ae-forgotten-export": {
50 | "logLevel": "none"
51 | }
52 | },
53 |
54 | "tsdocMessageReporting": {
55 | "default": {
56 | "logLevel": "warning"
57 | },
58 |
59 | "tsdoc-undefined-tag": {
60 | "logLevel": "none"
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/api-extractor.tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "baseUrl": "./temp",
5 | "types": []
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/benchmarks/big-table/demo.css:
--------------------------------------------------------------------------------
1 | form {
2 | margin-bottom: 15px;
3 | }
4 |
5 | td.hidden {
6 | color: #ccc;
7 | }
8 |
9 | table.filtered td.item {
10 | background-color: #FFFFBF;
11 | }
12 |
13 | table.filtered td.item.hidden {
14 | background-color: transparent;
15 | }
16 |
--------------------------------------------------------------------------------
/benchmarks/dbmon/app.js:
--------------------------------------------------------------------------------
1 | var app = new Vue({
2 | el: '#app',
3 | data: {
4 | databases: []
5 | }
6 | })
7 |
8 | function loadSamples() {
9 | app.databases = Object.freeze(ENV.generateData().toArray());
10 | Monitoring.renderRate.ping();
11 | setTimeout(loadSamples, ENV.timeout);
12 | }
13 |
14 | loadSamples()
15 |
--------------------------------------------------------------------------------
/benchmarks/dbmon/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | dbmon (Vue)
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 | {{db.dbname}}
17 |
18 | {{db.lastSample.nbQueries}}
19 |
20 |
21 | {{q.formatElapsed}}
22 |
23 |
{{q.query}}
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/benchmarks/dbmon/lib/styles.css:
--------------------------------------------------------------------------------
1 | body {color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;margin:0;}
2 | label {display:inline-block;font-weight:700;margin-bottom:5px;}
3 | input[type=range] {display:block;width:100%;}
4 | table {border-collapse:collapse;border-spacing:0;}
5 | :before,:after {box-sizing: border-box;}
6 |
7 | .table > thead > tr > th,.table > tbody > tr > th,.table > tfoot > tr > th,.table > thead > tr > td,.table > tbody > tr > td,.table > tfoot > tr > td {border-top:1px solid #ddd;line-height:1.42857143;padding:8px;vertical-align:top;}
8 | .table {width:100%;}
9 | .table-striped > tbody > tr:nth-child(odd) > td,.table-striped > tbody > tr:nth-child(odd) > th {background:#f9f9f9;}
10 |
11 | .label {border-radius:.25em;color:#fff;display:inline;font-size:75%;font-weight:700;line-height:1;padding:.2em .6em .3em;text-align:center;vertical-align:baseline;white-space:nowrap;}
12 | .label-success {background-color:#5cb85c;}
13 | .label-warning {background-color:#f0ad4e;}
14 |
15 | .popover {background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;box-shadow:0 5px 10px rgba(0,0,0,.2);display:none;left:0;max-width:276px;padding:1px;position:absolute;text-align:left;top:0;white-space:normal;z-index:1010;}
16 | .popover>.arrow:after {border-width:10px;content:"";}
17 | .popover.left {margin-left:-10px;}
18 | .popover.left > .arrow {border-right-width:0;border-left-color:rgba(0,0,0,.25);margin-top:-11px;right:-11px;top:50%;}
19 | .popover.left > .arrow:after {border-left-color:#fff;border-right-width:0;bottom:-10px;content:" ";right:1px;}
20 | .popover > .arrow {border-width:11px;}
21 | .popover > .arrow,.popover>.arrow:after {border-color:transparent;border-style:solid;display:block;height:0;position:absolute;width:0;}
22 |
23 | .popover-content {padding:9px 14px;}
24 |
25 | .Query {position:relative;}
26 | .Query:hover .popover {display:block;left:-100%;width:100%;}
27 |
--------------------------------------------------------------------------------
/benchmarks/ssr/README.md:
--------------------------------------------------------------------------------
1 | # Vue.js SSR benchmark
2 |
3 | This benchmark renders a table of 1000 rows with 10 columns (10k components), with around 30k normal elements on the page. Note this is not something likely to be seen in a typical app. This benchmark is mostly for stress/regression testing and comparing between `renderToString` and `renderToStream`.
4 |
5 | To view the results follow the run section. Note that the overall completion time for the results is variable, this is due to other system related variants at run time (available memory, processing power, etc). In ideal circumstances, both should finish within similar results.
6 |
7 | `renderToStream` pipes the content through a stream which provides considerable performance benefits (faster time-to-first-byte and non-event-loop-blocking) over `renderToString`. This can be observed through the benchmark.
8 |
9 | ### run
10 |
11 | ``` bash
12 | npm run bench:ssr
13 | ```
14 |
--------------------------------------------------------------------------------
/benchmarks/ssr/common.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const self = (global || root) // eslint-disable-line
4 |
5 | self.performance = {
6 | now: function () {
7 | var hrtime = process.hrtime()
8 | return ((hrtime[0] * 1000000 + hrtime[1] / 1000) / 1000)
9 | }
10 | }
11 |
12 | function generateGrid (rowCount, columnCount) {
13 | var grid = []
14 |
15 | for (var r = 0; r < rowCount; r++) {
16 | var row = { id: r, items: [] }
17 | for (var c = 0; c < columnCount; c++) {
18 | row.items.push({ id: (r + '-' + c) })
19 | }
20 | grid.push(row)
21 | }
22 |
23 | return grid
24 | }
25 |
26 | const gridData = generateGrid(1000, 10)
27 |
28 | module.exports = {
29 | template: '
{{ Math.random() }} ',
30 | components: {
31 | myTable: {
32 | data: function () {
33 | return {
34 | grid: gridData
35 | }
36 | },
37 | // template: '',
38 | template: '',
39 | components: {
40 | row: {
41 | props: ['row'],
42 | template: '{{ Math.random() }} ',
43 | components: {
44 | column: {
45 | template: '' +
46 | // 25 plain elements for each cell
47 | '' +
48 | `` +
49 | `fsefs ` +
50 | ' ' +
51 | ' ' +
52 | ' '
53 | }
54 | }
55 | }
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/benchmarks/ssr/renderToStream.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-unused-vars */
2 |
3 | 'use strict'
4 |
5 | process.env.NODE_ENV = 'production'
6 |
7 | const Vue = require('../../dist/vue.runtime.common.js')
8 | const createRenderer = require('../../packages/server-renderer').createRenderer
9 | const renderToStream = createRenderer().renderToStream
10 | const gridComponent = require('./common.js')
11 |
12 | console.log('--- renderToStream --- ')
13 | const self = (global || root)
14 | const s = self.performance.now()
15 |
16 | const stream = renderToStream(new Vue(gridComponent))
17 | let str = ''
18 | let first
19 | let complete
20 | stream.once('data', () => {
21 | first = self.performance.now() - s
22 | })
23 | stream.on('data', chunk => {
24 | str += chunk
25 | })
26 | stream.on('end', () => {
27 | complete = self.performance.now() - s
28 | console.log(`first chunk: ${first.toFixed(2)}ms`)
29 | console.log(`complete: ${complete.toFixed(2)}ms`)
30 | console.log()
31 | })
32 |
--------------------------------------------------------------------------------
/benchmarks/ssr/renderToString.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | const Vue = require('../../dist/vue.runtime.common.js')
6 | const createRenderer = require('../../packages/server-renderer').createRenderer
7 | const renderToString = createRenderer().renderToString
8 | const gridComponent = require('./common.js')
9 |
10 | console.log('--- renderToString --- ')
11 | const self = (global || root)
12 | self.s = self.performance.now()
13 |
14 | renderToString(new Vue(gridComponent), (err, res) => {
15 | if (err) throw err
16 | // console.log(res)
17 | console.log('Complete time: ' + (self.performance.now() - self.s).toFixed(2) + 'ms')
18 | console.log()
19 | })
20 |
--------------------------------------------------------------------------------
/compiler-sfc/index.d.ts:
--------------------------------------------------------------------------------
1 | export * from '@vue/compiler-sfc'
2 |
--------------------------------------------------------------------------------
/compiler-sfc/index.js:
--------------------------------------------------------------------------------
1 | module.exports = require('@vue/compiler-sfc')
2 |
--------------------------------------------------------------------------------
/compiler-sfc/index.mjs:
--------------------------------------------------------------------------------
1 | export * from '@vue/compiler-sfc'
2 |
--------------------------------------------------------------------------------
/compiler-sfc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "index.js",
3 | "module": "index.mjs",
4 | "types": "index.d.ts"
5 | }
6 |
--------------------------------------------------------------------------------
/dist/vue.common.js:
--------------------------------------------------------------------------------
1 | if (process.env.NODE_ENV === 'production') {
2 | module.exports = require('./vue.common.prod.js')
3 | } else {
4 | module.exports = require('./vue.common.dev.js')
5 | }
6 |
--------------------------------------------------------------------------------
/dist/vue.runtime.common.js:
--------------------------------------------------------------------------------
1 | if (process.env.NODE_ENV === 'production') {
2 | module.exports = require('./vue.runtime.common.prod.js')
3 | } else {
4 | module.exports = require('./vue.runtime.common.dev.js')
5 | }
6 |
--------------------------------------------------------------------------------
/dist/vue.runtime.mjs:
--------------------------------------------------------------------------------
1 | import Vue from './vue.runtime.common.js'
2 | export default Vue
3 |
4 | // this should be kept in sync with src/v3/index.ts
5 | export const {
6 | version,
7 |
8 | // refs
9 | ref,
10 | shallowRef,
11 | isRef,
12 | toRef,
13 | toRefs,
14 | unref,
15 | proxyRefs,
16 | customRef,
17 | triggerRef,
18 | computed,
19 |
20 | // reactive
21 | reactive,
22 | isReactive,
23 | isReadonly,
24 | isShallow,
25 | isProxy,
26 | shallowReactive,
27 | markRaw,
28 | toRaw,
29 | readonly,
30 | shallowReadonly,
31 |
32 | // watch
33 | watch,
34 | watchEffect,
35 | watchPostEffect,
36 | watchSyncEffect,
37 |
38 | // effectScope
39 | effectScope,
40 | onScopeDispose,
41 | getCurrentScope,
42 |
43 | // provide / inject
44 | provide,
45 | inject,
46 |
47 | // lifecycle
48 | onBeforeMount,
49 | onMounted,
50 | onBeforeUpdate,
51 | onUpdated,
52 | onBeforeUnmount,
53 | onUnmounted,
54 | onErrorCaptured,
55 | onActivated,
56 | onDeactivated,
57 | onServerPrefetch,
58 | onRenderTracked,
59 | onRenderTriggered,
60 |
61 | // v2 only
62 | set,
63 | del,
64 |
65 | // v3 compat
66 | h,
67 | getCurrentInstance,
68 | useSlots,
69 | useAttrs,
70 | mergeDefaults,
71 | nextTick,
72 | useCssModule,
73 | useCssVars,
74 | defineComponent,
75 | defineAsyncComponent
76 | } = Vue
77 |
--------------------------------------------------------------------------------
/examples/classic/commits/app.js:
--------------------------------------------------------------------------------
1 | var apiURL = 'https://api.github.com/repos/vuejs/vue/commits?per_page=3&sha='
2 |
3 | /**
4 | * Actual demo
5 | */
6 |
7 | new Vue({
8 | el: '#demo',
9 |
10 | data: {
11 | branches: ['main', 'dev'],
12 | currentBranch: 'main',
13 | commits: null
14 | },
15 |
16 | created: function () {
17 | this.fetchData()
18 | },
19 |
20 | watch: {
21 | currentBranch: 'fetchData'
22 | },
23 |
24 | filters: {
25 | truncate: function (v) {
26 | var newline = v.indexOf('\n')
27 | return newline > 0 ? v.slice(0, newline) : v
28 | },
29 | formatDate: function (v) {
30 | return v.replace(/T|Z/g, ' ')
31 | }
32 | },
33 |
34 | methods: {
35 | fetchData: function () {
36 | var self = this
37 | var xhr = new XMLHttpRequest()
38 | xhr.open('GET', apiURL + self.currentBranch)
39 | xhr.onload = function () {
40 | self.commits = JSON.parse(xhr.responseText)
41 | console.log(self.commits[0].html_url)
42 | }
43 | xhr.send()
44 | }
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/examples/classic/commits/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vue.js github commits example
5 |
21 |
22 |
23 |
24 |
25 |
26 |
Latest Vue.js Commits
27 |
28 |
33 | {{ branch }}
34 |
35 |
vuejs/vue@{{ currentBranch }}
36 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/examples/classic/elastic-header/style.css:
--------------------------------------------------------------------------------
1 | h1 {
2 | font-weight: 300;
3 | font-size: 1.8em;
4 | margin-top: 0;
5 | }
6 | a {
7 | color: #fff;
8 | }
9 | .draggable-header-view {
10 | background-color: #fff;
11 | box-shadow: 0 4px 16px rgba(0,0,0,.15);
12 | width: 320px;
13 | height: 560px;
14 | overflow: hidden;
15 | margin: 30px auto;
16 | position: relative;
17 | font-family: 'Roboto', Helvetica, Arial, sans-serif;
18 | color: #fff;
19 | font-size: 14px;
20 | font-weight: 300;
21 | -webkit-user-select: none;
22 | -moz-user-select: none;
23 | -ms-user-select: none;
24 | user-select: none;
25 | }
26 | .draggable-header-view .bg {
27 | position: absolute;
28 | top: 0;
29 | left: 0;
30 | z-index: 0;
31 | }
32 | .draggable-header-view .header, .draggable-header-view .content {
33 | position: relative;
34 | z-index: 1;
35 | padding: 30px;
36 | box-sizing: border-box;
37 | }
38 | .draggable-header-view .header {
39 | height: 160px;
40 | }
41 | .draggable-header-view .content {
42 | color: #333;
43 | line-height: 1.5em;
44 | }
45 |
--------------------------------------------------------------------------------
/examples/classic/firebase/app.js:
--------------------------------------------------------------------------------
1 | var emailRE = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
2 |
3 | // Setup Firebase
4 | var config = {
5 | apiKey: "AIzaSyAi_yuJciPXLFr_PYPeU3eTvtXf8jbJ8zw",
6 | authDomain: "vue-demo-537e6.firebaseapp.com",
7 | databaseURL: "https://vue-demo-537e6.firebaseio.com"
8 | }
9 | firebase.initializeApp(config)
10 |
11 | var usersRef = firebase.database().ref('users')
12 |
13 | // create Vue app
14 | var app = new Vue({
15 | // element to mount to
16 | el: '#app',
17 | // initial data
18 | data: {
19 | newUser: {
20 | name: '',
21 | email: ''
22 | }
23 | },
24 | // firebase binding
25 | // https://github.com/vuejs/vuefire
26 | firebase: {
27 | users: usersRef
28 | },
29 | // computed property for form validation state
30 | computed: {
31 | validation: function () {
32 | return {
33 | name: !!this.newUser.name.trim(),
34 | email: emailRE.test(this.newUser.email)
35 | }
36 | },
37 | isValid: function () {
38 | var validation = this.validation
39 | return Object.keys(validation).every(function (key) {
40 | return validation[key]
41 | })
42 | }
43 | },
44 | // methods
45 | methods: {
46 | addUser: function () {
47 | if (this.isValid) {
48 | usersRef.push(this.newUser)
49 | this.newUser.name = ''
50 | this.newUser.email = ''
51 | }
52 | },
53 | removeUser: function (user) {
54 | usersRef.child(user['.key']).remove()
55 | }
56 | }
57 | })
58 |
--------------------------------------------------------------------------------
/examples/classic/firebase/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vue.js firebase + validation example
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | {{user.name}} - {{user.email}}
20 | X
21 |
22 |
23 |
28 |
29 | Name cannot be empty.
30 | Please provide a valid email address.
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/examples/classic/firebase/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica, Arial, sans-serif;
3 | }
4 |
5 | ul {
6 | padding: 0;
7 | }
8 |
9 | .user {
10 | height: 30px;
11 | line-height: 30px;
12 | padding: 10px;
13 | border-top: 1px solid #eee;
14 | overflow: hidden;
15 | transition: all .25s ease;
16 | }
17 |
18 | .user:last-child {
19 | border-bottom: 1px solid #eee;
20 | }
21 |
22 | .v-enter, .v-leave-to {
23 | height: 0;
24 | padding-top: 0;
25 | padding-bottom: 0;
26 | border-top-width: 0;
27 | border-bottom-width: 0;
28 | }
29 |
30 | .errors {
31 | color: #f00;
32 | }
33 |
--------------------------------------------------------------------------------
/examples/classic/grid/grid.js:
--------------------------------------------------------------------------------
1 | // register the grid component
2 | Vue.component('demo-grid', {
3 | template: '#grid-template',
4 | replace: true,
5 | props: {
6 | data: Array,
7 | columns: Array,
8 | filterKey: String
9 | },
10 | data: function () {
11 | var sortOrders = {}
12 | this.columns.forEach(function (key) {
13 | sortOrders[key] = 1
14 | })
15 | return {
16 | sortKey: '',
17 | sortOrders: sortOrders
18 | }
19 | },
20 | computed: {
21 | filteredData: function () {
22 | var sortKey = this.sortKey
23 | var filterKey = this.filterKey && this.filterKey.toLowerCase()
24 | var order = this.sortOrders[sortKey] || 1
25 | var data = this.data
26 | if (filterKey) {
27 | data = data.filter(function (row) {
28 | return Object.keys(row).some(function (key) {
29 | return String(row[key]).toLowerCase().indexOf(filterKey) > -1
30 | })
31 | })
32 | }
33 | if (sortKey) {
34 | data = data.slice().sort(function (a, b) {
35 | a = a[sortKey]
36 | b = b[sortKey]
37 | return (a === b ? 0 : a > b ? 1 : -1) * order
38 | })
39 | }
40 | return data
41 | }
42 | },
43 | filters: {
44 | capitalize: function (str) {
45 | return str.charAt(0).toUpperCase() + str.slice(1)
46 | }
47 | },
48 | methods: {
49 | sortBy: function (key) {
50 | this.sortKey = key
51 | this.sortOrders[key] = this.sortOrders[key] * -1
52 | }
53 | }
54 | })
55 |
56 | // bootstrap the demo
57 | var demo = new Vue({
58 | el: '#demo',
59 | data: {
60 | searchQuery: '',
61 | gridColumns: ['name', 'power'],
62 | gridData: [
63 | { name: 'Chuck Norris', power: Infinity },
64 | { name: 'Bruce Lee', power: 9000 },
65 | { name: 'Jackie Chan', power: 7000 },
66 | { name: 'Jet Li', power: 8000 }
67 | ]
68 | }
69 | })
70 |
--------------------------------------------------------------------------------
/examples/classic/grid/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue.js grid component example
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
36 |
37 |
38 |
39 |
42 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/examples/classic/grid/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica Neue, Arial, sans-serif;
3 | font-size: 14px;
4 | color: #444;
5 | }
6 |
7 | table {
8 | border: 2px solid #42b983;
9 | border-radius: 3px;
10 | background-color: #fff;
11 | }
12 |
13 | th {
14 | background-color: #42b983;
15 | color: rgba(255,255,255,0.66);
16 | cursor: pointer;
17 | -webkit-user-select: none;
18 | -moz-user-select: none;
19 | -ms-user-select: none;
20 | user-select: none;
21 | }
22 |
23 | td {
24 | background-color: #f9f9f9;
25 | }
26 |
27 | th, td {
28 | min-width: 120px;
29 | padding: 10px 20px;
30 | }
31 |
32 | th.active {
33 | color: #fff;
34 | }
35 |
36 | th.active .arrow {
37 | opacity: 1;
38 | }
39 |
40 | .arrow {
41 | display: inline-block;
42 | vertical-align: middle;
43 | width: 0;
44 | height: 0;
45 | margin-left: 5px;
46 | opacity: 0.66;
47 | }
48 |
49 | .arrow.asc {
50 | border-left: 4px solid transparent;
51 | border-right: 4px solid transparent;
52 | border-bottom: 4px solid #fff;
53 | }
54 |
55 | .arrow.dsc {
56 | border-left: 4px solid transparent;
57 | border-right: 4px solid transparent;
58 | border-top: 4px solid #fff;
59 | }
60 |
--------------------------------------------------------------------------------
/examples/classic/markdown/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue.js markdown editor example
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
18 |
19 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/examples/classic/markdown/style.css:
--------------------------------------------------------------------------------
1 | html, body, #editor {
2 | margin: 0;
3 | height: 100%;
4 | font-family: 'Helvetica Neue', Arial, sans-serif;
5 | color: #333;
6 | }
7 |
8 | textarea, #editor div {
9 | display: inline-block;
10 | width: 49%;
11 | height: 100%;
12 | vertical-align: top;
13 | -webkit-box-sizing: border-box;
14 | -moz-box-sizing: border-box;
15 | box-sizing: border-box;
16 | padding: 0 20px;
17 | }
18 |
19 | textarea {
20 | border: none;
21 | border-right: 1px solid #ccc;
22 | resize: none;
23 | outline: none;
24 | background-color: #f6f6f6;
25 | font-size: 14px;
26 | font-family: 'Monaco', courier, monospace;
27 | padding: 20px;
28 | }
29 |
30 | code {
31 | color: #f66;
32 | }
--------------------------------------------------------------------------------
/examples/classic/modal/style.css:
--------------------------------------------------------------------------------
1 | .modal-mask {
2 | position: fixed;
3 | z-index: 9998;
4 | top: 0;
5 | left: 0;
6 | width: 100%;
7 | height: 100%;
8 | background-color: rgba(0, 0, 0, .5);
9 | display: table;
10 | transition: opacity .3s ease;
11 | }
12 |
13 | .modal-wrapper {
14 | display: table-cell;
15 | vertical-align: middle;
16 | }
17 |
18 | .modal-container {
19 | width: 300px;
20 | margin: 0px auto;
21 | padding: 20px 30px;
22 | background-color: #fff;
23 | border-radius: 2px;
24 | box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
25 | transition: all .3s ease;
26 | font-family: Helvetica, Arial, sans-serif;
27 | }
28 |
29 | .modal-header h3 {
30 | margin-top: 0;
31 | color: #42b983;
32 | }
33 |
34 | .modal-body {
35 | margin: 20px 0;
36 | }
37 |
38 | .modal-default-button {
39 | float: right;
40 | }
41 |
42 | /*
43 | * The following styles are auto-applied to elements with
44 | * transition="modal" when their visibility is toggled
45 | * by Vue.js.
46 | *
47 | * You can easily play with the modal transition by editing
48 | * these styles.
49 | */
50 |
51 | .modal-enter {
52 | opacity: 0;
53 | }
54 |
55 | .modal-leave-to {
56 | opacity: 0;
57 | }
58 |
59 | .modal-enter .modal-container,
60 | .modal-leave-to .modal-container {
61 | -webkit-transform: scale(1.1);
62 | transform: scale(1.1);
63 | }
64 |
--------------------------------------------------------------------------------
/examples/classic/svg/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue.js SVG graph example
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | {{stat.label}}
40 |
41 | {{stat.value}}
42 | X
43 |
44 |
48 |
{{ stats }}
49 |
50 |
51 | * input[type="range"] requires IE10 or above.
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/examples/classic/svg/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica Neue, Arial, sans-serif;
3 | }
4 |
5 | polygon {
6 | fill: #42b983;
7 | opacity: .75;
8 | }
9 |
10 | circle {
11 | fill: transparent;
12 | stroke: #999;
13 | }
14 |
15 | text {
16 | font-family: Helvetica Neue, Arial, sans-serif;
17 | font-size: 10px;
18 | fill: #666;
19 | }
20 |
21 | label {
22 | display: inline-block;
23 | margin-left: 10px;
24 | width: 20px;
25 | }
26 |
27 | #raw {
28 | position: absolute;
29 | top: 0;
30 | left: 300px;
31 | }
--------------------------------------------------------------------------------
/examples/classic/todomvc/readme.md:
--------------------------------------------------------------------------------
1 | # Vue.js TodoMVC Example
2 |
3 | > Vue.js is a library for building interactive web interfaces.
4 | It provides data-driven, nestable view components with a simple and flexible API.
5 |
6 | > _[Vue.js - v2.vuejs.org](https://v2.vuejs.org)_
7 |
8 | ## Learning Vue.js
9 | The [Vue.js website](https://v2.vuejs.org/) is a great resource to get started.
10 |
11 | Here are some links you may find helpful:
12 |
13 | * [Official Guide](https://v2.vuejs.org/guide/)
14 | * [API Reference](https://v2.vuejs.org/api/)
15 | * [Examples](https://v2.vuejs.org/examples/)
16 |
17 | Get help from other Vue.js users:
18 |
19 | * [Vue.js official forum](https://forum.vuejs.org)
20 | * [Vue.js on Twitter](https://twitter.com/vuejs)
21 | * [Vue.js on Gitter](https://gitter.im/vuejs/vue)
22 |
23 | _If you have other helpful links to share, or find any of the links above no longer work, please [let us know](https://github.com/tastejs/todomvc/issues)._
24 |
25 | ## Credit
26 |
27 | This TodoMVC application was created by [Evan You](https://evanyou.me).
28 |
--------------------------------------------------------------------------------
/examples/classic/tree/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue.js tree view example
6 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
48 |
49 | (You can double click on an item to turn it into a folder.)
50 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/examples/classic/tree/tree.js:
--------------------------------------------------------------------------------
1 | // demo data
2 | var data = {
3 | name: 'My Tree',
4 | children: [
5 | { name: 'hello' },
6 | { name: 'wat' },
7 | {
8 | name: 'child folder',
9 | children: [
10 | {
11 | name: 'child folder',
12 | children: [
13 | { name: 'hello' },
14 | { name: 'wat' }
15 | ]
16 | },
17 | { name: 'hello' },
18 | { name: 'wat' },
19 | {
20 | name: 'child folder',
21 | children: [
22 | { name: 'hello' },
23 | { name: 'wat' }
24 | ]
25 | }
26 | ]
27 | }
28 | ]
29 | }
30 |
31 | // define the item component
32 | Vue.component('item', {
33 | template: '#item-template',
34 | props: {
35 | model: Object
36 | },
37 | data: function () {
38 | return {
39 | open: false
40 | }
41 | },
42 | computed: {
43 | isFolder: function () {
44 | return this.model.children &&
45 | this.model.children.length
46 | }
47 | },
48 | methods: {
49 | toggle: function () {
50 | if (this.isFolder) {
51 | this.open = !this.open
52 | }
53 | },
54 | changeType: function () {
55 | if (!this.isFolder) {
56 | Vue.set(this.model, 'children', [])
57 | this.addChild()
58 | this.open = true
59 | }
60 | },
61 | addChild: function () {
62 | this.model.children.push({
63 | name: 'new stuff'
64 | })
65 | }
66 | }
67 | })
68 |
69 | // boot up the demo
70 | var demo = new Vue({
71 | el: '#demo',
72 | data: {
73 | treeData: data
74 | }
75 | })
76 |
--------------------------------------------------------------------------------
/examples/composition/markdown.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
29 |
30 |
67 |
--------------------------------------------------------------------------------
/packages/compiler-sfc/api-extractor.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3 |
4 | "projectFolder": ".",
5 |
6 | "mainEntryPointFilePath": "../../temp/packages/compiler-sfc/src/index.d.ts",
7 |
8 | "compiler": {
9 | "tsconfigFilePath": "../../api-extractor.tsconfig.json"
10 | },
11 |
12 | "dtsRollup": {
13 | "enabled": true,
14 | "untrimmedFilePath": "",
15 | "publicTrimmedFilePath": "./dist/compiler-sfc.d.ts"
16 | },
17 |
18 | "apiReport": {
19 | "enabled": false
20 | },
21 |
22 | "docModel": {
23 | "enabled": false
24 | },
25 |
26 | "tsdocMetadata": {
27 | "enabled": false
28 | },
29 |
30 | "messages": {
31 | "compilerMessageReporting": {
32 | "default": {
33 | "logLevel": "warning"
34 | }
35 | },
36 |
37 | "extractorMessageReporting": {
38 | "default": {
39 | "logLevel": "warning",
40 | "addToApiReportFile": true
41 | },
42 |
43 | "ae-missing-release-tag": {
44 | "logLevel": "none"
45 | },
46 | "ae-internal-missing-underscore": {
47 | "logLevel": "none"
48 | },
49 | "ae-forgotten-export": {
50 | "logLevel": "none"
51 | }
52 | },
53 |
54 | "tsdocMessageReporting": {
55 | "default": {
56 | "logLevel": "warning"
57 | },
58 |
59 | "tsdoc-undefined-tag": {
60 | "logLevel": "none"
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/packages/compiler-sfc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vue/compiler-sfc",
3 | "version": "2.7.16",
4 | "description": "compiler-sfc for Vue 2",
5 | "main": "dist/compiler-sfc.js",
6 | "types": "dist/compiler-sfc.d.ts",
7 | "files": [
8 | "dist"
9 | ],
10 | "dependencies": {
11 | "@babel/parser": "^7.23.5",
12 | "postcss": "^8.4.14",
13 | "source-map": "^0.6.1"
14 | },
15 | "devDependencies": {
16 | "@babel/types": "^7.23.5",
17 | "@types/estree": "^0.0.48",
18 | "@types/hash-sum": "^1.0.0",
19 | "@types/lru-cache": "^5.1.1",
20 | "@vue/consolidate": "^0.17.3",
21 | "de-indent": "^1.0.2",
22 | "estree-walker": "^2.0.2",
23 | "hash-sum": "^2.0.0",
24 | "less": "^4.1.3",
25 | "lru-cache": "^5.1.1",
26 | "magic-string": "^0.25.9",
27 | "merge-source-map": "^1.1.0",
28 | "postcss-modules": "^4.3.1",
29 | "postcss-selector-parser": "^6.0.10",
30 | "pug": "^3.0.2",
31 | "sass": "^1.52.3",
32 | "stylus": "^0.58.1"
33 | },
34 | "optionalDependencies": {
35 | "prettier": "^1.18.2 || ^2.0.0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/packages/compiler-sfc/src/index.ts:
--------------------------------------------------------------------------------
1 | // API
2 | export { parse } from './parse'
3 | export { compileTemplate } from './compileTemplate'
4 | export { compileStyle, compileStyleAsync } from './compileStyle'
5 | export { compileScript } from './compileScript'
6 | export { generateCodeFrame } from 'compiler/codeframe'
7 | export { rewriteDefault } from './rewriteDefault'
8 |
9 | // For backwards compat only. Some existing tools like
10 | // fork-ts-checker-webpack-plugin relies on its presence for differentiating
11 | // between Vue 2 and Vue 3.
12 | // ref #12719
13 | // ref https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/765
14 | export { parseComponent } from './parseComponent'
15 |
16 | // types
17 | export { SFCParseOptions } from './parse'
18 | export { CompilerOptions, WarningMessage } from 'types/compiler'
19 | export { TemplateCompiler } from './types'
20 | export {
21 | SFCBlock,
22 | SFCCustomBlock,
23 | SFCScriptBlock,
24 | SFCDescriptor
25 | } from './parseComponent'
26 | export {
27 | SFCTemplateCompileOptions,
28 | SFCTemplateCompileResults
29 | } from './compileTemplate'
30 | export { SFCStyleCompileOptions, SFCStyleCompileResults } from './compileStyle'
31 | export { SFCScriptCompileOptions } from './compileScript'
32 |
--------------------------------------------------------------------------------
/packages/compiler-sfc/src/stylePlugins/trim.ts:
--------------------------------------------------------------------------------
1 | import { PluginCreator } from 'postcss'
2 |
3 | const trimPlugin: PluginCreator<{}> = () => {
4 | return {
5 | postcssPlugin: 'vue-sfc-trim',
6 | Once(root) {
7 | root.walk(({ type, raws }) => {
8 | if (type === 'rule' || type === 'atrule') {
9 | if (raws.before) raws.before = '\n'
10 | if ('after' in raws && raws.after) raws.after = '\n'
11 | }
12 | })
13 | }
14 | }
15 | }
16 |
17 | trimPlugin.postcss = true
18 | export default trimPlugin
19 |
--------------------------------------------------------------------------------
/packages/compiler-sfc/src/types.ts:
--------------------------------------------------------------------------------
1 | import { CompilerOptions, CompiledResult } from 'types/compiler'
2 | import { SFCDescriptor } from './parseComponent'
3 |
4 | export interface StartOfSourceMap {
5 | file?: string
6 | sourceRoot?: string
7 | }
8 |
9 | export interface RawSourceMap extends StartOfSourceMap {
10 | version: string
11 | sources: string[]
12 | names: string[]
13 | sourcesContent?: string[]
14 | mappings: string
15 | }
16 |
17 | export interface TemplateCompiler {
18 | parseComponent(source: string, options?: any): SFCDescriptor
19 | compile(template: string, options: CompilerOptions): CompiledResult
20 | ssrCompile(template: string, options: CompilerOptions): CompiledResult
21 | }
22 |
23 | export const enum BindingTypes {
24 | /**
25 | * returned from data()
26 | */
27 | DATA = 'data',
28 | /**
29 | * declared as a prop
30 | */
31 | PROPS = 'props',
32 | /**
33 | * a local alias of a `
7 |
8 |
9 |
10 |
11 |
12 | {{ num }}
13 |
14 |
15 |
16 |
25 |
26 |
27 |
28 |
29 | Expand is True
30 |
31 |
34 |
35 | countA: {{countA}}
36 |
37 |
38 | countB: {{countB}}
39 |
40 |
41 |
51 |
52 |
53 |