@ulu/frontend-vue 0.1.3-beta.14 → 0.1.3-beta.16

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.
@@ -5,7 +5,10 @@ type __VLS_WithSlots<T, S> = T & (new () => {
5
5
  });
6
6
  declare const __VLS_component: import("vue").DefineComponent<{}, {
7
7
  $props: Partial<typeof props>;
8
+ animate: boolean | Record<string, any>;
9
+ triggerTextElement: string;
8
10
  items: unknown[];
11
+ modifiers?: string | unknown[] | undefined;
9
12
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
13
  type __VLS_Slots = {
11
14
  trigger?: ((props: {
@@ -28,6 +31,9 @@ type __VLS_Slots = {
28
31
  }) => any) | undefined;
29
32
  };
30
33
  declare const props: {
34
+ readonly animate: boolean | Record<string, any>;
35
+ readonly triggerTextElement: string;
31
36
  readonly items: unknown[];
37
+ readonly modifiers?: string | unknown[] | undefined;
32
38
  };
33
39
  //# sourceMappingURL=UluAccordionGroup.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UluAccordionGroup.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/collapsible/UluAccordionGroup.vue"],"names":[],"mappings":"wBAoNqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;2OAErC;;;;;;;;;;;;;;;;;;;;;AA9IH;;EASG"}
1
+ {"version":3,"file":"UluAccordionGroup.vue.d.ts","sourceRoot":"","sources":["../../../../lib/components/collapsible/UluAccordionGroup.vue"],"names":[],"mappings":"wBAsQqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;;;;2OAErC;;;;;;;;;;;;;;;;;;;;;AAzKH;;;;;EA8BG"}
@@ -14,6 +14,9 @@ type __VLS_Slots = {
14
14
  isActive: any;
15
15
  titleId: any;
16
16
  section: any;
17
+ inactiveFrom: any;
18
+ activeFrom: any;
19
+ sectionState: string | null;
17
20
  }) => any) | undefined;
18
21
  };
19
22
  declare const props: {
@@ -1 +1 @@
1
- {"version":3,"file":"UluScrollAnchorsHeadlessSection.vue.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsHeadlessSection.vue"],"names":[],"mappings":"wBAgIqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;;;2OAErC;;;;;;;;AAvFD;;;;EAmBG"}
1
+ {"version":3,"file":"UluScrollAnchorsHeadlessSection.vue.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsHeadlessSection.vue"],"names":[],"mappings":"wBAsKqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;;;2OAErC;;;;;;;;;;;AA9GD;;;;EAmBG"}
@@ -1 +1 @@
1
- {"version":3,"file":"UluScrollAnchorsSection.vue.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsSection.vue"],"names":[],"mappings":"wBAuMqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;;;;;;;2OAErC;;;;;;;;AAhID;;;;;;;;EA4CG"}
1
+ {"version":3,"file":"UluScrollAnchorsSection.vue.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/UluScrollAnchorsSection.vue"],"names":[],"mappings":"wBA+NqB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;;qBAEpD,CAAC,EAAE,CAAC;;;AARzB;YAGmB,OAAO,CAAC,OAAO,KAAK,CAAC;;;;;;;;2OAErC;;;;;;;;AA5ID;;;;;;;;EA4CG"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollAnchorSection.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/useScrollAnchorSection.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,8CAHW,MAAM,GACJ,MAAM,CA+ClB"}
1
+ {"version":3,"file":"useScrollAnchorSection.d.ts","sourceRoot":"","sources":["../../../../../lib/components/systems/scroll-anchors/useScrollAnchorSection.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,8CAHW,MAAM,GACJ,MAAM,CAmDlB"}
@@ -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,QA+InF"}
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,QAqJnF"}
@@ -7,6 +7,9 @@
7
7
  @update:modelValue="(newValue) => handleToggle(index, newValue)"
8
8
  :trigger-text="item.title"
9
9
  :classes="item.classes"
10
+ :trigger-text-element="triggerTextElement"
11
+ :modifiers="modifiers"
12
+ :animate="animate"
10
13
  >
11
14
  <template #trigger="{ isOpen }" v-if="$slots.trigger">
12
15
  <slot name="trigger" :item="item" :index="index" :isOpen="isOpen"></slot>
@@ -37,7 +40,28 @@ const props = defineProps({
37
40
  items: {
38
41
  type: Array,
39
42
  default: () => []
40
- }
43
+ },
44
+ /**
45
+ * If using summary text sets the inner element the text is wrapped in, usually a headline or strong
46
+ */
47
+ triggerTextElement: {
48
+ type: String,
49
+ default: "strong"
50
+ },
51
+ /**
52
+ * Class modifiers (ie. 'transparent', 'secondary', etc)
53
+ */
54
+ modifiers: [String, Array],
55
+ /**
56
+ * Enable or configure animations.
57
+ * - `false` (default) to disable all animations.
58
+ * - `true` to enable animations with default settings.
59
+ * - An object to provide custom options to auto-animate (e.g., { duration: 100, easing: 'linear' }).
60
+ */
61
+ animate: {
62
+ type: [Boolean, Object],
63
+ default: true
64
+ },
41
65
  });
