@uf_lee/leeui 1.0.0 → 1.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/dist/leeui.css +1 -0
- package/dist/my-component-library.es.js +37 -0
- package/dist/my-component-library.umd.js +1 -0
- package/dist/types/MyComponent.vue.d.ts +7 -0
- package/dist/types/MyComponentInstance.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +23 -6
- package/src/MyComponent.vue +34 -0
- package/src/MyComponentInstance.ts +29 -0
- package/src/index.ts +10 -0
- package/MyComponent.vue +0 -41
- package/index.js +0 -2
package/dist/leeui.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.my-component[data-v-58ee48fa]{position:fixed;top:20%;left:50%;transform:translate(-50%);padding:20px;background:#fff;border:1px solid #eee;box-shadow:0 0 10px #0000001a}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent as a, ref as m, createElementBlock as i, createCommentVNode as u, openBlock as d, createElementVNode as r, createVNode as f, render as _ } from "vue";
|
|
2
|
+
const v = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "my-component"
|
|
5
|
+
}, y = /* @__PURE__ */ a({
|
|
6
|
+
__name: "MyComponent",
|
|
7
|
+
setup(t, { expose: c }) {
|
|
8
|
+
const e = m(!1);
|
|
9
|
+
function l() {
|
|
10
|
+
e.value = !0;
|
|
11
|
+
}
|
|
12
|
+
function n() {
|
|
13
|
+
e.value = !1;
|
|
14
|
+
}
|
|
15
|
+
return c({ open: l, close: n }), (k, s) => e.value ? (d(), i("div", v, [
|
|
16
|
+
s[0] || (s[0] = r("p", null, "Hello! 我是一个全局单例组件", -1)),
|
|
17
|
+
r("button", { onClick: n }, "关闭")
|
|
18
|
+
])) : u("", !0);
|
|
19
|
+
}
|
|
20
|
+
}), C = (t, c) => {
|
|
21
|
+
const e = t.__vccOpts || t;
|
|
22
|
+
for (const [l, n] of c)
|
|
23
|
+
e[l] = n;
|
|
24
|
+
return e;
|
|
25
|
+
}, x = /* @__PURE__ */ C(y, [["__scopeId", "data-v-58ee48fa"]]);
|
|
26
|
+
let o = null, p = null;
|
|
27
|
+
function b() {
|
|
28
|
+
o || (p = document.createElement("div"), document.body.appendChild(p), o = f(x), _(o, p)), o.component.exposed.open();
|
|
29
|
+
}
|
|
30
|
+
function h() {
|
|
31
|
+
o && o.component.exposed.close();
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
x as MyComponent,
|
|
35
|
+
h as hideMyComponent,
|
|
36
|
+
b as showMyComponent
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.MyComponentLibrary={},n.Vue))})(this,function(n,e){"use strict";const f={key:0,class:"my-component"},l=((s,p)=>{const t=s.__vccOpts||s;for(const[d,c]of p)t[d]=c;return t})(e.defineComponent({__name:"MyComponent",setup(s,{expose:p}){const t=e.ref(!1);function d(){t.value=!0}function c(){t.value=!1}return p({open:d,close:c}),(y,r)=>t.value?(e.openBlock(),e.createElementBlock("div",f,[r[0]||(r[0]=e.createElementVNode("p",null,"Hello! 我是一个全局单例组件",-1)),e.createElementVNode("button",{onClick:c},"关闭")])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-58ee48fa"]]);let o=null,i=null;function m(){o||(i=document.createElement("div"),document.body.appendChild(i),o=e.createVNode(l),e.render(o,i)),o.component.exposed.open()}function u(){o&&o.component.exposed.close()}n.MyComponent=l,n.hideMyComponent=u,n.showMyComponent=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function open(): void;
|
|
2
|
+
declare function close(): void;
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
4
|
+
open: typeof open;
|
|
5
|
+
close: typeof close;
|
|
6
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uf_lee/leeui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "自己的组件库",
|
|
5
|
+
"main": "dist/my-component-library.cjs.js",
|
|
6
|
+
"module": "dist/my-component-library.esm.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
6
8
|
"files": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
9
11
|
],
|
|
10
12
|
"keywords": [
|
|
11
13
|
"vue",
|
|
12
14
|
"component"
|
|
13
15
|
],
|
|
14
16
|
"author": "李天惊",
|
|
15
|
-
"license": "MIT"
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"build:types": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.json",
|
|
22
|
+
"publish": "npm run build && npm publish"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
26
|
+
"typescript": "^5.8.2",
|
|
27
|
+
"vite": "^6.2.2",
|
|
28
|
+
"vue-tsc": "^2.2.8"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"vue": "^3.5.13"
|
|
32
|
+
}
|
|
16
33
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="visible" class="my-component">
|
|
3
|
+
<p>Hello! 我是一个全局单例组件</p>
|
|
4
|
+
<button @click="close">关闭</button>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref } from "vue";
|
|
10
|
+
|
|
11
|
+
const visible = ref(false);
|
|
12
|
+
|
|
13
|
+
function open() {
|
|
14
|
+
visible.value = true;
|
|
15
|
+
}
|
|
16
|
+
function close() {
|
|
17
|
+
visible.value = false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
defineExpose({ open, close });
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.my-component {
|
|
25
|
+
position: fixed;
|
|
26
|
+
top: 20%;
|
|
27
|
+
left: 50%;
|
|
28
|
+
transform: translateX(-50%);
|
|
29
|
+
padding: 20px;
|
|
30
|
+
background: #fff;
|
|
31
|
+
border: 1px solid #eee;
|
|
32
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 李天惊 uf_lee@163.com
|
|
3
|
+
* @Date: 2025-03-20 12:07:04
|
|
4
|
+
* @LastEditors: 李天惊 uf_lee@163.com
|
|
5
|
+
* @LastEditTime: 2025-03-20 12:07:13
|
|
6
|
+
* @FilePath: \leelcp2022\lee_ui\src\MyComponentInstance.ts
|
|
7
|
+
* Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
import { createVNode, render, VNode } from "vue";
|
|
10
|
+
import MyComponent from "./MyComponent.vue";
|
|
11
|
+
|
|
12
|
+
let instance: VNode | null = null;
|
|
13
|
+
let container: HTMLElement | null = null;
|
|
14
|
+
|
|
15
|
+
export function showMyComponent() {
|
|
16
|
+
if (!instance) {
|
|
17
|
+
container = document.createElement("div");
|
|
18
|
+
document.body.appendChild(container);
|
|
19
|
+
instance = createVNode(MyComponent);
|
|
20
|
+
render(instance, container);
|
|
21
|
+
}
|
|
22
|
+
(instance.component!.exposed as any).open();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function hideMyComponent() {
|
|
26
|
+
if (instance) {
|
|
27
|
+
(instance.component!.exposed as any).close();
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 李天惊 uf_lee@163.com
|
|
3
|
+
* @Date: 2025-03-20 11:24:35
|
|
4
|
+
* @LastEditors: 李天惊 uf_lee@163.com
|
|
5
|
+
* @LastEditTime: 2025-03-20 12:07:29
|
|
6
|
+
* @FilePath: \leelcp2022\lee_ui\src\index.ts
|
|
7
|
+
* Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
export { showMyComponent, hideMyComponent } from "./MyComponentInstance";
|
|
10
|
+
export { default as MyComponent } from "./MyComponent.vue";
|
package/MyComponent.vue
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
|
|
4
|
-
defineProps<{ msg: string }>();
|
|
5
|
-
|
|
6
|
-
const count = ref(0);
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<h1>{{ msg }}</h1>
|
|
11
|
-
|
|
12
|
-
<div class="card">
|
|
13
|
-
<button type="button" @click="count++">count is {{ count }}</button>
|
|
14
|
-
<p>
|
|
15
|
-
Edit
|
|
16
|
-
<code>components/HelloWorld.vue</code> to test HMR
|
|
17
|
-
</p>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<p>
|
|
21
|
-
Check out
|
|
22
|
-
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
|
23
|
-
>create-vue</a
|
|
24
|
-
>, the official Vue + Vite starter
|
|
25
|
-
</p>
|
|
26
|
-
<p>
|
|
27
|
-
Learn more about IDE Support for Vue in the
|
|
28
|
-
<a
|
|
29
|
-
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
|
30
|
-
target="_blank"
|
|
31
|
-
>Vue Docs Scaling up Guide</a
|
|
32
|
-
>.
|
|
33
|
-
</p>
|
|
34
|
-
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<style scoped>
|
|
38
|
-
.read-the-docs {
|
|
39
|
-
color: #888;
|
|
40
|
-
}
|
|
41
|
-
</style>
|
package/index.js
DELETED