@dodlhuat/basix 1.4.1 → 1.4.3
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 +38 -1
- package/css/calendar.scss +4 -3
- package/css/code-viewer.scss +1 -1
- package/css/datepicker.scss +83 -70
- package/css/editor.scss +2 -1
- package/css/flyout-menu.scss +2 -1
- package/css/form.scss +11 -32
- package/css/mixins.scss +25 -0
- package/css/range-slider.scss +63 -6
- package/css/stepper.scss +2 -1
- package/css/style.css +124 -71
- package/css/style.css.map +1 -1
- package/css/style.min.css +1 -1
- package/css/style.min.css.map +1 -1
- package/css/timepicker.scss +1 -1
- package/css/virtual-dropdown.scss +6 -16
- package/js/bottom-sheet.d.ts +3 -5
- package/js/bottom-sheet.js +39 -58
- package/js/calendar.d.ts +1 -2
- package/js/calendar.js +77 -84
- package/js/carousel.d.ts +1 -1
- package/js/carousel.js +22 -14
- package/js/chart.d.ts +1 -1
- package/js/chart.js +104 -65
- package/js/code-viewer.d.ts +1 -1
- package/js/code-viewer.js +7 -18
- package/js/color-picker.d.ts +2 -2
- package/js/color-picker.js +20 -22
- package/js/context-menu.d.ts +1 -1
- package/js/context-menu.js +10 -12
- package/js/datepicker.d.ts +14 -3
- package/js/datepicker.js +180 -99
- package/js/dropdown.d.ts +1 -1
- package/js/dropdown.js +4 -5
- package/js/editor.d.ts +1 -1
- package/js/editor.js +30 -34
- package/js/file-uploader.d.ts +2 -9
- package/js/file-uploader.js +57 -86
- package/js/flyout-menu.d.ts +3 -3
- package/js/flyout-menu.js +20 -22
- package/js/gallery.d.ts +1 -2
- package/js/gallery.js +14 -20
- package/js/group-picker.d.ts +1 -1
- package/js/group-picker.js +22 -29
- package/js/lightbox.d.ts +2 -2
- package/js/lightbox.js +28 -27
- package/js/listeners.d.ts +7 -0
- package/js/listeners.js +14 -0
- package/js/modal.d.ts +2 -1
- package/js/modal.js +13 -20
- package/js/popover.d.ts +2 -2
- package/js/popover.js +42 -37
- package/js/position.js +3 -5
- package/js/push-menu.d.ts +2 -0
- package/js/push-menu.js +21 -15
- package/js/range-slider.d.ts +15 -1
- package/js/range-slider.js +67 -7
- package/js/scroll.js +4 -7
- package/js/scrollbar.d.ts +3 -3
- package/js/scrollbar.js +39 -42
- package/js/select.d.ts +1 -1
- package/js/select.js +19 -23
- package/js/sidebar-nav.d.ts +1 -1
- package/js/sidebar-nav.js +13 -9
- package/js/stepper.d.ts +1 -1
- package/js/stepper.js +9 -11
- package/js/table.d.ts +1 -1
- package/js/table.js +24 -23
- package/js/tabs.d.ts +1 -1
- package/js/tabs.js +10 -17
- package/js/theme.d.ts +1 -0
- package/js/theme.js +6 -15
- package/js/timepicker.d.ts +8 -6
- package/js/timepicker.js +36 -36
- package/js/toast.d.ts +2 -1
- package/js/toast.js +8 -4
- package/js/tooltip.d.ts +1 -4
- package/js/tooltip.js +14 -23
- package/js/tree.d.ts +0 -1
- package/js/tree.js +6 -11
- package/js/utils.js +7 -8
- package/js/virtual-dropdown.d.ts +1 -1
- package/js/virtual-dropdown.js +26 -28
- package/package.json +1 -1
- package/css/calendar.css +0 -928
- package/css/guitar-chords.css +0 -251
- package/js/form-builder.js +0 -107
- package/js/guitar-chords.js +0 -268
- package/js/lazy-loader.js +0 -121
- package/js/request.js +0 -51
package/js/lazy-loader.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LazyLoader - A class to lazy load content into elements when they scroll into view.
|
|
3
|
-
*
|
|
4
|
-
* how to use:
|
|
5
|
-
* const lazyLoader = new LazyLoader({
|
|
6
|
-
* selector: '.lazy-section',
|
|
7
|
-
* rootMargin: '0px 0px 100px 0px', // Load 100px before element is visible
|
|
8
|
-
* threshold: 0.1,
|
|
9
|
-
* simulatedDelay: 2000, // 2 second delay to see the spinner
|
|
10
|
-
* onLoad: (el) => console.log('Loaded content for', el),
|
|
11
|
-
* onError: (err, el) => console.error('Failed to load', el)
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* in html:
|
|
15
|
-
* <div class="lazy-section" data-src="content/reviews.html"></div>
|
|
16
|
-
*/
|
|
17
|
-
class LazyLoader {
|
|
18
|
-
/**
|
|
19
|
-
* @param {Object} options - Configuration options
|
|
20
|
-
* @param {string} options.selector - CSS selector for elements to observe (default: '.lazy-load')
|
|
21
|
-
* @param {string} options.attribute - Attribute containing the URL to load (default: 'data-src')
|
|
22
|
-
* @param {string} options.rootMargin - IntersectionObserver rootMargin (default: '0px 0px 200px 0px')
|
|
23
|
-
* @param {number} options.threshold - IntersectionObserver threshold (default: 0.1)
|
|
24
|
-
* @param {Function} options.onError - Callback function when loading fails
|
|
25
|
-
* @param {Function} options.onLoad - Callback function when loading succeeds
|
|
26
|
-
*/
|
|
27
|
-
constructor(options = {}) {
|
|
28
|
-
this.selector = options.selector || '.lazy-load';
|
|
29
|
-
this.attribute = options.attribute || 'data-src';
|
|
30
|
-
this.rootMargin = options.rootMargin || '0px 0px 200px 0px';
|
|
31
|
-
this.threshold = options.threshold || 0.1;
|
|
32
|
-
this.onError = options.onError || null;
|
|
33
|
-
this.onLoad = options.onLoad || null;
|
|
34
|
-
this.simulatedDelay = options.simulatedDelay || 0; // Delay in ms for testing
|
|
35
|
-
this.init();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
init() {
|
|
39
|
-
this.elements = document.querySelectorAll(this.selector);
|
|
40
|
-
|
|
41
|
-
if ('IntersectionObserver' in window) {
|
|
42
|
-
this.setupIntersectionObserver();
|
|
43
|
-
} else {
|
|
44
|
-
this.setupScrollListener();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setupIntersectionObserver() {
|
|
49
|
-
const observerOptions = {
|
|
50
|
-
root: null,
|
|
51
|
-
rootMargin: this.rootMargin,
|
|
52
|
-
threshold: this.threshold
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const observer = new IntersectionObserver((entries, observer) => {
|
|
56
|
-
entries.forEach(entry => {
|
|
57
|
-
if (entry.isIntersecting) {
|
|
58
|
-
this.loadContent(entry.target);
|
|
59
|
-
observer.unobserve(entry.target);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}, observerOptions);
|
|
63
|
-
|
|
64
|
-
this.elements.forEach(el => observer.observe(el));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
setupScrollListener() {
|
|
68
|
-
// Fallback for older browsers
|
|
69
|
-
const checkVisible = () => {
|
|
70
|
-
this.elements.forEach(el => {
|
|
71
|
-
if (el.getAttribute(this.attribute)) {
|
|
72
|
-
const rect = el.getBoundingClientRect();
|
|
73
|
-
const windowHeight = window.innerHeight;
|
|
74
|
-
// Check if element is close to viewport (using approx 200px buffer like rootMargin)
|
|
75
|
-
if (rect.top <= windowHeight + 200) {
|
|
76
|
-
this.loadContent(el);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
window.addEventListener('scroll', checkVisible);
|
|
83
|
-
window.addEventListener('resize', checkVisible);
|
|
84
|
-
// Initial check
|
|
85
|
-
checkVisible();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async loadContent(element) {
|
|
89
|
-
const url = element.getAttribute(this.attribute);
|
|
90
|
-
if (!url) return;
|
|
91
|
-
|
|
92
|
-
// Remove attribute so we don't try to load again if using scroll fallback
|
|
93
|
-
element.removeAttribute(this.attribute);
|
|
94
|
-
element.classList.add('loading');
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
// Simulate network delay if configured
|
|
98
|
-
if (this.simulatedDelay > 0) {
|
|
99
|
-
await new Promise(resolve => setTimeout(resolve, this.simulatedDelay));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const response = await fetch(url);
|
|
103
|
-
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
104
|
-
const html = await response.text();
|
|
105
|
-
|
|
106
|
-
element.innerHTML = html;
|
|
107
|
-
element.classList.remove('loading');
|
|
108
|
-
element.classList.add('loaded'); // Animation hook
|
|
109
|
-
|
|
110
|
-
if (this.onLoad) this.onLoad(element);
|
|
111
|
-
|
|
112
|
-
} catch (error) {
|
|
113
|
-
console.error('LazyLoad Error:', error);
|
|
114
|
-
element.classList.remove('loading');
|
|
115
|
-
element.classList.add('error');
|
|
116
|
-
element.innerHTML = '<div class="error-msg">Failed to load content.</div>';
|
|
117
|
-
|
|
118
|
-
if (this.onError) this.onError(error, element);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
package/js/request.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
class Request {
|
|
2
|
-
constructor(url, parameters, success, error) {
|
|
3
|
-
this.url = url;
|
|
4
|
-
this.parameters = parameters;
|
|
5
|
-
this.success = success;
|
|
6
|
-
this.error = error;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get() {
|
|
10
|
-
const checked = this.#checkSuccessError(this.success, this.error);
|
|
11
|
-
if (this.parameters.data !== undefined) {
|
|
12
|
-
this.url += '?' + new URLSearchParams(this.parameters.data);
|
|
13
|
-
}
|
|
14
|
-
fetch(this.url)
|
|
15
|
-
.then(function(response) {
|
|
16
|
-
return response.json();
|
|
17
|
-
})
|
|
18
|
-
.then(checked.success)
|
|
19
|
-
.catch(checked.error);
|
|
20
|
-
}
|
|
21
|
-
post() {
|
|
22
|
-
const checked = this.#checkSuccessError(this.success, this.error);
|
|
23
|
-
fetch(this.url,
|
|
24
|
-
{
|
|
25
|
-
method: 'post',
|
|
26
|
-
headers: {
|
|
27
|
-
'Accept': 'application/json',
|
|
28
|
-
'Content-Type': 'application/json'
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify(this.parameters.data)
|
|
31
|
-
})
|
|
32
|
-
.then(checked.success)
|
|
33
|
-
.catch(checked.error);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
#checkSuccessError(success, error) {
|
|
37
|
-
if (success === undefined) {
|
|
38
|
-
success = function(data) {
|
|
39
|
-
console.log(data);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (error === undefined) {
|
|
43
|
-
error = function(error) {
|
|
44
|
-
console.error(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return {success, error};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export {Request}
|