suncy-my-npm-test 1.0.42 → 1.0.44

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/package.json CHANGED
@@ -1,49 +1,56 @@
1
- {
2
- "name": "suncy-my-npm-test",
3
- "version": "1.0.42",
4
- "type": "module",
5
- "description": "A Vue component compatible with Vue 2 & 3",
6
- "main": "dist/index.umd.js",
7
- "module": "dist/index.esm.js",
8
- "unpkg": "dist/index.umd.js",
9
- "jsdelivr": "dist/index.umd.js",
10
- "types": "dist/index.d.ts",
11
- "files": ["dist"],
12
- "exports": {
13
- ".": {
14
- "import": "./dist/index.esm.js",
15
- "require": "./dist/index.umd.js",
16
- "types": "./dist/index.d.ts"
17
- }
18
- },
19
- "scripts": {
20
- "dev": "vite",
21
- "build": "vite build",
22
- "build:vue2": "npm run switch:vue2 && npm run build",
23
- "build:vue3": "npm run switch:vue3 && npm run build",
24
- "build:all": "npm run build:vue2 && npm run build:vue3",
25
- "switch:vue2": "vue-demi-switch 2",
26
- "switch:vue3": "vue-demi-switch 3",
27
- "prepublishOnly": "npm run build:all",
28
- "postinstall": "vue-demi-switch 3"
29
- },
30
- "peerDependencies": {
31
- "vue": "^2.6.0 || ^3.0.0"
32
- },
33
- "peerDependenciesMeta": {
34
- "@vue/composition-api": {
35
- "optional": true
36
- }
37
- },
38
- "dependencies": {
39
- "vue-demi": "^0.14.0"
40
- },
41
- "devDependencies": {
42
- "@vitejs/plugin-vue": "^6.0.1",
43
- "@vue/composition-api": "^1.7.2",
44
- "typescript": "^5.0.0",
45
- "vite": "^7.1.2",
46
- "vue": "^3.5.12",
47
- "vue-tsc": "^2.0.0"
48
- }
49
- }
1
+ {
2
+ "name": "suncy-my-npm-test",
3
+ "version": "1.0.44",
4
+ "description": "A Vue2 component library",
5
+ "main": "lib/suncy-my-npm-test.umd.min.js",
6
+ "module": "lib/suncy-my-npm-test.esm.js",
7
+ "unpkg": "lib/suncy-my-npm-test.umd.min.js",
8
+ "jsdelivr": "lib/suncy-my-npm-test.umd.min.js",
9
+ "files": [
10
+ "lib",
11
+ "packages"
12
+ ],
13
+ "scripts": {
14
+ "serve": "vue-cli-service serve",
15
+ "build": "vue-cli-service build",
16
+ "build:lib": "vue-cli-service build --target lib --name suncy-my-npm-test ./packages/index.js",
17
+ "lint": "vue-cli-service lint",
18
+ "prepublishOnly": "npm run build:lib"
19
+ },
20
+ "dependencies": {
21
+ "core-js": "^3.8.3",
22
+ "vue": "^2.6.14"
23
+ },
24
+ "devDependencies": {
25
+ "@vue/cli-plugin-babel": "~5.0.8",
26
+ "@vue/cli-service": "~5.0.8",
27
+ "vue-template-compiler": "^2.6.14",
28
+ "sass": "^1.32.7",
29
+ "sass-loader": "^12.0.0",
30
+ "eslint": "^8.7.0",
31
+ "eslint-plugin-vue": "^8.4.1"
32
+ },
33
+ "peerDependencies": {
34
+ "vue": "^2.6.0"
35
+ },
36
+ "browserslist": [
37
+ "> 1%",
38
+ "last 2 versions",
39
+ "not dead"
40
+ ],
41
+ "keywords": [
42
+ "vue2",
43
+ "component",
44
+ "library"
45
+ ],
46
+ "author": "Your Name",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/yourname/suncy-my-npm-test.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/yourname/suncy-my-npm-test/issues"
54
+ },
55
+ "homepage": "https://github.com/yourname/suncy-my-npm-test#readme"
56
+ }
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <button
3
+ class="my-button"
4
+ :class="[typeClass, sizeClass]"
5
+ @click="$emit('click')"
6
+ >
7
+ <slot></slot>
8
+ </button>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'MyButton',
14
+ props: {
15
+ type: {
16
+ type: String,
17
+ default: 'default',
18
+ validator: (value) => ['default', 'primary', 'success', 'warning', 'danger'].includes(value)
19
+ },
20
+ size: {
21
+ type: String,
22
+ default: 'medium',
23
+ validator: (value) => ['small', 'medium', 'large'].includes(value)
24
+ }
25
+ },
26
+ computed: {
27
+ typeClass() {
28
+ return `my-button--${this.type}`
29
+ },
30
+ sizeClass() {
31
+ return `my-button--${this.size}`
32
+ }
33
+ }
34
+ }
35
+ </script>
36
+
37
+ <style scoped>
38
+ .my-button {
39
+ padding: 10px 20px;
40
+ border: none;
41
+ border-radius: 4px;
42
+ cursor: pointer;
43
+ font-size: 14px;
44
+ transition: all 0.3s;
45
+ }
46
+
47
+ .my-button--default {
48
+ background: #f0f0f0;
49
+ color: #333;
50
+ }
51
+
52
+ .my-button--primary {
53
+ background: #409eff;
54
+ color: white;
55
+ }
56
+
57
+ .my-button--success {
58
+ background: #67c23a;
59
+ color: white;
60
+ }
61
+
62
+ .my-button--small {
63
+ padding: 8px 16px;
64
+ font-size: 12px;
65
+ }
66
+
67
+ .my-button--medium {
68
+ padding: 10px 20px;
69
+ font-size: 14px;
70
+ }
71
+
72
+ .my-button--large {
73
+ padding: 12px 24px;
74
+ font-size: 16px;
75
+ }
76
+ </style>
@@ -0,0 +1,27 @@
1
+ import MyButton from './components/MyButton.vue'
2
+
3
+ const components = {
4
+ MyButton,
5
+ }
6
+
7
+ const install = function(Vue) {
8
+ if (install.installed) return
9
+
10
+ Object.keys(components).forEach(key => {
11
+ Vue.component(components[key].name, components[key])
12
+ })
13
+ }
14
+
15
+ // 自动安装
16
+ if (typeof window !== 'undefined' && window.Vue) {
17
+ install(window.Vue)
18
+ }
19
+
20
+ export default {
21
+ install,
22
+ ...components
23
+ }
24
+
25
+ export {
26
+ MyButton,
27
+ }
package/dist/index.esm.js DELETED
@@ -1,48 +0,0 @@
1
- import { defineComponent, ref } from "vue-demi";
2
- import { openBlock, createElementBlock, toDisplayString } from "vue";
3
- const _export_sfc = (sfc, props) => {
4
- const target = sfc.__vccOpts || sfc;
5
- for (const [key, val] of props) {
6
- target[key] = val;
7
- }
8
- return target;
9
- };
10
- const _sfc_main = defineComponent({
11
- name: "MyComponent",
12
- props: {
13
- label: {
14
- type: String,
15
- default: "Click me"
16
- }
17
- },
18
- emits: ["click"],
19
- // Vue3 的 emits,Vue2 会自动忽略
20
- setup(props, { emit }) {
21
- const count = ref(0);
22
- const handleClick = () => {
23
- count.value++;
24
- emit("click", count.value);
25
- };
26
- return {
27
- count,
28
- handleClick
29
- };
30
- },
31
- // Vue2 选项式 API 兼容
32
- methods: {
33
- // 如果需要支持 Vue2 的 $emit 调用
34
- onClick() {
35
- this.$emit("click", this.count);
36
- }
37
- }
38
- });
39
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
40
- return openBlock(), createElementBlock("div", {
41
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
42
- }, " aaaaa=" + toDisplayString(_ctx.count), 1);
43
- }
44
- const test = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
45
- export {
46
- test as default
47
- };
48
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/test.vue"],"sourcesContent":["<template>\r\n <div @click=\"handleClick\">\r\n aaaaa={{count}}\r\n </div>\r\n </template>\r\n <script>\r\n import { defineComponent, ref } from 'vue-demi'\r\n\r\n export default defineComponent({\r\n name: 'MyComponent',\r\n \r\n props: {\r\n label: {\r\n type: String,\r\n default: 'Click me'\r\n }\r\n },\r\n \r\n emits: ['click'], // Vue3 的 emits,Vue2 会自动忽略\r\n \r\n setup(props, { emit }) {\r\n const count = ref(0)\r\n \r\n const handleClick = () => {\r\n count.value++\r\n emit('click', count.value)\r\n }\r\n \r\n return {\r\n count,\r\n handleClick\r\n }\r\n },\r\n \r\n // Vue2 选项式 API 兼容\r\n methods: {\r\n // 如果需要支持 Vue2 的 $emit 调用\r\n onClick() {\r\n this.$emit('click', this.count)\r\n }\r\n }\r\n})\r\n </script>\r\n "],"names":["_createElementBlock"],"mappings":";;;;;;;;;AAQE,MAAK,YAAa,gBAAa;AAAA,EAC/B,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA;EAGF,OAAO,CAAC,OAAO;AAAA;AAAA,EAEf,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,QAAQ,IAAI,CAAC;AAEnB,UAAM,cAAc,MAAM;AACxB,YAAM;AACN,WAAK,SAAS,MAAM,KAAK;AAAA,IAC3B;AAEA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,SAAS;AAAA;AAAA,IAEP,UAAU;AACR,WAAK,MAAM,SAAS,KAAK,KAAK;AAAA,IAChC;AAAA,EACF;AACF,CAAC;;sBAxCGA,mBAEM,OAAA;AAAA,IAFA,gDAAO,KAAA,eAAA,KAAA,YAAA,GAAA,IAAA;AAAA,EAAa,GAAA,4BACd,KAAA,KAAK,GAAA,CAAA;;;"}
package/dist/index.umd.js DELETED
@@ -1,49 +0,0 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("vue-demi"), require("vue")) : typeof define === "function" && define.amd ? define(["vue-demi", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.MyTest = factory(global.VueDemi, global.Vue));
3
- })(this, (function(vueDemi, vue) {
4
- "use strict";
5
- const _export_sfc = (sfc, props) => {
6
- const target = sfc.__vccOpts || sfc;
7
- for (const [key, val] of props) {
8
- target[key] = val;
9
- }
10
- return target;
11
- };
12
- const _sfc_main = vueDemi.defineComponent({
13
- name: "MyComponent",
14
- props: {
15
- label: {
16
- type: String,
17
- default: "Click me"
18
- }
19
- },
20
- emits: ["click"],
21
- // Vue3 的 emits,Vue2 会自动忽略
22
- setup(props, { emit }) {
23
- const count = vueDemi.ref(0);
24
- const handleClick = () => {
25
- count.value++;
26
- emit("click", count.value);
27
- };
28
- return {
29
- count,
30
- handleClick
31
- };
32
- },
33
- // Vue2 选项式 API 兼容
34
- methods: {
35
- // 如果需要支持 Vue2 的 $emit 调用
36
- onClick() {
37
- this.$emit("click", this.count);
38
- }
39
- }
40
- });
41
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
42
- return vue.openBlock(), vue.createElementBlock("div", {
43
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
44
- }, " aaaaa=" + vue.toDisplayString(_ctx.count), 1);
45
- }
46
- const test = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
47
- return test;
48
- }));
49
- //# sourceMappingURL=index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/test.vue"],"sourcesContent":["<template>\r\n <div @click=\"handleClick\">\r\n aaaaa={{count}}\r\n </div>\r\n </template>\r\n <script>\r\n import { defineComponent, ref } from 'vue-demi'\r\n\r\n export default defineComponent({\r\n name: 'MyComponent',\r\n \r\n props: {\r\n label: {\r\n type: String,\r\n default: 'Click me'\r\n }\r\n },\r\n \r\n emits: ['click'], // Vue3 的 emits,Vue2 会自动忽略\r\n \r\n setup(props, { emit }) {\r\n const count = ref(0)\r\n \r\n const handleClick = () => {\r\n count.value++\r\n emit('click', count.value)\r\n }\r\n \r\n return {\r\n count,\r\n handleClick\r\n }\r\n },\r\n \r\n // Vue2 选项式 API 兼容\r\n methods: {\r\n // 如果需要支持 Vue2 的 $emit 调用\r\n onClick() {\r\n this.$emit('click', this.count)\r\n }\r\n }\r\n})\r\n </script>\r\n "],"names":["defineComponent","ref","_createElementBlock"],"mappings":";;;;;;;;;;;AAQE,QAAK,YAAaA,QAAAA,gBAAa;AAAA,IAC/B,MAAM;AAAA,IAEN,OAAO;AAAA,MACL,OAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA;IAGF,OAAO,CAAC,OAAO;AAAA;AAAA,IAEf,MAAM,OAAO,EAAE,QAAQ;AACrB,YAAM,QAAQC,QAAAA,IAAI,CAAC;AAEnB,YAAM,cAAc,MAAM;AACxB,cAAM;AACN,aAAK,SAAS,MAAM,KAAK;AAAA,MAC3B;AAEA,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,SAAS;AAAA;AAAA,MAEP,UAAU;AACR,aAAK,MAAM,SAAS,KAAK,KAAK;AAAA,MAChC;AAAA,IACF;AAAA,EACF,CAAC;;4BAxCGC,IAAAA,mBAEM,OAAA;AAAA,MAFA,gDAAO,KAAA,eAAA,KAAA,YAAA,GAAA,IAAA;AAAA,IAAa,GAAA,gCACd,KAAA,KAAK,GAAA,CAAA;AAAA;;;;"}