@ulu/frontend-vue 0.5.15 → 0.6.0

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 (75) hide show
  1. package/dist/components/elements/UluButton.vue.d.ts +4 -0
  2. package/dist/components/elements/UluButton.vue.d.ts.map +1 -1
  3. package/dist/components/elements/UluButton.vue.js +31 -16
  4. package/dist/components/elements/UluIcon.vue.js +21 -36
  5. package/dist/components/forms/UluFormCheckbox.vue.d.ts +3 -19
  6. package/dist/components/forms/UluFormCheckbox.vue.d.ts.map +1 -1
  7. package/dist/components/forms/UluFormCheckbox.vue.js +10 -31
  8. package/dist/components/forms/UluFormFile.vue.d.ts +3 -25
  9. package/dist/components/forms/UluFormFile.vue.d.ts.map +1 -1
  10. package/dist/components/forms/UluFormFile.vue.js +11 -49
  11. package/dist/components/forms/UluFormItem.vue.d.ts +23 -8
  12. package/dist/components/forms/UluFormItem.vue.d.ts.map +1 -1
  13. package/dist/components/forms/UluFormItem.vue.js +126 -29
  14. package/dist/components/forms/UluFormLabel.vue.d.ts +24 -0
  15. package/dist/components/forms/UluFormLabel.vue.d.ts.map +1 -0
  16. package/dist/components/forms/UluFormLabel.vue.js +34 -0
  17. package/dist/components/forms/UluFormRadio.vue.d.ts +7 -25
  18. package/dist/components/forms/UluFormRadio.vue.d.ts.map +1 -1
  19. package/dist/components/forms/UluFormRadio.vue.js +11 -37
  20. package/dist/components/forms/UluFormSelect.vue.d.ts +7 -23
  21. package/dist/components/forms/UluFormSelect.vue.d.ts.map +1 -1
  22. package/dist/components/forms/UluFormSelect.vue.js +24 -43
  23. package/dist/components/forms/UluFormText.vue.d.ts +5 -23
  24. package/dist/components/forms/UluFormText.vue.d.ts.map +1 -1
  25. package/dist/components/forms/UluFormText.vue.js +10 -38
  26. package/dist/components/forms/UluFormTextarea.vue.d.ts +5 -23
  27. package/dist/components/forms/UluFormTextarea.vue.d.ts.map +1 -1
  28. package/dist/components/forms/UluFormTextarea.vue.js +10 -37
  29. package/dist/components/forms/UluSearchForm.vue.d.ts +24 -3
  30. package/dist/components/forms/UluSearchForm.vue.d.ts.map +1 -1
  31. package/dist/components/forms/UluSearchForm.vue.js +67 -22
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/systems/facets/UluFacetsFilterSelects.vue.d.ts.map +1 -1
  34. package/dist/components/systems/facets/UluFacetsFilterSelects.vue.js +21 -22
  35. package/dist/components/systems/scroll-anchors/UluScrollAnchors.vue.d.ts.map +1 -1
  36. package/dist/components/systems/scroll-anchors/UluScrollAnchors.vue.js +18 -10
  37. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.d.ts +8 -2
  38. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.d.ts.map +1 -1
  39. package/dist/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue.js +92 -47
  40. package/dist/components/systems/scroll-anchors/useScrollAnchors.d.ts.map +1 -1
  41. package/dist/components/systems/scroll-anchors/useScrollAnchors.js +113 -70
  42. package/dist/components/utils/UluAction.vue.d.ts +2 -0
  43. package/dist/components/utils/UluAction.vue.d.ts.map +1 -1
  44. package/dist/components/utils/UluAction.vue.js +9 -5
  45. package/dist/components/visualizations/UluProgressBar.vue.d.ts +2 -2
  46. package/dist/index.js +130 -128
  47. package/dist/plugins/core/index.d.ts.map +1 -1
  48. package/dist/plugins/core/index.js +17 -16
  49. package/dist/utils/props.d.ts +7 -0
  50. package/dist/utils/props.d.ts.map +1 -1
  51. package/dist/utils/props.js +8 -2
  52. package/lib/components/elements/UluButton.vue +18 -3
  53. package/lib/components/elements/UluIcon.vue +8 -26
  54. package/lib/components/forms/UluForm.vue +25 -25
  55. package/lib/components/forms/UluFormCheckbox.vue +11 -25
  56. package/lib/components/forms/UluFormFieldset.vue +6 -6
  57. package/lib/components/forms/UluFormFile.vue +10 -40
  58. package/lib/components/forms/UluFormItem.vue +150 -39
  59. package/lib/components/forms/UluFormLabel.vue +30 -0
  60. package/lib/components/forms/UluFormRadio.vue +15 -34
  61. package/lib/components/forms/UluFormSelect.vue +19 -24
  62. package/lib/components/forms/UluFormText.vue +7 -25
  63. package/lib/components/forms/UluFormTextarea.vue +7 -25
  64. package/lib/components/forms/UluSearchForm.vue +67 -19
  65. package/lib/components/forms/UluSelectableMenu.vue +62 -62
  66. package/lib/components/index.js +1 -0
  67. package/lib/components/systems/facets/UluFacetsFilterSelects.vue +11 -14
  68. package/lib/components/systems/scroll-anchors/UluScrollAnchors.vue +9 -1
  69. package/lib/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue +95 -16
  70. package/lib/components/systems/scroll-anchors/_scroll-anchors-nav-animated.scss +12 -1
  71. package/lib/components/systems/scroll-anchors/useScrollAnchors.js +195 -54
  72. package/lib/components/utils/UluAction.vue +6 -2
  73. package/lib/plugins/core/index.js +2 -1
  74. package/lib/utils/props.js +14 -0
  75. package/package.json +3 -3
