heart-ui 0.0.11 → 0.0.14

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 (41) hide show
  1. package/dist/common/index.d.ts +1 -1
  2. package/dist/common/symbols.d.ts +1 -1
  3. package/dist/common/theme.d.ts +143 -0
  4. package/dist/components/HButton.js +1 -1
  5. package/dist/components/HButton.vue.d.ts +86 -21
  6. package/dist/components/HIcon.js +1 -1
  7. package/dist/components/HIcon.vue.d.ts +13 -33
  8. package/dist/components/index.d.ts +2 -166
  9. package/dist/composables/index.d.ts +1 -14
  10. package/dist/composables/index.js +2 -3
  11. package/dist/composables/theme.d.ts +71 -0
  12. package/dist/index.d.ts +6 -4
  13. package/dist/index.js +20 -16
  14. package/dist/node_modules/.pnpm/@unocss_reset@0.60.3/node_modules/@unocss/reset/tailwind.css.js +1 -0
  15. package/dist/nuxt/plugin.d.ts +130 -14
  16. package/dist/nuxt/plugin.js +8 -8
  17. package/dist/nuxt.d.ts +13 -5
  18. package/dist/nuxt.js +10 -10
  19. package/dist/src/common/symbols.js +4 -0
  20. package/dist/src/common/theme.js +74 -0
  21. package/dist/src/components/HButton.vue.js +145 -0
  22. package/dist/src/components/HIcon.vue.js +23 -0
  23. package/dist/src/components/index.js +6 -0
  24. package/dist/src/composables/theme.js +5 -0
  25. package/dist/style.css +1 -1
  26. package/package.json +51 -36
  27. package/dist/common/global.d.ts +0 -17
  28. package/dist/common/global.js +0 -19
  29. package/dist/common/symbols.js +0 -4
  30. package/dist/components/HButton.vue.js +0 -60
  31. package/dist/components/HIcon.vue.js +0 -28
  32. package/dist/components/index.js +0 -6
  33. package/dist/nuxt/nuxt.config.d.ts +0 -2
  34. package/dist/nuxt-layer/components/HButton.vue +0 -47
  35. package/dist/nuxt-layer/components/HIcon.vue +0 -29
  36. package/dist/nuxt-layer/components/index.ts +0 -4
  37. package/dist/nuxt-layer/composables/index.ts +0 -5
  38. package/dist/nuxt-layer/nuxt.config.ts +0 -3
  39. package/dist/nuxt-layer/package.json +0 -10
  40. package/dist/nuxt-layer/utils/index.ts +0 -1
  41. /package/dist/{utils → src/utils}/index.js +0 -0
