@v-c/slick 1.0.0 → 1.0.2

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/Track.cjs DELETED
@@ -1,314 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_innerSliderUtils = require("./utils/innerSliderUtils.cjs");
6
- let vue = require("vue");
7
- let _v_c_util = require("@v-c/util");
8
- let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
9
- function getSlideClasses(spec) {
10
- let slickActive = false;
11
- let slickCenter = false;
12
- let slickCloned = false;
13
- let index = spec.index;
14
- if (spec.rtl) index = spec.slideCount - 1 - index;
15
- slickCloned = index < 0 || index >= spec.slideCount;
16
- if (spec.centerMode) {
17
- const centerOffset = Math.floor(spec.slidesToShow / 2);
18
- slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
19
- if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) slickActive = true;
20
- } else slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
21
- let focusedSlide = 0;
22
- if (spec.targetSlide < 0) focusedSlide = spec.targetSlide + spec.slideCount;
23
- else if (spec.targetSlide >= spec.slideCount) focusedSlide = spec.targetSlide - spec.slideCount;
24
- else focusedSlide = spec.targetSlide;
25
- const slickCurrent = index === focusedSlide;
26
- return {
27
- "slick-slide": true,
28
- "slick-active": slickActive,
29
- "slick-center": slickCenter,
30
- "slick-cloned": slickCloned,
31
- "slick-current": slickCurrent
32
- };
33
- }
34
- function getSlideStyle(spec) {
35
- const style = {};
36
- if (spec.variableWidth === void 0 || spec.variableWidth === false) style.width = (0, _v_c_util_dist_props_util.getStylePxValue)(spec.slideWidth);
37
- if (spec.fade) {
38
- style.position = "relative";
39
- if (spec.vertical && spec.slideHeight) style.top = (0, _v_c_util_dist_props_util.getStylePxValue)(-spec.index * parseInt(String(spec.slideHeight), 10));
40
- else if (spec.slideWidth) style.left = (0, _v_c_util_dist_props_util.getStylePxValue)(-spec.index * parseInt(String(spec.slideWidth), 10));
41
- style.opacity = spec.currentSlide === spec.index ? 1 : 0;
42
- style.zIndex = spec.currentSlide === spec.index ? 999 : 998;
43
- if (spec.useCSS) style.transition = `opacity ${spec.speed}ms ${spec.cssEase}, visibility ${spec.speed}ms ${spec.cssEase}`;
44
- }
45
- return style;
46
- }
47
- function getKey(child, fallbackKey) {
48
- return `${child?.key ?? "slick"}-${fallbackKey}`;
49
- }
50
- function normalizeStyle(style) {
51
- if (!style) return {};
52
- if (Array.isArray(style)) return Object.assign({}, ...style);
53
- if (typeof style === "object") return style;
54
- return {};
55
- }
56
- function renderSlides(spec) {
57
- let key = 0;
58
- const slides = [];
59
- const preCloneSlides = [];
60
- const postCloneSlides = [];
61
- const childrenCount = Array.isArray(spec.children) ? spec.children.length : 0;
62
- const startIndex = require_innerSliderUtils.lazyStartIndex(spec);
63
- const endIndex = require_innerSliderUtils.lazyEndIndex(spec);
64
- (Array.isArray(spec.children) ? spec.children : []).forEach((elem, index) => {
65
- let child;
66
- const childOnClickOptions = {
67
- message: "children",
68
- index,
69
- slidesToScroll: spec.slidesToScroll,
70
- currentSlide: spec.currentSlide
71
- };
72
- if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.includes(index)) child = elem;
73
- else child = (0, vue.createVNode)("div", null, null);
74
- const childStyle = getSlideStyle({
75
- ...spec,
76
- index
77
- });
78
- const childProps = (0, vue.isVNode)(child) ? child.props ?? {} : {};
79
- const slideClass = childProps?.class ?? "";
80
- const slideClasses = getSlideClasses({
81
- ...spec,
82
- index
83
- });
84
- const clickHandler = (e) => {
85
- childProps?.onClick?.(e);
86
- if (spec.focusOnSelect) spec.focusOnSelect(childOnClickOptions);
87
- };
88
- slides.push((0, vue.cloneVNode)(child, {
89
- "key": `original${getKey(child, index)}`,
90
- "data-index": index,
91
- "class": (0, _v_c_util.clsx)(slideClasses, slideClass),
92
- "tabindex": -1,
93
- "aria-hidden": !slideClasses["slick-active"],
94
- "style": {
95
- outline: "none",
96
- ...normalizeStyle(childProps?.style),
97
- ...childStyle
98
- },
99
- "onClick": clickHandler
100
- }));
101
- if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
102
- const preCloneNo = childrenCount - index;
103
- if (preCloneNo <= require_innerSliderUtils.getPreClones(spec)) {
104
- key = -preCloneNo;
105
- if (key >= startIndex) child = elem;
106
- const preSlideClasses = getSlideClasses({
107
- ...spec,
108
- index: key
109
- });
110
- preCloneSlides.push((0, vue.cloneVNode)(child, {
111
- "key": `precloned${getKey(child, key)}`,
112
- "data-index": key,
113
- "tabindex": -1,
114
- "class": (0, _v_c_util.clsx)(preSlideClasses, slideClass),
115
- "aria-hidden": !preSlideClasses["slick-active"],
116
- "style": {
117
- ...normalizeStyle(childProps?.style),
118
- ...childStyle
119
- },
120
- "onClick": clickHandler
121
- }));
122
- }
123
- if (index < require_innerSliderUtils.getPostClones(spec)) {
124
- key = childrenCount + index;
125
- if (key < endIndex) child = elem;
126
- const postSlideClasses = getSlideClasses({
127
- ...spec,
128
- index: key
129
- });
130
- postCloneSlides.push((0, vue.cloneVNode)(child, {
131
- "key": `postcloned${getKey(child, key)}`,
132
- "data-index": key,
133
- "tabindex": -1,
134
- "class": (0, _v_c_util.clsx)(postSlideClasses, slideClass),
135
- "aria-hidden": !postSlideClasses["slick-active"],
136
- "style": {
137
- ...normalizeStyle(childProps?.style),
138
- ...childStyle
139
- },
140
- "onClick": clickHandler
141
- }));
142
- }
143
- }
144
- });
145
- if (spec.rtl) return preCloneSlides.concat(slides, postCloneSlides).reverse();
146
- return preCloneSlides.concat(slides, postCloneSlides);
147
- }
148
- var Track = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
149
- const setRef = (el) => {
150
- if (props.nodeRef) props.nodeRef.value = el;
151
- };
152
- return () => {
153
- const slides = renderSlides(props);
154
- return (0, vue.createVNode)("div", {
155
- "ref": setRef,
156
- "class": "slick-track",
157
- "style": props.trackStyle,
158
- "onMouseenter": props.onMouseEnter,
159
- "onMouseover": props.onMouseOver,
160
- "onMouseleave": props.onMouseLeave
161
- }, [slides]);
162
- };
163
- }, { props: {
164
- children: {
165
- type: Array,
166
- required: true,
167
- default: void 0
168
- },
169
- currentSlide: {
170
- type: Number,
171
- required: true,
172
- default: void 0
173
- },
174
- targetSlide: {
175
- type: Number,
176
- required: true,
177
- default: void 0
178
- },
179
- slideCount: {
180
- type: Number,
181
- required: true,
182
- default: void 0
183
- },
184
- slidesToShow: {
185
- type: Number,
186
- required: true,
187
- default: void 0
188
- },
189
- slidesToScroll: {
190
- type: Number,
191
- required: true,
192
- default: void 0
193
- },
194
- slideWidth: {
195
- type: [
196
- Number,
197
- String,
198
- null
199
- ],
200
- required: false,
201
- default: void 0
202
- },
203
- slideHeight: {
204
- type: [Number, null],
205
- required: false,
206
- default: void 0
207
- },
208
- listHeight: {
209
- type: [Number, null],
210
- required: false,
211
- default: void 0
212
- },
213
- fade: {
214
- type: Boolean,
215
- required: false,
216
- default: void 0
217
- },
218
- cssEase: {
219
- type: String,
220
- required: false,
221
- default: void 0
222
- },
223
- speed: {
224
- type: Number,
225
- required: false,
226
- default: void 0
227
- },
228
- infinite: {
229
- type: Boolean,
230
- required: false,
231
- default: void 0
232
- },
233
- centerMode: {
234
- type: Boolean,
235
- required: false,
236
- default: void 0
237
- },
238
- focusOnSelect: {
239
- type: Function,
240
- required: false,
241
- default: void 0
242
- },
243
- lazyLoad: {
244
- type: [
245
- String,
246
- Boolean,
247
- null
248
- ],
249
- required: false,
250
- default: void 0
251
- },
252
- lazyLoadedList: {
253
- type: Array,
254
- required: true,
255
- default: void 0
256
- },
257
- rtl: {
258
- type: Boolean,
259
- required: false,
260
- default: void 0
261
- },
262
- vertical: {
263
- type: Boolean,
264
- required: false,
265
- default: void 0
266
- },
267
- variableWidth: {
268
- type: Boolean,
269
- required: false,
270
- default: void 0
271
- },
272
- unslick: {
273
- type: Boolean,
274
- required: false,
275
- default: void 0
276
- },
277
- centerPadding: {
278
- type: String,
279
- required: false,
280
- default: void 0
281
- },
282
- trackStyle: {
283
- type: Object,
284
- required: false,
285
- default: void 0
286
- },
287
- useCSS: {
288
- type: Boolean,
289
- required: false,
290
- default: void 0
291
- },
292
- onMouseEnter: {
293
- type: Function,
294
- required: false,
295
- default: void 0
296
- },
297
- onMouseOver: {
298
- type: Function,
299
- required: false,
300
- default: void 0
301
- },
302
- onMouseLeave: {
303
- type: Function,
304
- required: false,
305
- default: void 0
306
- },
307
- nodeRef: {
308
- type: Object,
309
- required: false,
310
- default: void 0
311
- }
312
- } });
313
- var Track_default = Track;
314
- exports.default = Track_default;
@@ -1,62 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- let vue = require("vue");
6
- var defaultProps = {
7
- accessibility: true,
8
- adaptiveHeight: false,
9
- afterChange: null,
10
- appendDots: (dots) => (0, vue.createVNode)("ul", { "style": { display: "block" } }, [dots]),
11
- arrows: true,
12
- autoplay: false,
13
- autoplaySpeed: 3e3,
14
- beforeChange: null,
15
- centerMode: false,
16
- centerPadding: "50px",
17
- className: "",
18
- cssEase: "ease",
19
- customPaging: (i) => (0, vue.createVNode)("button", null, [i + 1]),
20
- dots: false,
21
- dotsClass: "slick-dots",
22
- draggable: true,
23
- easing: "linear",
24
- edgeFriction: .35,
25
- fade: false,
26
- focusOnSelect: false,
27
- infinite: true,
28
- initialSlide: 0,
29
- lazyLoad: null,
30
- nextArrow: null,
31
- onEdge: null,
32
- onInit: null,
33
- onLazyLoadError: null,
34
- onReInit: null,
35
- pauseOnDotsHover: false,
36
- pauseOnFocus: false,
37
- pauseOnHover: true,
38
- prevArrow: null,
39
- responsive: null,
40
- rows: 1,
41
- rtl: false,
42
- slide: "div",
43
- slidesPerRow: 1,
44
- slidesToScroll: 1,
45
- slidesToShow: 1,
46
- speed: 500,
47
- swipe: true,
48
- swipeEvent: null,
49
- swipeToSlide: false,
50
- touchMove: true,
51
- touchThreshold: 5,
52
- useCSS: true,
53
- useTransform: true,
54
- variableWidth: false,
55
- vertical: false,
56
- verticalSwiping: false,
57
- waitForAnimate: true,
58
- asNavFor: null,
59
- unslick: false
60
- };
61
- var default_props_default = defaultProps;
62
- exports.default = default_props_default;
package/dist/index.cjs DELETED
@@ -1,7 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_Slider = require("./Slider.cjs");
6
- var src_default = require_Slider.default;
7
- exports.default = src_default;
@@ -1,36 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- var initialState = {
6
- animating: false,
7
- autoplaying: null,
8
- currentDirection: 0,
9
- currentLeft: null,
10
- currentSlide: 0,
11
- direction: 1,
12
- dragging: false,
13
- edgeDragged: false,
14
- initialized: false,
15
- lazyLoadedList: [],
16
- listHeight: null,
17
- listWidth: null,
18
- scrolling: false,
19
- slideCount: 0,
20
- slideHeight: null,
21
- slideWidth: null,
22
- swipeLeft: null,
23
- swiped: false,
24
- swiping: false,
25
- touchObject: {
26
- startX: 0,
27
- startY: 0,
28
- curX: 0,
29
- curY: 0
30
- },
31
- trackStyle: {},
32
- trackWidth: 0,
33
- targetSlide: 0
34
- };
35
- var initial_state_default = initialState;
36
- exports.default = initial_state_default;
@@ -1 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });