svelte-tweakpane-ui 1.3.2 → 1.3.3

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.
@@ -21,7 +21,7 @@
21
21
  />
22
22
  {/if}
23
23
 
24
- <div bind:this={sourceDiv} class="element">
24
+ <div bind:this={sourceDiv} class="element skip-element-index">
25
25
  <div
26
26
  class="element-container"
27
27
  style:height={BROWSER ? null : `${maxHeight}px`}
package/dist/utils.js CHANGED
@@ -84,7 +84,12 @@ export function getElementIndex(element) {
84
84
  // eslint-disable-next-line @typescript-eslint/ban-types
85
85
  let sibling = element;
86
86
  while ((sibling = sibling.previousElementSibling) !== null) {
87
- index++;
87
+ // The Element component can add extra stuff to the DOM which will mess up counting...
88
+ // So we add an extra class to its wrapper and don't let it increment the index.
89
+ // This was the cause of https://github.com/kitschpatrol/svelte-tweakpane-ui/issues/18
90
+ if (!sibling.classList.contains('skip-element-index')) {
91
+ index++;
92
+ }
88
93
  }
89
94
  return index;
90
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tweakpane-ui",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "description": "A Svelte component library wrapping UI elements from Tweakpane, plus some additional functionality for convenience and flexibility.",
6
6
  "repository": {