cnhis-design-vue 3.1.7-beta.3 → 3.1.8-beta.2
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/env.d.ts +42 -38
- package/es/packages/big-table/index.d.ts +2042 -0
- package/es/packages/big-table/index2.mjs +4 -4
- package/es/packages/big-table/src/BigTable.vue.d.ts +2056 -0
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/packages/big-table/src/components/NoData.vue.d.ts +51 -0
- package/es/packages/bpmn-workflow/index.d.ts +74 -0
- package/es/packages/bpmn-workflow/index2.mjs +3 -3
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.vue.d.ts +77 -0
- package/es/packages/button-print/index.d.ts +7317 -0
- package/es/packages/button-print/index2.mjs +3 -3
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +7316 -0
- package/es/packages/chunk-upload/index.d.ts +1748 -0
- package/es/packages/chunk-upload/index2.mjs +3 -3
- package/es/packages/chunk-upload/src/chunk-upload-new.vue.d.ts +1905 -0
- package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +1749 -0
- package/es/packages/drag-layout/index2.mjs +3 -3
- package/es/packages/editor/index2.mjs +3 -3
- package/es/packages/field-set/index2.mjs +3 -3
- package/es/packages/form-render/index.d.ts +402 -0
- package/es/packages/form-render/index2.mjs +3 -3
- package/es/packages/form-render/src/FormRender.vue.d.ts +402 -0
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/packages/form-render/src/components/cascader.d.ts +2 -2
- package/es/packages/form-render/src/components/cascader2.mjs +26 -12
- package/es/packages/form-render/src/components/collapse2.mjs +3 -3
- package/es/packages/form-render/src/components/combination2.mjs +9 -7
- package/es/packages/form-render/src/components/formItem2.mjs +1 -1
- package/es/packages/form-render/src/components/inputGroup2.mjs +1 -1
- package/es/packages/form-render/src/components/slider2.mjs +1 -1
- package/es/packages/form-render/src/hooks/useFieldList2Schema2.mjs +1 -1
- package/es/packages/form-render/src/hooks/useFormValidator2.mjs +1 -1
- package/es/packages/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/packages/form-render/style/index.css +21 -17
- package/es/packages/form-render/style/index.less +121 -116
- package/es/packages/form-table/index2.mjs +3 -3
- package/es/packages/form-table/src/components/table-age.vue.d.ts +4270 -0
- package/es/packages/form-table/src/components/table-date-picker.vue.d.ts +5282 -0
- package/es/packages/form-table/src/components/table-digital.vue.d.ts +2899 -0
- package/es/packages/form-table/src/components/table-input-password.vue.d.ts +1620 -0
- package/es/packages/form-table/src/components/table-input.vue.d.ts +1577 -0
- package/es/packages/form-table/src/components/table-month-picker.vue.d.ts +5225 -0
- package/es/packages/form-table/src/components/table-search-more.vue.d.ts +1785 -0
- package/es/packages/form-table/src/components/table-search.vue.d.ts +3093 -0
- package/es/packages/form-table/src/components/table-select-multiple.vue.d.ts +1549 -0
- package/es/packages/form-table/src/components/table-select.vue.d.ts +1548 -0
- package/es/packages/form-table/src/components/table-textarea.vue.d.ts +1636 -0
- package/es/packages/form-table/src/components/table-time-picker.vue.d.ts +2670 -0
- package/es/packages/form-table/src/components/text-over-tooltip.vue.d.ts +542 -0
- package/es/packages/grid/index2.mjs +3 -3
- package/es/packages/index.css +21 -17
- package/es/packages/index.d.ts +2 -2
- package/es/packages/index.less +121 -116
- package/es/packages/index.mjs +1 -1
- package/es/packages/index2.mjs +2 -2
- package/es/packages/info-header/index.d.ts +1687 -0
- package/es/packages/info-header/index2.mjs +3 -3
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +362 -0
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +1688 -0
- package/es/packages/info-header/src/InfoHeader.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/packages/map/index.d.ts +2312 -0
- package/es/packages/map/index2.mjs +3 -3
- package/es/packages/map/src/Map.vue.d.ts +2312 -0
- package/es/packages/scale-view/index.d.ts +4308 -0
- package/es/packages/scale-view/index2.mjs +7 -7
- package/es/packages/scale-view/src/ScaleView.vue.d.ts +4149 -0
- package/es/packages/scale-view/src/ScaleView.vue_vue_type_script_setup_true_lang.mjs +27 -5
- package/es/packages/scale-view/src/components/AnswerParse.vue.d.ts +72 -0
- package/es/packages/scale-view/src/components/AnswerParse.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/packages/scale-view/src/components/EvaluateCountdown.vue.d.ts +150 -0
- package/es/packages/scale-view/src/components/EvaluatePage.vue.d.ts +1503 -0
- package/es/packages/scale-view/src/components/NoData.vue.d.ts +51 -0
- package/es/packages/scale-view/src/components/formitem/r-checkbox2.mjs +5 -4
- package/es/packages/scale-view/src/components/formitem/r-collection2.mjs +1 -1
- package/es/packages/scale-view/src/components/formitem/r-datetime2.mjs +5 -3
- package/es/packages/scale-view/src/components/formitem/r-radio2.mjs +6 -5
- package/es/packages/scale-view/src/components/formitem/r-select2.mjs +3 -3
- package/es/packages/scale-view/src/hooks/scaleview-computed.d.ts +1 -1
- package/es/packages/scale-view/src/hooks/scaleview-computed2.mjs +33 -13
- package/es/packages/scale-view/src/hooks/scaleview-props.d.ts +7 -3
- package/es/packages/scale-view/src/hooks/scaleview-props2.mjs +7 -3
- package/es/packages/scale-view/src/hooks/use-component.d.ts +9753 -0
- package/es/packages/scale-view/src/hooks/use-component2.mjs +4 -2
- package/es/packages/select-label/index.d.ts +11489 -0
- package/es/packages/select-label/index2.mjs +4 -4
- package/es/packages/select-label/src/SelectLabel.vue.d.ts +7120 -0
- package/es/packages/select-label/src/SelectLabel.vue_vue_type_script_setup_true_lang.mjs +7 -4
- package/es/packages/select-person/index.d.ts +3498 -0
- package/es/packages/select-person/index2.mjs +3 -3
- package/es/packages/select-person/src/SearchTree.vue.d.ts +344 -0
- package/es/packages/select-person/src/SelectPerson.vue.d.ts +3501 -0
- package/es/packages/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.mjs +20 -9
- package/es/packages/time-line/index2.mjs +3 -3
- package/es/src/components/SelectPage/SelectPage.vue.d.ts +1446 -0
- package/es/src/core/create2.mjs +2 -2
- package/es/src/global/variable.d.ts +1 -1
- package/es/src/global/variable.mjs +1 -1
- package/es/src/global/variable2.mjs +2 -2
- package/es/src/utils/index.d.ts +0 -1
- package/es/src/utils/index.mjs +1 -1
- package/es/src/utils/index2.mjs +1 -5
- package/memory-log.ts +62 -0
- package/package.json +15 -8
- package/sync-w.sh +13 -0
- package/md-plugin.ts +0 -201
- package/uno.config.ts +0 -22
package/es/src/core/create2.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { COMPONENT_NAMESPACE } from '../global/variable2.mjs';
|
|
2
2
|
|
|
3
3
|
function create(vm) {
|
|
4
|
-
vm.name =
|
|
4
|
+
vm.name = COMPONENT_NAMESPACE + (vm.name || "");
|
|
5
5
|
return vm;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const COMPONENT_NAMESPACE = "C";
|
|
2
2
|
export declare const GROUP_TITLE_KEY = "group-show-title";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { COMPONENT_NAMESPACE, GROUP_TITLE_KEY } from './variable2.mjs';
|
package/es/src/utils/index.d.ts
CHANGED
package/es/src/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { safeComponentRegister } from './index2.mjs';
|
package/es/src/utils/index2.mjs
CHANGED
|
@@ -3,7 +3,6 @@ function safeComponentRegister(app, component, cName = component.name, scheduler
|
|
|
3
3
|
throw new Error(`[CUI]: invalid component name for ${component}`);
|
|
4
4
|
const { components = {} } = app._context;
|
|
5
5
|
if (components[cName]) {
|
|
6
|
-
console.warn(`[CUI]: You are trying to register a component named ${cName} multiple times`);
|
|
7
6
|
return;
|
|
8
7
|
}
|
|
9
8
|
if (scheduler) {
|
|
@@ -12,8 +11,5 @@ function safeComponentRegister(app, component, cName = component.name, scheduler
|
|
|
12
11
|
app.component(cName, component);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
function getComponentName(component) {
|
|
16
|
-
return component.name || Reflect.get(component, "__name");
|
|
17
|
-
}
|
|
18
14
|
|
|
19
|
-
export {
|
|
15
|
+
export { safeComponentRegister };
|
package/memory-log.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const enum Level {
|
|
2
|
+
NORMAL,
|
|
3
|
+
WARNING,
|
|
4
|
+
DANGER
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function memoryLog(duration: number = 3_000) {
|
|
8
|
+
const _global = global as any;
|
|
9
|
+
clearInterval(_global.$__timer);
|
|
10
|
+
|
|
11
|
+
_global.$__timer = setInterval(walk, duration);
|
|
12
|
+
|
|
13
|
+
const lock = new Map<Level, number>();
|
|
14
|
+
|
|
15
|
+
function walk() {
|
|
16
|
+
const memory = process.memoryUsage();
|
|
17
|
+
|
|
18
|
+
const level = levelFor(memory);
|
|
19
|
+
|
|
20
|
+
const levelLock = lock.get(level);
|
|
21
|
+
|
|
22
|
+
if (levelLock) {
|
|
23
|
+
lock.set(level, levelLock - 1);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
switch (level) {
|
|
27
|
+
case Level.NORMAL:
|
|
28
|
+
console.info(`INFO: 堆内存总量为:${ unitFormatter(memory.heapTotal) }, 已使用: ${ unitFormatter(memory.heapUsed) }, 占比${ percentageFor(memory) }%`);
|
|
29
|
+
// 清除所有🔒
|
|
30
|
+
lock.clear();
|
|
31
|
+
// 普通状态下每3轮log一次
|
|
32
|
+
lock.set(level, 2);
|
|
33
|
+
break;
|
|
34
|
+
case Level.WARNING:
|
|
35
|
+
console.warn(`WARNING: 堆内存总量为:${ unitFormatter(memory.heapTotal) }, 已使用: ${ unitFormatter(memory.heapUsed) }, 占比${ percentageFor(memory) }%`);
|
|
36
|
+
// 清除所有🔒
|
|
37
|
+
lock.clear();
|
|
38
|
+
// 警告状态下每2轮log一次
|
|
39
|
+
lock.set(level, 1);
|
|
40
|
+
break;
|
|
41
|
+
case Level.DANGER:
|
|
42
|
+
console.error(`DANGER: 堆内存总量为:${ unitFormatter(memory.heapTotal) }, 已使用: ${ unitFormatter(memory.heapUsed) }, 占比${ percentageFor(memory) }%`);
|
|
43
|
+
// 清除所有🔒
|
|
44
|
+
lock.clear();
|
|
45
|
+
// 危险状态下每1轮log一次
|
|
46
|
+
lock.set(level, 0);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function levelFor(memory: NodeJS.MemoryUsage) {
|
|
52
|
+
return +percentageFor(memory) > 90 ? Level.DANGER : +percentageFor(memory) > 70 ? Level.WARNING : Level.NORMAL;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function percentageFor({ heapUsed, heapTotal }: NodeJS.MemoryUsage) {
|
|
56
|
+
return (heapUsed / heapTotal * 100).toFixed(2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function unitFormatter(kb: number) {
|
|
60
|
+
return (kb / 1024 / 1024).toFixed(0) + 'Mb';
|
|
61
|
+
}
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.8-beta.2",
|
|
5
|
+
"license": "ISC",
|
|
5
6
|
"module": "es/packages/index.mjs",
|
|
6
7
|
"main": "es/packages/index.mjs",
|
|
7
8
|
"types": "es/packages/index.d.ts",
|
|
@@ -10,11 +11,18 @@
|
|
|
10
11
|
"es/packages/*(.css,.less)"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
|
-
"dev": "
|
|
14
|
+
"dev": "vite --host --port 3200",
|
|
14
15
|
"start": "gulp --require @esbuild-kit/cjs-loader -f build/gulpfile.ts",
|
|
15
16
|
"build": "npm run start",
|
|
17
|
+
"build:doc": "cross-env CUI_DOCS=true vite build",
|
|
18
|
+
"build:doc-local": "vite build",
|
|
19
|
+
"test": "vitest spec",
|
|
20
|
+
"test:resnap": "vitest spec -u",
|
|
21
|
+
"test:coverage": "vitest run --coverage",
|
|
16
22
|
"preview": "vite preview",
|
|
17
|
-
"release": "standard-version"
|
|
23
|
+
"release": "standard-version",
|
|
24
|
+
"deploy": "sh sync.sh",
|
|
25
|
+
"deploy-w": "sh sync-w.sh"
|
|
18
26
|
},
|
|
19
27
|
"peerDependencies": {
|
|
20
28
|
"naive-ui": "^2.29.0",
|
|
@@ -81,18 +89,19 @@
|
|
|
81
89
|
"bpmn-js": "^9.2.2",
|
|
82
90
|
"chalk": "^5.0.1",
|
|
83
91
|
"consola": "^2.15.3",
|
|
92
|
+
"cross-env": "^7.0.3",
|
|
84
93
|
"cssnano": "^5.1.7",
|
|
85
94
|
"esbuild": "^0.14.42",
|
|
86
95
|
"eslint": "^8.10.0",
|
|
87
96
|
"eslint-plugin-prettier": "^4.0.0",
|
|
88
97
|
"eslint-plugin-vue": "^8.5.0",
|
|
89
|
-
"fast-glob": "^3.2.11",
|
|
90
98
|
"gulp": "^4.0.2",
|
|
91
99
|
"gulp-cssimport": "^7.0.0",
|
|
92
100
|
"gulp-less": "^5.0.0",
|
|
93
101
|
"gulp-rename": "^2.0.0",
|
|
94
102
|
"gulp-replace": "^1.1.3",
|
|
95
103
|
"gulp-util": "^3.0.8",
|
|
104
|
+
"heapdump": "^0.3.15",
|
|
96
105
|
"less": "^4.1.2",
|
|
97
106
|
"markdown-it": "^13.0.1",
|
|
98
107
|
"postcss": "^8.4.14",
|
|
@@ -108,11 +117,9 @@
|
|
|
108
117
|
"standard-version": "^9.3.2",
|
|
109
118
|
"ts-morph": "^15.1.0",
|
|
110
119
|
"typescript": "4.6.4",
|
|
111
|
-
"unocss": "^0.41.1",
|
|
112
120
|
"vite": "^2.9.9",
|
|
113
|
-
"
|
|
114
|
-
"vue-tsc": "^0.29.8"
|
|
115
|
-
"xe-css": "^1.2.3"
|
|
121
|
+
"vitest": "^0.16.0",
|
|
122
|
+
"vue-tsc": "^0.29.8"
|
|
116
123
|
},
|
|
117
124
|
"browserslist": [
|
|
118
125
|
"defaults",
|
package/sync-w.sh
ADDED
package/md-plugin.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import MarkdownIt from 'markdown-it';
|
|
2
|
-
import { parse, compileScript, compileTemplate, SFCDescriptor } from '@vue/compiler-sfc';
|
|
3
|
-
import { PluginOption } from 'vite';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import { resolve } from 'path';
|
|
6
|
-
import hljs from 'highlight.js';
|
|
7
|
-
|
|
8
|
-
type ComponentInfo = {
|
|
9
|
-
alias: string;
|
|
10
|
-
path: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
code: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const demoMatcher = /(::: demo\s*([^]+?)\s:::)/g;
|
|
17
|
-
const tipMatcher = /(::: tip\s*(\S*)([^]+?)\s:::)/g;
|
|
18
|
-
const getVueImportMatcher = (flags?: string) =>
|
|
19
|
-
new RegExp('([\\\\/.a-zA-Z-_\\d]+\\.vue)(\\[.+?])?(\\{.+?})?', flags);
|
|
20
|
-
|
|
21
|
-
const isMdExtension = (id: string) => /\.md$/.test(id);
|
|
22
|
-
|
|
23
|
-
function highlight(str: string, lang = 'html') {
|
|
24
|
-
if (lang && hljs.getLanguage(lang)) {
|
|
25
|
-
try {
|
|
26
|
-
return (
|
|
27
|
-
'<pre><code class="hljs">' +
|
|
28
|
-
hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
|
|
29
|
-
'</code></pre>'
|
|
30
|
-
);
|
|
31
|
-
} catch (e) {
|
|
32
|
-
console.warn(e);
|
|
33
|
-
return '';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return '';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const md2html = MarkdownIt({ highlight });
|
|
40
|
-
|
|
41
|
-
function escape(code: string) {
|
|
42
|
-
return code
|
|
43
|
-
.replace(/<script/g, '\\<script')
|
|
44
|
-
.replace(/<\/script/g, '\\<\\/script')
|
|
45
|
-
.replace(/`/g, '\\`')
|
|
46
|
-
.replace(/\t/g, ' ');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function transformMd2Html(md: string) {
|
|
50
|
-
return md2html.render(md);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function parseDemo(html: string, id: string) {
|
|
54
|
-
let totalIndex = 0;
|
|
55
|
-
const resultComponents: ComponentInfo[] = [];
|
|
56
|
-
|
|
57
|
-
const resultCode = html.replace(demoMatcher, (_, wrapper, innerContent) => {
|
|
58
|
-
if (!wrapper || !innerContent) return '';
|
|
59
|
-
|
|
60
|
-
const vueDemos: string[] = innerContent.match(getVueImportMatcher('g')) || [];
|
|
61
|
-
const componentList = vueDemos.map(pathAndInfo => createComponentInfo(pathAndInfo));
|
|
62
|
-
resultComponents.push(...componentList);
|
|
63
|
-
|
|
64
|
-
return componentList.reduce((fin, cur) => {
|
|
65
|
-
return fin + generateTemplateString(cur, cur.alias);
|
|
66
|
-
}, '');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return { code: resultCode, components: resultComponents };
|
|
70
|
-
|
|
71
|
-
function generateTemplateString(info: ComponentInfo, alias: string) {
|
|
72
|
-
return `<demo-collapse>
|
|
73
|
-
${generateTitleString(info)}
|
|
74
|
-
${generateDescriptionString(info)}
|
|
75
|
-
<template #source>
|
|
76
|
-
<highlightjs :code="code__${alias}" />
|
|
77
|
-
</template>
|
|
78
|
-
<${info.alias}/>
|
|
79
|
-
</demo-collapse>\n`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function generateTitleString(info: ComponentInfo) {
|
|
83
|
-
return info.title ? `<template #title>${info.title.replace(/[\[\]]/g, '')}</template>` : '';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function generateDescriptionString(info: ComponentInfo) {
|
|
87
|
-
return info.description
|
|
88
|
-
? `<template #description>${info.description.replace(/[{}]/g, '')}</template>`
|
|
89
|
-
: '';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function createComponentInfo(pathAndInfo: string): ComponentInfo {
|
|
93
|
-
const [_, path, title, description] = pathAndInfo.match(getVueImportMatcher()) || [];
|
|
94
|
-
return {
|
|
95
|
-
alias: `Component${totalIndex++}`,
|
|
96
|
-
title,
|
|
97
|
-
description,
|
|
98
|
-
path: resolveIdPath(path),
|
|
99
|
-
code: getCodeFromPath(path)
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function getCodeFromPath(path: string) {
|
|
104
|
-
return escape(fs.readFileSync(resolveIdPath(path), 'utf-8'));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function resolveIdPath(path: string) {
|
|
108
|
-
return resolve(id, '..', path).replace(/\\/g, '/');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function parseTip(html: string) {
|
|
113
|
-
return html.replace(tipMatcher, (_, __, type, content) => {
|
|
114
|
-
return `<n-alert type="${type}">${content}</n-alert>`;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function parseMarkdown(md: string, id: string) {
|
|
119
|
-
const html = transformMd2Html(md);
|
|
120
|
-
const res = parseDemo(html, id);
|
|
121
|
-
const code = parseTip(res.code);
|
|
122
|
-
return { code, components: res.components };
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function transformMd2VueComponent(src: string, id: string) {
|
|
126
|
-
const { code, components } = parseMarkdown(src, id);
|
|
127
|
-
const { descriptor } = parse(generateSourceCode());
|
|
128
|
-
|
|
129
|
-
return combine(getTemplateCode(descriptor), getScriptCode(descriptor));
|
|
130
|
-
|
|
131
|
-
function generateSourceCode() {
|
|
132
|
-
return `
|
|
133
|
-
<template>
|
|
134
|
-
<div class='markdown'>
|
|
135
|
-
<anchor-list>
|
|
136
|
-
${code}
|
|
137
|
-
</anchor-list>
|
|
138
|
-
</div>
|
|
139
|
-
</template>
|
|
140
|
-
<script>
|
|
141
|
-
${generateImports()}
|
|
142
|
-
const __script={
|
|
143
|
-
components:{${generateComponents()}},
|
|
144
|
-
setup(){
|
|
145
|
-
${generateVarDeclare()}
|
|
146
|
-
return {${generateSetupReturn()}}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
export default __script;
|
|
150
|
-
</script>
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function getTemplateCode(descriptor: SFCDescriptor) {
|
|
155
|
-
return compileTemplate({
|
|
156
|
-
source: descriptor.template?.content ?? '',
|
|
157
|
-
id: '-1',
|
|
158
|
-
filename: 'index.vue'
|
|
159
|
-
}).code;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function getScriptCode(descriptor: SFCDescriptor) {
|
|
163
|
-
return compileScript(descriptor, { id: '-1' }).content;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function combine(template: string, script: string) {
|
|
167
|
-
return `${template}\n${script.replace(
|
|
168
|
-
'export default',
|
|
169
|
-
'__script.render=render;\nexport default'
|
|
170
|
-
)}`;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function generateImports() {
|
|
174
|
-
return components.map(({ alias, path }) => `import ${alias} from "${path}";\n`).join('');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function generateComponents() {
|
|
178
|
-
return components.map(({ alias }) => `${alias}`).join(',');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function generateVarDeclare() {
|
|
182
|
-
return components.map(({ code, alias }) => `const code__${alias} = \`${code}\`;\n`).join('');
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function generateSetupReturn() {
|
|
186
|
-
return `${components.map(({ alias }) => `code__${alias}`).join(',')}`;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function MDPlugin(): PluginOption {
|
|
191
|
-
return {
|
|
192
|
-
name: 'MDPlugin',
|
|
193
|
-
transform(src, id) {
|
|
194
|
-
if (isMdExtension(id)) {
|
|
195
|
-
return {
|
|
196
|
-
code: transformMd2VueComponent(src, id)
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
}
|
package/uno.config.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import presetAttributify from '@unocss/preset-attributify';
|
|
2
|
-
import { XeCSSDefaultRules } from 'xe-css/dist/presets';
|
|
3
|
-
import Unocss from 'unocss/vite';
|
|
4
|
-
|
|
5
|
-
export const UnoConfig = Unocss({
|
|
6
|
-
rules: XeCSSDefaultRules.concat([
|
|
7
|
-
[/^fw-(\d+)$/, ([ weight]) => {
|
|
8
|
-
return { 'font-weight': weight };
|
|
9
|
-
}]
|
|
10
|
-
]).map(item => {
|
|
11
|
-
return [
|
|
12
|
-
new RegExp(`${ item[0].toString().replace(/^\/\^(.+)\/$/, '^$1') }`),
|
|
13
|
-
(args: any[]) => {
|
|
14
|
-
return item[1](args.slice(1));
|
|
15
|
-
}
|
|
16
|
-
];
|
|
17
|
-
}),
|
|
18
|
-
presets: [presetAttributify({})],
|
|
19
|
-
shortcuts: {
|
|
20
|
-
'gray-border': 'bor-s-solid bor-w-1 bor-c-c5c5c5-20'
|
|
21
|
-
}
|
|
22
|
-
})
|