@ulu/frontend-vue 0.6.20 → 0.6.21

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.
@@ -1 +1 @@
1
- {"version":3,"file":"UluToast.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/toast/UluToast.vue"],"names":[],"mappings":"AAiDA;wBAsRqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;sPAQG"}
1
+ {"version":3,"file":"UluToast.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/toast/UluToast.vue"],"names":[],"mappings":"AAiDA;wBAuRqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;sPAQG"}
@@ -1,7 +1,7 @@
1
- import { computed as C, createElementBlock as l, openBlock as o, normalizeClass as e, createCommentVNode as c, createElementVNode as r, renderSlot as m, createBlock as B, toDisplayString as d, Fragment as g, renderList as S, createVNode as h, nextTick as E } from "vue";
2
- import k from "../../components/elements/UluIcon.vue.js";
3
- import { mergeClassLookups as L } from "../../utils/props.js";
4
- const $ = ["onClick"], T = {
1
+ import { computed as C, createElementBlock as l, openBlock as o, normalizeClass as e, createCommentVNode as c, createElementVNode as d, renderSlot as m, createBlock as B, toDisplayString as r, Fragment as g, renderList as S, unref as h, createVNode as E, nextTick as L } from "vue";
2
+ import v from "../../components/elements/UluIcon.vue.js";
3
+ import { mergeClassLookups as $, resolveClassOverride as A } from "../../utils/props.js";
4
+ const F = ["onClick"], V = {
5
5
  __name: "UluToast",
6
6
  props: {
7
7
  /**
@@ -17,20 +17,20 @@ const $ = ["onClick"], T = {
17
17
  }
18
18
  },
19
19
  setup(t) {
20
- const v = {
20
+ const k = {
21
21
  content: "type-small",
22
22
  date: "type-small-x",
23
23
  actions: "type-small-x",
24
24
  action: "button button--small button--outline",
25
25
  closeButton: "button button--icon button--transparent"
26
- }, u = t, s = C(() => L(
27
- v,
26
+ }, u = t, s = C(() => $(
27
+ k,
28
28
  u.classes,
29
29
  u.toast?.classes
30
30
  )), y = (i, n) => {
31
31
  u.toast.close();
32
32
  const a = typeof n == "function" ? n : n.click;
33
- a && E(() => {
33
+ a && L(() => {
34
34
  a(i, u.toast, n);
35
35
  });
36
36
  };
@@ -47,13 +47,13 @@ const $ = ["onClick"], T = {
47
47
  class: e(["toast__icon", s.value.icon])
48
48
  }, [
49
49
  m(i.$slots, "icon", { toast: t.toast }, () => [
50
- t.toast.icon ? (o(), B(k, {
50
+ t.toast.icon ? (o(), B(v, {
51
51
  key: 0,
52
52
  icon: t.toast.icon
53
53
  }, null, 8, ["icon"])) : c("", !0)
54
54
  ])
55
55
  ], 2)) : c("", !0),
56
- r("div", {
56
+ d("div", {
57
57
  class: e(["toast__content", s.value.content])
58
58
  }, [
59
59
  m(i.$slots, "content", { toast: t.toast }, () => [
@@ -61,18 +61,18 @@ const $ = ["onClick"], T = {
61
61
  key: 0,
62
62
  class: e(["toast__header", s.value.header])
63
63
  }, [
64
- r("strong", {
64
+ d("strong", {
65
65
  class: e(["toast__title", s.value.title])
66
- }, d(t.toast.title), 3),
66
+ }, r(t.toast.title), 3),
67
67
  t.toast.date ? (o(), l("span", {
68
68
  key: 0,
69
69
  class: e(["toast__date", s.value.date])
70
- }, d(t.toast.date), 3)) : c("", !0)
70
+ }, r(t.toast.date), 3)) : c("", !0)
71
71
  ], 2)) : c("", !0),
72
72
  t.toast.description ? (o(), l("div", {
73
73
  key: 1,
74
74
  class: e(["toast__body", s.value.body])
75
- }, d(t.toast.description), 3)) : c("", !0)
75
+ }, r(t.toast.description), 3)) : c("", !0)
76
76
  ])
77
77
  ], 2),
78
78
  t.toast.actions?.length ? (o(), l("div", {
@@ -81,19 +81,19 @@ const $ = ["onClick"], T = {
81
81
  }, [
82
82
  (o(!0), l(g, null, S(t.toast.actions, (a, b) => (o(), l("button", {
83
83
  key: b,
84
- class: e(["toast__action", [s.value.action, a.class]]),
84
+ class: e(["toast__action", h(A)(s.value.action, a.class)]),
85
85
  onClick: (f) => y(f, a)
86
- }, d(a.label), 11, $))), 128))
86
+ }, r(a.label), 11, F))), 128))
87
87
  ], 2)) : c("", !0),
88
- r("button", {
88
+ d("button", {
89
89
  class: e(["toast__close", s.value.closeButton]),
90
90
  onClick: n[0] || (n[0] = (...a) => t.toast.close && t.toast.close(...a))
91
91
  }, [
92
- h(k, { icon: "type:close" })
92
+ E(v, { icon: "type:close" })
93
93
  ], 2)
94
94
  ], 2));
95
95
  }
96
96
  };
97
97
  export {
98
- T as default
98
+ V as default
99
99
  };
@@ -28,4 +28,13 @@ export function checkDeprecatedProps(props: object, deprecatedNames: string[], c
28
28
  * @returns {Object} The final resolved classes object
29
29
  */
30
30
  export function mergeClassLookups(defaults: Object, ...sources: (Object | boolean | Function)[]): Object;
31
+ /**
32
+ * Merges a base class (string, array, or object) with a user-supplied class override.
33
+ * Supports string, array, object, function, or boolean (false to clear) overrides.
34
+ *
35
+ * @param {String|Array|Object} base The base classes
36
+ * @param {String|Array|Object|Function|Boolean} override The class override
37
+ * @returns {String|Array|Object} The resolved classes suitable for Vue class binding
38
+ */
39
+ export function resolveClassOverride(base: string | any[] | Object, override: string | any[] | Object | Function | boolean): string | any[] | Object;
31
40
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../lib/utils/props.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,wDAEC;AAED;;;;;GAKG;AACH,4CAJW,MAAM,mBACN,MAAM,EAAE,4BASlB;AAED;;;;;;;;;;;;GAYG;AACH,4CAJW,MAAM,cACF,CAAC,MAAM,qBAAiB,CAAC,EAAA,GAC3B,MAAM,CAclB"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../lib/utils/props.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,wDAEC;AAED;;;;;GAKG;AACH,4CAJW,MAAM,mBACN,MAAM,EAAE,4BASlB;AAED;;;;;;;;;;;;GAYG;AACH,4CAJW,MAAM,cACF,CAAC,MAAM,qBAAiB,CAAC,EAAA,GAC3B,MAAM,CAclB;AAED;;;;;;;GAOG;AACH,2CAJW,iBAAa,MAAM,YACnB,iBAAa,MAAM,qBAAiB,GAClC,iBAAa,MAAM,CAS/B"}
@@ -1,19 +1,23 @@
1
- function t(f) {
2
- return f.every((r) => typeof r == "object");
1
+ function o(f) {
2
+ return f.every((e) => typeof e == "object");
3
3
  }
4
- function c(f, r, o) {
5
- r.forEach((e) => {
6
- f[e] !== void 0 && o(e);
4
+ function r(f, e, n) {
5
+ e.forEach((t) => {
6
+ f[t] !== void 0 && n(t);
7
7
  });
8
8
  }
9
- function n(f, ...r) {
10
- let o = { ...f };
11
- for (const e of r)
12
- e === !1 ? o = {} : typeof e == "function" ? o = e(o, f) : typeof e == "object" && e !== null && (o = { ...o, ...e });
13
- return o;
9
+ function c(f, ...e) {
10
+ let n = { ...f };
11
+ for (const t of e)
12
+ t === !1 ? n = {} : typeof t == "function" ? n = t(n, f) : typeof t == "object" && t !== null && (n = { ...n, ...t });
13
+ return n;
14
+ }
15
+ function u(f, e) {
16
+ return e ? e === !1 ? "" : typeof e == "function" ? e(f) : [f, e] : f;
14
17
  }
15
18
  export {
16
- c as checkDeprecatedProps,
17
- t as isArrayOfObjects,
18
- n as mergeClassLookups
19
+ r as checkDeprecatedProps,
20
+ o as isArrayOfObjects,
21
+ c as mergeClassLookups,
22
+ u as resolveClassOverride
19
23
  };
@@ -36,14 +36,14 @@
36
36
  v-for="(action, index) in toast.actions"
37
37
  :key="index"
38
38
  class="toast__action"
39
- :class="[resolvedClasses.action, action.class]"
39
+ :class="resolveClassOverride(resolvedClasses.action, action.class)"
40
40
  @click="handleAction($event, action)"
41
41
  >
42
42
  {{ action.label }}
43
43
  </button>
44
44
  </div>
45
45
  <button class="toast__close" :class="resolvedClasses.closeButton" @click="toast.close">
46
- <UluIcon :icon="'type:close'"/>
46
+ <UluIcon icon="type:close" />
47
47
  </button>
48
48
  </div>
49
49
  </template>
@@ -51,7 +51,7 @@
51
51
  <script setup>
52
52
  import { nextTick, computed } from "vue";
53
53
  import UluIcon from "../../components/elements/UluIcon.vue";
54
- import { mergeClassLookups } from "../../utils/props.js";
54
+ import { mergeClassLookups, resolveClassOverride } from "../../utils/props.js";
55
55
 
56
56
  const DEFAULT_CLASSES = {
57
57
  content: "type-small",
@@ -49,4 +49,21 @@ export function mergeClassLookups(defaults, ...sources) {
49
49
  }
50
50
  }
51
51
  return resolved;
52
+ }
53
+
54
+ /**
55
+ * Merges a base class (string, array, or object) with a user-supplied class override.
56
+ * Supports string, array, object, function, or boolean (false to clear) overrides.
57
+ *
58
+ * @param {String|Array|Object} base The base classes
59
+ * @param {String|Array|Object|Function|Boolean} override The class override
60
+ * @returns {String|Array|Object} The resolved classes suitable for Vue class binding
61
+ */
62
+ export function resolveClassOverride(base, override) {
63
+ if (!override) return base;
64
+ if (override === false) return "";
65
+ if (typeof override === "function") {
66
+ return override(base);
67
+ }
68
+ return [base, override];
52
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "description": "A modular, tree-shakeable Vue 3 component library for the Ulu Frontend theming system, plus general utilities for Vue development",
5
5
  "type": "module",
6
6
  "files": [