geekplus-digital-ui 0.1.0 → 0.1.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/README.md CHANGED
@@ -1,74 +1 @@
1
1
  # Geekplus Digital UI
2
-
3
- 极智嘉数字化 Vue 3 组件库,基于 Element Plus 进行业务封装和样式定制。
4
-
5
- ## 在线文档
6
-
7
- [https://ui.geekplus.cc/](https://ui.geekplus.cc/)
8
-
9
- ## 开发规范
10
-
11
- 本规范为组件库开发的基本原则与价值观,用于指导组件设计方向与技术选型。具体实现细则将随着组件库发展逐步补充。
12
-
13
- 1. 项目使用 pnpm 进行包管理。
14
- 2. 代码统一使用 ESLint 进行格式化,提交代码前请确保代码格式正确。
15
- 3. 开发请严格遵循 Vue 3 规范,推荐使用 Composition API。
16
- 4. 样式请使用 SCSS 编写,遵循 BEM 命名规范。
17
- 5. 组件国际化请使用 Vue I18n 进行处理。
18
- 6. 业务逻辑解耦,不得有与业务强耦合的代码及接口存在组件内。
19
- 7. 易于扩展和维护,组件设计需考虑复用性和可配置性。
20
- 8. 遵循 npm 包管理规范,确保版本控制清晰。
21
- 9. 文档请使用 VitePress 进行编写,确保文档清晰易懂。
22
- 10. 提交代码前请确保所有单元测试通过。
23
-
24
- ## 目录结构
25
-
26
- 开发核心目录说明:
27
-
28
- - docs(文档目录)
29
- - play(调试目录)
30
- - packages(组件目录)
31
- - components(组件集合)
32
- - hooks(钩子函数集合)
33
- - locale(国际化文件)
34
- - utils(工具函数集合)
35
-
36
- ## 快速开始
37
-
38
- ### 安装依赖
39
-
40
- ```bash
41
- pnpm install
42
- ```
43
-
44
- ### 启动调试
45
-
46
- ```bash
47
- pnpm run dev
48
- ```
49
-
50
- ### 构建组件库
51
-
52
- ```bash
53
- pnpm run build
54
- ```
55
-
56
- ### 运行文档
57
-
58
- ```bash
59
- pnpm run docs:dev
60
- ```
61
-
62
- ### 构建文档
63
-
64
- ```bash
65
- pnpm run docs:build
66
- ```
67
-
68
- ### 发布组件库
69
-
70
- 发布前请确保已正确设置 `package.json` 中的版本号及相关信息。
71
-
72
- ```bash
73
- pnpm publish
74
- ```
@@ -0,0 +1,9 @@
1
+ const s = (t, e) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [r, c] of e)
4
+ o[r] = c;
5
+ return o;
6
+ };
7
+ export {
8
+ s as default
9
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./src/copy.vue.js";
2
+ const r = o;
3
+ export {
4
+ r as DCopy
5
+ };
@@ -0,0 +1,18 @@
1
+ import { openBlock as l, createElementBlock as o, createElementVNode as e } from "vue";
2
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
3
+ const r = {}, n = {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ viewBox: "0 0 448 512"
6
+ };
7
+ function s(f, c) {
8
+ return l(), o("svg", n, [...c[0] || (c[0] = [
9
+ e("path", {
10
+ fill: "currentColor",
11
+ d: "M160 64c0-17.7 14.3-32 32-32l132.1 0c8.5 0 16.6 3.4 22.6 9.4l59.9 59.9c6 6 9.4 14.1 9.4 22.6L416 320c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-256zM192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-196.1c0-17-6.7-33.3-18.7-45.3L369.4 18.7C357.4 6.7 341.1 0 324.1 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-32 0 0 16c0 17.7-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l16 0 0-32-16 0z"
12
+ }, null, -1)
13
+ ])]);
14
+ }
15
+ const _ = /* @__PURE__ */ t(r, [["render", s]]);
16
+ export {
17
+ _ as default
18
+ };
@@ -0,0 +1,81 @@
1
+ import { ref as p, toRef as d, computed as f, onMounted as x, onBeforeUnmount as L, openBlock as s, createBlock as v, unref as y, withModifiers as S, normalizeStyle as M, withCtx as g, createElementBlock as N, normalizeClass as B, createVNode as b, renderSlot as w, createCommentVNode as I } from "vue";
2
+ import { useClipboard as R } from "@vueuse/core";
3
+ import { ElLink as $, ElIcon as z, ElMessage as V } from "element-plus";
4
+ import { useLocale as j } from "../../../hooks/use-locale/index.js";
5
+ import D from "./copy-icon.vue.js";
6
+ import '../../../../assets/components/copy/src/copy-B7_9JShm.css';/* empty css */
7
+ import H from "../../../_virtual/_plugin-vue_export-helper.js";
8
+ const O = /* @__PURE__ */ Object.assign({
9
+ name: "DCopy"
10
+ }, {
11
+ __name: "copy",
12
+ props: {
13
+ text: String,
14
+ type: {
15
+ type: String,
16
+ default: "primary"
17
+ },
18
+ icon: String,
19
+ triggerElement: String
20
+ // 触发元素显示的dom,不设置就一直显示
21
+ },
22
+ setup(a, { expose: E }) {
23
+ const o = a, r = p(null), l = p(!1), h = d(o, "text"), u = d(o, "icon"), { copy: k } = R({
24
+ source: h
25
+ }), { t: C } = j(), e = f(() => {
26
+ const n = r.value?.$el ?? r.value;
27
+ if (!o.triggerElement || !n)
28
+ return null;
29
+ let t = n.parentNode;
30
+ for (; t; ) {
31
+ if (t.matches(o.triggerElement))
32
+ return t;
33
+ t = t.parentNode;
34
+ }
35
+ return null;
36
+ }), _ = f(() => ({
37
+ display: o.triggerElement && !l.value ? "none" : ""
38
+ })), c = () => {
39
+ k().then(() => {
40
+ V.success(C("d.copy.success"));
41
+ });
42
+ }, i = () => {
43
+ l.value = !0;
44
+ }, m = () => {
45
+ l.value = !1;
46
+ };
47
+ return x(() => {
48
+ e.value && (e.value.addEventListener("mouseenter", i), e.value.addEventListener("mouseleave", m));
49
+ }), L(() => {
50
+ e.value && (e.value.removeEventListener("mouseenter", i), e.value.removeEventListener("mouseleave", m));
51
+ }), E({
52
+ rootRef: r,
53
+ handleCopy: c
54
+ }), (n, t) => (s(), v(y($), {
55
+ ref_key: "rootRef",
56
+ ref: r,
57
+ class: "d-copy",
58
+ type: a.type,
59
+ underline: "never",
60
+ style: M(_.value),
61
+ onClick: S(c, ["stop"])
62
+ }, {
63
+ default: g(() => [
64
+ u.value ? (s(), N("i", {
65
+ key: 0,
66
+ class: B(u.value)
67
+ }, null, 2)) : (s(), v(y(z), { key: 1 }, {
68
+ default: g(() => [
69
+ b(D)
70
+ ]),
71
+ _: 1
72
+ })),
73
+ n.$slots.default ? w(n.$slots, "default", { key: 2 }, void 0, !0) : I("", !0)
74
+ ]),
75
+ _: 3
76
+ }, 8, ["type", "style"]));
77
+ }
78
+ }), P = /* @__PURE__ */ H(O, [["__scopeId", "data-v-cad5f2ba"]]);
79
+ export {
80
+ P as default
81
+ };
@@ -0,0 +1,4 @@
1
+ import { DCopy as r } from "./copy/index.js";
2
+ export {
3
+ r as DCopy
4
+ };
@@ -0,0 +1,19 @@
1
+ import { install as o } from "./install.js";
2
+ import { DCopy as f } from "../components/copy/index.js";
3
+ import { useLocale as p } from "../hooks/use-locale/index.js";
4
+ import { default as n } from "../locale/lang/en.js";
5
+ import { default as x } from "../locale/lang/zh-cn.js";
6
+ import { getLocale as c, initI18n as d, setLocale as u, t as L } from "../locale/i18n.js";
7
+ const t = { install: o };
8
+ export {
9
+ f as DCopy,
10
+ t as default,
11
+ n as en,
12
+ c as getLocale,
13
+ d as initI18n,
14
+ o as install,
15
+ u as setLocale,
16
+ L as t,
17
+ p as useLocale,
18
+ x as zhCn
19
+ };
@@ -0,0 +1,11 @@
1
+ import { initI18n as s } from "../locale/i18n.js";
2
+ import * as a from "../components/index.js";
3
+ const c = (n, o = {}) => {
4
+ const { locale: t } = o, e = s(t);
5
+ n.use(e), Object.values(a).forEach((i) => {
6
+ i?.name && n.component(i.name, i);
7
+ });
8
+ };
9
+ export {
10
+ c as install
11
+ };
@@ -0,0 +1,9 @@
1
+ import { setLocale as e, getLocale as o, t } from "../../locale/i18n.js";
2
+ const a = () => ({
3
+ t,
4
+ getLocale: o,
5
+ setLocale: e
6
+ });
7
+ export {
8
+ a as useLocale
9
+ };
@@ -0,0 +1,29 @@
1
+ import { createI18n as i } from "vue-i18n";
2
+ import r from "./lang/en.js";
3
+ const o = "en", f = {
4
+ [r.name]: r
5
+ };
6
+ let a;
7
+ const s = (n) => n ? typeof n == "string" ? n : typeof n == "object" && n.name ? n.name : o : o, t = (n) => (a || (a = i({
8
+ legacy: !1,
9
+ locale: s(n),
10
+ fallbackLocale: o,
11
+ messages: { ...f }
12
+ })), a), c = (n) => {
13
+ if (!n || typeof n != "object")
14
+ return;
15
+ const e = s(n);
16
+ t(n).global.setLocaleMessage(e, n);
17
+ }, b = (n) => {
18
+ const e = t(n);
19
+ return c(n), e.global.locale.value = s(n), e;
20
+ }, L = (n) => {
21
+ const e = t(n);
22
+ c(n), e.global.locale.value = s(n);
23
+ }, l = () => t().global.locale.value, p = (...n) => t().global.t(...n);
24
+ export {
25
+ l as getLocale,
26
+ b as initI18n,
27
+ L as setLocale,
28
+ p as t
29
+ };
@@ -0,0 +1,11 @@
1
+ const s = {
2
+ name: "en",
3
+ d: {
4
+ copy: {
5
+ success: "Copy successful"
6
+ }
7
+ }
8
+ };
9
+ export {
10
+ s as default
11
+ };
@@ -0,0 +1,11 @@
1
+ const c = {
2
+ name: "zh-cn",
3
+ d: {
4
+ copy: {
5
+ success: "复制成功"
6
+ }
7
+ }
8
+ };
9
+ export {
10
+ c as default
11
+ };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "geekplus-digital-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
- "main": "esm/index.js",
6
- "module": "esm/index.js",
5
+ "main": "esm/geekplus-digital-ui/index.js",
6
+ "module": "esm/geekplus-digital-ui/index.js",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./esm/index.js"
9
+ "import": "./esm/geekplus-digital-ui/index.js"
10
10
  }
