@dodlhuat/basix 1.4.2 → 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.
Files changed (90) hide show
  1. package/README.md +13 -1
  2. package/css/calendar.scss +4 -3
  3. package/css/code-viewer.scss +1 -1
  4. package/css/datepicker.scss +83 -70
  5. package/css/editor.scss +2 -1
  6. package/css/flyout-menu.scss +2 -1
  7. package/css/form.scss +11 -32
  8. package/css/mixins.scss +25 -0
  9. package/css/range-slider.scss +7 -6
  10. package/css/stepper.scss +2 -1
  11. package/css/style.css +84 -71
  12. package/css/style.css.map +1 -1
  13. package/css/style.min.css +1 -1
  14. package/css/style.min.css.map +1 -1
  15. package/css/timepicker.scss +1 -1
  16. package/css/virtual-dropdown.scss +6 -16
  17. package/js/bottom-sheet.d.ts +3 -5
  18. package/js/bottom-sheet.js +39 -58
  19. package/js/calendar.d.ts +1 -2
  20. package/js/calendar.js +77 -84
  21. package/js/carousel.d.ts +1 -1
  22. package/js/carousel.js +22 -14
  23. package/js/chart.d.ts +1 -1
  24. package/js/chart.js +104 -65
  25. package/js/code-viewer.d.ts +1 -1
  26. package/js/code-viewer.js +7 -18
  27. package/js/color-picker.d.ts +2 -2
  28. package/js/color-picker.js +20 -22
  29. package/js/context-menu.d.ts +1 -1
  30. package/js/context-menu.js +10 -12
  31. package/js/datepicker.d.ts +14 -3
  32. package/js/datepicker.js +180 -99
  33. package/js/dropdown.d.ts +1 -1
  34. package/js/dropdown.js +4 -5
  35. package/js/editor.d.ts +1 -1
  36. package/js/editor.js +30 -34
  37. package/js/file-uploader.d.ts +2 -9
  38. package/js/file-uploader.js +57 -86
  39. package/js/flyout-menu.d.ts +3 -3
  40. package/js/flyout-menu.js +20 -22
  41. package/js/gallery.d.ts +1 -2
  42. package/js/gallery.js +14 -20
  43. package/js/group-picker.d.ts +1 -1
  44. package/js/group-picker.js +22 -29
  45. package/js/lightbox.d.ts +2 -2
  46. package/js/lightbox.js +28 -27
  47. package/js/listeners.d.ts +7 -0
  48. package/js/listeners.js +14 -0
  49. package/js/modal.d.ts +2 -1
  50. package/js/modal.js +13 -20
  51. package/js/popover.d.ts +2 -2
  52. package/js/popover.js +42 -37
  53. package/js/position.js +3 -5
  54. package/js/push-menu.d.ts +2 -0
  55. package/js/push-menu.js +21 -15
  56. package/js/range-slider.d.ts +2 -2
  57. package/js/range-slider.js +7 -6
  58. package/js/scroll.js +4 -7
  59. package/js/scrollbar.d.ts +3 -3
  60. package/js/scrollbar.js +39 -42
  61. package/js/select.d.ts +1 -1
  62. package/js/select.js +19 -23
  63. package/js/sidebar-nav.d.ts +1 -1
  64. package/js/sidebar-nav.js +13 -9
  65. package/js/stepper.d.ts +1 -1
  66. package/js/stepper.js +9 -11
  67. package/js/table.d.ts +1 -1
  68. package/js/table.js +24 -23
  69. package/js/tabs.d.ts +1 -1
  70. package/js/tabs.js +10 -17
  71. package/js/theme.d.ts +1 -0
  72. package/js/theme.js +6 -15
  73. package/js/timepicker.d.ts +8 -6
  74. package/js/timepicker.js +36 -36
  75. package/js/toast.d.ts +2 -1
  76. package/js/toast.js +8 -4
  77. package/js/tooltip.d.ts +1 -4
  78. package/js/tooltip.js +14 -23
  79. package/js/tree.d.ts +0 -1
  80. package/js/tree.js +6 -11
  81. package/js/utils.js +7 -8
  82. package/js/virtual-dropdown.d.ts +1 -1
  83. package/js/virtual-dropdown.js +26 -28
  84. package/package.json +1 -1
  85. package/css/calendar.css +0 -928
  86. package/css/guitar-chords.css +0 -251
  87. package/js/form-builder.js +0 -107
  88. package/js/guitar-chords.js +0 -268
  89. package/js/lazy-loader.js +0 -121
  90. 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}