@@ -47,6 +47,7 @@ export { default as UluFormActions } from './forms/UluFormActions.vue';
47
47
  export { default as UluFormCheckbox } from './forms/UluFormCheckbox.vue';
48
48
  export { default as UluFormFieldset } from './forms/UluFormFieldset.vue';
49
49
  export { default as UluFormItem } from './forms/UluFormItem.vue';
50
+ export { default as UluFormLabel } from './forms/UluFormLabel.vue';
50
51
  export { default as UluFormItemsInline } from './forms/UluFormItemsInline.vue';
51
52
  export { default as UluFormRadio } from './forms/UluFormRadio.vue';
52
53
  export { default as UluFormRequiredChar } from './forms/UluFormRequiredChar.vue';
@@ -1 +1 @@
1
- {"version":3,"file":"UluFacetsFilterSelects.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/facets/UluFacetsFilterSelects.vue"],"names":[],"mappings":"AA0CA;wBA+OqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;sPASG"}
1
+ {"version":3,"file":"UluFacetsFilterSelects.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/facets/UluFacetsFilterSelects.vue"],"names":[],"mappings":"AA0CA;wBAyOqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;sPASG"}
@@ -1,6 +1,6 @@
1
- import { createElementBlock as n, openBlock as d, normalizeClass as a, Fragment as m, renderList as y, createElementVNode as o, renderSlot as i, createTextVNode as r, toDisplayString as u } from "vue";
1
+ import { createElementBlock as d, openBlock as n, normalizeClass as a, Fragment as m, renderList as _, createElementVNode as i, renderSlot as r, createTextVNode as o, toDisplayString as u } from "vue";
2
2
  /* empty css */
