@y14e/tabs 1.5.5 → 1.5.6
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/README.md +4 -4
- package/dist/index.cjs +8 -13
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/tabs
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import Tabs from '@y14e/tabs@1.5.
|
|
13
|
+
import Tabs from '@y14e/tabs@1.5.6';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Tabs from 'https://esm.sh/@y14e/tabs@1.5.
|
|
16
|
+
import Tabs from 'https://esm.sh/@y14e/tabs@1.5.6';
|
|
17
17
|
// or
|
|
18
|
-
import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs@1.5.
|
|
18
|
+
import Tabs from 'https://cdn.jsdelivr.net/npm/@y14e/tabs@1.5.6/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import Tabs from 'https://esm.unpkg.com/@y14e/tabs@1.5.
|
|
20
|
+
import Tabs from 'https://esm.unpkg.com/@y14e/tabs@1.5.6';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -761,14 +761,14 @@ var Tabs = class _Tabs {
|
|
|
761
761
|
const { style } = this.#contentElement;
|
|
762
762
|
style.setProperty("overflow", "clip");
|
|
763
763
|
style.setProperty("position", "relative");
|
|
764
|
-
const {
|
|
764
|
+
const { crossFade, fade } = this.#settings.animation.content;
|
|
765
765
|
const panel = this.#bindings.get(tab)?.panel;
|
|
766
766
|
if (!panel) {
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
769
|
this.#panelElements.forEach((p) => {
|
|
770
770
|
const { style: style2 } = p;
|
|
771
|
-
if (
|
|
771
|
+
if (crossFade || fade) {
|
|
772
772
|
style2.setProperty("content-visibility", "visible");
|
|
773
773
|
style2.setProperty("display", "block");
|
|
774
774
|
style2.setProperty("opacity", p.hidden ? "0" : "1");
|
|
@@ -835,7 +835,7 @@ var Tabs = class _Tabs {
|
|
|
835
835
|
opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
|
|
836
836
|
},
|
|
837
837
|
{
|
|
838
|
-
duration: isMatch || !(
|
|
838
|
+
duration: isMatch || !(crossFade || fade) ? 0 : this.#settings.animation.content.duration,
|
|
839
839
|
easing: "ease"
|
|
840
840
|
}
|
|
841
841
|
);
|
|
@@ -888,10 +888,7 @@ var Tabs = class _Tabs {
|
|
|
888
888
|
);
|
|
889
889
|
}
|
|
890
890
|
this.#panelElements.forEach((panel) => {
|
|
891
|
-
|
|
892
|
-
if (animation) {
|
|
893
|
-
animation.cancel();
|
|
894
|
-
}
|
|
891
|
+
this.#bindings.get(panel)?.animation?.cancel();
|
|
895
892
|
});
|
|
896
893
|
this.#onAnimationFinish();
|
|
897
894
|
this.#animationController?.abort();
|
|
@@ -973,11 +970,9 @@ var Tabs = class _Tabs {
|
|
|
973
970
|
});
|
|
974
971
|
const options = { selector: this.#settings.selector.tab, wrap: true };
|
|
975
972
|
this.#listElements.forEach((list) => {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
});
|
|
980
|
-
}
|
|
973
|
+
list.ariaOrientation !== "undefined" && Object.assign(options, {
|
|
974
|
+
direction: this.#settings.vertical ? "vertical" : "horizontal"
|
|
975
|
+
});
|
|
981
976
|
this.#cleanupsRovingTabIndex.push(createRovingTabIndex(list, options));
|
|
982
977
|
list.querySelectorAll(this.#settings.selector.tab).forEach((tab) => {
|
|
983
978
|
tab.setAttribute(
|
|
@@ -1145,7 +1140,7 @@ function isFocusable2(element) {
|
|
|
1145
1140
|
* Tabs
|
|
1146
1141
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1147
1142
|
*
|
|
1148
|
-
* @version 1.5.
|
|
1143
|
+
* @version 1.5.6
|
|
1149
1144
|
* @author Yusuke Kamiyamane
|
|
1150
1145
|
* @license MIT
|
|
1151
1146
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -759,14 +759,14 @@ var Tabs = class _Tabs {
|
|
|
759
759
|
const { style } = this.#contentElement;
|
|
760
760
|
style.setProperty("overflow", "clip");
|
|
761
761
|
style.setProperty("position", "relative");
|
|
762
|
-
const {
|
|
762
|
+
const { crossFade, fade } = this.#settings.animation.content;
|
|
763
763
|
const panel = this.#bindings.get(tab)?.panel;
|
|
764
764
|
if (!panel) {
|
|
765
765
|
return;
|
|
766
766
|
}
|
|
767
767
|
this.#panelElements.forEach((p) => {
|
|
768
768
|
const { style: style2 } = p;
|
|
769
|
-
if (
|
|
769
|
+
if (crossFade || fade) {
|
|
770
770
|
style2.setProperty("content-visibility", "visible");
|
|
771
771
|
style2.setProperty("display", "block");
|
|
772
772
|
style2.setProperty("opacity", p.hidden ? "0" : "1");
|
|
@@ -833,7 +833,7 @@ var Tabs = class _Tabs {
|
|
|
833
833
|
opacity: fade ? isSelected ? [opacity, opacity, "1"] : [opacity, "0", "0"] : isSelected ? [opacity, "1"] : [opacity, "0"]
|
|
834
834
|
},
|
|
835
835
|
{
|
|
836
|
-
duration: isMatch || !(
|
|
836
|
+
duration: isMatch || !(crossFade || fade) ? 0 : this.#settings.animation.content.duration,
|
|
837
837
|
easing: "ease"
|
|
838
838
|
}
|
|
839
839
|
);
|
|
@@ -886,10 +886,7 @@ var Tabs = class _Tabs {
|
|
|
886
886
|
);
|
|
887
887
|
}
|
|
888
888
|
this.#panelElements.forEach((panel) => {
|
|
889
|
-
|
|
890
|
-
if (animation) {
|
|
891
|
-
animation.cancel();
|
|
892
|
-
}
|
|
889
|
+
this.#bindings.get(panel)?.animation?.cancel();
|
|
893
890
|
});
|
|
894
891
|
this.#onAnimationFinish();
|
|
895
892
|
this.#animationController?.abort();
|
|
@@ -971,11 +968,9 @@ var Tabs = class _Tabs {
|
|
|
971
968
|
});
|
|
972
969
|
const options = { selector: this.#settings.selector.tab, wrap: true };
|
|
973
970
|
this.#listElements.forEach((list) => {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
});
|
|
978
|
-
}
|
|
971
|
+
list.ariaOrientation !== "undefined" && Object.assign(options, {
|
|
972
|
+
direction: this.#settings.vertical ? "vertical" : "horizontal"
|
|
973
|
+
});
|
|
979
974
|
this.#cleanupsRovingTabIndex.push(createRovingTabIndex(list, options));
|
|
980
975
|
list.querySelectorAll(this.#settings.selector.tab).forEach((tab) => {
|
|
981
976
|
tab.setAttribute(
|
|
@@ -1143,7 +1138,7 @@ function isFocusable2(element) {
|
|
|
1143
1138
|
* Tabs
|
|
1144
1139
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
1145
1140
|
*
|
|
1146
|
-
* @version 1.5.
|
|
1141
|
+
* @version 1.5.6
|
|
1147
1142
|
* @author Yusuke Kamiyamane
|
|
1148
1143
|
* @license MIT
|
|
1149
1144
|
* @copyright Copyright (c) Yusuke Kamiyamane
|