@kiva/kv-components 3.105.3 → 3.107.0

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/.eslintrc.cjs CHANGED
@@ -7,6 +7,7 @@ module.exports = {
7
7
  '../../.eslintrc.cjs',
8
8
  'plugin:vue/recommended',
9
9
  ],
10
+ ignorePatterns: ["dist/*"],
10
11
  plugins: [
11
12
  'vue',
12
13
  ],
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.107.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.106.0...@kiva/kv-components@3.107.0) (2024-11-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * compile kv-component utils ([7b41391](https://github.com/kiva/kv-ui-elements/commit/7b413912c3bcf2659e729072fe1705427a78c1ba))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.106.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.105.3...@kiva/kv-components@3.106.0) (2024-11-01)
18
+
19
+
20
+ ### Features
21
+
22
+ * basic vertical carousel ([6a40563](https://github.com/kiva/kv-ui-elements/commit/6a405637ee4186d3cb5a7dbf71f87d8a04d46d86))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [3.105.3](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.105.2...@kiva/kv-components@3.105.3) (2024-10-28)
7
29
 
8
30
  **Note:** Version bump only for package @kiva/kv-components
package/dist/Alea.cjs ADDED
@@ -0,0 +1,87 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/Alea.js
20
+ var Alea_exports = {};
21
+ __export(Alea_exports, {
22
+ Mash: () => Mash,
23
+ default: () => Alea
24
+ });
25
+ module.exports = __toCommonJS(Alea_exports);
26
+ function Mash() {
27
+ let n = 4022871197;
28
+ const mash = function(data) {
29
+ data = data.toString();
30
+ for (let i = 0; i < data.length; i++) {
31
+ n += data.charCodeAt(i);
32
+ let h = 0.02519603282416938 * n;
33
+ n = h >>> 0;
34
+ h -= n;
35
+ h *= n;
36
+ n = h >>> 0;
37
+ h -= n;
38
+ n += h * 4294967296;
39
+ }
40
+ return (n >>> 0) * 23283064365386963e-26;
41
+ };
42
+ mash.version = "Mash 0.9";
43
+ return mash;
44
+ }
45
+ function Alea() {
46
+ return function(args) {
47
+ let s0 = 0;
48
+ let s1 = 0;
49
+ let s2 = 0;
50
+ let c = 1;
51
+ if (args.length === 0) {
52
+ args = [+/* @__PURE__ */ new Date()];
53
+ }
54
+ let mash = Mash();
55
+ s0 = mash(" ");
56
+ s1 = mash(" ");
57
+ s2 = mash(" ");
58
+ for (let i = 0; i < args.length; i++) {
59
+ s0 -= mash(args[i]);
60
+ if (s0 < 0) {
61
+ s0 += 1;
62
+ }
63
+ s1 -= mash(args[i]);
64
+ if (s1 < 0) {
65
+ s1 += 1;
66
+ }
67
+ s2 -= mash(args[i]);
68
+ if (s2 < 0) {
69
+ s2 += 1;
70
+ }
71
+ }
72
+ mash = null;
73
+ const random = function() {
74
+ const t = 2091639 * s0 + c * 23283064365386963e-26;
75
+ s0 = s1;
76
+ s1 = s2;
77
+ return s2 = t - (c = t | 0);
78
+ };
79
+ random.version = "Alea 0.9";
80
+ random.args = args;
81
+ return random;
82
+ }(Array.prototype.slice.call(arguments));
83
+ }
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ Mash
87
+ });
package/dist/Alea.js ADDED
@@ -0,0 +1,63 @@
1
+ // utils/Alea.js
2
+ function Mash() {
3
+ let n = 4022871197;
4
+ const mash = function(data) {
5
+ data = data.toString();
6
+ for (let i = 0; i < data.length; i++) {
7
+ n += data.charCodeAt(i);
8
+ let h = 0.02519603282416938 * n;
9
+ n = h >>> 0;
10
+ h -= n;
11
+ h *= n;
12
+ n = h >>> 0;
13
+ h -= n;
14
+ n += h * 4294967296;
15
+ }
16
+ return (n >>> 0) * 23283064365386963e-26;
17
+ };
18
+ mash.version = "Mash 0.9";
19
+ return mash;
20
+ }
21
+ function Alea() {
22
+ return function(args) {
23
+ let s0 = 0;
24
+ let s1 = 0;
25
+ let s2 = 0;
26
+ let c = 1;
27
+ if (args.length === 0) {
28
+ args = [+/* @__PURE__ */ new Date()];
29
+ }
30
+ let mash = Mash();
31
+ s0 = mash(" ");
32
+ s1 = mash(" ");
33
+ s2 = mash(" ");
34
+ for (let i = 0; i < args.length; i++) {
35
+ s0 -= mash(args[i]);
36
+ if (s0 < 0) {
37
+ s0 += 1;
38
+ }
39
+ s1 -= mash(args[i]);
40
+ if (s1 < 0) {
41
+ s1 += 1;
42
+ }
43
+ s2 -= mash(args[i]);
44
+ if (s2 < 0) {
45
+ s2 += 1;
46
+ }
47
+ }
48
+ mash = null;
49
+ const random = function() {
50
+ const t = 2091639 * s0 + c * 23283064365386963e-26;
51
+ s0 = s1;
52
+ s1 = s2;
53
+ return s2 = t - (c = t | 0);
54
+ };
55
+ random.version = "Alea 0.9";
56
+ random.args = args;
57
+ return random;
58
+ }(Array.prototype.slice.call(arguments));
59
+ }
60
+ export {
61
+ Mash,
62
+ Alea as default
63
+ };
package/dist/attrs.cjs ADDED
@@ -0,0 +1,50 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/attrs.js
20
+ var attrs_exports = {};
21
+ __export(attrs_exports, {
22
+ useAttrs: () => useAttrs
23
+ });
24
+ module.exports = __toCommonJS(attrs_exports);
25
+ function asArray(input) {
26
+ if (!input)
27
+ return [];
28
+ return Array.isArray(input) ? input : [input];
29
+ }
30
+ function useAttrs({ attrs, listeners }, ownEvents = []) {
31
+ const classes = asArray(attrs == null ? void 0 : attrs.class);
32
+ const styles = asArray(attrs == null ? void 0 : attrs.style);
33
+ const inputListeners = listeners ? { ...listeners } : {};
34
+ ownEvents.forEach((event) => {
35
+ delete inputListeners[event];
36
+ });
37
+ const inputAttrs = { ...attrs };
38
+ delete inputAttrs.class;
39
+ delete inputAttrs.style;
40
+ return {
41
+ classes,
42
+ styles,
43
+ inputAttrs,
44
+ inputListeners
45
+ };
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ useAttrs
50
+ });
package/dist/attrs.js ADDED
@@ -0,0 +1,26 @@
1
+ // utils/attrs.js
2
+ function asArray(input) {
3
+ if (!input)
4
+ return [];
5
+ return Array.isArray(input) ? input : [input];
6
+ }
7
+ function useAttrs({ attrs, listeners }, ownEvents = []) {
8
+ const classes = asArray(attrs == null ? void 0 : attrs.class);
9
+ const styles = asArray(attrs == null ? void 0 : attrs.style);
10
+ const inputListeners = listeners ? { ...listeners } : {};
11
+ ownEvents.forEach((event) => {
12
+ delete inputListeners[event];
13
+ });
14
+ const inputAttrs = { ...attrs };
15
+ delete inputAttrs.class;
16
+ delete inputAttrs.style;
17
+ return {
18
+ classes,
19
+ styles,
20
+ inputAttrs,
21
+ inputListeners
22
+ };
23
+ }
24
+ export {
25
+ useAttrs
26
+ };
@@ -0,0 +1,184 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // utils/carousels.js
30
+ var carousels_exports = {};
31
+ __export(carousels_exports, {
32
+ carouselUtil: () => carouselUtil
33
+ });
34
+ module.exports = __toCommonJS(carousels_exports);
35
+ var import_vue_demi = require("vue-demi");
36
+ var import_embla_carousel = __toESM(require("embla-carousel"), 1);
37
+
38
+ // utils/throttle.js
39
+ function throttle(func, timeFrame) {
40
+ let lastTime = 0;
41
+ return function t(...args) {
42
+ const now = /* @__PURE__ */ new Date();
43
+ if (now - lastTime >= timeFrame) {
44
+ func(...args);
45
+ lastTime = now;
46
+ }
47
+ };
48
+ }
49
+
50
+ // utils/carousels.js
51
+ function carouselUtil(props, { emit, slots }, extraEmblaOptions) {
52
+ var _a;
53
+ const {
54
+ emblaOptions,
55
+ slidesToScroll
56
+ } = (0, import_vue_demi.toRefs)(props);
57
+ const rootEl = (0, import_vue_demi.ref)(null);
58
+ const embla = (0, import_vue_demi.ref)(null);
59
+ const slides = (0, import_vue_demi.ref)([]);
60
+ const startIndex = ((_a = emblaOptions.value) == null ? void 0 : _a.startIndex) ?? 0;
61
+ const currentIndex = (0, import_vue_demi.ref)(startIndex);
62
+ const slideIndicatorCount = (0, import_vue_demi.ref)(0);
63
+ const componentSlotKeys = (0, import_vue_demi.computed)(() => {
64
+ const keys = Object.keys(slots);
65
+ return keys;
66
+ });
67
+ const nextIndex = (0, import_vue_demi.computed)(() => {
68
+ const nextSlideIndex = currentIndex.value + 1;
69
+ if (nextSlideIndex < slides.value.length) {
70
+ return nextSlideIndex;
71
+ }
72
+ return 0;
73
+ });
74
+ const previousIndex = (0, import_vue_demi.computed)(() => {
75
+ const previousSlideIndex = currentIndex.value - 1;
76
+ if (previousSlideIndex >= 0) {
77
+ return previousSlideIndex;
78
+ }
79
+ return slides.value.length - 1;
80
+ });
81
+ const goToSlide = (index) => {
82
+ embla.value.scrollTo(index);
83
+ };
84
+ const handleUserInteraction = async (index, interactionType) => {
85
+ if (index !== null && typeof index !== "undefined") {
86
+ await (0, import_vue_demi.nextTick)();
87
+ goToSlide(index);
88
+ }
89
+ emit("interact-carousel", interactionType);
90
+ };
91
+ const slideIndicatorListLength = () => {
92
+ const indicator = embla.value ? embla.value.scrollSnapList().length : 0;
93
+ slideIndicatorCount.value = indicator;
94
+ return indicator;
95
+ };
96
+ const reInitVisible = () => {
97
+ const slidesInView = embla.value.slidesInView(true).length;
98
+ if (slidesInView) {
99
+ embla.value.reInit({
100
+ slidesToScroll: slidesInView,
101
+ inViewThreshold: 0.9
102
+ });
103
+ }
104
+ };
105
+ const reInit = () => {
106
+ embla.value.reInit();
107
+ if (slidesToScroll.value === "visible") {
108
+ reInitVisible();
109
+ }
110
+ slides.value = embla.value.slideNodes();
111
+ slideIndicatorListLength();
112
+ };
113
+ const onCarouselContainerClick = (e) => {
114
+ if (embla.value && !embla.value.clickAllowed()) {
115
+ e.preventDefault();
116
+ e.stopPropagation();
117
+ }
118
+ };
119
+ const isAriaHidden = (index) => {
120
+ if (embla.value) {
121
+ return !embla.value.slidesInView(true).includes(index);
122
+ }
123
+ return false;
124
+ };
125
+ (0, import_vue_demi.onMounted)(async () => {
126
+ var _a2;
127
+ embla.value = (0, import_embla_carousel.default)(rootEl.value, {
128
+ loop: true,
129
+ containScroll: "trimSnaps",
130
+ inViewThreshold: 0.9,
131
+ align: "start",
132
+ ...extraEmblaOptions,
133
+ ...emblaOptions.value
134
+ });
135
+ if (slidesToScroll.value === "visible") {
136
+ reInitVisible();
137
+ embla.value.on(
138
+ "resize",
139
+ throttle(() => {
140
+ embla.value.reInit({
141
+ slidesToScroll: embla.value.slidesInView(true).length || "auto",
142
+ inViewThreshold: 0.9
143
+ });
144
+ slides.value = embla.value.slideNodes();
145
+ slideIndicatorListLength();
146
+ }, 250)
147
+ );
148
+ }
149
+ slides.value = embla.value.slideNodes();
150
+ slideIndicatorListLength();
151
+ (_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.on("select", () => {
152
+ currentIndex.value = embla.value.selectedScrollSnap();
153
+ (0, import_vue_demi.nextTick)(() => {
154
+ emit("change", currentIndex);
155
+ });
156
+ });
157
+ });
158
+ (0, import_vue_demi.onUnmounted)(async () => {
159
+ var _a2, _b;
160
+ (_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.off("select");
161
+ (_b = embla == null ? void 0 : embla.value) == null ? void 0 : _b.destroy();
162
+ });
163
+ return {
164
+ rootEl,
165
+ embla,
166
+ slides,
167
+ currentIndex,
168
+ componentSlotKeys,
169
+ nextIndex,
170
+ previousIndex,
171
+ slideIndicatorCount,
172
+ handleUserInteraction,
173
+ goToSlide,
174
+ reInit,
175
+ reInitVisible,
176
+ onCarouselContainerClick,
177
+ isAriaHidden,
178
+ slideIndicatorListLength
179
+ };
180
+ }
181
+ // Annotate the CommonJS export names for ESM import in node:
182
+ 0 && (module.exports = {
183
+ carouselUtil
184
+ });
@@ -0,0 +1,147 @@
1
+ import {
2
+ throttle
3
+ } from "./chunk-HV3AUBFT.js";
4
+
5
+ // utils/carousels.js
6
+ import {
7
+ computed,
8
+ onMounted,
9
+ onUnmounted,
10
+ ref,
11
+ toRefs,
12
+ nextTick
13
+ } from "vue-demi";
14
+ import EmblaCarousel from "embla-carousel";
15
+ function carouselUtil(props, { emit, slots }, extraEmblaOptions) {
16
+ var _a;
17
+ const {
18
+ emblaOptions,
19
+ slidesToScroll
20
+ } = toRefs(props);
21
+ const rootEl = ref(null);
22
+ const embla = ref(null);
23
+ const slides = ref([]);
24
+ const startIndex = ((_a = emblaOptions.value) == null ? void 0 : _a.startIndex) ?? 0;
25
+ const currentIndex = ref(startIndex);
26
+ const slideIndicatorCount = ref(0);
27
+ const componentSlotKeys = computed(() => {
28
+ const keys = Object.keys(slots);
29
+ return keys;
30
+ });
31
+ const nextIndex = computed(() => {
32
+ const nextSlideIndex = currentIndex.value + 1;
33
+ if (nextSlideIndex < slides.value.length) {
34
+ return nextSlideIndex;
35
+ }
36
+ return 0;
37
+ });
38
+ const previousIndex = computed(() => {
39
+ const previousSlideIndex = currentIndex.value - 1;
40
+ if (previousSlideIndex >= 0) {
41
+ return previousSlideIndex;
42
+ }
43
+ return slides.value.length - 1;
44
+ });
45
+ const goToSlide = (index) => {
46
+ embla.value.scrollTo(index);
47
+ };
48
+ const handleUserInteraction = async (index, interactionType) => {
49
+ if (index !== null && typeof index !== "undefined") {
50
+ await nextTick();
51
+ goToSlide(index);
52
+ }
53
+ emit("interact-carousel", interactionType);
54
+ };
55
+ const slideIndicatorListLength = () => {
56
+ const indicator = embla.value ? embla.value.scrollSnapList().length : 0;
57
+ slideIndicatorCount.value = indicator;
58
+ return indicator;
59
+ };
60
+ const reInitVisible = () => {
61
+ const slidesInView = embla.value.slidesInView(true).length;
62
+ if (slidesInView) {
63
+ embla.value.reInit({
64
+ slidesToScroll: slidesInView,
65
+ inViewThreshold: 0.9
66
+ });
67
+ }
68
+ };
69
+ const reInit = () => {
70
+ embla.value.reInit();
71
+ if (slidesToScroll.value === "visible") {
72
+ reInitVisible();
73
+ }
74
+ slides.value = embla.value.slideNodes();
75
+ slideIndicatorListLength();
76
+ };
77
+ const onCarouselContainerClick = (e) => {
78
+ if (embla.value && !embla.value.clickAllowed()) {
79
+ e.preventDefault();
80
+ e.stopPropagation();
81
+ }
82
+ };
83
+ const isAriaHidden = (index) => {
84
+ if (embla.value) {
85
+ return !embla.value.slidesInView(true).includes(index);
86
+ }
87
+ return false;
88
+ };
89
+ onMounted(async () => {
90
+ var _a2;
91
+ embla.value = EmblaCarousel(rootEl.value, {
92
+ loop: true,
93
+ containScroll: "trimSnaps",
94
+ inViewThreshold: 0.9,
95
+ align: "start",
96
+ ...extraEmblaOptions,
97
+ ...emblaOptions.value
98
+ });
99
+ if (slidesToScroll.value === "visible") {
100
+ reInitVisible();
101
+ embla.value.on(
102
+ "resize",
103
+ throttle(() => {
104
+ embla.value.reInit({
105
+ slidesToScroll: embla.value.slidesInView(true).length || "auto",
106
+ inViewThreshold: 0.9
107
+ });
108
+ slides.value = embla.value.slideNodes();
109
+ slideIndicatorListLength();
110
+ }, 250)
111
+ );
112
+ }
113
+ slides.value = embla.value.slideNodes();
114
+ slideIndicatorListLength();
115
+ (_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.on("select", () => {
116
+ currentIndex.value = embla.value.selectedScrollSnap();
117
+ nextTick(() => {
118
+ emit("change", currentIndex);
119
+ });
120
+ });
121
+ });
122
+ onUnmounted(async () => {
123
+ var _a2, _b;
124
+ (_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.off("select");
125
+ (_b = embla == null ? void 0 : embla.value) == null ? void 0 : _b.destroy();
126
+ });
127
+ return {
128
+ rootEl,
129
+ embla,
130
+ slides,
131
+ currentIndex,
132
+ componentSlotKeys,
133
+ nextIndex,
134
+ previousIndex,
135
+ slideIndicatorCount,
136
+ handleUserInteraction,
137
+ goToSlide,
138
+ reInit,
139
+ reInitVisible,
140
+ onCarouselContainerClick,
141
+ isAriaHidden,
142
+ slideIndicatorListLength
143
+ };
144
+ }
145
+ export {
146
+ carouselUtil
147
+ };
@@ -0,0 +1,15 @@
1
+ // utils/throttle.js
2
+ function throttle(func, timeFrame) {
3
+ let lastTime = 0;
4
+ return function t(...args) {
5
+ const now = /* @__PURE__ */ new Date();
6
+ if (now - lastTime >= timeFrame) {
7
+ func(...args);
8
+ lastTime = now;
9
+ }
10
+ };
11
+ }
12
+
13
+ export {
14
+ throttle
15
+ };
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/expander.js
20
+ var expander_exports = {};
21
+ __export(expander_exports, {
22
+ collapse: () => collapse,
23
+ expand: () => expand
24
+ });
25
+ module.exports = __toCommonJS(expander_exports);
26
+ function setInitialStyle(el, { property, delay, easing }) {
27
+ el.style.overflow = "hidden";
28
+ el.style.transition = `${property} ${delay}ms ${easing}`;
29
+ }
30
+ function unsetStyles(el, { property }) {
31
+ el.style[property] = null;
32
+ el.style.overflow = null;
33
+ el.style.transition = null;
34
+ }
35
+ function expand(el, {
36
+ easing = "ease",
37
+ delay = 500,
38
+ done = () => {
39
+ },
40
+ from = 0,
41
+ property = "height"
42
+ }) {
43
+ setInitialStyle(el, { property, delay, easing });
44
+ el.style[property] = "auto";
45
+ el.style.display = null;
46
+ const propValue = window.getComputedStyle(el).getPropertyValue(property);
47
+ el.style[property] = from;
48
+ el.addEventListener("transitionend", function listener() {
49
+ unsetStyles(el, { property });
50
+ done();
51
+ el.removeEventListener("transitionend", listener, true);
52
+ }, true);
53
+ void el.offsetWidth;
54
+ el.style[property] = propValue;
55
+ }
56
+ function collapse(el, {
57
+ easing = "ease",
58
+ delay = 500,
59
+ done = () => {
60
+ },
61
+ to = 0,
62
+ property = "height"
63
+ }) {
64
+ setInitialStyle(el, { property, delay, easing });
65
+ el.style[property] = window.getComputedStyle(el).getPropertyValue(property);
66
+ el.addEventListener("transitionend", function listener() {
67
+ unsetStyles(el, { property });
68
+ done();
69
+ el.removeEventListener("transitionend", listener, true);
70
+ }, true);
71
+ void el.offsetWidth;
72
+ el.style[property] = to;
73
+ }
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ collapse,
77
+ expand
78
+ });