@tekkare/romulus 0.1.328 → 0.1.329

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.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.327",
7
+ "version": "0.1.328",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -96,12 +96,31 @@ function select(chapter: RmChapter) {
96
96
  emit('select', chapter.value)
97
97
  const section = document.getElementById(chapter.value)
98
98
  if (!section) return
99
+ // Dans le cadre OIP 7 la fenetre ne defile pas : c'est la zone principale
100
+ // (`.rm-shell__main`, overflow auto) qui porte le defilement. On fait donc
101
+ // defiler le premier ancetre qui defile vraiment, la fenetre a defaut.
102
+ const scroller = scrollParent(section)
103
+ if (scroller) {
104
+ scroller.scrollTo({
105
+ top: section.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop - props.offset,
106
+ behavior: 'smooth',
107
+ })
108
+ return
109
+ }
99
110
  window.scrollTo({
100
111
  top: section.getBoundingClientRect().top + window.scrollY - props.offset,
101
112
  behavior: 'smooth',
102
113
  })
103
114
  }
104
115
 
116
+ function scrollParent(el: HTMLElement): HTMLElement | null {
117
+ for (let node = el.parentElement; node && node !== document.body; node = node.parentElement) {
118
+ const { overflowY } = getComputedStyle(node)
119
+ if ((overflowY === 'auto' || overflowY === 'scroll') && node.scrollHeight > node.clientHeight) return node
120
+ }
121
+ return null
122
+ }
123
+
105
124
  onMounted(() => {
106
125
  observe()
107
126
  placeBar()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.328",
3
+ "version": "0.1.329",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",