@@ -1,30 +1,146 @@
1
1
  declare const _default: import("nuxt/app").Plugin<{
2
2
  heart: {
3
- css: {
3
+ theme: {
4
4
  [x: string]: any;
5
- icon: {
6
- root: string;
5
+ css: {
6
+ icon: {
7
+ root: string;
8
+ };
9
+ button: {
10
+ root: string;
11
+ prefix: string;
12
+ suffix: string;
13
+ text: string;
14
+ busy: string;
15
+ disabled: string;
16
+ style: {
17
+ solid: {
18
+ custom: string;
19
+ default: string;
20
+ primary: string;
21
+ danger: string;
22
+ warning: string;
23
+ success: string;
24
+ info: string;
25
+ };
26
+ semi: {
27
+ custom: string;
28
+ default: string;
29
+ primary: string;
30
+ danger: string;
31
+ warning: string;
32
+ success: string;
33
+ info: string;
34
+ };
35
+ outline: {
36
+ custom: string;
37
+ default: string;
38
+ primary: string;
39
+ danger: string;
40
+ warning: string;
41
+ success: string;
42
+ info: string;
43
+ };
44
+ ghost: {
45
+ custom: string;
46
+ default: string;
47
+ primary: string;
48
+ danger: string;
49
+ warning: string;
50
+ success: string;
51
+ info: string;
52
+ };
53
+ };
54
+ size: {
55
+ default: string;
56
+ large: string;
57
+ small: string;
58
+ };
59
+ rounded: string;
60
+ };
7
61
  };
8
- button: {
9
- root: string;
10
- prefix: import("../common").CssEntry;
11
- suffix: import("../common").CssEntry;
62
+ icons: {
63
+ loading: {
64
+ default: string;
65
+ dot: string;
66
+ clock: string;
67
+ pulse: string;
68
+ };
12
69
  };
13
70
  };
71
+ setTheme: (value: Record<string, any>) => void;
14
72
  };
15
73
  }> & import("nuxt/app").ObjectPlugin<{
16
74
  heart: {
17
- css: {
75
+ theme: {
18
76
  [x: string]: any;
19
- icon: {
20
- root: string;
77
+ css: {
78
+ icon: {
79
+ root: string;
80
+ };
81
+ button: {
82
+ root: string;
83
+ prefix: string;
84
+ suffix: string;
85
+ text: string;
86
+ busy: string;
87
+ disabled: string;
88
+ style: {
89
+ solid: {
90
+ custom: string;
91
+ default: string;
92
+ primary: string;
93
+ danger: string;
94
+ warning: string;
95
+ success: string;
96
+ info: string;
97
+ };
98
+ semi: {
99
+ custom: string;
100
+ default: string;
101
+ primary: string;
102
+ danger: string;
103
+ warning: string;
104
+ success: string;
105
+ info: string;
106
+ };
107
+ outline: {
108
+ custom: string;
109
+ default: string;
110
+ primary: string;
111
+ danger: string;
112
+ warning: string;
113
+ success: string;
114
+ info: string;
115
+ };
116
+ ghost: {
117
+ custom: string;
118
+ default: string;
119
+ primary: string;
120
+ danger: string;
121
+ warning: string;
122
+ success: string;
123
+ info: string;
124
+ };
125
+ };
126
+ size: {
127
+ default: string;
128
+ large: string;
129
+ small: string;
130
+ };
131
+ rounded: string;
132
+ };
21
133
  };
22
- button: {
23
- root: string;
24
- prefix: import("../common").CssEntry;
25
- suffix: import("../common").CssEntry;
134
+ icons: {
135
+ loading: {
136
+ default: string;
137
+ dot: string;
138
+ clock: string;
139
+ pulse: string;
140
+ };
26
141
  };
27
142
  };
143
+ setTheme: (value: Record<string, any>) => void;
28
144
  };
29
145
  }>;
30
146
  export default _default;
@@ -1,15 +1,15 @@
1
- import { defineNuxtPlugin as p, useAppConfig as t } from "#imports";
2
- import { setGlobalCss as a, globalCss as o } from "../common/global.js";
3
- import { heartGlobalKey as l } from "../common/symbols.js";
4
- const f = p((s) => {
1
+ import { defineNuxtPlugin as m, useAppConfig as i } from "#imports";
2
+ import { setTheme as t, theme as o } from "../src/common/theme.js";
3
+ import { HEART_GLOBAL_KEY as u } from "../src/common/symbols.js";
4
+ const h = m((p) => {
5
5
  var e;
6
- const r = t();
7
- return a(((e = r.heart) == null ? void 0 : e.css) ?? {}), s.vueApp.provide(l, { css: o.value }), {
6
+ const r = i();
7
+ return t(((e = r.heart) == null ? void 0 : e.theme) ?? {}), p.vueApp.provide(u, { theme: o.value }), {
8
8
  provide: {
9
- heart: { css: o.value }
9
+ heart: { theme: o.value, setTheme: t }
10
10
  }
11
11
  };
12
12
  });
13
13
  export {
14
- f as default
14
+ h as default
15
15
  };
package/dist/nuxt.d.ts CHANGED
@@ -1,25 +1,33 @@
1
- import { globalCss } from ".";
1
+ import { HeartTheme } from ".";
2
2
  declare const _default: import("@nuxt/schema").NuxtModule<import("@nuxt/schema").ModuleOptions>;
3
3
  export default _default;
4
4
  declare module "@nuxt/schema" {
5
5
  interface AppConfigInput {
6
6
  heart?: {
7
- css: typeof globalCss;
7
+ theme: {
8
+ css: HeartTheme;
9
+ };
8
10
  } | undefined;
9
11
  }
10
12
  interface AppConfig {
11
13
  heart?: {
12
- css: typeof globalCss;
14
+ theme: {
15
+ css: HeartTheme;
16
+ };
13
17
  } | undefined;
14
18
  }
15
19
  interface NuxtConfig {
16
20
  heart?: {
17
- css: typeof globalCss;
21
+ theme: {
22
+ css: HeartTheme;
23
+ };
18
24
  } | undefined;
19
25
  }
20
26
  interface NuxtOptions {
21
27
  heart?: {
22
- css: typeof globalCss;
28
+ theme: {
29
+ css: HeartTheme;
30
+ };
23
31
  } | undefined;
24
32
  }
25
33
  }
package/dist/nuxt.js CHANGED
@@ -1,24 +1,24 @@
1
- import { defineNuxtModule as o, createResolver as t, addComponentsDir as r, addImports as n, addPlugin as a } from "@nuxt/kit";
2
- const p = o({
1
+ import { defineNuxtModule as o, createResolver as r, addComponentsDir as s, addImports as n, addPlugin as a } from "@nuxt/kit";
2
+ const u = o({
3
3
  meta: {
4
4
  name: "heart-ui",
5
5
  configKey: "heart"
6
6
  },
7
- setup: (l, s) => {
8
- const e = t(import.meta.url);
9
- r({
7
+ setup: (i, t) => {
8
+ const e = r(import.meta.url);
9
+ s({
10
10
  path: e.resolve("./components/"),
11
11
  prefix: "h",
12
12
  pattern: "**/*.js",
13
- ignore: ["**/*.vue.js", "**/*.d.ts"]
13
+ ignore: ["**/*.vue.js", "**/*.d.ts", "**/index.js"]
14
14
  }), n({
15
- name: "useGlobalCss",
15
+ name: "useHeartTheme",
16
16
  // name of the composable to be used
17
- as: "useGlobalCss",
17
+ // as: "useHeartTheme",
18
18
  from: e.resolve("./composables/index")
19
- }), s.options.build.transpile.push(e.resolve("./nuxt/plugin")), a(e.resolve("./nuxt/plugin"));
19
+ }), t.options.build.transpile.push(e.resolve("./nuxt/plugin")), a(e.resolve("./nuxt/plugin"));
20
20
  }
21
21
  });
22
22
  export {
23
- p as default
23
+ u as default
24
24
  };
@@ -0,0 +1,4 @@
1
+ const o = Symbol("heart");
2
+ export {
3
+ o as HEART_GLOBAL_KEY
4
+ };
@@ -0,0 +1,74 @@
1
+ import { ref as s } from "vue";
2
+ const e = {
3
+ css: {
4
+ icon: {
5
+ root: "inline-flex"
6
+ },
7
+ button: {
8
+ root: "flex justify-center items-center outline-2 cursor-pointer transition-all",
9
+ prefix: "text-[1.5em]",
10
+ suffix: "text-[1.5em]",
11
+ text: "font-semibold whitespace-nowrap",
12
+ busy: "bg-[#ffffff24] text-[1.5em]",
13
+ disabled: "opacity-50 pointer-events-none",
14
+ style: {
15
+ solid: {
16
+ custom: "",
17
+ default: "bg-neutral-7 c-white hover:bg-neutral-8 focus:outline-neutral-3 focus:bg-neutral-8 active:bg-neutral-9",
18
+ primary: "bg-primary-5 c-white hover:bg-primary-6 focus:outline-primary-3 focus:bg-primary-6 active:bg-primary-7",
19
+ danger: "bg-danger-5 c-white hover:bg-danger-6 focus:outline-danger-3 focus:bg-danger-6 active:bg-danger-7",
20
+ warning: "bg-warning-5 c-white hover:bg-warning-6 focus:outline-warning-3 focus:bg-warning-6 active:bg-warning-7",
21
+ success: "bg-success-5 c-white hover:bg-success-6 focus:outline-success-3 focus:bg-success-6 active:bg-success-7",
22
+ info: "bg-info-5 c-white hover:bg-info-6 focus:outline-info-3 focus:bg-info-6 active:bg-info-7"
23
+ },
24
+ semi: {
25
+ custom: "",
26
+ default: "bg-neutral-2 c-neutral-7 hover:bg-neutral-3 focus:outline-neutral-4 focus:bg-neutral-3 active:bg-neutral-4",
27
+ primary: "bg-primary-1 c-primary-6 hover:bg-primary-2 focus:outline-primary-3 focus:bg-primary-2 active:bg-primary-3",
28
+ danger: "bg-danger-1 c-danger-6 hover:bg-danger-2 focus:outline-danger-3 focus:bg-danger-2 active:bg-danger-3",
29
+ warning: "bg-warning-1 c-warning-6 hover:bg-warning-2 focus:outline-warning-3 focus:bg-warning-2 active:bg-warning-3",
30
+ success: "bg-success-1 c-success-6 hover:bg-success-2 focus:outline-success-3 focus:bg-success-2 active:bg-success-3",
31
+ info: "bg-info-1 c-info-6 hover:bg-info-2 focus:outline-info-3 focus:bg-info-2 active:bg-info-3"
32
+ },
33
+ outline: {
34
+ custom: "shadow-[inset_0_0_0_2px]",
35
+ default: "shadow-[inset_0_0_0_2px] shadow-neutral-7 c-neutral-7 hover:c-white hover:bg-neutral-7 focus:outline-neutral-3 focus:c-white focus:bg-neutral-7 active:c-white active:shadow-neutral-8 active:bg-neutral-8",
36
+ primary: "shadow-[inset_0_0_0_2px] shadow-primary-5 c-primary-6 hover:c-white hover:bg-primary-5 focus:outline-primary-3 focus:c-white focus:bg-primary-5 active:c-white active:shadow-primary-6 active:bg-primary-6",
37
+ danger: "shadow-[inset_0_0_0_2px] shadow-danger-5 c-danger-6 hover:c-white hover:bg-danger-5 focus:outline-danger-3 focus:c-white focus:bg-danger-5 active:c-white active:shadow-danger-5 active:bg-danger-6",
38
+ warning: "shadow-[inset_0_0_0_2px] shadow-warning-5 c-warning-6 hover:c-white hover:bg-warning-5 focus:outline-warning-3 focus:c-white focus:bg-warning-5 active:c-white active:shadow-warning-5 active:bg-warning-6",
39
+ success: "shadow-[inset_0_0_0_2px] shadow-success-5 c-success-6 hover:c-white hover:bg-success-5 focus:outline-success-3 focus:c-white focus:bg-success-5 active:c-white active:shadow-success-5 active:bg-success-6",
40
+ info: "shadow-[inset_0_0_0_2px] shadow-info-5 c-info-6 hover:c-white hover:bg-info-5 focus:outline-info-3 focus:c-white focus:bg-info-5 active:c-white active:shadow-info-5 active:bg-info-6"
41
+ },
42
+ ghost: {
43
+ custom: "",
44
+ default: "c-neutral-7 hover:bg-neutral-1 focus:outline-neutral-3 focus:bg-neutral-1 active:bg-neutral-2",
45
+ primary: "c-primary-6 hover:bg-primary-1 focus:outline-primary-3 focus:bg-primary-1 active:bg-primary-2",
46
+ danger: "c-danger-6 hover:bg-danger-1 focus:outline-danger-3 focus:bg-danger-1 active:bg-danger-2",
47
+ warning: "c-warning-6 hover:bg-warning-1 focus:outline-warning-3 focus:bg-warning-1 active:bg-warning-2",
48
+ success: "c-success-6 hover:bg-success-1 focus:outline-success-3 focus:bg-success-1 active:bg-success-2",
49
+ info: "c-info-6 hover:bg-info-1 focus:outline-info-3 focus:bg-info-1 active:bg-info-2"
50
+ }
51
+ },
52
+ size: {
53
+ default: "gap-1 px-5 h-12 text-md rounded-2xl",
54
+ large: "gap-1.5 px-7 h-14 text-lg rounded-[20px]",
55
+ small: "gap-0.5 px-3 h-10 text-sm rounded-xl"
56
+ },
57
+ rounded: "rounded-full"
58
+ }
59
+ },
60
+ icons: {
61
+ loading: {
62
+ default: "svg-spinners:270-ring-with-bg",
63
+ dot: "svg-spinners:3-dots-fade",
64
+ clock: "svg-spinners:clock",
65
+ pulse: "svg-spinners:pulse-2"
66
+ }
67
+ }
68
+ }, i = s(e), o = (c) => {
69
+ i.value = Object.assign(e, c);
70
+ };
71
+ export {
72
+ o as setTheme,
73
+ i as theme
74
+ };
@@ -0,0 +1,145 @@
1
+ import { defineComponent as G, computed as l, openBlock as c, createBlock as J, resolveDynamicComponent as K, normalizeClass as a, withCtx as M, createElementBlock as f, renderSlot as p, createVNode as y, createCommentVNode as m, createElementVNode as O } from "vue";
2
+ import b from "./HIcon.vue.js";
3
+ import "../common/theme.js";
4
+ import "../../node_modules/.pnpm/@unocss_reset@0.60.3/node_modules/@unocss/reset/tailwind.css.js";
5
+ import { useHeartTheme as Q } from "../composables/theme.js";
6
+ const _ = /* @__PURE__ */ G({
7
+ name: "HButton",
8
+ __name: "HButton",
9
+ props: {
10
+ css: {},
11
+ tag: { default: "button" },
12
+ nativeType: { default: "button" },
13
+ icons: {},
14
+ prefixIcon: {},
15
+ suffixIcon: {},
16
+ loadingIcon: {},
17
+ busy: { type: Boolean },
18
+ disabled: { type: Boolean },
19
+ outline: { type: Boolean },
20
+ ghost: { type: Boolean },
21
+ semi: { type: Boolean },
22
+ primary: { type: Boolean },
23
+ danger: { type: Boolean },
24
+ warning: { type: Boolean },
25
+ success: { type: Boolean },
26
+ info: { type: Boolean },
27
+ custom: { type: Boolean },
28
+ rounded: { type: Boolean },
29
+ small: { type: Boolean },
30
+ large: { type: Boolean }
31
+ },
32
+ setup(I) {
33
+ const o = I, { theme: s } = Q(), x = l(
34
+ () => {
35
+ var e;
36
+ return o.loadingIcon ?? ((e = o.icons) == null ? void 0 : e.loading) ?? s.value.icons.loading.dot;
37
+ }
38
+ ), $ = l(() => {
39
+ var g, B, h, C;
40
+ const {
41
+ css: e,
42
+ outline: v,
43
+ ghost: u,
44
+ semi: i,
45
+ primary: t,
46
+ danger: H,
47
+ warning: N,
48
+ success: V,
49
+ info: E,
50
+ custom: S,
51
+ rounded: j,
52
+ small: D,
53
+ large: L,
54
+ busy: P,
55
+ disabled: W
56
+ } = o, n = v && (((g = e == null ? void 0 : e.style) == null ? void 0 : g.outline) ?? s.value.css.button.style.outline) || u && (((B = e == null ? void 0 : e.style) == null ? void 0 : B.ghost) ?? s.value.css.button.style.ghost) || i && (((h = e == null ? void 0 : e.style) == null ? void 0 : h.semi) ?? s.value.css.button.style.semi) || (((C = e == null ? void 0 : e.style) == null ? void 0 : C.solid) ?? s.value.css.button.style.solid), d = s.value.css.button.size, q = s.value.css.button.rounded, A = (S && n.custom || t && n.primary || H && n.danger || N && n.warning || V && n.success || E && n.info || n.default).split(" ");
57
+ let r = (D && d.small || L && d.large || d.default).split(" ");
58
+ return j && (r = r.filter((F) => !F.startsWith("rounded")), r.push(q)), [
59
+ (e == null ? void 0 : e.root) ?? s.value.css.button.root,
60
+ ...A,
61
+ ...r,
62
+ W && ((e == null ? void 0 : e.disabled) ?? s.value.css.button.disabled),
63
+ P && "relative pointer-events-none"
64
+ ];
65
+ }), k = l(() => {
66
+ var e;
67
+ return [
68
+ "absolute top-0 left-0 z-1 w-full h-full flex justify-center items-center",
69
+ ((e = o.css) == null ? void 0 : e.busy) ?? s.value.css.button.busy
70
+ ];
71
+ }), w = l(() => {
72
+ var e;
73
+ return [
74
+ ((e = o.css) == null ? void 0 : e.prefix) ?? s.value.css.button.prefix,
75
+ { invisible: o.busy }
76
+ ];
77
+ }), z = l(() => {
78
+ var e;
79
+ return [
80
+ ((e = o.css) == null ? void 0 : e.suffix) ?? s.value.css.button.suffix,
81
+ { invisible: o.busy }
82
+ ];
83
+ }), T = l(() => {
84
+ var e;
85
+ return [
86
+ ((e = o.css) == null ? void 0 : e.text) ?? s.value.css.button.text,
87
+ { invisible: o.busy }
88
+ ];
89
+ });
90
+ return (e, v) => (c(), J(K(e.tag), {
91
+ type: e.nativeType,
92
+ class: a($.value),
93
+ disabled: e.disabled || e.busy
94
+ }, {
95
+ default: M(() => {
96
+ var u, i;
97
+ return [
98
+ e.$slots.prefix ?? e.prefixIcon ?? ((u = e.icons) == null ? void 0 : u.prefix) ? (c(), f("span", {
99
+ key: 0,
100
+ class: a(w.value)
101
+ }, [
102
+ p(e.$slots, "prefix", {}, () => {
103
+ var t;
104
+ return [
105
+ y(b, {
106
+ icon: `${e.prefixIcon || ((t = e.icons) == null ? void 0 : t.prefix)}`
107
+ }, null, 8, ["icon"])
108
+ ];
109
+ })
110
+ ], 2)) : m("", !0),
111
+ O("span", {
112
+ class: a(T.value)
113
+ }, [
114
+ p(e.$slots, "default")
115
+ ], 2),
116
+ e.$slots.suffix ?? e.suffixIcon ?? ((i = e.icons) == null ? void 0 : i.suffix) ? (c(), f("span", {
117
+ key: 1,
118
+ class: a(z.value)
119
+ }, [
120
+ p(e.$slots, "suffix", {}, () => {
121
+ var t;
122
+ return [
123
+ y(b, {
124
+ icon: e.suffixIcon ?? ((t = e.icons) == null ? void 0 : t.suffix) ?? ""
125
+ }, null, 8, ["icon"])
126
+ ];
127
+ })
128
+ ], 2)) : m("", !0),
129
+ e.busy ? (c(), f("span", {
130
+ key: 2,
131
+ class: a(k.value)
132
+ }, [
133
+ p(e.$slots, "busy", {}, () => [
134
+ y(b, { icon: x.value }, null, 8, ["icon"])
135
+ ])
136
+ ], 2)) : m("", !0)
137
+ ];
138
+ }),
139
+ _: 3
140
+ }, 8, ["type", "class", "disabled"]));
141
+ }
142
+ });
143
+ export {
144
+ _ as default
145
+ };
@@ -0,0 +1,23 @@
1
+ import { defineComponent as e, openBlock as n, createBlock as r, unref as c } from "vue";
2
+ import { Icon as p } from "@iconify/vue";
3
+ const a = /* @__PURE__ */ e({
4
+ name: "HIcon",
5
+ __name: "HIcon",
6
+ props: {
7
+ icon: {},
8
+ mode: {},
9
+ color: {},
10
+ flip: {}
11
+ },
12
+ setup(l) {
13
+ return (o, i) => (n(), r(c(p), {
14
+ icon: o.icon,
15
+ mode: o.mode,
16
+ color: o.color,
17
+ flip: o.flip
18
+ }, null, 8, ["icon", "mode", "color", "flip"]));
19
+ }
20
+ });
21
+ export {
22
+ a as default
23
+ };
@@ -0,0 +1,6 @@
1
+ import { default as a } from "./HButton.vue.js";
2
+ import { default as f } from "./HIcon.vue.js";
3
+ export {
4
+ a as HButton,
5
+ f as HIcon
6
+ };
@@ -0,0 +1,5 @@
1
+ import { theme as e, setTheme as t } from "../common/theme.js";
2
+ const m = () => ({ theme: e, setTheme: t });
3
+ export {
4
+ m as useHeartTheme
5
+ };