42
66
 
43
67
  const internalItems = ref([]);
@@ -61,4 +85,4 @@ function handleToggle(selectedIndex, newValue) {
61
85
  internalItems.value[selectedIndex].isOpen = false;
62
86
  }
63
87
  }
64
- </script>
88
+ </script>
@@ -1,14 +1,19 @@
1
1
  <template>
2
- <component
3
- :is="element"
4
- :class="['scroll-anchors__section', { 'is-active': isActive }]"
5
- ref="sectionRef"
2
+ <component
3
+ :is="element"
4
+ :class="[
5
+ 'scroll-anchors__section',
6
+ { 'is-active': isActive }
7
+ ]"
8
+ :data-scrollpoint-state="sectionState"
9
+ ref="sectionRef"
6
10
  >
7
- <slot :isActive="isActive" :titleId="titleId" :section="section" />
11
+ <slot :isActive="isActive" :titleId="titleId" :section="section" :inactiveFrom="inactiveFrom" :activeFrom="activeFrom" :sectionState="sectionState" />
8
12
  </component>
9
13
  </template>
10
14
 
11
15
  <script setup>
16
+ import { computed } from "vue";
12
17
  import { useScrollAnchorSection } from "./useScrollAnchorSection";
13
18
 
14
19
  const props = defineProps({
@@ -24,7 +29,7 @@
24
29
  */
25
30
  customTitleId: String,
26
31
  /**
27
- * Element to use
32
+ * Element to use
28
33
  */
29
34
  element: {
30
35
  type: String,
@@ -32,5 +37,14 @@
32
37
  }
33
38
  });
34
39
 
35
- const { sectionRef, titleId, isActive, section } = useScrollAnchorSection(props);
40
+ const { sectionRef, titleId, isActive, inactiveFrom, activeFrom, section } = useScrollAnchorSection(props);
41
+
42
+ const sectionState = computed(() => {
43
+ if (isActive.value) {
44
+ if (activeFrom.value) return `enter-${activeFrom.value}`;
45
+ } else {
46
+ if (inactiveFrom.value) return `exit-${inactiveFrom.value}`;
47
+ }
48
+ return null;
49
+ });
36
50
  </script>
@@ -1,7 +1,8 @@
1
1
  <template>
2
- <component
3
- :is="element"
4
- :class="[wrapperClass, { [activeClass] : activeClass && isActive }]"
2
+ <component
3
+ :is="element"
4
+ :class="[wrapperClass, { [activeClass]: activeClass && isActive }]"
5
+ :data-scrollpoint-state="sectionState"
5
6
  ref="sectionRef"
6
7
  >
7
8
  <component :is="titleElement" :class="titleClass" :id="titleId">
