@smilodon/core 1.0.4 → 1.0.6
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 +8 -7
- package/dist/index.cjs +0 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +0 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,13 +77,14 @@ import '@smilodon/core';
|
|
|
77
77
|
<smilodon-select ref={selectRef} />
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
**Optional Framework Adapters** (
|
|
81
|
-
- **React**:
|
|
82
|
-
- **Vue**:
|
|
83
|
-
- **Svelte**:
|
|
84
|
-
- **Angular**:
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
**Optional Framework Adapters** (for enhanced developer experience):
|
|
81
|
+
- **React**: `npm install @smilodon/react` - React hooks and components
|
|
82
|
+
- **Vue**: `npm install @smilodon/vue` - Vue composables and components
|
|
83
|
+
- **Svelte**: `npm install @smilodon/svelte` - Svelte stores and components
|
|
84
|
+
- **Angular**: `npm install @smilodon/angular` - Angular directives and services
|
|
85
|
+
- **Vanilla**: `npm install @smilodon/vanilla` - Vanilla JS helpers
|
|
86
|
+
|
|
87
|
+
These adapters provide framework-native APIs (hooks, composables, directives) for enhanced developer experience, but are **not required** - the core package works everywhere!
|
|
87
88
|
|
|
88
89
|
See the [main documentation](https://github.com/navidrezadoost/smilodon#readme) for framework-specific examples.
|
|
89
90
|
|
package/dist/index.cjs
CHANGED
|
@@ -1481,7 +1481,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1481
1481
|
this._input.addEventListener('input', (e) => {
|
|
1482
1482
|
if (!this._config.searchable)
|
|
1483
1483
|
return;
|
|
1484
|
-
console.log('[EnhancedSelect] Input event fired', e.target.value);
|
|
1485
1484
|
const query = e.target.value;
|
|
1486
1485
|
this._handleSearch(query);
|
|
1487
1486
|
});
|
|
@@ -1507,7 +1506,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1507
1506
|
this._intersectionObserver = new IntersectionObserver((entries) => {
|
|
1508
1507
|
entries.forEach((entry) => {
|
|
1509
1508
|
if (entry.isIntersecting) {
|
|
1510
|
-
console.log('[InfiniteScroll] Sentinel intersected. isBusy:', this._state.isBusy);
|
|
1511
1509
|
if (!this._state.isBusy) {
|
|
1512
1510
|
this._loadMoreItems();
|
|
1513
1511
|
}
|
|
@@ -1599,7 +1597,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1599
1597
|
}
|
|
1600
1598
|
}
|
|
1601
1599
|
_handleSearch(query) {
|
|
1602
|
-
console.log('[EnhancedSelect] _handleSearch called with:', JSON.stringify(query));
|
|
1603
1600
|
this._state.searchQuery = query;
|
|
1604
1601
|
// Clear previous search timeout
|
|
1605
1602
|
if (this._searchTimeout) {
|
|
@@ -1610,12 +1607,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1610
1607
|
this._state.isSearching = false;
|
|
1611
1608
|
// Ensure dropdown is open when searching
|
|
1612
1609
|
if (!this._state.isOpen) {
|
|
1613
|
-
console.log('[EnhancedSelect] Opening dropdown for search');
|
|
1614
1610
|
this._handleOpen();
|
|
1615
1611
|
}
|
|
1616
1612
|
else {
|
|
1617
1613
|
// Filter and render options immediately
|
|
1618
|
-
console.log('[EnhancedSelect] Dropdown already open, re-rendering options');
|
|
1619
1614
|
this._renderOptions();
|
|
1620
1615
|
}
|
|
1621
1616
|
// Get filtered items based on search query - searches ENTIRE phrase
|
|
@@ -1635,7 +1630,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1635
1630
|
})
|
|
1636
1631
|
: this._state.loadedItems;
|
|
1637
1632
|
const count = filteredItems.length;
|
|
1638
|
-
console.log(`[EnhancedSelect] Search results: ${count} items found for query "${searchQuery}"`);
|
|
1639
1633
|
// Announce search results for accessibility
|
|
1640
1634
|
if (searchQuery) {
|
|
1641
1635
|
this._announce(`${count} result${count !== 1 ? 's' : ''} found for "${query}"`);
|
|
@@ -1941,7 +1935,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1941
1935
|
async _loadMoreItems() {
|
|
1942
1936
|
if (this._state.isBusy)
|
|
1943
1937
|
return;
|
|
1944
|
-
console.log('[InfiniteScroll] _loadMoreItems triggered');
|
|
1945
1938
|
this._setBusy(true);
|
|
1946
1939
|
// Save scroll position before loading
|
|
1947
1940
|
if (this._dropdown) {
|
|
@@ -1955,7 +1948,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1955
1948
|
try {
|
|
1956
1949
|
// Emit event for parent to handle
|
|
1957
1950
|
this._state.currentPage++;
|
|
1958
|
-
console.log(`[InfiniteScroll] Emitting loadMore event for page ${this._state.currentPage}`);
|
|
1959
1951
|
this._emit('loadMore', { page: this._state.currentPage, items: [] });
|
|
1960
1952
|
this._config.callbacks.onLoadMore?.(this._state.currentPage);
|
|
1961
1953
|
// NOTE: We do NOT set isBusy = false here.
|
|
@@ -2010,14 +2002,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2010
2002
|
// we need to maintain scroll position during the update
|
|
2011
2003
|
if (this._state.preserveScrollPosition && this._dropdown) {
|
|
2012
2004
|
const targetScrollTop = this._state.lastScrollPosition;
|
|
2013
|
-
console.log('[InfiniteScroll] setItems: before render', {
|
|
2014
|
-
previousLength,
|
|
2015
|
-
newLength,
|
|
2016
|
-
lastScrollPosition: this._state.lastScrollPosition,
|
|
2017
|
-
scrollTop: this._dropdown.scrollTop,
|
|
2018
|
-
scrollHeight: this._dropdown.scrollHeight,
|
|
2019
|
-
clientHeight: this._dropdown.clientHeight
|
|
2020
|
-
});
|
|
2021
2005
|
// Only clear loading if we actually got more items
|
|
2022
2006
|
if (newLength > previousLength) {
|
|
2023
2007
|
this._state.isBusy = false;
|
|
@@ -2031,13 +2015,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2031
2015
|
requestAnimationFrame(() => {
|
|
2032
2016
|
if (this._dropdown) {
|
|
2033
2017
|
this._dropdown.scrollTop = targetScrollTop;
|
|
2034
|
-
console.log('[InfiniteScroll] setItems: after render', {
|
|
2035
|
-
newLength,
|
|
2036
|
-
lastScrollPosition: this._state.lastScrollPosition,
|
|
2037
|
-
scrollTop: this._dropdown.scrollTop,
|
|
2038
|
-
scrollHeight: this._dropdown.scrollHeight,
|
|
2039
|
-
clientHeight: this._dropdown.clientHeight
|
|
2040
|
-
});
|
|
2041
2018
|
}
|
|
2042
2019
|
});
|
|
2043
2020
|
// Only clear preserveScrollPosition if we got new items
|
|
@@ -2213,7 +2190,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2213
2190
|
* Render options based on current state
|
|
2214
2191
|
*/
|
|
2215
2192
|
_renderOptions() {
|
|
2216
|
-
console.log('[EnhancedSelect] _renderOptions called');
|
|
2217
2193
|
// Cleanup observer
|
|
2218
2194
|
if (this._loadMoreTrigger && this._intersectionObserver) {
|
|
2219
2195
|
this._intersectionObserver.unobserve(this._loadMoreTrigger);
|
|
@@ -2369,7 +2345,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2369
2345
|
this._optionsContainer.appendChild(container);
|
|
2370
2346
|
// Setup intersection observer for auto-load
|
|
2371
2347
|
if (this._intersectionObserver && this._loadMoreTrigger) {
|
|
2372
|
-
console.log('[InfiniteScroll] Observing sentinel');
|
|
2373
2348
|
this._intersectionObserver.observe(this._loadMoreTrigger);
|
|
2374
2349
|
}
|
|
2375
2350
|
}
|