3
- const v = ["for"], w = ["id", "onChange"], S = { value: "" }, $ = ["value", "selected"], F = {
3
+ const w = ["for"], S = ["id", "onChange"], $ = { value: "" }, k = ["value", "selected"], F = {
4
4
  __name: "UluFacetsFilterSelects",
5
5
  props: {
6
6
  /**
@@ -19,10 +19,9 @@ const v = ["for"], w = ["id", "onChange"], S = { value: "" }, $ = ["value", "sel
19
19
  }
20
20
  },
21
21
  emits: ["facet-change"],
22
- setup(c, { emit: _ }) {
23
- console.log(c);
24
- const b = _;
25
- function p(l, f) {
22
+ setup(c, { emit: y }) {
23
+ const b = y;
24
+ function v(l, f) {
26
25
  const e = f.target.value;
27
26
  l.children.find((s) => s.selected)?.uid !== e && l.children.forEach((s) => {
28
27
  const h = s.uid === e;
@@ -33,45 +32,45 @@ const v = ["for"], w = ["id", "onChange"], S = { value: "" }, $ = ["value", "sel
33
32
  });
34
33
  });
35
34
  }
36
- return (l, f) => (d(), n("div", {
35
+ return (l, f) => (n(), d("div", {
37
36
  class: a(["facets-dropdown-filters", c.classes.container])
38
37
  }, [
39
- (d(!0), n(m, null, y(c.facets, (e) => (d(), n("div", {
38
+ (n(!0), d(m, null, _(c.facets, (e) => (n(), d("div", {
40
39
  class: a(["facets-dropdown-filters__group", c.classes.group]),
41
40
  key: e.uid
42
41
  }, [
43
- o("label", {
42
+ i("label", {
44
43
  for: `facet-dropdown-${e.uid}`,
45
44
  class: a(["facets-dropdown-filters__label", c.classes.label])
46
45
  }, [
47
- i(l.$slots, "label", {}, () => [
48
- r(u(e.name), 1)
46
+ r(l.$slots, "label", {}, () => [
47
+ o(u(e.name), 1)
49
48
  ])
50
- ], 10, v),
51
- o("select", {
49
+ ], 10, w),
50
+ i("select", {
52
51
  id: `facet-dropdown-${e.uid}`,
53
52
  class: a(["facets-dropdown-filters__select", c.classes.select]),
54
- onChange: (t) => p(e, t)
53
+ onChange: (t) => v(e, t)
55
54
  }, [
56
- o("option", S, [
57
- i(l.$slots, "optionAll", { group: e }, () => [
58
- r(" All " + u(e.name) + "s ", 1)
55
+ i("option", $, [
56
+ r(l.$slots, "optionAll", { group: e }, () => [
57
+ o(" All " + u(e.name) + "s ", 1)
59
58
  ])
60
59
  ]),
61
- (d(!0), n(m, null, y(e.children, (t, s) => (d(), n("option", {
60
+ (n(!0), d(m, null, _(e.children, (t, s) => (n(), d("option", {
62
61
  key: t.uid,
63
62
  value: t.uid,
64
63
  selected: t.selected
65
64
  }, [
66
- i(l.$slots, "option", {
65
+ r(l.$slots, "option", {
67
66
  group: e,
68
67
  option: t,
69
68
  index: s
70
69
  }, () => [
71
- r(u(t.label), 1)
70
+ o(u(t.label), 1)
72
71
  ])
73
- ], 8, $))), 128))
74
- ], 42, w)
72
+ ], 8, k))), 128))
73
+ ], 42, S)
75
74
  ], 2))), 128))
76
75
  ], 2));
77
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UluScrollAnchors.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/UluScrollAnchors.vue"],"names":[],"mappings":"AAKA;wBAqLqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;;;;;;;mBAUG"}
1
+ {"version":3,"file":"UluScrollAnchors.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/UluScrollAnchors.vue"],"names":[],"mappings":"AAKA;wBAqMqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;;;;;;;mBAUG"}
@@ -1,4 +1,4 @@
1
- import { ref as s, provide as n, computed as p, createElementBlock as f, openBlock as m, renderSlot as d } from "vue";
1
+ import { ref as s, provide as l, computed as p, createElementBlock as f, openBlock as m, renderSlot as d } from "vue";
2
2
  import { useScrollAnchors as h } from "./useScrollAnchors.js";
3
3
  const A = {
4
4
  __name: "UluScrollAnchors",
@@ -33,20 +33,28 @@ const A = {
33
33
  /**
34
34
  * Enable debug logging for the IntersectionObserver
35
35
  */
36
- debug: Boolean
36
+ debug: Boolean,
37
+ /**
38
+ * If true, the last section will deactivate when scrolling past its bounding box.
39
+ * By default, the last section remains active until the user scrolls back up.
40
+ */
41
+ deactivateLastItem: {
42
+ type: Boolean,
43
+ default: !1
44
+ }
37
45
  },
38
46
  emits: ["section-change"],
39
- setup(r, { emit: c }) {
40
- const u = r, a = c, e = s([]), t = s(null);
41
- return h({ sections: e, props: u, emit: a, componentElRef: t }), n("uluScrollAnchorsSections", p(() => e.value)), n("uluScrollAnchorsRegister", (o) => {
47
+ setup(c, { emit: r }) {
48
+ const a = c, u = r, e = s([]), n = s(null);
49
+ return h({ sections: e, props: a, emit: u, componentElRef: n }), l("uluScrollAnchorsSections", p(() => e.value)), l("uluScrollAnchorsRegister", (o) => {
42
50
  e.value.push(o);
43
- }), n("uluScrollAnchorsUnregister", (o) => {
44
- const l = e.value.findIndex((i) => i.id === o);
45
- l > -1 && e.value.splice(l, 1);
46
- }), (o, l) => (m(), f("div", {
51
+ }), l("uluScrollAnchorsUnregister", (o) => {
52
+ const t = e.value.findIndex((i) => i.id === o);
53
+ t > -1 && e.value.splice(t, 1);
54
+ }), (o, t) => (m(), f("div", {
47
55
  class: "scroll-anchors",
48
56
  ref_key: "componentEl",
49
- ref: t
57
+ ref: n
50
58
  }, [
51
59
  d(o.$slots, "default")
52
60
  ], 512));
@@ -6,6 +6,9 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
7
  element: string;
8
8
  railWidth: number;
9
+ trimRailToCenters: boolean;
10
+ railStartOffset: number;
11
+ railEndOffset: number;
9
12
  indicatorWidth: number;
10
13
  indicatorHeight: number;
11
14
  indicatorAlignment: string;
@@ -13,13 +16,16 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
13
16
  $props: {
14
17
  readonly element?: string | undefined;
15
18
  readonly railWidth?: number | undefined;
19
+ readonly trimRailToCenters?: boolean | undefined;
20
+ readonly railStartOffset?: number | undefined;
21
+ readonly railEndOffset?: number | undefined;
16
22
  readonly indicatorWidth?: number | undefined;
17
23
  readonly indicatorHeight?: number | undefined;
18
24
  readonly indicatorAlignment?: string | undefined;
19
25
  readonly indicatorAlignmentOffset?: number | undefined;
20
26
  };
21
27
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
22
- indicator: HTMLDivElement;
28
+ listRef: HTMLUListElement;
23
29
  }, any>;
24
30
  type __VLS_TemplateResult = {
25
31
  attrs: Partial<{}>;
@@ -30,7 +36,7 @@ type __VLS_TemplateResult = {
30
36
  }): any;
31
37
  };
32
38
  refs: {
33
- indicator: HTMLDivElement;
39
+ listRef: HTMLUListElement;
34
40
  };
35
41
  rootEl: any;
36
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UluScrollAnchorsNavAnimated.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue"],"names":[],"mappings":"AAsCA;wBA4UqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;QAQG"}
1
+ {"version":3,"file":"UluScrollAnchorsNavAnimated.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsNavAnimated.vue"],"names":[],"mappings":"AAqCA;wBA4eqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;QAQG"}
@@ -1,7 +1,7 @@
1
- import { ref as d, computed as N, watch as w, createBlock as $, createCommentVNode as W, unref as f, openBlock as h, resolveDynamicComponent as b, normalizeStyle as _, withCtx as C, createElementVNode as m, createElementBlock as g, Fragment as H, renderList as B, normalizeClass as v, renderSlot as I, createTextVNode as R, toDisplayString as V } from "vue";
2
- import { runAfterFramePaint as z } from "@ulu/utils/browser/performance.js";
3
- import { useScrollAnchorSections as D } from "./useScrollAnchorSections.js";
4
- const E = { class: "scroll-anchors-nav-animated__rail" }, F = ["href"], P = {
1
+ import { ref as c, onMounted as $, onBeforeUnmount as w, computed as N, watch as C, createBlock as z, createCommentVNode as B, unref as p, openBlock as y, resolveDynamicComponent as M, normalizeStyle as g, withCtx as T, createElementVNode as _, createElementBlock as k, Fragment as W, renderList as E, normalizeClass as S, renderSlot as H, createTextVNode as I, toDisplayString as V } from "vue";
2
+ import { runAfterFramePaint as D } from "@ulu/utils/browser/performance.js";
3
+ import { useScrollAnchorSections as F } from "./useScrollAnchorSections.js";
4
+ const L = ["href"], j = {
5
5
  __name: "UluScrollAnchorsNavAnimated",
6
6
  props: {
7
7
  /**
@@ -18,6 +18,26 @@ const E = { class: "scroll-anchors-nav-animated__rail" }, F = ["href"], P = {
18
18
  type: Number,
19
19
  default: 3
20
20
  },
21
+ /**
22
+ * Dynamically trims the rail to span exactly from the center of the first indicator to the center of the last indicator. Disabled by default
23
+ */
24
+ trimRailToCenters: {
25
+ type: Boolean
26
+ },
27
+ /**
28
+ * Pixel offset for the start (top) of the dynamic rail.
29
+ */
30
+ railStartOffset: {
31
+ type: Number,
32
+ default: 0
33
+ },
34
+ /**
35
+ * Pixel offset for the end (bottom) of the dynamic rail.
36
+ */
37
+ railEndOffset: {
38
+ type: Number,
39
+ default: 0
40
+ },
21
41
  /**
22
42
  * The width of the indicator, defaults to railWidth
23
43
  */
@@ -48,71 +68,96 @@ const E = { class: "scroll-anchors-nav-animated__rail" }, F = ["href"], P = {
48
68
  default: 0
49
69
  }
50
70
  },
51
- setup(o) {
52
- const i = o, n = D(), p = d({}), c = d(!1), S = d(null), e = N(() => {
53
- if (!n || !n.value || !n.value.length)
54
- return !1;
55
- const t = n.value.findIndex((x) => x.active);
56
- if (t === -1)
71
+ setup(u) {
72
+ const l = u, a = F(), f = c(null), x = c({}), d = c(!1), h = c(0);
73
+ let s = null;
74
+ $(() => {
75
+ f.value && (s = new ResizeObserver(() => {
76
+ h.value++;
77
+ }), s.observe(f.value));
78
+ }), w(() => {
79
+ s && (s.disconnect(), s = null);
80
+ });
81
+ function v(e) {
82
+ const t = x.value[e];
83
+ if (!t) return null;
84
+ const { offsetTop: n, offsetHeight: r } = t, o = l.indicatorHeight != null, R = l.indicatorWidth ?? l.railWidth, b = o ? l.indicatorHeight : r;
85
+ let m = n;
86
+ return l.indicatorAlignment === "center" && (m = n + r / 2 - b / 2), m += l.indicatorAlignmentOffset, { y: m, height: b, width: R };
87
+ }
88
+ const i = N(() => {
89
+ if (h.value, !a || !a.value || !a.value.length)
57
90
  return !1;
58
- const l = p.value[t];
59
- if (!l) return !1;
60
- const { offsetTop: a, offsetHeight: r } = l, s = i.indicatorHeight != null, A = i.indicatorWidth ?? i.railWidth, y = s ? i.indicatorHeight : r;
61
- let u = a;
62
- return i.indicatorAlignment === "center" && (u = a + r / 2 - y / 2), u += i.indicatorAlignmentOffset, { y: u, height: y, width: A };
91
+ const e = a.value.findIndex((t) => t.active);
92
+ return e === -1 ? !1 : v(e) || !1;
93
+ }), A = N(() => {
94
+ if (h.value, !l.trimRailToCenters) return {};
95
+ if (!a || !a.value || a.value.length < 1) return {};
96
+ const e = v(0), t = v(a.value.length - 1);
97
+ if (!e || !t) return {};
98
+ let n = e.y + e.height / 2, r = t.y + t.height / 2;
99
+ n += l.railStartOffset, r += l.railEndOffset;
100
+ const o = Math.max(0, r - n);
101
+ return {
102
+ "--ulu-sa-nav-rail-top": `${n}px`,
103
+ "--ulu-sa-nav-rail-height": `${o}px`
104
+ };
63
105
  });
64
- w(e, (t) => {
65
- t && !c.value && z(() => {
66
- c.value = !0;
106
+ C(i, (e) => {
107
+ e && !d.value && D(() => {
108
+ d.value = !0;
67
109
  });
68
110
  });
69
- function k(t, l) {
70
- l && (p.value[t] = l);
111
+ function O(e, t) {
112
+ t && (x.value[e] = t);
71
113
  }
72
- return (t, l) => f(n) && f(n).length ? (h(), $(b(o.element), {
114
+ return (e, t) => p(a) && p(a).length ? (y(), z(M(u.element), {
73
115
  key: 0,
74
116
  class: "scroll-anchors__nav scroll-anchors__nav--animated scroll-anchors-nav-animated",
75
- style: _({ "--ulu-sa-nav-rail-width": `${o.railWidth}px` })
117
+ style: g({ "--ulu-sa-nav-rail-width": `${u.railWidth}px` })
76
118
  }, {
77
- default: C(() => [
78
- m("ul", E, [
79
- (h(!0), g(H, null, B(f(n), (a, r) => (h(), g("li", {
119
+ default: T(() => [
120
+ _("ul", {
121
+ class: "scroll-anchors-nav-animated__rail",
122
+ ref_key: "listRef",
123
+ ref: f,
124
+ style: g(A.value)
125
+ }, [
126
+ (y(!0), k(W, null, E(p(a), (n, r) => (y(), k("li", {
80
127
  key: r,
81
- class: v({ "is-active": a.active })
128
+ class: S({ "is-active": n.active })
82
129
  }, [
83
- m("a", {
84
- class: v({ "is-active": a.active }),
130
+ _("a", {
131
+ class: S({ "is-active": n.active }),
85
132
  ref_for: !0,
86
- ref: (s) => k(r, s),
87
- href: `#${a.titleId}`
133
+ ref: (o) => O(r, o),
134
+ href: `#${n.titleId}`
88
135
  }, [
89
- I(t.$slots, "default", {
90
- item: a,
136
+ H(e.$slots, "default", {
137
+ item: n,
91
138
  index: r
92
139
  }, () => [
93
- R(V(a.title), 1)
140
+ I(V(n.title), 1)
94
141
  ])
95
- ], 10, F)
142
+ ], 10, L)
96
143
  ], 2))), 128))
97
- ]),
98
- m("div", {
99
- class: v(["scroll-anchors-nav-animated__indicator", {
100
- "scroll-anchors-nav-animated__indicator--can-transition": c.value
144
+ ], 4),
145
+ _("div", {
146
+ class: S(["scroll-anchors-nav-animated__indicator", {
147
+ "scroll-anchors-nav-animated__indicator--can-transition": d.value
101
148
  }]),
102
- ref_key: "indicator",
103
- ref: S,
104
- style: _({
105
- opacity: e.value ? "1" : "0",
106
- transform: `translateY(${e.value ? e.value.y : 0}px)`,
107
- height: `${e.value ? e.value.height : 0}px`,
108
- width: `${e.value ? e.value.width : 0}px`
149
+ style: g({
150
+ opacity: i.value ? "1" : "0",
151
+ transform: `translateY(${i.value ? i.value.y : 0}px)`,
152
+ height: `${i.value ? i.value.height : 0}px`,
153
+ width: `${i.value ? i.value.width : 0}px`
109
154
  })
110
155
  }, null, 6)
111
156
  ]),
112
157
  _: 3
113
- }, 8, ["style"])) : W("", !0);
158
+ }, 8, ["style"])) : B("", !0);
114
159
  }
115
160
  };
116
161
  export {
117
- P as default
162
+ j as default
118
163
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollAnchors.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/useScrollAnchors.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,4EAFW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,WAAW;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC,QA0KnF"}
1
+ {"version":3,"file":"useScrollAnchors.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/scroll-anchors/useScrollAnchors.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,4EAFW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,WAAW;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC,QAsTnF"}
@@ -1,95 +1,138 @@
1
- import { onMounted as T, onUnmounted as Y, watch as F, nextTick as O } from "vue";
2
- import { getScrollParent as C } from "@ulu/utils/browser/dom.js";
3
- function D({ sections: i, props: e, emit: h, componentElRef: I }) {
4
- let r = null;
5
- function v(t) {
6
- return i.value.findIndex(({ element: l }) => t === l);
1
+ import { onMounted as P, onUnmounted as U, watch as Y, nextTick as L } from "vue";
2
+ import { getScrollParent as M } from "@ulu/utils/browser/dom.js";
3
+ import { debounce as j } from "@ulu/utils/performance.js";
4
+ function J({ sections: r, props: t, emit: T, componentElRef: m }) {
5
+ let a = null, O = 0, k = "down", d = null, x = !0;
6
+ function g(e) {
7
+ return r.value.findIndex(({ element: n }) => e === n);
7
8
  }
8
- function w(t = null, l = "down") {
9
- i.value.forEach((c) => {
10
- c !== t && (c.active && (c.inactiveFrom = l === "down" ? "forward" : "reverse", c.activeFrom = null), c.active = !1);
9
+ function B(e, n, s = "down") {
10
+ if (!e) return;
11
+ const v = s === "down" ? "forward" : "reverse";
12
+ n ? (e.active = !0, e.inactiveFrom = null, e.activeFrom = v) : (e.active && (e.inactiveFrom = v, e.activeFrom = null), e.active = !1);
13
+ }
14
+ function $(e = null, n = "down") {
15
+ r.value.forEach((s) => {
16
+ s !== e && B(s, !1, n);
11
17
  });
12
18
  }
13
- function A() {
14
- let t = 0, l = !0;
15
- const c = (a) => {
16
- const { root: S } = r, d = S ? S.scrollTop : document.documentElement.scrollTop || window.scrollY;
17
- if (e.debug && (console.group("useScrollAnchors: onObserve"), console.log("Observer:", r), console.log("Last/Current Y:", `${t}/${d}`), console.log("Entries:", a.map((n) => ({ el: n.target, is: n.isIntersecting })))), l && e.firstItemActive) {
18
- e.debug && console.log("Initial observation, respecting `firstItemActive`."), l = !1, t = d, e.debug && console.groupEnd();
19
- return;
20
- }
21
- l = !1;
22
- const s = d > t ? "down" : "up";
23
- t = d, e.debug && console.log(`Scroll direction: ${s}`);
24
- const f = a.filter((n) => n.isIntersecting);
25
- if (e.debug && console.log("Intersecting entries:", f.map((n) => n.target)), f.length > 0) {
26
- f.sort((u, m) => v(u.target) - v(m.target));
27
- const n = s === "down" ? f[f.length - 1] : f[0];
28
- e.debug && console.log("Chosen target entry:", n.target);
29
- const o = i.value[v(n.target)];
30
- o && !o.active && (e.debug && console.log("Activating section:", o.title), O(() => {
31
- w(o, s), o.active = !0, o.inactiveFrom = null, o.activeFrom = s === "down" ? "forward" : "reverse", h("section-change", { section: o, sections: i.value, active: !0 });
32
- }));
19
+ function h(e, n) {
20
+ e && !e.active && (t.debug && console.log("Activate:", e.title), L(() => {
21
+ $(e, n), B(e, !0, n), T("section-change", { section: e, sections: r.value, active: !0 });
22
+ }));
23
+ }
24
+ function I(e, n) {
25
+ const s = r.value.find((v) => v.active);
26
+ s && (t.debug && n && console.log(n, s.title), L(() => {
27
+ $(null, e), T("section-change", { section: s, sections: r.value, active: !1 });
28
+ }));
29
+ }
30
+ function y() {
31
+ let e = null;
32
+ return t.observerOptions && t.observerOptions.root !== void 0 ? e = t.observerOptions.root : m.value && (e = M(m.value), e === document.scrollingElement && (e = null)), e || window;
33
+ }
34
+ const A = j(() => {
35
+ t.debug && console.log("New Observer (debounced/check)"), a && (a.disconnect(), a = null), E(), w();
36
+ }, 100);
37
+ function C() {
38
+ D(), d = y(), d && d.addEventListener("scroll", A, { passive: !0 });
39
+ }
40
+ function D() {
41
+ d && (d.removeEventListener("scroll", A), d = null);
42
+ }
43
+ function E() {
44
+ x = !0;
45
+ const e = (u) => {
46
+ const { root: R } = a, S = R ? R.scrollTop : document.documentElement.scrollTop || window.scrollY;
47
+ let i = k;
48
+ S > O ? i = "down" : S < O && (i = "up"), t.debug && (console.groupCollapsed(`Scroll: ${O} -> ${S} (${i})`), console.table(u.map((o) => ({
49
+ el: o.target.id || o.target.tagName,
50
+ int: o.isIntersecting,
51
+ ratio: o.intersectionRatio.toFixed(2)
52
+ })))), O = S, k = i;
53
+ const b = u.filter((o) => o.isIntersecting);
54
+ if (b.length > 0) {
55
+ b.sort((c, f) => g(c.target) - g(f.target));
56
+ const o = i === "down" ? b[b.length - 1] : b[0];
57
+ t.debug && console.log("Target:", o.target.id || o.target.tagName);
58
+ const l = r.value[g(o.target)];
59
+ h(l, i);
60
+ } else if (x) {
61
+ t.debug && console.log("Fallback: bounds");
62
+ let o = -1;
63
+ if (u.forEach((l) => {
64
+ const c = l.rootBounds ? l.rootBounds.top : 0;
65
+ if (l.boundingClientRect.top <= c + 1) {
66
+ const f = g(l.target);
67
+ f > o && (o = f);
68
+ }
69
+ }), o > -1) {
70
+ const l = o === r.value.length - 1, c = r.value[o];
71
+ if (l && t.deactivateLastItem) {
72
+ const f = u.find((H) => H.target === c.element), F = f.rootBounds ? f.rootBounds.bottom : window.innerHeight;
73
+ f && f.boundingClientRect.bottom < F ? I(i, "Deactivate (last):") : h(c, i);
74
+ } else
75
+ h(c, i);
76
+ } else if (t.debug && console.log("Fallback: top"), !t.firstItemActive)
77
+ I(i, "Deactivate (top):");
78
+ else {
79
+ const l = r.value[0];
80
+ h(l, i);
81
+ }
33
82
  } else {
34
- e.debug && console.log("No intersecting entries. Checking edge cases.");
35
- const n = i.value.find((o) => o.active);
36
- if (n) {
37
- const o = a.find((u) => u.target === n.element);
38
- if (o && !o.isIntersecting) {
39
- const u = v(o.target), m = u === 0, y = u === i.value.length - 1;
40
- (m && s === "up" && !e.firstItemActive || y && s === "down") && (e.debug && console.log("Deactivating section at edge:", n.title), O(() => {
41
- w(null, s), h("section-change", { section: n, sections: i.value, active: !1 });
42
- }));
83
+ t.debug && console.log("Check edges");
84
+ const o = r.value.find((l) => l.active);
85
+ if (o) {
86
+ const l = u.find((c) => c.target === o.element);
87
+ if (l && !l.isIntersecting) {
88
+ const c = g(l.target), f = c === 0, F = c === r.value.length - 1;
89
+ (f && i === "up" && !t.firstItemActive || F && i === "down" && t.deactivateLastItem) && I(i, "Deactivate (edge):");
43
90
  }
44
91
  }
45
92
  }
46
- e.debug && console.groupEnd();
93
+ x = !1, t.debug && console.groupEnd();
47
94
  };
48
- let g = null;
49
- e.observerOptions && e.observerOptions.root !== void 0 ? g = e.observerOptions.root : I.value && (g = C(I.value), g === document.scrollingElement && (g = null));
50
- let E = {
95
+ let n = null;
96
+ t.observerOptions && t.observerOptions.root !== void 0 ? n = t.observerOptions.root : m.value && (n = M(m.value), n === document.scrollingElement && (n = null));
97
+ let s = {
51
98
  rootMargin: "-25% 0px -55% 0px",
52
99
  threshold: 0
53
100
  };
54
- if (e.snapOffset !== !1 && e.snapOffset !== void 0) {
55
- const a = e.snapOffset === !0 ? 20 : Number(e.snapOffset);
56
- E.rootMargin = `-${a}% 0px -${99 - a}% 0px`;
101
+ if (t.snapOffset !== !1 && t.snapOffset !== void 0) {
102
+ const u = t.snapOffset === !0 ? 20 : Number(t.snapOffset);
103
+ s.rootMargin = `-${u}% 0px -${99 - u}% 0px`;
57
104
  }
58
- const $ = {
59
- ...E,
60
- ...e.observerOptions || {},
61
- root: g
105
+ const v = {
106
+ ...s,
107
+ ...t.observerOptions || {},
108
+ root: n
62
109
  };
63
- r = new IntersectionObserver(c, $);
110
+ a = new IntersectionObserver(e, v);
64
111
  }
65
- function b() {
66
- r && (r.disconnect(), i.value.forEach(({ element: t }) => {
67
- t && r.observe(t);
112
+ function w() {
113
+ a && (a.disconnect(), r.value.forEach(({ element: e }) => {
114
+ e && a.observe(e);
68
115
  }));
69
116
  }
70
- function x() {
71
- r && (r.disconnect(), r = null);
117
+ function N() {
118
+ a && (a.disconnect(), a = null);
72
119
  }
73
- T(() => {
74
- if (e.firstItemActive && i.value.length > 0) {
75
- const t = i.value[0];
76
- t && (t.active = !0);
77
- }
78
- A(), b();
79
- }), Y(() => {
80
- x();
81
- }), F(() => i.value.length, () => {
82
- O(() => {
83
- b();
120
+ P(() => {
121
+ E(), w(), C();
122
+ }), U(() => {
123
+ N(), D(), A.cancel();
124
+ }), Y(() => r.value.length, () => {
125
+ L(() => {
126
+ w();
84
127
  });
85
- }), F(
86
- () => [e.snapOffset, e.observerOptions],
128
+ }), Y(
129
+ () => [t.snapOffset, t.observerOptions],
87
130
  () => {
88
- x(), A(), b();
131
+ N(), E(), w(), C();
89
132
  },
90
133
  { deep: !0 }
91
134
  );
92
135
  }
93
136
  export {
94
- D as useScrollAnchors
137
+ J as useScrollAnchors
95
138
  };
@@ -4,6 +4,7 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
4
  $slots: S;
5
5
  });
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
+ type?: string | undefined;
7
8
  activeClass?: string | undefined;
8
9
  to?: string | Record<string, any> | undefined;
9
10
  target?: string | undefined;
@@ -14,6 +15,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
14
15
  exactActiveClass?: string | undefined;
15
16
  click?: Function | undefined;
16
17
  $props: {
18
+ readonly type?: string | undefined;
17
19
  readonly activeClass?: string | undefined;
18
20
  readonly to?: string | Record<string, any> | undefined;
19
21
  readonly target?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"UluAction.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/utils/UluAction.vue"],"names":[],"mappings":"AAQA;wBAqNqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;2OAQG"}
1
+ {"version":3,"file":"UluAction.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/utils/UluAction.vue"],"names":[],"mappings":"AAQA;wBA6NqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;2OAQG"}