@kupola/kupola 1.2.0 → 1.4.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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +330 -286
  3. package/adapters/axios.d.ts +34 -0
  4. package/adapters/axios.js +122 -0
  5. package/adapters/navios-http.d.ts +110 -0
  6. package/adapters/navios-http.js +151 -0
  7. package/css/components-ext.css +157 -0
  8. package/css/components.css +69 -0
  9. package/css/theme-dark.css +5 -5
  10. package/css/utilities.css +119 -1
  11. package/dist/css/accessibility.css +119 -0
  12. package/dist/css/animations.css +224 -0
  13. package/dist/css/brand-themes.css +300 -0
  14. package/dist/css/colors_and_type.css +441 -0
  15. package/dist/css/components-ext.css +4165 -0
  16. package/dist/css/components.css +1483 -0
  17. package/dist/css/kupola.css +1 -12
  18. package/dist/css/kupola.min.css +1 -0
  19. package/dist/css/responsive.css +697 -0
  20. package/dist/css/scaffold.css +145 -0
  21. package/dist/css/states.css +316 -0
  22. package/dist/css/theme-dark.css +296 -0
  23. package/dist/css/theme-light.css +296 -0
  24. package/dist/css/utilities.css +171 -0
  25. package/dist/icons.svg +284 -0
  26. package/dist/kupola.cjs.js +17409 -257
  27. package/dist/kupola.cjs.js.map +1 -1
  28. package/dist/kupola.css +9000 -0
  29. package/dist/kupola.esm.js +17183 -7597
  30. package/dist/kupola.esm.js.map +1 -1
  31. package/dist/kupola.min.css +1 -0
  32. package/dist/kupola.min.js +2 -0
  33. package/dist/kupola.min.js.map +1 -0
  34. package/dist/kupola.umd.js +17415 -257
  35. package/dist/kupola.umd.js.map +1 -1
  36. package/dist/plugins/vite-plugin-kupola.js +120 -0
  37. package/dist/types/kupola.d.ts +421 -323
  38. package/js/calendar.js +334 -25
  39. package/js/carousel.js +182 -48
  40. package/js/collapse.js +148 -34
  41. package/js/color-picker.js +416 -108
  42. package/js/component.js +8 -19
  43. package/js/countdown.js +9 -8
  44. package/js/data-bind.js +73 -16
  45. package/js/datepicker.js +488 -110
  46. package/js/depends.js +710 -0
  47. package/js/dialog.js +4 -2
  48. package/js/drawer.js +172 -8
  49. package/js/dropdown.js +272 -17
  50. package/js/dynamic-tags.js +156 -40
  51. package/js/fileupload.js +9 -8
  52. package/js/form.js +280 -254
  53. package/js/global-events.js +281 -188
  54. package/js/heatmap.js +10 -7
  55. package/js/i18n.js +18 -10
  56. package/js/icons.js +141 -161
  57. package/js/image-preview.js +146 -2
  58. package/js/initializer.js +151 -71
  59. package/js/kupola-core.js +123 -45
  60. package/js/kupola-lifecycle.js +13 -11
  61. package/js/message.js +8 -1
  62. package/js/modal.js +207 -59
  63. package/js/notification.js +8 -1
  64. package/js/numberinput.js +9 -8
  65. package/js/pagination.js +263 -0
  66. package/js/registry.js +29 -12
  67. package/js/select.js +482 -27
  68. package/js/slide-captcha.js +11 -2
  69. package/js/slider.js +442 -25
  70. package/js/statcard.js +9 -7
  71. package/js/table.js +1210 -0
  72. package/js/tag.js +268 -14
  73. package/js/theme-standalone.js +88 -0
  74. package/js/theme.js +14 -43
  75. package/js/timepicker.js +335 -66
  76. package/js/tooltip.js +317 -86
  77. package/js/utils.js +6 -2
  78. package/js/validation.js +6 -2
  79. package/js/virtual-list.js +11 -7
  80. package/js/web-components.js +288 -0
  81. package/package.json +81 -67
  82. package/plugins/vite-plugin-kupola.js +120 -0
  83. package/scripts/build-css.cjs +113 -0
  84. package/scripts/build-svg-sprite.cjs +107 -0
  85. package/types/kupola.d.ts +421 -323
  86. package/CHANGELOG.md +0 -130
  87. package/INTEGRATION.md +0 -440
  88. package/PROJECT_SUMMARY.md +0 -312
  89. package/SKILL.md +0 -572
  90. package/dist/utils/utils/Kupola.cs +0 -77
  91. package/dist/utils/utils/Kupola.java +0 -104
  92. package/dist/utils/utils/kupola.go +0 -120
  93. package/dist/utils/utils/kupola.js +0 -63
  94. package/dist/utils/utils/kupola.py +0 -1392
  95. package/dist/utils/utils/kupola.rb +0 -69
  96. package/js/composition-api.js +0 -458
  97. package/js/error-handler.js +0 -181
  98. package/js/http.js +0 -419
  99. package/js/kupola-devtools.js +0 -598
  100. package/js/performance.js +0 -250
  101. package/js/router.js +0 -396
  102. package/js/security.js +0 -189
  103. package/js/test-utils.js +0 -251
  104. package/templates/base.html +0 -30
  105. package/templates/base_dashboard.html +0 -99
  106. package/utils/Kupola.cs +0 -77
  107. package/utils/Kupola.java +0 -104
  108. package/utils/kupola.go +0 -120
  109. package/utils/kupola.js +0 -63
  110. package/utils/kupola.py +0 -1392
  111. package/utils/kupola.rb +0 -69
