yangs-ui 0.0.0-stage → 0.0.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.
Files changed (52) hide show
  1. package/es/button/index.d.ts +33 -0
  2. package/es/button/index.js +7 -0
  3. package/es/button/src/button.d.ts +6 -0
  4. package/es/button/src/button.js +6 -0
  5. package/es/button/src/button.vue.d.ts +21 -0
  6. package/es/button/src/button.vue.js +4 -0
  7. package/es/button/src/button.vue_vue_type_script_setup_true_lang.js +27 -0
  8. package/es/button/style/index.css +3 -0
  9. package/es/icon/index.d.ts +33 -0
  10. package/es/icon/index.js +7 -0
  11. package/es/icon/src/icon.d.ts +23 -0
  12. package/es/icon/src/icon.js +23 -0
  13. package/es/icon/src/icon.vue.d.ts +21 -0
  14. package/es/icon/src/icon.vue.js +4 -0
  15. package/es/icon/src/icon.vue_vue_type_script_setup_true_lang.js +27 -0
  16. package/es/icon/style/index.css +6 -0
  17. package/es/index.d.ts +7 -0
  18. package/es/index.js +11 -0
  19. package/es/utils/create.js +44 -0
  20. package/es/utils/with-install.js +9 -0
  21. package/lib/button/index.cjs +9 -0
  22. package/lib/button/index.d.ts +33 -0
  23. package/lib/button/src/button.cjs +6 -0
  24. package/lib/button/src/button.d.ts +6 -0
  25. package/lib/button/src/button.vue.cjs +3 -0
  26. package/lib/button/src/button.vue.d.ts +21 -0
  27. package/lib/button/src/button.vue_vue_type_script_setup_true_lang.cjs +27 -0
  28. package/lib/button/style/index.css +3 -0
  29. package/lib/component.d.ts +3 -0
  30. package/lib/constants/index.d.ts +1 -0
  31. package/lib/constants/key.d.ts +1 -0
  32. package/lib/icon/index.cjs +9 -0
  33. package/lib/icon/index.d.ts +33 -0
  34. package/lib/icon/src/icon.cjs +23 -0
  35. package/lib/icon/src/icon.d.ts +23 -0
  36. package/lib/icon/src/icon.vue.cjs +3 -0
  37. package/lib/icon/src/icon.vue.d.ts +21 -0
  38. package/lib/icon/src/icon.vue_vue_type_script_setup_true_lang.cjs +27 -0
  39. package/lib/icon/style/index.css +6 -0
  40. package/lib/index.cjs +18 -0
  41. package/lib/index.d.ts +7 -0
  42. package/lib/index.prod.d.ts +8 -0
  43. package/lib/make-install.d.ts +4 -0
  44. package/lib/theme-chalk/src/index.d.ts +0 -0
  45. package/lib/utils/create.cjs +44 -0
  46. package/lib/utils/create.d.ts +20 -0
  47. package/lib/utils/with-install.cjs +9 -0
  48. package/lib/utils/with-install.d.ts +3 -0
  49. package/package.json +56 -3
  50. package/umd/index.full.css +8 -0
  51. package/umd/index.full.js +127 -0
  52. package/README.md +0 -3
