A Vue 3 Component Library
Fairly Complete, Theme Customizable, Uses TypeScript, Fast
Kinda Interesting
English | 中文
## Documentation [www.naiveui.com](http://www.naiveui.com) ## Community - [Discord](https://discord.gg/Pqv7Mev5Dd) - DingTalk Group 1 (Member limit reached) 33482509 - DingTalk Group 2 (Member limit reached) 35886835 - DingTalk Group 3 (Member limit reached) 32377370 - DingTalk Group 4 (Member limit reached) 8165002788 - DingTalk Group 5 (Member limit reached) 31205022250 - DingTalk Group 6 (Member limit reached) 62720001971 - DingTalk Group 7 172000005810 - [Awesome Naive UI](https://github.com/naive-ui/awesome-naive) ## Features ### Fairly Complete There are more than 90 components. Hope they can help you write less code. What's more, they are all treeshakable. ### Theme Customizable We provide an advanced type safe theme system built using TypeScript. All you need is to provide a theme overrides object in JS. Then all the stuff will be done by us. What's more, no less/sass/css variables, no webpack loaders are required. ### Uses TypeScript All the stuff in Naive UI is written in TypeScript. It can work with your typescript project seamlessly. What's more, you don't need to import any CSS to use the components. ### Fast I try to make it not rather slow. All data components works with virtual list by default. What's more, ..., no more. Just enjoy it. ## Installation ### npm Use npm to install. ```bash npm i -D naive-ui ``` ### Fonts ```bash npm i -D vfonts ``` ### Icons Naive UI recommends using [xicons](https://www.xicons.org) as icon library. ### Design Resources [Naive UI (Sketch)](https://naive-ui.oss-accelerate.aliyuncs.com/NaiveUI-Design-Library-en-US.sketch). ## Contributing Please see [CONTRIBUTING.md](https://github.com/tusen-ai/naive-ui/blob/main/CONTRIBUTING.md). ## License Naive UI is licensed under the [MIT license](https://opensource.org/licenses/MIT). Graphics resources of `result` component is licensed under the [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/). The graphics resources come from [Twemoji](https://github.com/twitter/twemoji). ================================================ FILE: README.zh-CN.md ================================================
一个 Vue 3 组件库
比较完整,主题可调,使用 TypeScript,快
有点意思
English | 中文
## 文档 [www.naiveui.com](http://www.naiveui.com) ## 社区 - [Discord](https://discord.gg/Pqv7Mev5Dd) - 钉钉一群 33482509 (已满) - 钉钉二群 35886835 (已满) - 钉钉三群 32377370 (已满) - 钉钉四群 8165002788 (已满) - 钉钉五群 31205022250 (已满) - 钉钉六群 62720001971 (已满) - 钉钉七群 172000005810 - [Awesome Naive UI](https://github.com/naive-ui/awesome-naive) 钉钉群加入方法:在**搜索框**中搜索群号,点击下拉框中更多分组内的**网络查找公开群组** ## 特性 ### 比较完整 有超过 90 个组件,希望能帮你少写点代码。 顺便一提,它们全都可以 treeshaking。 ### 主题可调 我们提供了一个使用 TypeScript 构建的先进的类型安全主题系统。你只需要提供一个样式覆盖的对象,剩下的都交给我们。 顺便一提,不用 less、sass、css 变量,也不用 webpack 的 loaders。以及你可以试试右下角的主题编辑器。 ### 使用 TypeScript Naive UI 全量使用 TypeScript 编写,和你的 TypeScript 项目无缝衔接。 顺便一提,你不需要导入任何 CSS 就能让组件正常工作。 ### 快 我尽力让它不要太慢。任何数据组件均可使用虚拟列表。 顺便一提,...,没有顺便了。祝你使用愉快。 ## 安装 ### npm 使用 npm 安装。 ```bash npm i -D naive-ui ``` ### 字体 ```bash npm i -D vfonts ``` ### 图标 naive-ui 建议使用 [xicons](https://www.xicons.org) 作为图标库。 ### 设计资源 [Naive UI (Sketch)](https://naive-ui.oss-accelerate.aliyuncs.com/NaiveUI-Design-Library-zh-CN.sketch) ## 贡献 请参考 [CONTRIBUTING.zh-CN.md](https://github.com/tusen-ai/naive-ui/blob/main/CONTRIBUTING.zh-CN.md) ## 许可 Naive UI 使用 [MIT license](https://opensource.org/licenses/MIT) 许可证书。 `result` 组件的图像资源来自于 [Twemoji](https://github.com/twitter/twemoji),遵守 [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) 许可。 ================================================ FILE: babel.config.js ================================================ // the file is used for site building and other tooling builds // > 2%, make template string not compiled to concat, since it's not fast const process = require('node:process') module.exports = { presets: process.env.NODE_ENV === 'test' ? [['@babel/preset-env', { targets: { node: 'current' } }]] : [ [ '@babel/preset-env', { targets: '>2%, not IE 11' } ] ] } ================================================ FILE: build/loaders/ComponentDemoTemplate.vue ================================================
{{ themeVars }}
================================================
FILE: demo/pages/docs/theme/zhCN/element.demo.vue
================================================
{{ themeVars }}
================================================
FILE: demo/pages/docs/umd/enUS/index.md
================================================
# Using UMD
(
prefix: P,
suffix: S
): S extends 'default' ? P : `${P}${Capitalize}` {
return (prefix
+ (suffix === 'default'
? ''
: suffix.replace(/^[a-z]/, startChar =>
startChar.toUpperCase()))) as any
}
export {
asModal,
c,
cB,
cCB,
cE,
cM,
cNotM,
createKey,
find,
insideModal,
insidePopover,
namespace,
prefix
}
================================================
FILE: src/_utils/dom/download.ts
================================================
export function download(url: string | null, name: string | undefined): void {
if (!url)
return
const a = document.createElement('a')
a.href = url
if (name !== undefined) {
a.download = name
}
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
export function publicDownload(url: string, name: string | undefined): void {
download(url, name)
}
================================================
FILE: src/_utils/dom/index.ts
================================================
export { download } from './download'
export { isDocument } from './is-document'
================================================
FILE: src/_utils/dom/is-document.ts
================================================
export function isDocument(node: Node): node is Document {
return node.nodeName === '#document'
}
================================================
FILE: src/_utils/env/browser.ts
================================================
import { isBrowser } from './is-browser'
export const isChrome = isBrowser && 'chrome' in window
export const isFirefox = isBrowser && navigator.userAgent.includes('Firefox')
export const isSafari
= isBrowser && navigator.userAgent.includes('Safari') && !isChrome
================================================
FILE: src/_utils/env/is-browser.ts
================================================
export const isBrowser
= typeof document !== 'undefined' && typeof window !== 'undefined'
================================================
FILE: src/_utils/env/is-jsdom.ts
================================================
let _isJsdom: boolean | undefined
export function isJsdom(): boolean {
if (_isJsdom === undefined) {
_isJsdom
= navigator.userAgent.includes('Node.js')
|| navigator.userAgent.includes('jsdom')
}
return _isJsdom
}
================================================
FILE: src/_utils/env/is-native-lazy-load.ts
================================================
import { isBrowser } from './is-browser'
export const isImageSupportNativeLazy
= isBrowser && 'loading' in document.createElement('img')
================================================
FILE: src/_utils/event/index.ts
================================================
const eventSet = new WeakSet