package/js/slider.js CHANGED
@@ -1,40 +1,425 @@
1
1
  class Slider {
2
- constructor(element) {
2
+ constructor(element, options = {}) {
3
3
  this.element = element;
4
4
  this.track = element.querySelector('.ds-slider__track');
5
5
  this.fill = element.querySelector('.ds-slider__fill');
6
6
  this.input = element.querySelector('.ds-slider__input');
7
7
  this.valueEl = element.querySelector('.ds-slider__value');
8
8
 
9
- if (!this.track || !this.fill || !this.input) {
9
+ // Options
10
+ this.range = options.range || element.hasAttribute('data-slider-range');
11
+ this.vertical = options.vertical || element.hasAttribute('data-slider-vertical');
12
+ this.disabled = options.disabled || element.hasAttribute('data-slider-disabled');
13
+ this.showTooltip = options.showTooltip !== false;
14
+ this.showMarks = options.marks || element.hasAttribute('data-slider-marks');
15
+ this.markStep = options.markStep || parseInt(element.getAttribute('data-slider-mark-step')) || 10;
16
+ this.tooltipFormat = options.tooltipFormat || ((v) => v);
17
+ this.onChange = options.onChange || null;
18
+ this.onInput = options.onInput || null;
19
+
20
+ // Range mode
21
+ this.inputEnd = element.querySelector('.ds-slider__input--end');
22
+ this.fillEnd = null;
23
+ this.thumbStart = null;
24
+ this.thumbEnd = null;
25
+ this.tooltipStart = null;
26
+ this.tooltipEnd = null;
27
+ this.marksEl = null;
28
+
29
+ this._listeners = [];
30
+ this._isDragging = false;
31
+ this._activeThumb = null;
32
+
33
+ if (!this.track || !this.fill) {
10
34
  throw new Error('Slider: Missing required elements');
11
35
  }
12
36
 
37
+ this._build();
13
38
  this._bindEvents();
14
39
  this.updateSlider();
15
40
  }
16
41
 
42
+ _build() {
43
+ // Add vertical class
44
+ if (this.vertical) {
45
+ this.element.classList.add('ds-slider--vertical');
46
+ }
47
+ if (this.disabled) {
48
+ this.element.classList.add('is-disabled');
49
+ }
50
+
51
+ // Create thumb elements for better interaction
52
+ if (!this.element.querySelector('.ds-slider__thumb')) {
53
+ this.thumbStart = document.createElement('div');
54
+ this.thumbStart.className = 'ds-slider__thumb ds-slider__thumb--start';
55
+ this.thumbStart.setAttribute('role', 'slider');
56
+ this.thumbStart.setAttribute('tabindex', this.disabled ? '-1' : '0');
57
+ this.track.appendChild(this.thumbStart);
58
+
59
+ // Tooltip
60
+ if (this.showTooltip) {
61
+ this.tooltipStart = document.createElement('div');
62
+ this.tooltipStart.className = 'ds-slider__tooltip';
63
+ this.thumbStart.appendChild(this.tooltipStart);
64
+ }
65
+ } else {
66
+ this.thumbStart = this.element.querySelector('.ds-slider__thumb--start');
67
+ }
68
+
69
+ // Range mode: second thumb
70
+ if (this.range) {
71
+ this.element.classList.add('ds-slider--range');
72
+
73
+ if (!this.element.querySelector('.ds-slider__thumb--end')) {
74
+ this.thumbEnd = document.createElement('div');
75
+ this.thumbEnd.className = 'ds-slider__thumb ds-slider__thumb--end';
76
+ this.thumbEnd.setAttribute('role', 'slider');
77
+ this.thumbEnd.setAttribute('tabindex', this.disabled ? '-1' : '0');
78
+ this.track.appendChild(this.thumbEnd);
79
+
80
+ if (this.showTooltip) {
81
+ this.tooltipEnd = document.createElement('div');
82
+ this.tooltipEnd.className = 'ds-slider__tooltip';
83
+ this.thumbEnd.appendChild(this.tooltipEnd);
84
+ }
85
+ } else {
86
+ this.thumbEnd = this.element.querySelector('.ds-slider__thumb--end');
87
+ }
88
+ }
89
+
90
+ // Marks
91
+ if (this.showMarks) {
92
+ this._renderMarks();
93
+ }
94
+ }
95
+
96
+ _renderMarks() {
97
+ if (this.marksEl) this.marksEl.remove();
98
+
99
+ this.marksEl = document.createElement('div');
100
+ this.marksEl.className = 'ds-slider__marks';
101
+
102
+ const min = parseFloat(this.input?.min || 0);
103
+ const max = parseFloat(this.input?.max || 100);
104
+
105
+ for (let v = min; v <= max; v += this.markStep) {
106
+ const mark = document.createElement('div');
107
+ mark.className = 'ds-slider__mark';
108
+ const pct = ((v - min) / (max - min)) * 100;
109
+
110
+ if (this.vertical) {
111
+ mark.style.bottom = pct + '%';
112
+ } else {
113
+ mark.style.left = pct + '%';
114
+ }
115
+
116
+ const label = document.createElement('span');
117
+ label.className = 'ds-slider__mark-label';
118
+ label.textContent = v;
119
+ mark.appendChild(label);
120
+
121
+ this.marksEl.appendChild(mark);
122
+ }
123
+
124
+ this.element.appendChild(this.marksEl);
125
+ }
126
+
17
127
  _bindEvents() {
18
- this.updateSlider = () => {
19
- const value = this.input.value;
20
- const min = this.input.min || 0;
21
- const max = this.input.max || 100;
22
- const percentage = ((value - min) / (max - min)) * 100;
128
+ // Native input events (backward compat)
129
+ if (this.input) {
130
+ const inputHandler = () => this.updateSlider();
131
+ const changeHandler = () => this.updateSlider();
132
+ this.input.addEventListener('input', inputHandler);
133
+ this.input.addEventListener('change', changeHandler);
134
+ this._listeners.push(
135
+ { el: this.input, event: 'input', handler: inputHandler },
136
+ { el: this.input, event: 'change', handler: changeHandler }
137
+ );
138
+ }
23
139
 
24
- this.fill.style.width = `${percentage}%`;
25
- if (this.valueEl) {
26
- this.valueEl.textContent = value;
140
+ if (this.inputEnd) {
141
+ const inputHandler = () => this.updateSlider();
142
+ this.inputEnd.addEventListener('input', inputHandler);
143
+ this._listeners.push({ el: this.inputEnd, event: 'input', handler: inputHandler });
144
+ }
145
+
146
+ // Custom thumb drag
147
+ if (this.thumbStart) {
148
+ this._bindThumbDrag(this.thumbStart, 'start');
149
+ }
150
+ if (this.thumbEnd) {
151
+ this._bindThumbDrag(this.thumbEnd, 'end');
152
+ }
153
+
154
+ // Track click
155
+ if (this.track) {
156
+ const trackClick = (e) => {
157
+ if (this.disabled) return;
158
+ this._handleTrackClick(e);
159
+ };
160
+ this.track.addEventListener('click', trackClick);
161
+ this._listeners.push({ el: this.track, event: 'click', handler: trackClick });
162
+ }
163
+
164
+ // Keyboard
165
+ if (this.thumbStart) {
166
+ const keyHandler = (e) => this._handleKeyboard(e, 'start');
167
+ this.thumbStart.addEventListener('keydown', keyHandler);
168
+ this._listeners.push({ el: this.thumbStart, event: 'keydown', handler: keyHandler });
169
+ }
170
+ if (this.thumbEnd) {
171
+ const keyHandler = (e) => this._handleKeyboard(e, 'end');
172
+ this.thumbEnd.addEventListener('keydown', keyHandler);
173
+ this._listeners.push({ el: this.thumbEnd, event: 'keydown', handler: keyHandler });
174
+ }
175
+ }
176
+
177
+ _bindThumbDrag(thumb, which) {
178
+ const startDrag = (e) => {
179
+ if (this.disabled) return;
180
+ e.preventDefault();
181
+ this._isDragging = true;
182
+ this._activeThumb = which;
183
+ this.element.classList.add('is-dragging');
184
+ document.addEventListener('mousemove', onDrag);
185
+ document.addEventListener('mouseup', stopDrag);
186
+ document.addEventListener('touchmove', onDrag, { passive: false });
187
+ document.addEventListener('touchend', stopDrag);
188
+ };
189
+
190
+ const onDrag = (e) => {
191
+ if (!this._isDragging) return;
192
+ e.preventDefault();
193
+
194
+ const clientX = e.touches ? e.touches[0].clientX : e.clientX;
195
+ const clientY = e.touches ? e.touches[0].clientY : e.clientY;
196
+
197
+ const rect = this.track.getBoundingClientRect();
198
+ let percentage;
199
+
200
+ if (this.vertical) {
201
+ percentage = 1 - (clientY - rect.top) / rect.height;
202
+ } else {
203
+ percentage = (clientX - rect.left) / rect.width;
204
+ }
205
+
206
+ percentage = Math.max(0, Math.min(1, percentage));
207
+
208
+ const min = parseFloat(this.input?.min || 0);
209
+ const max = parseFloat(this.input?.max || 100);
210
+ const step = parseFloat(this.input?.step || 1);
211
+ let value = min + percentage * (max - min);
212
+ value = Math.round(value / step) * step;
213
+ value = Math.max(min, Math.min(max, value));
214
+
215
+ if (which === 'start' && this.range && this.inputEnd) {
216
+ const endVal = parseFloat(this.inputEnd.value);
217
+ if (value > endVal) value = endVal;
218
+ }
219
+ if (which === 'end' && this.range && this.input) {
220
+ const startVal = parseFloat(this.input.value);
221
+ if (value < startVal) value = startVal;
222
+ }
223
+
224
+ if (which === 'start' && this.input) {
225
+ this.input.value = value;
226
+ } else if (which === 'end' && this.inputEnd) {
227
+ this.inputEnd.value = value;
228
+ }
229
+
230
+ this.updateSlider();
231
+
232
+ if (this.onInput) {
233
+ this.onInput({ value: this.getValue(), percentage });
27
234
  }
28
- this.element.setAttribute('aria-valuenow', value);
29
235
  };
30
236
 
31
- this.input.addEventListener('input', this.updateSlider);
32
- this.input.addEventListener('change', this.updateSlider);
237
+ const stopDrag = () => {
238
+ this._isDragging = false;
239
+ this._activeThumb = null;
240
+ this.element.classList.remove('is-dragging');
241
+ document.removeEventListener('mousemove', onDrag);
242
+ document.removeEventListener('mouseup', stopDrag);
243
+ document.removeEventListener('touchmove', onDrag);
244
+ document.removeEventListener('touchend', stopDrag);
245
+
246
+ if (this.onChange) {
247
+ this.onChange({ value: this.getValue() });
248
+ }
249
+ this.element.dispatchEvent(new CustomEvent('kupola:slider-change', {
250
+ detail: { value: this.getValue() },
251
+ bubbles: true
252
+ }));
253
+ };
254
+
255
+ thumb.addEventListener('mousedown', startDrag);
256
+ thumb.addEventListener('touchstart', startDrag, { passive: false });
257
+ this._listeners.push(
258
+ { el: thumb, event: 'mousedown', handler: startDrag },
259
+ { el: thumb, event: 'touchstart', handler: startDrag }
260
+ );
261
+ }
262
+
263
+ _handleTrackClick(e) {
264
+ if (e.target.classList.contains('ds-slider__thumb')) return;
265
+
266
+ const rect = this.track.getBoundingClientRect();
267
+ const clientX = e.clientX;
268
+ const clientY = e.clientY;
269
+
270
+ let percentage;
271
+ if (this.vertical) {
272
+ percentage = 1 - (clientY - rect.top) / rect.height;
273
+ } else {
274
+ percentage = (clientX - rect.left) / rect.width;
275
+ }
276
+
277
+ percentage = Math.max(0, Math.min(1, percentage));
278
+
279
+ const min = parseFloat(this.input?.min || 0);
280
+ const max = parseFloat(this.input?.max || 100);
281
+ const step = parseFloat(this.input?.step || 1);
282
+ let value = min + percentage * (max - min);
283
+ value = Math.round(value / step) * step;
284
+
285
+ if (this.range) {
286
+ const startVal = parseFloat(this.input?.value || 0);
287
+ const endVal = parseFloat(this.inputEnd?.value || 0);
288
+ const distToStart = Math.abs(value - startVal);
289
+ const distToEnd = Math.abs(value - endVal);
290
+
291
+ if (distToStart <= distToEnd) {
292
+ if (this.input) this.input.value = Math.min(value, endVal);
293
+ } else {
294
+ if (this.inputEnd) this.inputEnd.value = Math.max(value, startVal);
295
+ }
296
+ } else {
297
+ if (this.input) this.input.value = value;
298
+ }
299
+
300
+ this.updateSlider();
301
+ }
302
+
303
+ _handleKeyboard(e, which) {
304
+ if (this.disabled) return;
305
+
306
+ const inputEl = which === 'start' ? this.input : this.inputEnd;
307
+ if (!inputEl) return;
308
+
309
+ const step = parseFloat(inputEl.step || 1);
310
+ const min = parseFloat(inputEl.min || 0);
311
+ const max = parseFloat(inputEl.max || 100);
312
+ let value = parseFloat(inputEl.value);
313
+
314
+ switch (e.key) {
315
+ case 'ArrowRight':
316
+ case 'ArrowUp':
317
+ e.preventDefault();
318
+ value = Math.min(max, value + step);
319
+ break;
320
+ case 'ArrowLeft':
321
+ case 'ArrowDown':
322
+ e.preventDefault();
323
+ value = Math.max(min, value - step);
324
+ break;
325
+ case 'Home':
326
+ e.preventDefault();
327
+ value = min;
328
+ break;
329
+ case 'End':
330
+ e.preventDefault();
331
+ value = max;
332
+ break;
333
+ default:
334
+ return;
335
+ }
336
+
337
+ inputEl.value = value;
338
+ this.updateSlider();
339
+
340
+ if (this.onChange) {
341
+ this.onChange({ value: this.getValue() });
342
+ }
343
+ }
344
+
345
+ updateSlider() {
346
+ const min = parseFloat(this.input?.min || 0);
347
+ const max = parseFloat(this.input?.max || 100);
348
+
349
+ if (this.range && this.inputEnd) {
350
+ const startVal = parseFloat(this.input?.value || 0);
351
+ const endVal = parseFloat(this.inputEnd?.value || 0);
352
+ const startPct = ((startVal - min) / (max - min)) * 100;
353
+ const endPct = ((endVal - min) / (max - min)) * 100;
354
+
355
+ if (this.vertical) {
356
+ this.fill.style.bottom = startPct + '%';
357
+ this.fill.style.height = (endPct - startPct) + '%';
358
+ } else {
359
+ this.fill.style.left = startPct + '%';
360
+ this.fill.style.width = (endPct - startPct) + '%';
361
+ }
362
+
363
+ if (this.thumbStart) {
364
+ if (this.vertical) {
365
+ this.thumbStart.style.bottom = startPct + '%';
366
+ } else {
367
+ this.thumbStart.style.left = startPct + '%';
368
+ }
369
+ }
370
+ if (this.thumbEnd) {
371
+ if (this.vertical) {
372
+ this.thumbEnd.style.bottom = endPct + '%';
373
+ } else {
374
+ this.thumbEnd.style.left = endPct + '%';
375
+ }
376
+ }
377
+
378
+ if (this.tooltipStart) {
379
+ this.tooltipStart.textContent = this.tooltipFormat(startVal);
380
+ }
381
+ if (this.tooltipEnd) {
382
+ this.tooltipEnd.textContent = this.tooltipFormat(endVal);
383
+ }
384
+
385
+ if (this.valueEl) {
386
+ this.valueEl.textContent = `${this.tooltipFormat(startVal)} - ${this.tooltipFormat(endVal)}`;
387
+ }
388
+
389
+ // ARIA
390
+ if (this.thumbStart) this.thumbStart.setAttribute('aria-valuenow', startVal);
391
+ if (this.thumbEnd) this.thumbEnd.setAttribute('aria-valuenow', endVal);
392
+ } else {
393
+ const value = this.input?.value || 0;
394
+ const percentage = ((value - min) / (max - min)) * 100;
33
395
 
34
- this._listeners = [
35
- { el: this.input, event: 'input', handler: this.updateSlider },
36
- { el: this.input, event: 'change', handler: this.updateSlider }
37
- ];
396
+ if (this.vertical) {
397
+ this.fill.style.height = `${percentage}%`;
398
+ } else {
399
+ this.fill.style.width = `${percentage}%`;
400
+ }
401
+
402
+ if (this.thumbStart) {
403
+ if (this.vertical) {
404
+ this.thumbStart.style.bottom = percentage + '%';
405
+ } else {
406
+ this.thumbStart.style.left = percentage + '%';
407
+ }
408
+ }
409
+
410
+ if (this.tooltipStart) {
411
+ this.tooltipStart.textContent = this.tooltipFormat(parseFloat(value));
412
+ }
413
+
414
+ if (this.valueEl) {
415
+ this.valueEl.textContent = this.tooltipFormat(parseFloat(value));
416
+ }
417
+
418
+ if (this.thumbStart) {
419
+ this.thumbStart.setAttribute('aria-valuenow', value);
420
+ }
421
+ this.element.setAttribute('aria-valuenow', value);
422
+ }
38
423
  }
39
424
 
40
425
  destroy() {
@@ -42,30 +427,53 @@ class Slider {
42
427
  el.removeEventListener(event, handler);
43
428
  });
44
429
  this._listeners = null;
430
+ if (this.marksEl) this.marksEl.remove();
45
431
  this.track = null;
46
432
  this.fill = null;
47
433
  this.input = null;
434
+ this.inputEnd = null;
48
435
  this.valueEl = null;
436
+ this.thumbStart = null;
437
+ this.thumbEnd = null;
438
+ this.tooltipStart = null;
439
+ this.tooltipEnd = null;
440
+ this.marksEl = null;
49
441
  this.element = null;
50
442
  }
51
443
 
52
- setValue(value) {
444
+ setValue(value, endValue) {
53
445
  if (this.input) {
54
446
  this.input.value = value;
55
- this.updateSlider();
56
447
  }
448
+ if (endValue !== undefined && this.inputEnd) {
449
+ this.inputEnd.value = endValue;
450
+ }
451
+ this.updateSlider();
57
452
  }
58
453
 
59
454
  getValue() {
60
- return this.input?.value;
455
+ if (this.range && this.inputEnd) {
456
+ return [parseFloat(this.input?.value || 0), parseFloat(this.inputEnd?.value || 0)];
457
+ }
458
+ return parseFloat(this.input?.value || 0);
459
+ }
460
+
461
+ enable() {
462
+ this.disabled = false;
463
+ this.element.classList.remove('is-disabled');
464
+ }
465
+
466
+ disable() {
467
+ this.disabled = true;
468
+ this.element.classList.add('is-disabled');
61
469
  }
62
470
  }
63
471
 
64
- function initSlider(element) {
472
+ function initSlider(element, options) {
65
473
  if (element.__kupolaInitialized) return;
66
474
 
67
475
  try {
68
- const slider = new Slider(element);
476
+ const slider = new Slider(element, options);
69
477
  element.__kupolaInstance = slider;
70
478
  element.__kupolaInitialized = true;
71
479
  } catch (error) {
@@ -89,6 +497,15 @@ function initSliders() {
89
497
  });
90
498
  }
91
499
 
92
- if (window.kupolaInitializer) {
93
- window.kupolaInitializer.register('slider', initSlider, cleanupSlider);
94
- }
500
+ export { Slider, initSlider, initSliders, cleanupSlider };
501
+
502
+ if (typeof window !== 'undefined') {
503
+ window.Slider = Slider;
504
+ window.initSlider = initSlider;
505
+ window.initSliders = initSliders;
506
+ window.cleanupSlider = cleanupSlider;
507
+
508
+ if (window.kupolaInitializer) {
509
+ window.kupolaInitializer.register('slider', initSlider, cleanupSlider);
510
+ }
511
+ }
package/js/statcard.js CHANGED
@@ -206,14 +206,16 @@ function updateStatCard(selector, newValue) {
206
206
  }
207
207
  }
208
208
 
209
- if (typeof module !== 'undefined' && module.exports) {
210
- module.exports = { StatCard, initStatCards, initStatCard, cleanupStatCard, updateStatCard };
211
- } else {
209
+ export { StatCard, initStatCards, initStatCard, cleanupStatCard, updateStatCard };
210
+
211
+ if (typeof window !== 'undefined') {
212
212
  window.StatCard = StatCard;
213
213
  window.initStatCard = initStatCard;
214
214
  window.cleanupStatCard = cleanupStatCard;
215
- }
216
-
217
- if (window.kupolaInitializer) {
218
- window.kupolaInitializer.register('statcard', initStatCard, cleanupStatCard);
215
+ window.initStatCards = initStatCards;
216
+ window.updateStatCard = updateStatCard;
217
+
218
+ if (window.kupolaInitializer) {
219
+ window.kupolaInitializer.register('statcard', initStatCard, cleanupStatCard);
220
+ }
219
221
  }