@ulu/frontend-vue 0.6.26 → 0.6.27

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":"UluTourContent.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourContent.vue"],"names":[],"mappings":"AAgBA;"}
1
+ {"version":3,"file":"UluTourContent.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourContent.vue"],"names":[],"mappings":"AAkBA;"}
@@ -1,6 +1,7 @@
1
- import { createElementBlock as o, openBlock as t, createBlock as s, createCommentVNode as n, createVNode as c, resolveDynamicComponent as l, normalizeClass as r, withCtx as i, createTextVNode as m, toDisplayString as a } from "vue";
2
- import d from "../../components/elements/UluRule.vue.js";
3
- const u = { class: "tour-content crop-margins" }, p = { key: 1 }, C = {
1
+ import { computed as c, createElementBlock as a, openBlock as o, createBlock as i, createCommentVNode as l, createVNode as u, resolveDynamicComponent as m, normalizeClass as d, withCtx as p, createTextVNode as f, toDisplayString as r } from "vue";
2
+ import C from "../../components/elements/UluRule.vue.js";
3
+ import { useTour as h } from "./useTour.js";
4
+ const v = { class: "tour-content crop-margins" }, y = { key: 1 }, M = {
4
5
  __name: "UluTourContent",
5
6
  props: {
6
7
  /**
@@ -19,21 +20,25 @@ const u = { class: "tour-content crop-margins" }, p = { key: 1 }, C = {
19
20
  }
20
21
  },
21
22
  setup(e) {
22
- return (f, h) => (t(), o("div", u, [
23
- e.step?.title ? (t(), s(l(e.isModal ? "h2" : "strong"), {
23
+ const { state: s } = h(), t = e, n = c(() => t.step.titleClass ? t.step.titleClass : t.isModal ? s.active?.modalTitleClass || "h3" : s.active?.popoverTitleClass || "h4");
24
+ return (k, T) => (o(), a("div", v, [
25
+ e.step?.title ? (o(), i(m(e.isModal ? "h2" : "strong"), {
24
26
  key: 0,
25
- class: r([e.isModal ? "h3" : "h4", "display-block no-margin"])
27
+ class: d([
28
+ "display-block no-margin",
29
+ n.value
30
+ ])
26
31
  }, {
27
- default: i(() => [
28
- m(a(e.step.title), 1)
32
+ default: p(() => [
33
+ f(r(e.step.title), 1)
29
34
  ]),
30
35
  _: 1
31
- }, 8, ["class"])) : n("", !0),
32
- c(d),
33
- e.step?.content ? (t(), o("p", p, a(e.step.content), 1)) : n("", !0)
36
+ }, 8, ["class"])) : l("", !0),
37
+ u(C),
38
+ e.step?.content ? (o(), a("p", y, r(e.step.content), 1)) : l("", !0)
34
39
  ]));
35
40
  }
36
41
  };
37
42
  export {
38
- C as default
43
+ M as default
39
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UluTourPager.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourPager.vue"],"names":[],"mappings":"AAqBA;"}
1
+ {"version":3,"file":"UluTourPager.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourPager.vue"],"names":[],"mappings":"AAyBA;"}
@@ -1,29 +1,35 @@
1
- import { computed as s, createElementBlock as p, openBlock as u, createVNode as i, unref as n } from "vue";
2
- import { useTour as c } from "./useTour.js";
1
+ import { computed as a, createElementBlock as u, openBlock as c, normalizeClass as m, unref as s, createVNode as o } from "vue";
2
+ import { useTour as d } from "./useTour.js";
3
3
  import l from "../../components/elements/UluButton.vue.js";
4
- const d = { class: "tour-pager layout-flex-justified" }, y = {
4
+ const y = {
5
5
  __name: "UluTourPager",
6
- setup(m) {
7
- const { api: r, state: e } = c(), o = s(() => e.active && e.stepIndex === e.active.steps.length - 1);
8
- return s(() => e.active && e.stepIndex === 0), (x, t) => (u(), p("div", d, [
9
- i(l, {
10
- onClick: t[0] || (t[0] = (a) => n(r).prev()),
6
+ setup(v) {
7
+ const { api: n, state: e } = d(), i = a(() => e.active?.steps[e.stepIndex]), r = a(() => e.active && e.stepIndex === e.active.steps.length - 1);
8
+ return (x, t) => (c(), u("div", {
9
+ class: m([
10
+ "tour-pager layout-flex-justified",
11
+ s(e).active?.pagerClass,
12
+ i.value?.pagerClass
13
+ ])
14
+ }, [
15
+ o(l, {
16
+ onClick: t[0] || (t[0] = (p) => s(n).prev()),
11
17
  text: "Previous",
12
- disabled: n(e).stepIndex === 0,
18
+ disabled: s(e).stepIndex === 0,
13
19
  icon: "type:previous",
14
20
  iconBefore: "",
15
21
  small: "",
16
22
  secondary: "",
17
23
  transparent: ""
18
24
  }, null, 8, ["disabled"]),
19
- i(l, {
25
+ o(l, {
20
26
  primary: "",
21
- icon: o.value ? null : "type:next",
22
- onClick: t[1] || (t[1] = (a) => n(r).next()),
23
- text: o.value ? "Finish" : "Next",
27
+ icon: r.value ? null : "type:next",
28
+ onClick: t[1] || (t[1] = (p) => s(n).next()),
29
+ text: r.value ? "Finish" : "Next",
24
30
  small: ""
25
31
  }, null, 8, ["icon", "text"])
26
- ]));
32
+ ], 2));
27
33
  }
28
34
  };
29
35
  export {
@@ -8,6 +8,14 @@ export type TourStep = {
8
8
  * - The title text for the step.
9
9
  */
10
10
  title?: string | undefined;
11
+ /**
12
+ * - Class to apply to the title.
13
+ */
14
+ titleClass?: string | Object | any[] | undefined;
15
+ /**
16
+ * - Class to apply to the pager footer.
17
+ */
18
+ pagerClass?: string | Object | any[] | undefined;
11
19
  /**
12
20
  * - The content text for the step.
13
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AAuBO,iCAHI,MAAM,GACJ,MAAM,CA6DjB"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AAyBO,iCAHI,MAAM,GACJ,MAAM,CAgEjB"}
@@ -7,6 +7,9 @@ const o = (e) => ({
7
7
  * @param {String} [tour.name] - Optional name for the tour
8
8
  * @param {Object} [tour.modalProps] - Global props applied to all modal steps in this tour (can be overridden by step)
9
9
  * @param {Object} [tour.popoverProps] - Global props applied to all popover steps in this tour (can be overridden by step)
10
+ * @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
11
+ * @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
12
+ * @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
10
13
  */
11
14
  async start(n) {
12
15
  n?.steps?.length && (await this._runHooks(n.steps[0]), e.active = t(n), e.stepIndex = 0);
@@ -3,8 +3,10 @@
3
3
  <component
4
4
  v-if="step?.title"
5
5
  :is="isModal ? 'h2' : 'strong'"
6
- :class="isModal ? 'h3' : 'h4'"
7
- class="display-block no-margin"
6
+ :class="[
7
+ 'display-block no-margin',
8
+ resolvedTitleClass
9
+ ]"
8
10
  >
9
11
  {{ step.title }}
10
12
  </component>
@@ -16,9 +18,13 @@
16
18
  </template>
17
19
 
18
20
  <script setup>
21
+ import { computed } from "vue";
19
22
  import UluRule from "../../components/elements/UluRule.vue";
23
+ import { useTour } from "./useTour.js";
20
24
 
21
- defineProps({
25
+ const { state: tourState } = useTour();
26
+
27
+ const props = defineProps({
22
28
  /**
23
29
  * The tour step configuration object
24
30
  */
@@ -34,4 +40,14 @@
34
40
  default: false
35
41
  }
36
42
  });
43
+
44
+ const resolvedTitleClass = computed(() => {
45
+ if (props.step.titleClass) return props.step.titleClass;
46
+
47
+ if (props.isModal) {
48
+ return tourState.active?.modalTitleClass || 'h3';
49
+ } else {
50
+ return tourState.active?.popoverTitleClass || 'h4';
51
+ }
52
+ });
37
53
  </script>
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="tour-pager layout-flex-justified">
2
+ <div :class="[
3
+ 'tour-pager layout-flex-justified',
4
+ state.active?.pagerClass,
5
+ currentStep?.pagerClass
6
+ ]">
3
7
  <UluButton
4
8
  @click="api.prev()"
5
9
  text="Previous"
@@ -27,10 +31,9 @@
27
31
 
28
32
  const { api, state } = useTour();
29
33
 
34
+ const currentStep = computed(() => state.active?.steps[state.stepIndex]);
35
+
30
36
  const isLastStep = computed(() => {
31
37
  return state.active && state.stepIndex === state.active.steps.length - 1;
32
38
  });
33
- const isFirstStep = computed(() => {
34
- return state.active && state.stepIndex === 0;
35
- });
36
39
  </script>
@@ -4,6 +4,8 @@ import { markRaw } from "vue";
4
4
  * @typedef {Object} TourStep
5
5
  * @property {String} [target] - The CSS selector for the target element. If omitted, step renders as a modal.
6
6
  * @property {String} [title] - The title text for the step.
7
+ * @property {String|Array|Object} [titleClass] - Class to apply to the title.
8
+ * @property {String|Array|Object} [pagerClass] - Class to apply to the pager footer.
7
9
  * @property {String} [content] - The content text for the step.
8
10
  * @property {Object} [component] - A Vue component to completely replace the modal/popover wrapper and layout.
9
11
  * @property {Object} [contentComponent] - A Vue component to replace the step text content, keeping the modal/popover wrappers and default footer.
@@ -29,6 +31,9 @@ export const createApi = (state) => ({
29
31
  * @param {String} [tour.name] - Optional name for the tour
30
32
  * @param {Object} [tour.modalProps] - Global props applied to all modal steps in this tour (can be overridden by step)
31
33
  * @param {Object} [tour.popoverProps] - Global props applied to all popover steps in this tour (can be overridden by step)
34
+ * @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
35
+ * @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
36
+ * @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
32
37
  */
33
38
  async start(tour) {
34
39
  if (!tour?.steps?.length) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.6.26",
3
+ "version": "0.6.27",
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": [