@@ -14,6 +15,7 @@
14
15
  </template>
15
16
 
16
17
  <script setup>
18
+ import { computed } from "vue";
17
19
  import { useScrollAnchorSection } from "./useScrollAnchorSection";
18
20
 
19
21
  const props = defineProps({
@@ -62,5 +64,14 @@
62
64
  }
63
65
  });
64
66
 
65
- const { sectionRef, titleId, isActive, section } = useScrollAnchorSection(props);
67
+ const { sectionRef, titleId, isActive, inactiveFrom, activeFrom, section } = useScrollAnchorSection(props);
68
+
69
+ const sectionState = computed(() => {
70
+ if (isActive.value) {
71
+ if (activeFrom.value) return `enter-${activeFrom.value}`;
72
+ } else {
73
+ if (inactiveFrom.value) return `exit-${inactiveFrom.value}`;
74
+ }
75
+ return null;
76
+ });
66
77
  </script>
@@ -22,7 +22,9 @@ export function useScrollAnchorSection(props) {
22
22
  title: props.title,
23
23
  titleId: titleId.value,
24
24
  element: null, // will be set on mount
25
- active: false
25
+ active: false,
26
+ inactiveFrom: null,
27
+ activeFrom: null
26
28
  });
27
29
 
28
30
  // Keep title and titleId in sync with props
@@ -51,6 +53,8 @@ export function useScrollAnchorSection(props) {
51
53
  sectionRef, // the ref for the user to attach
52
54
  titleId,
53
55
  isActive: computed(() => section.active),
56
+ inactiveFrom: computed(() => section.inactiveFrom),
57
+ activeFrom: computed(() => section.activeFrom),
54
58
  section
55
59
  };
56
60
  }
@@ -15,9 +15,13 @@ export function useScrollAnchors({ sections, props, emit, componentElRef }) {
15
15
  return sections.value.findIndex(({ element }) => el === element);
16
16
  }
17
17
 
18
- function removeActive(except = null) {
18
+ function removeActive(except = null, scrollDirection = 'down') {
19
19
  sections.value.forEach(s => {
20
20
  if (s !== except) {
21
+ if (s.active) {
22
+ s.inactiveFrom = scrollDirection === 'down' ? 'above' : 'below';
23
+ s.activeFrom = null;
24
+ }
21
25
  s.active = false;
22
26
  }
23
27
  });
@@ -67,8 +71,10 @@ export function useScrollAnchors({ sections, props, emit, componentElRef }) {
67
71
  if (sectionToActivate && !sectionToActivate.active) {
68
72
  if (props.debug) console.log("Activating section:", sectionToActivate.title);
69
73
  nextTick(() => {
70
- removeActive(sectionToActivate);
74
+ removeActive(sectionToActivate, scrollDirection);
71
75
  sectionToActivate.active = true;
76
+ sectionToActivate.inactiveFrom = null;
77
+ sectionToActivate.activeFrom = scrollDirection === 'down' ? 'below' : 'above';
72
78
  emit("section-change", { section: sectionToActivate, sections: sections.value, active: true });
73
79
  });
74
80
  }
@@ -84,7 +90,7 @@ export function useScrollAnchors({ sections, props, emit, componentElRef }) {
84
90
  if ((isFirst && scrollDirection === 'up' && !props.firstItemActive) || (isLast && scrollDirection === 'down')) {
85
91
  if (props.debug) console.log("Deactivating section at edge:", activeSection.title);
86
92
  nextTick(() => {
87
- removeActive();
93
+ removeActive(null, scrollDirection);
88
94
  emit("section-change", { section: activeSection, sections: sections.value, active: false });
89
95
  });
90
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.1.3-beta.14",
3
+ "version": "0.1.3-beta.16",
4
4
  "description": "A modular and tree-shakeable Vue 3 component library for the Ulu frontend",
5
5
  "type": "module",
6
6
  "files": [