11
11
  },
12
12
  "sideEffects": [
package/esm/index.js DELETED
@@ -1,150 +0,0 @@
1
- import { createI18n as N } from "vue-i18n";
2
- import { openBlock as u, createElementBlock as M, createElementVNode as j, ref as g, toRef as _, computed as L, onMounted as O, onBeforeUnmount as B, createBlock as E, unref as b, withModifiers as $, normalizeStyle as D, withCtx as C, normalizeClass as R, createVNode as V, renderSlot as A, createCommentVNode as T } from "vue";
3
- import { useClipboard as U } from "@vueuse/core";
4
- import { ElLink as F, ElIcon as H, ElMessage as P } from "element-plus";
5
- const h = {
6
- name: "en",
7
- d: {
8
- copy: {
9
- success: "Copy successful"
10
- }
11
- }
12
- }, ie = {
13
- name: "zh-cn",
14
- d: {
15
- copy: {
16
- success: "复制成功"
17
- }
18
- }
19
- }, m = "en", q = {
20
- [h.name]: h
21
- };
22
- let f;
23
- const i = (e) => e ? typeof e == "string" ? e : typeof e == "object" && e.name ? e.name : m : m, a = (e) => (f || (f = N({
24
- legacy: !1,
25
- locale: i(e),
26
- fallbackLocale: m,
27
- messages: { ...q }
28
- })), f), k = (e) => {
29
- if (!e || typeof e != "object")
30
- return;
31
- const t = i(e);
32
- a(e).global.setLocaleMessage(t, e);
33
- }, G = (e) => {
34
- const t = a(e);
35
- return k(e), t.global.locale.value = i(e), t;
36
- }, J = (e) => {
37
- const t = a(e);
38
- k(e), t.global.locale.value = i(e);
39
- }, K = () => a().global.locale.value, Q = (...e) => a().global.t(...e), W = () => ({
40
- t: Q,
41
- getLocale: K,
42
- setLocale: J
43
- }), x = (e, t) => {
44
- const n = e.__vccOpts || e;
45
- for (const [s, o] of t)
46
- n[s] = o;
47
- return n;
48
- }, X = {}, Y = {
49
- xmlns: "http://www.w3.org/2000/svg",
50
- viewBox: "0 0 448 512"
51
- };
52
- function Z(e, t) {
53
- return u(), M("svg", Y, [...t[0] || (t[0] = [
54
- j("path", {
55
- fill: "currentColor",
56
- d: "M160 64c0-17.7 14.3-32 32-32l132.1 0c8.5 0 16.6 3.4 22.6 9.4l59.9 59.9c6 6 9.4 14.1 9.4 22.6L416 320c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-256zM192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-196.1c0-17-6.7-33.3-18.7-45.3L369.4 18.7C357.4 6.7 341.1 0 324.1 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-32 0 0 16c0 17.7-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l16 0 0-32-16 0z"
57
- }, null, -1)
58
- ])]);
59
- }
60
- const ee = /* @__PURE__ */ x(X, [["render", Z]]), te = /* @__PURE__ */ Object.assign({
61
- name: "DCopy"
62
- }, {
63
- __name: "copy",
64
- props: {
65
- text: String,
66
- type: {
67
- type: String,
68
- default: "primary"
69
- },
70
- icon: String,
71
- triggerElement: String
72
- // 触发元素显示的dom,不设置就一直显示
73
- },
74
- setup(e, { expose: t }) {
75
- const n = e, s = g(null), o = g(!1), z = _(n, "text"), d = _(n, "icon"), { copy: w } = U({
76
- source: z
77
- }), { t: I } = W(), c = L(() => {
78
- const l = s.value?.$el ?? s.value;
79
- if (!n.triggerElement || !l)
80
- return null;
81
- let r = l.parentNode;
82
- for (; r; ) {
83
- if (r.matches(n.triggerElement))
84
- return r;
85
- r = r.parentNode;
86
- }
87
- return null;
88
- }), S = L(() => ({
89
- display: n.triggerElement && !o.value ? "none" : ""
90
- })), p = () => {
91
- w().then(() => {
92
- P.success(I("d.copy.success"));
93
- });
94
- }, v = () => {
95
- o.value = !0;
96
- }, y = () => {
97
- o.value = !1;
98
- };
99
- return O(() => {
100
- c.value && (c.value.addEventListener("mouseenter", v), c.value.addEventListener("mouseleave", y));
101
- }), B(() => {
102
- c.value && (c.value.removeEventListener("mouseenter", v), c.value.removeEventListener("mouseleave", y));
103
- }), t({
104
- rootRef: s,
105
- handleCopy: p
106
- }), (l, r) => (u(), E(b(F), {
107
- ref_key: "rootRef",
108
- ref: s,
109
- class: "d-copy",
110
- type: e.type,
111
- underline: "never",
112
- style: D(S.value),
113
- onClick: $(p, ["stop"])
114
- }, {
115
- default: C(() => [
116
- d.value ? (u(), M("i", {
117
- key: 0,
118
- class: R(d.value)
119
- }, null, 2)) : (u(), E(b(H), { key: 1 }, {
120
- default: C(() => [
121
- V(ee)
122
- ]),
123
- _: 1
124
- })),
125
- l.$slots.default ? A(l.$slots, "default", { key: 2 }, void 0, !0) : T("", !0)
126
- ]),
127
- _: 3
128
- }, 8, ["type", "style"]));
129
- }
130
- }), ne = /* @__PURE__ */ x(te, [["__scopeId", "data-v-cad5f2ba"]]), oe = ne, se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
131
- __proto__: null,
132
- DCopy: oe
133
- }, Symbol.toStringTag, { value: "Module" })), ce = (e, t = {}) => {
134
- const { locale: n } = t, s = G(n);
135
- e.use(s), Object.values(se).forEach((o) => {
136
- o?.name && e.component(o.name, o);
137
- });
138
- }, fe = { install: ce };
139
- export {
140
- oe as DCopy,
141
- fe as default,
142
- h as en,
143
- K as getLocale,
144
- G as initI18n,
145
- ce as install,
146
- J as setLocale,
147
- Q as t,
148
- W as useLocale,
149
- ie as zhCn
150
- };