diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4c257de..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules
-dist
-lib
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7dbae3b..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-# 编译环境
-language: node_js
-
-# Node 版本
-node_js:
- - "10"
-
-# 安装依赖
-install:
- - npm install
-
-# 代码编译
-script:
- - npm run build
- - npm run release
-
-# 发布配置
-deploy:
- # 发布到 gh-pages
- - provider: pages
- local_dir: dist
- skip_cleanup: true
- github_token: $GITHUB_TOKEN
- keep_history: true
- on:
- branch: master
- # 发布到 npm
- - provider: npm
- email: $NPM_EMAIL
- api_key: $NPM_TOKEN
- skip_cleanup: true
- on:
- tags: true
- branch: master
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 8bbb8f9..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# 更新日志
-
-- 修订版本号:修复 bug,代码调整,功能优化。
-- 次版本号:新增功组件或者新增功能。
-- 主版本号:含有破坏性更新和新特性。
-
-## 0.1.0
-
-`2020-04-15`
-
-- 🎉 第一个组件示例
diff --git a/README.md b/README.md
deleted file mode 100644
index b6bed2a..0000000
--- a/README.md
+++ /dev/null
@@ -1,693 +0,0 @@
-# VUE-UI-DOCS
-
-vue 2.x 组件库自动解析 `Markdown` 示例,自动构建发布到 `github-pages` 和 `npm`
-
-[旧版本代码](https://github.com/kitorv/vue-ui-docs/tree/v0.x)
-
-## 实现目标
-
-- 自动发布
- - [x] 使用 `Travis` 自动构建和发布代码
- - [x] 提交代码到 `master` 分支,自动发布到 `github-pages`
- - [x] 打标签 `tag` 到 `master` 分支,自动发布到 `npm`
-- 文档解析
- - [x] `.md` 文件通过编写 `webpack` 加载器解析为 `vue` 代码
- - [x] `Markdown` 文件解析其中包含 `snippet::: {code} :::` 格式为局部组件
-- 项目构建
- - [x] `travis` 自动构建 [https://travis-ci.org/github/kitorv/vue-ui-docs](https://travis-ci.org/github/kitorv/vue-ui-docs)
- - [x] `github-pages` 在线访问 [https://kitorv.github.io/vue-ui-docs](https://kitorv.github.io/vue-ui-docs)
- - [x] `npm` 包安装 [https://www.npmjs.com/package/vue-ui-docs](https://www.npmjs.com/package/vue-ui-docs)
-
-代码示例格式:
-
-````markdown
-:::snippet 通过 `v-button` 标签初始化按钮。
-
-```html
-
- Home
-
-
-
-```
-
-4. 页面访问
-
-
-
-## 组件开发
-
-1. `Button` 组件开发
-
-```html
-
-
-
-
-
-
-
-```
-
-2. 安装配置 `src/button/index.js`
-
-```javascript
-import Button from "./src/button";
-
-Button.install = (Vue) => {
- Vue.component(Button.name, Button);
-};
-
-export default Button;
-```
-
-3. 组件集成安装 `src/index.js`
-
-```javascript
-import Button from "./button/index.js";
-
-const components = [Button];
-
-const install = (Vue) => {
- components.forEach((component) => {
- Vue.use(component);
- });
-};
-
-export default {
- install,
-};
-```
-
-4. 入口文件引入 `site/main.js`
-
-```javascript
-import VueUIDocs from "../src/index";
-Vue.use(VueUIDocs);
-```
-
-## 文档解析
-
-1. 文档示例组件开发 `site/components/snippet.vue` ,并且在 `site/main.js` 使用 `Vue.component` 全局注册
-
-```html
-
-
${
- hljs.highlight(lang, str, true).value
- }
`;
- }
- return `${markdownIt.utils.escapeHtml(
- str
- )}
`;
- },
- });
- // 解析【:::tip:::】
- markdownIt.use(MarkdownItContainer, "tip");
- // 解析【:::warning:::】
- markdownIt.use(MarkdownItContainer, "warning");
- // 使用【markdown-it-container】插件解析【:::snippet :::】代码块为vue渲染
- markdownIt.use(MarkdownItContainer, "snippet", {
- // 验证代码块为【:::snippet :::】才进行渲染
- validate(params) {
- return params.trim().match(/^snippet\s*(.*)$/);
- },
- // 代码块渲染
- render(tokens, index) {
- const token = tokens[index];
- const tokenInfo = token.info.trim().match(/^snippet\s*(.*)$/);
- if (token.nesting === 1) {
- // 获取snippet第一行的表述内容
- const desc = tokenInfo && tokenInfo.length > 1 ? tokenInfo[1] : "";
- // 获取vue组件示例的代码
- const nextIndex = tokens[index + 1];
- let content = nextIndex.type === "fence" ? nextIndex.content : "";
- if (!/^/.test(content)) {
- content = `${codeHtml}
`;
- },
- });
- // 解析【:::tip:::】
- markdownIt.use(MarkdownItContainer, "tip");
- // 解析【:::warning:::】
- markdownIt.use(MarkdownItContainer, "warning");
- // 使用【markdown-it-container】插件解析【:::snippet :::】代码块为vue渲染
- markdownIt.use(MarkdownItContainer, "snippet", {
- // 验证代码块为【:::snippet :::】才进行渲染
- validate(params) {
- return params.trim().match(/^snippet\s*(.*)$/);
- },
- // 代码块渲染
- render(tokens, index) {
- const token = tokens[index];
- const tokenInfo = token.info.trim().match(/^snippet\s*(.*)$/);
- if (token.nesting === 1) {
- // 获取snippet第一行的表述内容
- const desc = tokenInfo && tokenInfo.length > 1 ? tokenInfo[1] : "";
- // 获取vue组件示例的代码
- const nextIndex = tokens[index + 1];
- let content = nextIndex.type === "fence" ? nextIndex.content : "";
- // 将content解析为vue组件基本属性对象;
- let { template, script, styles } = parse({
- source: content,
- compiler: VueTemplateComplier,
- needMap: false,
- });
- styleCodeList = styleCodeList.concat(styles);
- // 将template的转为render函数
- let templateCodeRender = "";
- if (template && template.content) {
- const { code } = compileTemplate({
- source: template.content,
- compiler: VueTemplateComplier,
- });
- templateCodeRender = code;
- }
-
- // 获取script的代码
- script = script ? script.content : "";
- if (script) {
- const [global, content] = script.split(/export\s+default/);
- globalScript.push(global.trim());
- script = `const exportJavaScript = ${content}`;
- } else {
- script = "const exportJavaScript = {};";
- }
- // 代码块解析将需要解析vue组件的存储,渲染html用组件名称替代
- const name = `vc-snippent-${componentCodeList.length}`;
- // 渲染组件代码添加到数据集合
- componentCodeList.push(`"${name}":(function () {
- ${templateCodeRender}
- ${script}
- return {
- ...exportJavaScript,
- ${templateCodeRender ? "render," : ""}
- ${templateCodeRender ? "staticRenderFns," : ""}
- }
- })()`);
- // 将需要渲染的示例用vc-snippet组件包裹替换插槽显示示例效果
- return `vue-ui-docs 基于 vue.js 2.x 组件库。
\n项目直接使用 npm
命令安装。
npm i vue-ui-docs -S\n
\n入口文件引入。
\nimport VueUIDocs from \"vue-ui-docs\";\nimport \"vue-ui-docs/lib/vue-ui-docs.css\";\nVue.use(VueUIDocs);\n
\n直接在项目中使用。
\n<template>\n <v-button>Button</v-button>\n</template>\n
\n\n 2020-04-15
按钮用于开始一个即时操作。
\n通过 v-button
标签初始化按钮。
<template>\n <div>\n <v-button>Default</v-button>\n </div>\n</template>\n
\n 通过 text
设置按钮文本。
<template>\n <div>\n <v-button text=\"Default\"></v-button>\n </div>\n</template>\n
\n 绑定 click
事件。
<template>\n <div>\n <v-button text=\"Default\" @click=\"handleButtonClick\"></v-button>\n </div>\n</template>\n\n<script>\n export default {\n methods: {\n handleButtonClick() {\n alert(1);\n },\n },\n };\n</script>\n
\n 示例代码支持jsx
渲染。
<script>\n export default {\n render() {\n return (\n <div>\n <v-button\n text=\"Default\"\n onClick={() => {\n this.handleButtonClick();\n }}\n ></v-button>\n </div>\n );\n },\n methods: {\n handleButtonClick() {\n alert(1);\n },\n },\n };\n</script>\n
\n 参数 | \n说明 | \n类型 | \n可选值 | \n默认值 | \n
---|---|---|---|---|
text | \n按钮文本 | \nString | \n— | \n— | \n
事件名称 | \n说明 | \n回调参数 | \n
---|---|---|
click | \n单击触发 | \nevent | \n
名称 | \n说明 | \n
---|---|
— | \n按钮内容 | \n
, or missing
. Bailing hydration and performing ' +\n 'full client-side render.'\n );\n }\n }\n // either not server-rendered, or hydration failed.\n // create an empty node and replace it\n oldVnode = emptyNodeAt(oldVnode);\n }\n\n // replacing existing element\n var oldElm = oldVnode.elm;\n var parentElm = nodeOps.parentNode(oldElm);\n\n // create new node\n createElm(\n vnode,\n insertedVnodeQueue,\n // extremely rare edge case: do not insert if old element is in a\n // leaving transition. Only happens when combining transition +\n // keep-alive + HOCs. (#4590)\n oldElm._leaveCb ? null : parentElm,\n nodeOps.nextSibling(oldElm)\n );\n\n // update parent placeholder node element, recursively\n if (isDef(vnode.parent)) {\n var ancestor = vnode.parent;\n var patchable = isPatchable(vnode);\n while (ancestor) {\n for (var i = 0; i < cbs.destroy.length; ++i) {\n cbs.destroy[i](ancestor);\n }\n ancestor.elm = vnode.elm;\n if (patchable) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, ancestor);\n }\n // #6513\n // invoke insert hooks that may have been merged by create hooks.\n // e.g. for directives that uses the \"inserted\" hook.\n var insert = ancestor.data.hook.insert;\n if (insert.merged) {\n // start at index 1 to avoid re-invoking component mounted hook\n for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {\n insert.fns[i$2]();\n }\n }\n } else {\n registerRef(ancestor);\n }\n ancestor = ancestor.parent;\n }\n }\n\n // destroy old node\n if (isDef(parentElm)) {\n removeVnodes([oldVnode], 0, 0);\n } else if (isDef(oldVnode.tag)) {\n invokeDestroyHook(oldVnode);\n }\n }\n }\n\n invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);\n return vnode.elm\n }\n}\n\n/* */\n\nvar directives = {\n create: updateDirectives,\n update: updateDirectives,\n destroy: function unbindDirectives (vnode) {\n updateDirectives(vnode, emptyNode);\n }\n};\n\nfunction updateDirectives (oldVnode, vnode) {\n if (oldVnode.data.directives || vnode.data.directives) {\n _update(oldVnode, vnode);\n }\n}\n\nfunction _update (oldVnode, vnode) {\n var isCreate = oldVnode === emptyNode;\n var isDestroy = vnode === emptyNode;\n var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);\n var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);\n\n var dirsWithInsert = [];\n var dirsWithPostpatch = [];\n\n var key, oldDir, dir;\n for (key in newDirs) {\n oldDir = oldDirs[key];\n dir = newDirs[key];\n if (!oldDir) {\n // new directive, bind\n callHook$1(dir, 'bind', vnode, oldVnode);\n if (dir.def && dir.def.inserted) {\n dirsWithInsert.push(dir);\n }\n } else {\n // existing directive, update\n dir.oldValue = oldDir.value;\n dir.oldArg = oldDir.arg;\n callHook$1(dir, 'update', vnode, oldVnode);\n if (dir.def && dir.def.componentUpdated) {\n dirsWithPostpatch.push(dir);\n }\n }\n }\n\n if (dirsWithInsert.length) {\n var callInsert = function () {\n for (var i = 0; i < dirsWithInsert.length; i++) {\n callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);\n }\n };\n if (isCreate) {\n mergeVNodeHook(vnode, 'insert', callInsert);\n } else {\n callInsert();\n }\n }\n\n if (dirsWithPostpatch.length) {\n mergeVNodeHook(vnode, 'postpatch', function () {\n for (var i = 0; i < dirsWithPostpatch.length; i++) {\n callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);\n }\n });\n }\n\n if (!isCreate) {\n for (key in oldDirs) {\n if (!newDirs[key]) {\n // no longer present, unbind\n callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);\n }\n }\n }\n}\n\nvar emptyModifiers = Object.create(null);\n\nfunction normalizeDirectives$1 (\n dirs,\n vm\n) {\n var res = Object.create(null);\n if (!dirs) {\n // $flow-disable-line\n return res\n }\n var i, dir;\n for (i = 0; i < dirs.length; i++) {\n dir = dirs[i];\n if (!dir.modifiers) {\n // $flow-disable-line\n dir.modifiers = emptyModifiers;\n }\n res[getRawDirName(dir)] = dir;\n dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);\n }\n // $flow-disable-line\n return res\n}\n\nfunction getRawDirName (dir) {\n return dir.rawName || ((dir.name) + \".\" + (Object.keys(dir.modifiers || {}).join('.')))\n}\n\nfunction callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {\n var fn = dir.def && dir.def[hook];\n if (fn) {\n try {\n fn(vnode.elm, dir, vnode, oldVnode, isDestroy);\n } catch (e) {\n handleError(e, vnode.context, (\"directive \" + (dir.name) + \" \" + hook + \" hook\"));\n }\n }\n}\n\nvar baseModules = [\n ref,\n directives\n];\n\n/* */\n\nfunction updateAttrs (oldVnode, vnode) {\n var opts = vnode.componentOptions;\n if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {\n return\n }\n if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {\n return\n }\n var key, cur, old;\n var elm = vnode.elm;\n var oldAttrs = oldVnode.data.attrs || {};\n var attrs = vnode.data.attrs || {};\n // clone observed objects, as the user probably wants to mutate it\n if (isDef(attrs.__ob__)) {\n attrs = vnode.data.attrs = extend({}, attrs);\n }\n\n for (key in attrs) {\n cur = attrs[key];\n old = oldAttrs[key];\n if (old !== cur) {\n setAttr(elm, key, cur);\n }\n }\n // #4391: in IE9, setting type can reset value for input[type=radio]\n // #6666: IE/Edge forces progress value down to 1 before setting a max\n /* istanbul ignore if */\n if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {\n setAttr(elm, 'value', attrs.value);\n }\n for (key in oldAttrs) {\n if (isUndef(attrs[key])) {\n if (isXlink(key)) {\n elm.removeAttributeNS(xlinkNS, getXlinkProp(key));\n } else if (!isEnumeratedAttr(key)) {\n elm.removeAttribute(key);\n }\n }\n }\n}\n\nfunction setAttr (el, key, value) {\n if (el.tagName.indexOf('-') > -1) {\n baseSetAttr(el, key, value);\n } else if (isBooleanAttr(key)) {\n // set attribute for blank value\n // e.g. \n if (isFalsyAttrValue(value)) {\n el.removeAttribute(key);\n } else {\n // technically allowfullscreen is a boolean attribute for