yangs-ui 0.0.0-stage → 0.0.1
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/es/button/index.js +7 -0
- package/es/button/src/button.js +6 -0
- package/es/button/src/button.vue.js +4 -0
- package/es/button/src/button.vue_vue_type_script_setup_true_lang.js +27 -0
- package/es/button/style/index.css +3 -0
- package/es/icon/index.js +7 -0
- package/es/icon/src/icon.js +23 -0
- package/es/icon/src/icon.vue.js +4 -0
- package/es/icon/src/icon.vue_vue_type_script_setup_true_lang.js +27 -0
- package/es/icon/style/index.css +6 -0
- package/es/index.js +11 -0
- package/es/utils/create.js +44 -0
- package/es/utils/with-install.js +9 -0
- package/lib/button/index.cjs +9 -0
- package/lib/button/src/button.cjs +6 -0
- package/lib/button/src/button.vue.cjs +3 -0
- package/lib/button/src/button.vue_vue_type_script_setup_true_lang.cjs +27 -0
- package/lib/button/style/index.css +3 -0
- package/lib/icon/index.cjs +9 -0
- package/lib/icon/src/icon.cjs +23 -0
- package/lib/icon/src/icon.vue.cjs +3 -0
- package/lib/icon/src/icon.vue_vue_type_script_setup_true_lang.cjs +27 -0
- package/lib/icon/style/index.css +6 -0
- package/lib/index.cjs +18 -0
- package/lib/utils/create.cjs +44 -0
- package/lib/utils/with-install.cjs +9 -0
- package/package.json +61 -4
- package/umd/index.full.css +8 -0
- package/umd/index.full.js +127 -0
- package/README.md +0 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withInstall } from "../utils/with-install.js";
|
|
2
|
+
import { buttonProps } from "./src/button.js";
|
|
3
|
+
import button_default from "./src/button.vue.js";
|
|
4
|
+
import './style/index.css';/* empty css */
|
|
5
|
+
// ../compontents/button/index.ts
|
|
6
|
+
var YButton = withInstall(button_default);
|
|
7
|
+
export { YButton, YButton as default, buttonProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createNameSpace } from "../../utils/create.js";
|
|
2
|
+
import { buttonProps } from "./button.js";
|
|
3
|
+
import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, unref } from "vue";
|
|
4
|
+
// ../compontents/button/src/button.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
6
|
+
name: "y-button",
|
|
7
|
+
__name: "button",
|
|
8
|
+
props: buttonProps,
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const bem = createNameSpace("button");
|
|
12
|
+
const style = computed(() => {
|
|
13
|
+
if (!props.color && !props.size) return {};
|
|
14
|
+
return {
|
|
15
|
+
...props.color ? { color: props.color } : {},
|
|
16
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return openBlock(), createElementBlock("i", {
|
|
21
|
+
class: normalizeClass(unref(bem).b()),
|
|
22
|
+
style: normalizeStyle(style.value)
|
|
23
|
+
}, [renderSlot(_ctx.$slots, "default")], 6);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export { button_vue_vue_type_script_setup_true_lang_default as default };
|
package/es/icon/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withInstall } from "../utils/with-install.js";
|
|
2
|
+
import { iconProps } from "./src/icon.js";
|
|
3
|
+
import icon_default from "./src/icon.vue.js";
|
|
4
|
+
import './style/index.css';/* empty css */
|
|
5
|
+
// ../compontents/icon/index.ts
|
|
6
|
+
var YIcon = withInstall(icon_default);
|
|
7
|
+
export { YIcon, YIcon as default, iconProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ../compontents/icon/src/icon.ts
|
|
2
|
+
var iconProps = {
|
|
3
|
+
color: String,
|
|
4
|
+
size: [Number, String]
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* const iconProps = {
|
|
8
|
+
color: String,
|
|
9
|
+
size: [Number, String]
|
|
10
|
+
};
|
|
11
|
+
这种写法是在vue组件中定义props时的写法,运行时的写法,只能写一个构造函数。String,Number本身也是构造函数
|
|
12
|
+
|
|
13
|
+
为什么使用as const。ts的类型
|
|
14
|
+
让所有属性变为readonly
|
|
15
|
+
不能直接赋值 iconProps.color = String; // 报错,因为color是readonly属性
|
|
16
|
+
|
|
17
|
+
as PropType<number | string> ts的类型
|
|
18
|
+
返回一个构造函数(构造函数的返回值为number|string)
|
|
19
|
+
如果color是一个对象,可以指定具体对象的属性类型 color: Object as PropType<{ name: string; age: number }>
|
|
20
|
+
如果color是一个函数,color: Function as PropType<(val: string) => void>
|
|
21
|
+
让ExtractPropTypes更好的推导类型,避免手动定义类型
|
|
22
|
+
*/
|
|
23
|
+
export { iconProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createNameSpace } from "../../utils/create.js";
|
|
2
|
+
import { iconProps } from "./icon.js";
|
|
3
|
+
import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, unref } from "vue";
|
|
4
|
+
// ../compontents/icon/src/icon.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var icon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
6
|
+
name: "y-icon",
|
|
7
|
+
__name: "icon",
|
|
8
|
+
props: iconProps,
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const bem = createNameSpace("icon");
|
|
12
|
+
const iconStyle = computed(() => {
|
|
13
|
+
if (!props.color && !props.size) return {};
|
|
14
|
+
return {
|
|
15
|
+
...props.color ? { color: props.color } : {},
|
|
16
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return openBlock(), createElementBlock("i", {
|
|
21
|
+
class: normalizeClass(unref(bem).b()),
|
|
22
|
+
style: normalizeStyle(iconStyle.value)
|
|
23
|
+
}, [renderSlot(_ctx.$slots, "default")], 6);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export { icon_vue_vue_type_script_setup_true_lang_default as default };
|
package/es/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { YIcon } from "./icon/index.js";
|
|
2
|
+
import { YButton } from "./button/index.js";
|
|
3
|
+
// index.prod.ts
|
|
4
|
+
var components = [YIcon, YButton];
|
|
5
|
+
var install = (app) => {
|
|
6
|
+
components.forEach((component) => {
|
|
7
|
+
app.use(component);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var installer = { install };
|
|
11
|
+
export { YButton, YIcon, installer as default, install };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ../utils/create.ts
|
|
2
|
+
function _bem(prefixName, blockSuffix, element, modifier) {
|
|
3
|
+
if (blockSuffix) prefixName += `-${blockSuffix}`;
|
|
4
|
+
if (element) prefixName += `__${element}`;
|
|
5
|
+
if (modifier) prefixName += `--${modifier}`;
|
|
6
|
+
return prefixName;
|
|
7
|
+
}
|
|
8
|
+
function createBem(prefixName) {
|
|
9
|
+
const b = (blockSuffix = "") => _bem(prefixName, blockSuffix, "", "");
|
|
10
|
+
const e = (element = "") => _bem(prefixName, "", element, "");
|
|
11
|
+
const m = (modifier = "") => _bem(prefixName, "", "", modifier);
|
|
12
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(prefixName, blockSuffix, element, "") : "";
|
|
13
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(prefixName, blockSuffix, "", modifier) : "";
|
|
14
|
+
const em = (element, modifier) => element && modifier ? _bem(prefixName, "", element, modifier) : "";
|
|
15
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(prefixName, blockSuffix, element, modifier) : "";
|
|
16
|
+
const is = (name, state) => {
|
|
17
|
+
if (state) return `is-${name}`;
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
b,
|
|
22
|
+
e,
|
|
23
|
+
m,
|
|
24
|
+
be,
|
|
25
|
+
bm,
|
|
26
|
+
em,
|
|
27
|
+
bem,
|
|
28
|
+
is
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function createNameSpace(name) {
|
|
32
|
+
return createBem(`y-${name}`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* const bem = createNameSpace("icon");
|
|
36
|
+
console.log(bem.b("block"));
|
|
37
|
+
console.log(bem.e("element"));
|
|
38
|
+
console.log(bem.m("modifier"));
|
|
39
|
+
console.log(bem.be("block", "element"));
|
|
40
|
+
console.log(bem.bm("block", "modifier"));
|
|
41
|
+
console.log(bem.em("element", "modifier"));
|
|
42
|
+
console.log(bem.bem("block", "element", "modifier"));
|
|
43
|
+
*/
|
|
44
|
+
export { createNameSpace };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require('./style/index.css');const require_with_install = require("../utils/with-install.cjs");
|
|
2
|
+
const require_button = require("./src/button.cjs");
|
|
3
|
+
const require_button$1 = require("./src/button.vue.cjs");
|
|
4
|
+
;/* empty css */
|
|
5
|
+
// ../compontents/button/index.ts
|
|
6
|
+
var YButton = require_with_install.withInstall(require_button$1.default);
|
|
7
|
+
exports.YButton = YButton;
|
|
8
|
+
exports.default = YButton;
|
|
9
|
+
exports.buttonProps = require_button.buttonProps;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_create = require("../../utils/create.cjs");
|
|
2
|
+
const require_button = require("./button.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
// ../compontents/button/src/button.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
6
|
+
name: "y-button",
|
|
7
|
+
__name: "button",
|
|
8
|
+
props: require_button.buttonProps,
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const bem = require_create.createNameSpace("button");
|
|
12
|
+
const style = (0, vue.computed)(() => {
|
|
13
|
+
if (!props.color && !props.size) return {};
|
|
14
|
+
return {
|
|
15
|
+
...props.color ? { color: props.color } : {},
|
|
16
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
|
|
21
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(bem).b()),
|
|
22
|
+
style: (0, vue.normalizeStyle)(style.value)
|
|
23
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 6);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
exports.default = button_vue_vue_type_script_setup_true_lang_default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require('./style/index.css');const require_with_install = require("../utils/with-install.cjs");
|
|
2
|
+
const require_icon = require("./src/icon.cjs");
|
|
3
|
+
const require_icon$1 = require("./src/icon.vue.cjs");
|
|
4
|
+
;/* empty css */
|
|
5
|
+
// ../compontents/icon/index.ts
|
|
6
|
+
var YIcon = require_with_install.withInstall(require_icon$1.default);
|
|
7
|
+
exports.YIcon = YIcon;
|
|
8
|
+
exports.default = YIcon;
|
|
9
|
+
exports.iconProps = require_icon.iconProps;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ../compontents/icon/src/icon.ts
|
|
2
|
+
var iconProps = {
|
|
3
|
+
color: String,
|
|
4
|
+
size: [Number, String]
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* const iconProps = {
|
|
8
|
+
color: String,
|
|
9
|
+
size: [Number, String]
|
|
10
|
+
};
|
|
11
|
+
这种写法是在vue组件中定义props时的写法,运行时的写法,只能写一个构造函数。String,Number本身也是构造函数
|
|
12
|
+
|
|
13
|
+
为什么使用as const。ts的类型
|
|
14
|
+
让所有属性变为readonly
|
|
15
|
+
不能直接赋值 iconProps.color = String; // 报错,因为color是readonly属性
|
|
16
|
+
|
|
17
|
+
as PropType<number | string> ts的类型
|
|
18
|
+
返回一个构造函数(构造函数的返回值为number|string)
|
|
19
|
+
如果color是一个对象,可以指定具体对象的属性类型 color: Object as PropType<{ name: string; age: number }>
|
|
20
|
+
如果color是一个函数,color: Function as PropType<(val: string) => void>
|
|
21
|
+
让ExtractPropTypes更好的推导类型,避免手动定义类型
|
|
22
|
+
*/
|
|
23
|
+
exports.iconProps = iconProps;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_create = require("../../utils/create.cjs");
|
|
2
|
+
const require_icon = require("./icon.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
// ../compontents/icon/src/icon.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var icon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
6
|
+
name: "y-icon",
|
|
7
|
+
__name: "icon",
|
|
8
|
+
props: require_icon.iconProps,
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const bem = require_create.createNameSpace("icon");
|
|
12
|
+
const iconStyle = (0, vue.computed)(() => {
|
|
13
|
+
if (!props.color && !props.size) return {};
|
|
14
|
+
return {
|
|
15
|
+
...props.color ? { color: props.color } : {},
|
|
16
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
|
|
21
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(bem).b()),
|
|
22
|
+
style: (0, vue.normalizeStyle)(iconStyle.value)
|
|
23
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 6);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
exports.default = icon_vue_vue_type_script_setup_true_lang_default;
|
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_index = require("./icon/index.cjs");
|
|
6
|
+
const require_index$1 = require("./button/index.cjs");
|
|
7
|
+
// index.prod.ts
|
|
8
|
+
var components = [require_index.YIcon, require_index$1.YButton];
|
|
9
|
+
var install = (app) => {
|
|
10
|
+
components.forEach((component) => {
|
|
11
|
+
app.use(component);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var installer = { install };
|
|
15
|
+
exports.YButton = require_index$1.YButton;
|
|
16
|
+
exports.YIcon = require_index.YIcon;
|
|
17
|
+
exports.default = installer;
|
|
18
|
+
exports.install = install;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ../utils/create.ts
|
|
2
|
+
function _bem(prefixName, blockSuffix, element, modifier) {
|
|
3
|
+
if (blockSuffix) prefixName += `-${blockSuffix}`;
|
|
4
|
+
if (element) prefixName += `__${element}`;
|
|
5
|
+
if (modifier) prefixName += `--${modifier}`;
|
|
6
|
+
return prefixName;
|
|
7
|
+
}
|
|
8
|
+
function createBem(prefixName) {
|
|
9
|
+
const b = (blockSuffix = "") => _bem(prefixName, blockSuffix, "", "");
|
|
10
|
+
const e = (element = "") => _bem(prefixName, "", element, "");
|
|
11
|
+
const m = (modifier = "") => _bem(prefixName, "", "", modifier);
|
|
12
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(prefixName, blockSuffix, element, "") : "";
|
|
13
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(prefixName, blockSuffix, "", modifier) : "";
|
|
14
|
+
const em = (element, modifier) => element && modifier ? _bem(prefixName, "", element, modifier) : "";
|
|
15
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(prefixName, blockSuffix, element, modifier) : "";
|
|
16
|
+
const is = (name, state) => {
|
|
17
|
+
if (state) return `is-${name}`;
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
b,
|
|
22
|
+
e,
|
|
23
|
+
m,
|
|
24
|
+
be,
|
|
25
|
+
bm,
|
|
26
|
+
em,
|
|
27
|
+
bem,
|
|
28
|
+
is
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function createNameSpace(name) {
|
|
32
|
+
return createBem(`y-${name}`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* const bem = createNameSpace("icon");
|
|
36
|
+
console.log(bem.b("block"));
|
|
37
|
+
console.log(bem.e("element"));
|
|
38
|
+
console.log(bem.m("modifier"));
|
|
39
|
+
console.log(bem.be("block", "element"));
|
|
40
|
+
console.log(bem.bm("block", "modifier"));
|
|
41
|
+
console.log(bem.em("element", "modifier"));
|
|
42
|
+
console.log(bem.bem("block", "element", "modifier"));
|
|
43
|
+
*/
|
|
44
|
+
exports.createNameSpace = createNameSpace;
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yangs-ui",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "A Component Library for Vue 3",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"yangs-ui",
|
|
8
|
+
"ui framework",
|
|
9
|
+
"ui",
|
|
10
|
+
"vue"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"main": "./lib/index.js",
|
|
14
|
+
"module": "./es/index.js",
|
|
15
|
+
"types": "./es/index.d.ts",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"directory": "dist"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"vue": "^3.5.0"
|
|
22
|
+
},
|
|
23
|
+
"unpkg": "./dist/umd/index.full.js",
|
|
24
|
+
"jsdelivr": "./dist/umd/index.full.js",
|
|
25
|
+
"style": "./dist/umd/index.css",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./es/index.d.ts",
|
|
29
|
+
"import": "./es/index.js",
|
|
30
|
+
"require": "./lib/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./es": {
|
|
33
|
+
"types": "./es/index.d.ts",
|
|
34
|
+
"import": "./es/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./lib": {
|
|
37
|
+
"types": "./lib/index.d.ts",
|
|
38
|
+
"require": "./lib/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./es/*": {
|
|
41
|
+
"types": [
|
|
42
|
+
"./es/*.d.ts",
|
|
43
|
+
"./es/*/index.d.ts"
|
|
44
|
+
],
|
|
45
|
+
"import": "./es/*.js"
|
|
46
|
+
},
|
|
47
|
+
"./lib/*.js": {
|
|
48
|
+
"types": "./lib/*.d.ts",
|
|
49
|
+
"require": "./lib/*.js"
|
|
50
|
+
},
|
|
51
|
+
"./lib/*": {
|
|
52
|
+
"types": [
|
|
53
|
+
"./lib/*.d.ts",
|
|
54
|
+
"./lib/*/index.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"require": "./lib/*.js"
|
|
57
|
+
},
|
|
58
|
+
"./*": "./*"
|
|
59
|
+
},
|
|
60
|
+
"sideEffects": [
|
|
61
|
+
"**/style/**"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.YangsUI = {}, global.Vue));
|
|
3
|
+
})(this, function(exports, vue) {
|
|
4
|
+
Object.defineProperties(exports, {
|
|
5
|
+
__esModule: { value: true },
|
|
6
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
7
|
+
});
|
|
8
|
+
// ../utils/with-install.ts
|
|
9
|
+
function withInstall(component) {
|
|
10
|
+
component.install = function(app) {
|
|
11
|
+
const { name } = component;
|
|
12
|
+
app.component(name, component);
|
|
13
|
+
};
|
|
14
|
+
return component;
|
|
15
|
+
}
|
|
16
|
+
// ../utils/create.ts
|
|
17
|
+
function _bem(prefixName, blockSuffix, element, modifier) {
|
|
18
|
+
if (blockSuffix) prefixName += `-${blockSuffix}`;
|
|
19
|
+
if (element) prefixName += `__${element}`;
|
|
20
|
+
if (modifier) prefixName += `--${modifier}`;
|
|
21
|
+
return prefixName;
|
|
22
|
+
}
|
|
23
|
+
function createBem(prefixName) {
|
|
24
|
+
const b = (blockSuffix = "") => _bem(prefixName, blockSuffix, "", "");
|
|
25
|
+
const e = (element = "") => _bem(prefixName, "", element, "");
|
|
26
|
+
const m = (modifier = "") => _bem(prefixName, "", "", modifier);
|
|
27
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(prefixName, blockSuffix, element, "") : "";
|
|
28
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(prefixName, blockSuffix, "", modifier) : "";
|
|
29
|
+
const em = (element, modifier) => element && modifier ? _bem(prefixName, "", element, modifier) : "";
|
|
30
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(prefixName, blockSuffix, element, modifier) : "";
|
|
31
|
+
const is = (name, state) => {
|
|
32
|
+
if (state) return `is-${name}`;
|
|
33
|
+
return "";
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
b,
|
|
37
|
+
e,
|
|
38
|
+
m,
|
|
39
|
+
be,
|
|
40
|
+
bm,
|
|
41
|
+
em,
|
|
42
|
+
bem,
|
|
43
|
+
is
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function createNameSpace(name) {
|
|
47
|
+
return createBem(`y-${name}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* const bem = createNameSpace("icon");
|
|
51
|
+
console.log(bem.b("block"));
|
|
52
|
+
console.log(bem.e("element"));
|
|
53
|
+
console.log(bem.m("modifier"));
|
|
54
|
+
console.log(bem.be("block", "element"));
|
|
55
|
+
console.log(bem.bm("block", "modifier"));
|
|
56
|
+
console.log(bem.em("element", "modifier"));
|
|
57
|
+
console.log(bem.bem("block", "element", "modifier"));
|
|
58
|
+
*/
|
|
59
|
+
// ../compontents/icon/src/icon.ts
|
|
60
|
+
var iconProps = {
|
|
61
|
+
color: String,
|
|
62
|
+
size: [Number, String]
|
|
63
|
+
};
|
|
64
|
+
// ../compontents/icon/index.ts
|
|
65
|
+
var YIcon = withInstall(/* @__PURE__ */ (0, vue.defineComponent)({
|
|
66
|
+
name: "y-icon",
|
|
67
|
+
__name: "icon",
|
|
68
|
+
props: iconProps,
|
|
69
|
+
setup(__props) {
|
|
70
|
+
const props = __props;
|
|
71
|
+
const bem = createNameSpace("icon");
|
|
72
|
+
const iconStyle = (0, vue.computed)(() => {
|
|
73
|
+
if (!props.color && !props.size) return {};
|
|
74
|
+
return {
|
|
75
|
+
...props.color ? { color: props.color } : {},
|
|
76
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
return (_ctx, _cache) => {
|
|
80
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
|
|
81
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(bem).b()),
|
|
82
|
+
style: (0, vue.normalizeStyle)(iconStyle.value)
|
|
83
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 6);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
// ../compontents/button/src/button.ts
|
|
88
|
+
var buttonProps = {
|
|
89
|
+
color: String,
|
|
90
|
+
size: [Number, String]
|
|
91
|
+
};
|
|
92
|
+
// ../compontents/button/index.ts
|
|
93
|
+
var YButton = withInstall(/* @__PURE__ */ (0, vue.defineComponent)({
|
|
94
|
+
name: "y-button",
|
|
95
|
+
__name: "button",
|
|
96
|
+
props: buttonProps,
|
|
97
|
+
setup(__props) {
|
|
98
|
+
const props = __props;
|
|
99
|
+
const bem = createNameSpace("button");
|
|
100
|
+
const style = (0, vue.computed)(() => {
|
|
101
|
+
if (!props.color && !props.size) return {};
|
|
102
|
+
return {
|
|
103
|
+
...props.color ? { color: props.color } : {},
|
|
104
|
+
...props.size ? { "font-size": `${props.size}px` } : {}
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
return (_ctx, _cache) => {
|
|
108
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
|
|
109
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(bem).b()),
|
|
110
|
+
style: (0, vue.normalizeStyle)(style.value)
|
|
111
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 6);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
// index.prod.ts
|
|
116
|
+
var components = [YIcon, YButton];
|
|
117
|
+
var install = (app) => {
|
|
118
|
+
components.forEach((component) => {
|
|
119
|
+
app.use(component);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
var installer = { install };
|
|
123
|
+
exports.YButton = YButton;
|
|
124
|
+
exports.YIcon = YIcon;
|
|
125
|
+
exports.default = installer;
|
|
126
|
+
exports.install = install;
|
|
127
|
+
});
|
package/README.md
DELETED