hy-app 0.2.13 → 0.2.15
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/components/hy-action-sheet/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +70 -77
- package/components/hy-button/props.ts +40 -41
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +5 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/component-helper.ts +0 -177
- package/components.json +0 -3287
- package/dist/attributes.json +0 -1
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
- package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
- package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
- package/dist/docs/components/hy-badge/hy-badge.md +0 -13
- package/dist/docs/components/hy-button/hy-button.md +0 -61
- package/dist/docs/components/hy-calendar/header.md +0 -17
- package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
- package/dist/docs/components/hy-calendar/month.md +0 -38
- package/dist/docs/components/hy-card/hy-card.md +0 -24
- package/dist/docs/components/hy-cell/hy-cell.md +0 -26
- package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
- package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
- package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
- package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
- package/dist/docs/components/hy-divider/hy-divider.md +0 -13
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
- package/dist/docs/components/hy-empty/hy-empty.md +0 -20
- package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
- package/dist/docs/components/hy-form/hy-form.md +0 -29
- package/dist/docs/components/hy-grid/hy-grid.md +0 -19
- package/dist/docs/components/hy-icon/hy-icon.md +0 -13
- package/dist/docs/components/hy-image/hy-image.md +0 -22
- package/dist/docs/components/hy-input/hy-input.md +0 -29
- package/dist/docs/components/hy-line/hy-line.md +0 -7
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
- package/dist/docs/components/hy-list/hy-list.md +0 -25
- package/dist/docs/components/hy-loading/hy-loading.md +0 -14
- package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
- package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
- package/dist/docs/components/hy-login/hy-login.md +0 -14
- package/dist/docs/components/hy-menu/hy-menu.md +0 -21
- package/dist/docs/components/hy-modal/hy-modal.md +0 -23
- package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
- package/dist/docs/components/hy-notify/hy-notify.md +0 -23
- package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
- package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
- package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
- package/dist/docs/components/hy-parse/hy-parse.md +0 -46
- package/dist/docs/components/hy-parse/node/node.md +0 -7
- package/dist/docs/components/hy-picker/hy-picker.md +0 -32
- package/dist/docs/components/hy-popover/hy-popover.md +0 -34
- package/dist/docs/components/hy-popup/hy-popup.md +0 -22
- package/dist/docs/components/hy-price/hy-price.md +0 -13
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
- package/dist/docs/components/hy-radio/hy-radio.md +0 -21
- package/dist/docs/components/hy-rate/hy-rate.md +0 -14
- package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
- package/dist/docs/components/hy-search/hy-search.md +0 -27
- package/dist/docs/components/hy-signature/hy-signature.md +0 -45
- package/dist/docs/components/hy-slider/hy-slider.md +0 -24
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
- package/dist/docs/components/hy-steps/hy-steps.md +0 -23
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
- package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
- package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
- package/dist/docs/components/hy-switch/hy-switch.md +0 -20
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
- package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
- package/dist/docs/components/hy-tag/hy-tag.md +0 -21
- package/dist/docs/components/hy-text/hy-text.md +0 -13
- package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
- package/dist/docs/components/hy-toast/hy-toast.md +0 -17
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
- package/dist/docs/components/hy-transition/hy-transition.md +0 -25
- package/dist/docs/components/hy-upload/hy-upload.md +0 -25
- package/dist/docs/components/hy-warn/hy-warn.md +0 -14
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
- package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
- package/dist/docs/components/message/TheMessage.md +0 -17
- package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
- package/dist/tags.json +0 -1
- package/dist/web-types.json +0 -1
- package/docgen.config.js +0 -14
- package/web-types.config.js +0 -7
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hy-app",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.15",
|
|
4
|
+
"description": "组件提示第一版",
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"private": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"web-types": "vue-docgen-web-types --configFile web-types.config.js",
|
|
9
|
-
"web": "npx web-types-generator --name hy-app --src ./components --out ./web-types.json",
|
|
10
9
|
"doc": "npx vue-docgen -c docgen.config.js",
|
|
11
|
-
"gen:web-types": "tsx ./component-helper.ts"
|
|
10
|
+
"gen:web-types": "tsx ./component-helper.ts",
|
|
11
|
+
"docs": "npx ts-node compiler.ts"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"华玥组件库",
|
|
@@ -17,13 +17,5 @@
|
|
|
17
17
|
],
|
|
18
18
|
"web-types": "./web-types.json",
|
|
19
19
|
"author": "gaoxianhua",
|
|
20
|
-
"license": "MIT"
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"component-helper": "1.3.1-rc.1",
|
|
23
|
-
"components-helper": "^2.2.0",
|
|
24
|
-
"tsx": "^4.20.3",
|
|
25
|
-
"vue-docgen-api": "^4.79.2",
|
|
26
|
-
"vue-docgen-cli": "^4.79.0",
|
|
27
|
-
"vue-docgen-web-types": "^0.1.8"
|
|
28
|
-
}
|
|
20
|
+
"license": "MIT"
|
|
29
21
|
}
|
package/utils/inspect.ts
CHANGED
|
@@ -21,10 +21,12 @@ export const isNumber = (text: string | number): boolean => {
|
|
|
21
21
|
* @param arr 传入数组值
|
|
22
22
|
* @return {boolean}
|
|
23
23
|
*/
|
|
24
|
-
export const isArray = (arr: any):
|
|
24
|
+
export const isArray = (arr: any): arr is Array<any> => {
|
|
25
|
+
// 如果 Array.isArray 函数可用,直接使用该函数检查
|
|
25
26
|
if (typeof Array.isArray === 'function') {
|
|
26
27
|
return Array.isArray(arr)
|
|
27
28
|
}
|
|
29
|
+
// 否则,使用对象原型的 toString 方法进行检查
|
|
28
30
|
return Object.prototype.toString.call(arr) === '[object Array]'
|
|
29
31
|
}
|
|
30
32
|
|
package/web-types.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"hy-app","version":"0.2.
|
|
1
|
+
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"hy-app","version":"0.2.15","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
|
package/component-helper.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import fg from 'fast-glob'
|
|
2
|
-
import { read, parse, vetur, webTypes, write, isString } from 'components-helper'
|
|
3
|
-
import type {
|
|
4
|
-
Config,
|
|
5
|
-
InstallOptions,
|
|
6
|
-
NormalizeData,
|
|
7
|
-
Options,
|
|
8
|
-
ParseData,
|
|
9
|
-
ParseTable,
|
|
10
|
-
} from 'components-helper'
|
|
11
|
-
|
|
12
|
-
const config: Config = {
|
|
13
|
-
tags: 'tags.json',
|
|
14
|
-
attributes: 'attributes.json',
|
|
15
|
-
webTypes: 'web-types.json',
|
|
16
|
-
titleRegExp: /#+\s+(.*)\n+([^(#|\n)]*)/g,
|
|
17
|
-
tableRegExp: /#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
|
|
18
|
-
fileNameRegExp: /\/((\w|-)+)\.\w+$/,
|
|
19
|
-
separator: ',', // values截取
|
|
20
|
-
props: 'Props',
|
|
21
|
-
propsName: 'Prop name',
|
|
22
|
-
propsType: 'Type',
|
|
23
|
-
propsDescription: 'Description',
|
|
24
|
-
propsOptions: 'Values',
|
|
25
|
-
propsDefault: 'Default',
|
|
26
|
-
events: 'events',
|
|
27
|
-
eventsName: 'Event name',
|
|
28
|
-
eventsDescription: 'Description',
|
|
29
|
-
slots: 'slots',
|
|
30
|
-
slotsName: 'Name',
|
|
31
|
-
slotsDescription: 'Description',
|
|
32
|
-
slotsType: 'Type',
|
|
33
|
-
slotsSubtags: 'Subtags',
|
|
34
|
-
directives: 'directives',
|
|
35
|
-
directivesName: 'Name',
|
|
36
|
-
directivesType: 'Type',
|
|
37
|
-
directivesDescription: 'Description',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function normalize(options: Options, data: ParseData, path: string): NormalizeData {
|
|
41
|
-
const { fileNameRegExp, props, events, slots, directives } = options
|
|
42
|
-
const _fileNameRegExp = isString(fileNameRegExp) ? new RegExp(fileNameRegExp) : fileNameRegExp
|
|
43
|
-
const _path = path.match(_fileNameRegExp)
|
|
44
|
-
const fileName = _path ? _path[1] : ''
|
|
45
|
-
const _data: NormalizeData = Object.assign(data, { path, fileName })
|
|
46
|
-
const _props = new RegExp(props, 'i')
|
|
47
|
-
const _events = new RegExp(events, 'i')
|
|
48
|
-
const _slots = new RegExp(slots, 'i')
|
|
49
|
-
const _directives = new RegExp(directives, 'i')
|
|
50
|
-
|
|
51
|
-
if (!_data.table || !_data.table.length) return _data
|
|
52
|
-
|
|
53
|
-
for (let i = 0; i < _data.table.length; i++) {
|
|
54
|
-
const item = _data.table[i]
|
|
55
|
-
const title = item.title
|
|
56
|
-
if (!title) continue
|
|
57
|
-
|
|
58
|
-
if (_props.test(title)) {
|
|
59
|
-
setData({
|
|
60
|
-
data: _data,
|
|
61
|
-
item,
|
|
62
|
-
path,
|
|
63
|
-
fileName,
|
|
64
|
-
title,
|
|
65
|
-
key: 'props',
|
|
66
|
-
regExp: _props,
|
|
67
|
-
})
|
|
68
|
-
} else if (_events.test(title)) {
|
|
69
|
-
setData({
|
|
70
|
-
data: _data,
|
|
71
|
-
item,
|
|
72
|
-
path,
|
|
73
|
-
fileName,
|
|
74
|
-
title,
|
|
75
|
-
key: 'events',
|
|
76
|
-
regExp: _events,
|
|
77
|
-
})
|
|
78
|
-
} else if (_slots.test(title)) {
|
|
79
|
-
setData({
|
|
80
|
-
data: _data,
|
|
81
|
-
item,
|
|
82
|
-
path,
|
|
83
|
-
fileName,
|
|
84
|
-
title,
|
|
85
|
-
key: 'slots',
|
|
86
|
-
regExp: _slots,
|
|
87
|
-
})
|
|
88
|
-
} else if (_directives.test(title)) {
|
|
89
|
-
setData({
|
|
90
|
-
data: _data,
|
|
91
|
-
item,
|
|
92
|
-
path,
|
|
93
|
-
fileName,
|
|
94
|
-
title,
|
|
95
|
-
key: 'directives',
|
|
96
|
-
regExp: _directives,
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return _data
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function setData({
|
|
104
|
-
data,
|
|
105
|
-
key,
|
|
106
|
-
item,
|
|
107
|
-
title,
|
|
108
|
-
path,
|
|
109
|
-
fileName,
|
|
110
|
-
regExp,
|
|
111
|
-
}: {
|
|
112
|
-
data: NormalizeData
|
|
113
|
-
key: 'props' | 'events' | 'slots' | 'directives'
|
|
114
|
-
item: ParseTable
|
|
115
|
-
title: string
|
|
116
|
-
path: string
|
|
117
|
-
fileName: string
|
|
118
|
-
regExp: RegExp
|
|
119
|
-
}) {
|
|
120
|
-
const childTitle = title.replace(regExp, '').trim()
|
|
121
|
-
|
|
122
|
-
if (childTitle) {
|
|
123
|
-
const childHeader = data.headers?.find((item) => item.title === childTitle)
|
|
124
|
-
const childItem = {
|
|
125
|
-
path,
|
|
126
|
-
fileName,
|
|
127
|
-
title: childTitle,
|
|
128
|
-
description: childHeader?.description || data.description,
|
|
129
|
-
[key]: item,
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!data.children) {
|
|
133
|
-
data.children = [childItem]
|
|
134
|
-
} else {
|
|
135
|
-
const child = data.children.find((item) => item.title === childTitle)
|
|
136
|
-
|
|
137
|
-
if (child) {
|
|
138
|
-
child[key] = item
|
|
139
|
-
} else {
|
|
140
|
-
data.children.push(childItem)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
data[key] = item
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function generateWebTypes(options = {} as InstallOptions) {
|
|
149
|
-
if (!options.entry) throw new Error('entry must be a string (non empty) or an array of strings')
|
|
150
|
-
if (!options.outDir) throw new Error('outDir must be a string (non empty)')
|
|
151
|
-
if (!options.name) console.warn('missing property "name"')
|
|
152
|
-
if (!options.version) console.warn('missing property "version"')
|
|
153
|
-
|
|
154
|
-
const _options: Options = Object.assign(config, options)
|
|
155
|
-
const files: string[] = fg.sync(_options.entry, _options.fastGlobConfig)
|
|
156
|
-
const data = files.map((path) => {
|
|
157
|
-
const fileContent = read(path)
|
|
158
|
-
const parseContent = parse(_options, fileContent)
|
|
159
|
-
const content = normalize(_options, parseContent, path)
|
|
160
|
-
if (content.title === 'hy-button') console.log(JSON.stringify(content))
|
|
161
|
-
return content
|
|
162
|
-
})
|
|
163
|
-
const { tags, attributes } = vetur(_options, data)
|
|
164
|
-
const webTypesData = webTypes(_options, data)
|
|
165
|
-
console.log(_options, data)
|
|
166
|
-
|
|
167
|
-
write(_options, 'tags', tags)
|
|
168
|
-
write(_options, 'attributes', attributes)
|
|
169
|
-
write(_options, 'webTypes', webTypesData)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
generateWebTypes({
|
|
173
|
-
entry: './dist/docs/components/hy-button/hy-button.md', // 你的组件路径
|
|
174
|
-
outDir: 'dist', // 输出目录
|
|
175
|
-
name: 'hy-app', // 组件库名字
|
|
176
|
-
version: '0.2.10', // 版本号
|
|
177
|
-
})
|