@likable-hair/svelte 3.1.9 → 3.1.10

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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  <script>import { afterUpdate, onMount } from "svelte";
4
4
  import "./TabSwitcher.css";
5
+ import { BROWSER } from "esm-env";
5
6
  let clazz = {};
6
7
  export { clazz as class };
7
8
  export let tabs = [], selected = void 0, mandatory = true;
@@ -37,12 +38,17 @@ function handleTabKeypress(clickedTab, nativeEvent) {
37
38
  });
38
39
  }
39
40
  function setBookmarkPosition() {
40
- let tabButton = selected ? tabButtons[selected] : void 0;
41
- if (tabButton) {
42
- bookmarkWidth = tabButton.offsetWidth - 10;
43
- bookmarkLeft = tabButton.offsetLeft + 5;
41
+ if (BROWSER) {
42
+ let tabButton = selected ? tabButtons[selected] : void 0;
43
+ if (tabButton) {
44
+ bookmarkWidth = tabButton.offsetWidth - 10;
45
+ bookmarkLeft = tabButton.offsetLeft + 5;
46
+ }
44
47
  }
45
48
  }
49
+ $:
50
+ if (!!selected)
51
+ setBookmarkPosition();
46
52
  </script>
47
53
 
48
54
  <div
@@ -50,6 +56,7 @@ function setBookmarkPosition() {
50
56
  >
51
57
  {#each tabs as tab}
52
58
  <div
59
+ role="presentation"
53
60
  class:selected-tab={tab.name == selected}
54
61
  class="tab-label {clazz.tabs || ''} {tab.name == selected ? clazz.selected || '' : ''}"
55
62
  on:click={(event) => handleTabClick(tab, event)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair and others",
4
- "version": "3.1.9",
4
+ "version": "3.1.10",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",