@@ -0,0 +1,33 @@
1
+ export declare const YButton: import('@yangs-ui/utils/with-install').SFCWithInstall<{
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
3
+ readonly color: StringConstructor;
4
+ readonly size: import('vue').PropType<number | string>;
5
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
6
+ P: {};
7
+ B: {};
8
+ D: {};
9
+ C: {};
10
+ M: {};
11
+ Defaults: {};
12
+ }, Readonly<import('vue').ExtractPropTypes<{
13
+ readonly color: StringConstructor;
14
+ readonly size: import('vue').PropType<number | string>;
15
+ }>> & Readonly<{}>, {}, {}, {}, {}, {}>;
16
+ __isFragment?: never;
17
+ __isTeleport?: never;
18
+ __isSuspense?: never;
19
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
20
+ readonly color: StringConstructor;
21
+ readonly size: import('vue').PropType<number | string>;
22
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
23
+ $slots: {
24
+ default?: (props: {}) => any;
25
+ };
26
+ })>;
27
+ export default YButton;
28
+ export * from './src/button';
29
+ declare module "vue" {
30
+ interface GlobalComponents {
31
+ YButton: typeof YButton;
32
+ }
33
+ }
@@ -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,6 @@
1
+ import { PropType, ExtractPropTypes } from 'vue';
2
+ export declare const buttonProps: {
3
+ readonly color: StringConstructor;
4
+ readonly size: PropType<number | string>;
5
+ };
6
+ export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
@@ -0,0 +1,6 @@
1
+ // ../compontents/button/src/button.ts
2
+ var buttonProps = {
3
+ color: String,
4
+ size: [Number, String]
5
+ };
6
+ export { buttonProps };
@@ -0,0 +1,21 @@
1
+ declare const __VLS_template: () => {
2
+ __VLS_Slots: {
3
+ default?: (props: {}) => any;
4
+ };
5
+ };
6
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
7
+ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
+ readonly color: StringConstructor;
9
+ readonly size: import('vue').PropType<number | string>;
10
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
+ readonly color: StringConstructor;
12
+ readonly size: import('vue').PropType<number | string>;
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,4 @@
1
+ import button_vue_vue_type_script_setup_true_lang_default from "./button.vue_vue_type_script_setup_true_lang.js";
2
+ // ../compontents/button/src/button.vue
3
+ var button_default = button_vue_vue_type_script_setup_true_lang_default;
4
+ export { button_default as default };
@@ -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 };
@@ -0,0 +1,3 @@
1
+ .y-button {
2
+ border: 1px solid #ccc;
3
+ }
@@ -0,0 +1,33 @@
1
+ export declare const YIcon: import('@yangs-ui/utils/with-install').SFCWithInstall<{
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
3
+ readonly color: StringConstructor;
4
+ readonly size: import('vue').PropType<number | string>;
5
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
6
+ P: {};
7
+ B: {};
8
+ D: {};
9
+ C: {};
10
+ M: {};
11
+ Defaults: {};
12
+ }, Readonly<import('vue').ExtractPropTypes<{
13
+ readonly color: StringConstructor;
14
+ readonly size: import('vue').PropType<number | string>;
15
+ }>> & Readonly<{}>, {}, {}, {}, {}, {}>;
16
+ __isFragment?: never;
17
+ __isTeleport?: never;
18
+ __isSuspense?: never;
19
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
20
+ readonly color: StringConstructor;
21
+ readonly size: import('vue').PropType<number | string>;
22
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
23
+ $slots: {
24
+ default?: (props: {}) => any;
25
+ };
26
+ })>;
27
+ export default YIcon;
28
+ export * from './src/icon';
29
+ declare module "vue" {
30
+ interface GlobalComponents {
31
+ YIcon: typeof YIcon;
32
+ }
33
+ }
@@ -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
+ import { PropType, ExtractPropTypes } from 'vue';
2
+ export declare const iconProps: {
3
+ readonly color: StringConstructor;
4
+ readonly size: PropType<number | string>;
5
+ };
6
+ export type IconProps = ExtractPropTypes<typeof iconProps>;
7
+ /**
8
+ * const iconProps = {
9
+ color: String,
10
+ size: [Number, String]
11
+ };
12
+ 这种写法是在vue组件中定义props时的写法,运行时的写法,只能写一个构造函数。String,Number本身也是构造函数
13
+
14
+ 为什么使用as const。ts的类型
15
+ 让所有属性变为readonly
16
+ 不能直接赋值 iconProps.color = String; // 报错,因为color是readonly属性
17
+
18
+ as PropType<number | string> ts的类型
19
+ 返回一个构造函数(构造函数的返回值为number|string)
20
+ 如果color是一个对象,可以指定具体对象的属性类型 color: Object as PropType<{ name: string; age: number }>
21
+ 如果color是一个函数,color: Function as PropType<(val: string) => void>
22
+ 让ExtractPropTypes更好的推导类型,避免手动定义类型
23
+ */
@@ -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,21 @@
1
+ declare const __VLS_template: () => {
2
+ __VLS_Slots: {
3
+ default?: (props: {}) => any;
4
+ };
5
+ };
6
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
7
+ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
+ readonly color: StringConstructor;
9
+ readonly size: import('vue').PropType<number | string>;
10
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
+ readonly color: StringConstructor;
12
+ readonly size: import('vue').PropType<number | string>;
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,4 @@
1
+ import icon_vue_vue_type_script_setup_true_lang_default from "./icon.vue_vue_type_script_setup_true_lang.js";
2
+ // ../compontents/icon/src/icon.vue
3
+ var icon_default = icon_vue_vue_type_script_setup_true_lang_default;
4
+ export { icon_default as default };
@@ -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 };
@@ -0,0 +1,6 @@
1
+ .y-icon {
2
+ width: 1em;
3
+ height: 1em;
4
+ vertical-align: middle;
5
+ display: inline-flex;
6
+ }
package/es/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from '@yangs-ui/components';
2
+ export * from '@yangs-ui/constants';
3
+ declare const installer: {
4
+ install: (app: any) => void;
5
+ };
6
+ export declare const install: (app: any) => void;
7
+ export default installer;
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
+ // ../utils/with-install.ts
2
+ function withInstall(component) {
3
+ component.install = function(app) {
4
+ const { name } = component;
5
+ app.component(name, component);
6
+ };
7
+ return component;
8
+ }
9
+ export { withInstall };
@@ -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,33 @@
1
+ export declare const YButton: import('@yangs-ui/utils/with-install').SFCWithInstall<{
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
3
+ readonly color: StringConstructor;
4
+ readonly size: import('vue').PropType<number | string>;
5
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
6
+ P: {};
7
+ B: {};
8
+ D: {};
9
+ C: {};
10
+ M: {};
11
+ Defaults: {};
12
+ }, Readonly<import('vue').ExtractPropTypes<{
13
+ readonly color: StringConstructor;
14
+ readonly size: import('vue').PropType<number | string>;
15
+ }>> & Readonly<{}>, {}, {}, {}, {}, {}>;
16
+ __isFragment?: never;
17
+ __isTeleport?: never;
18
+ __isSuspense?: never;
19
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
20
+ readonly color: StringConstructor;
21
+ readonly size: import('vue').PropType<number | string>;
22
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
23
+ $slots: {
24
+ default?: (props: {}) => any;
25
+ };
26
+ })>;
27
+ export default YButton;
28
+ export * from './src/button';
29
+ declare module "vue" {
30
+ interface GlobalComponents {
31
+ YButton: typeof YButton;
32
+ }
33
+ }
@@ -0,0 +1,6 @@
1
+ // ../compontents/button/src/button.ts
2
+ var buttonProps = {
3
+ color: String,
4
+ size: [Number, String]
5
+ };
6
+ exports.buttonProps = buttonProps;
@@ -0,0 +1,6 @@
1
+ import { PropType, ExtractPropTypes } from 'vue';
2
+ export declare const buttonProps: {
3
+ readonly color: StringConstructor;
4
+ readonly size: PropType<number | string>;
5
+ };
6
+ export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
@@ -0,0 +1,3 @@
1
+ // ../compontents/button/src/button.vue
2
+ var button_default = require("./button.vue_vue_type_script_setup_true_lang.cjs").default;
3
+ exports.default = button_default;
@@ -0,0 +1,21 @@
1
+ declare const __VLS_template: () => {
2
+ __VLS_Slots: {
3
+ default?: (props: {}) => any;
4
+ };
5
+ };
6
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
7
+ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
+ readonly color: StringConstructor;
9
+ readonly size: import('vue').PropType<number | string>;
10
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
+ readonly color: StringConstructor;
12
+ readonly size: import('vue').PropType<number | string>;
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -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,3 @@
1
+ .y-button {
2
+ border: 1px solid #ccc;
3
+ }
@@ -0,0 +1,3 @@
1
+ import { Plugin } from 'vue';
2
+ declare const _default: Plugin[];
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './key';
@@ -0,0 +1 @@
1
+ export declare const INSTALLED_KEY: unique symbol;
@@ -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,33 @@
1
+ export declare const YIcon: import('@yangs-ui/utils/with-install').SFCWithInstall<{
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
3
+ readonly color: StringConstructor;
4
+ readonly size: import('vue').PropType<number | string>;
5
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
6
+ P: {};
7
+ B: {};
8
+ D: {};
9
+ C: {};
10
+ M: {};
11
+ Defaults: {};
12
+ }, Readonly<import('vue').ExtractPropTypes<{
13
+ readonly color: StringConstructor;
14
+ readonly size: import('vue').PropType<number | string>;
15
+ }>> & Readonly<{}>, {}, {}, {}, {}, {}>;
16
+ __isFragment?: never;
17
+ __isTeleport?: never;
18
+ __isSuspense?: never;
19
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
20
+ readonly color: StringConstructor;
21
+ readonly size: import('vue').PropType<number | string>;
22
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
23
+ $slots: {
24
+ default?: (props: {}) => any;
25
+ };
26
+ })>;
27
+ export default YIcon;
28
+ export * from './src/icon';
29
+ declare module "vue" {
30
+ interface GlobalComponents {
31
+ YIcon: typeof YIcon;
32
+ }
33
+ }
@@ -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,23 @@
1
+ import { PropType, ExtractPropTypes } from 'vue';
2
+ export declare const iconProps: {
3
+ readonly color: StringConstructor;
4
+ readonly size: PropType<number | string>;
5
+ };
6
+ export type IconProps = ExtractPropTypes<typeof iconProps>;
7
+ /**
8
+ * const iconProps = {
9
+ color: String,
10
+ size: [Number, String]
11
+ };
12
+ 这种写法是在vue组件中定义props时的写法,运行时的写法,只能写一个构造函数。String,Number本身也是构造函数
13
+
14
+ 为什么使用as const。ts的类型
15
+ 让所有属性变为readonly
16
+ 不能直接赋值 iconProps.color = String; // 报错,因为color是readonly属性
17
+
18
+ as PropType<number | string> ts的类型
19
+ 返回一个构造函数(构造函数的返回值为number|string)
20
+ 如果color是一个对象,可以指定具体对象的属性类型 color: Object as PropType<{ name: string; age: number }>
21
+ 如果color是一个函数,color: Function as PropType<(val: string) => void>
22
+ 让ExtractPropTypes更好的推导类型,避免手动定义类型
23
+ */
@@ -0,0 +1,3 @@
1
+ // ../compontents/icon/src/icon.vue
2
+ var icon_default = require("./icon.vue_vue_type_script_setup_true_lang.cjs").default;
3
+ exports.default = icon_default;
@@ -0,0 +1,21 @@
1
+ declare const __VLS_template: () => {
2
+ __VLS_Slots: {
3
+ default?: (props: {}) => any;
4
+ };
5
+ };
6
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
7
+ declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
8
+ readonly color: StringConstructor;
9
+ readonly size: import('vue').PropType<number | string>;
10
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
+ readonly color: StringConstructor;
12
+ readonly size: import('vue').PropType<number | string>;
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -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;
@@ -0,0 +1,6 @@
1
+ .y-icon {
2
+ width: 1em;
3
+ height: 1em;
4
+ vertical-align: middle;
5
+ display: inline-flex;
6
+ }
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;
package/lib/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from '@yangs-ui/components';
2
+ export * from '@yangs-ui/constants';
3
+ declare const installer: {
4
+ install: (app: any) => void;
5
+ };
6
+ export declare const install: (app: any) => void;
7
+ export default installer;
@@ -0,0 +1,8 @@
1
+ import { YIcon } from '@yangs-ui/components/icon';
2
+ import { YButton } from '@yangs-ui/components/button';
3
+ declare const install: (app: any) => void;
4
+ declare const installer: {
5
+ install: (app: any) => void;
6
+ };
7
+ export default installer;
8
+ export { install, YIcon, YButton };
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'vue';
2
+ export declare function makeInstall(components: Plugin[]): {
3
+ install: (app: any) => void;
4
+ };
File without changes
@@ -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;
@@ -0,0 +1,20 @@
1
+ export declare function createNameSpace(name: string): {
2
+ b: (blockSuffix?: string) => string;
3
+ e: (element?: string) => string;
4
+ m: (modifier?: string) => string;
5
+ be: (blockSuffix: string, element: string) => string;
6
+ bm: (blockSuffix: string, modifier: string) => string;
7
+ em: (element: string, modifier: string) => string;
8
+ bem: (blockSuffix: string, element: string, modifier: string) => string;
9
+ is: (name: string, state: string | boolean) => string;
10
+ };
11
+ /**
12
+ * const bem = createNameSpace("icon");
13
+ console.log(bem.b("block"));
14
+ console.log(bem.e("element"));
15
+ console.log(bem.m("modifier"));
16
+ console.log(bem.be("block", "element"));
17
+ console.log(bem.bm("block", "modifier"));
18
+ console.log(bem.em("element", "modifier"));
19
+ console.log(bem.bem("block", "element", "modifier"));
20
+ */
@@ -0,0 +1,9 @@
1
+ // ../utils/with-install.ts
2
+ function withInstall(component) {
3
+ component.install = function(app) {
4
+ const { name } = component;
5
+ app.component(name, component);
6
+ };
7
+ return component;
8
+ }
9
+ exports.withInstall = withInstall;
@@ -0,0 +1,3 @@
1
+ import { ObjectPlugin } from 'vue';
2
+ export type SFCWithInstall<T> = T & ObjectPlugin;
3
+ export declare function withInstall<T>(component: T): SFCWithInstall<T>;
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "yangs-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "type": "module",
4
+ "version": "0.0.2",
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
+ "peerDependencies": {
17
+ "vue": "^3.5.0"
18
+ },
19
+ "unpkg": "./dist/umd/index.full.js",
20
+ "jsdelivr": "./dist/umd/index.full.js",
21
+ "style": "./dist/umd/index.css",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./es/index.d.ts",
25
+ "import": "./es/index.js",
26
+ "require": "./lib/index.js"
27
+ },
28
+ "./es": {
29
+ "types": "./es/index.d.ts",
30
+ "import": "./es/index.js"
31
+ },
32
+ "./lib": {
33
+ "types": "./lib/index.d.ts",
34
+ "require": "./lib/index.js"
35
+ },
36
+ "./es/*": {
37
+ "types": [
38
+ "./es/*.d.ts",
39
+ "./es/*/index.d.ts"
40
+ ],
41
+ "import": "./es/*.js"
42
+ },
43
+ "./lib/*.js": {
44
+ "types": "./lib/*.d.ts",
45
+ "require": "./lib/*.js"
46
+ },
47
+ "./lib/*": {
48
+ "types": [
49
+ "./lib/*.d.ts",
50
+ "./lib/*/index.d.ts"
51
+ ],
52
+ "require": "./lib/*.js"
53
+ },
54
+ "./*": "./*"
55
+ },
56
+ "sideEffects": [
57
+ "**/style/**"
58
+ ]
6
59
  }
@@ -0,0 +1,8 @@
1
+ .y-icon {
2
+ width: 1em;
3
+ height: 1em;
4
+ vertical-align: middle;
5
+ display: inline-flex;
6
+ }.y-button {
7
+ border: 1px solid #ccc;
8
+ }/*$vite$:1*/
@@ -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
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.