@aquera/nile-elements 1.2.6-beta-1.0 → 1.2.6-beta-1.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 (28) hide show
  1. package/README.md +3 -0
  2. package/demo/index.html +38 -7
  3. package/dist/index.js +66 -66
  4. package/dist/nile-select/nile-select.cjs.js +1 -1
  5. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  6. package/dist/nile-select/nile-select.esm.js +2 -2
  7. package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
  8. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  9. package/dist/nile-select/virtual-scroll-helper.esm.js +1 -1
  10. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +2 -2
  11. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  12. package/dist/nile-virtual-select/nile-virtual-select.esm.js +13 -13
  13. package/dist/src/nile-select/nile-select.d.ts +12 -12
  14. package/dist/src/nile-select/nile-select.js +71 -71
  15. package/dist/src/nile-select/nile-select.js.map +1 -1
  16. package/dist/src/nile-select/virtual-scroll-helper.js +1 -1
  17. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  18. package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +10 -10
  19. package/dist/src/nile-virtual-select/nile-virtual-select.js +119 -80
  20. package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
  21. package/dist/src/version.js +1 -1
  22. package/dist/src/version.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +1 -1
  25. package/src/nile-select/nile-select.ts +96 -101
  26. package/src/nile-select/virtual-scroll-helper.ts +1 -1
  27. package/src/nile-virtual-select/nile-virtual-select.ts +149 -115
  28. package/vscode-html-custom-data.json +22 -22
@@ -120,7 +120,6 @@ let NileSelect = class NileSelect extends NileElement {
120
120
  this.searchValue = '';
121
121
  this.searchEnabled = false;
122
122
  this.internalSearchPlaceHolder = 'Search...';
123
- this.enableVisibilityEffect = false;
124
123
  this.blockValueChange = false;
125
124
  this.disableLocalSearch = false;
126
125
  this.optionsLoading = false;
@@ -182,7 +181,6 @@ let NileSelect = class NileSelect extends NileElement {
182
181
  this.required = false;
183
182
  this.showSelected = false;
184
183
  this.oldMaxOptionsVisible = 1;
185
- this.enableTabClose = false;
186
184
  this.showNoResults = false;
187
185
  this.noResultsMessage = 'No results found';
188
186
  this.data = [];
@@ -193,6 +191,14 @@ let NileSelect = class NileSelect extends NileElement {
193
191
  this.autoFocusSearch = false;
194
192
  /** loading indicator for virtual select */
195
193
  this.loading = false;
194
+ this.enableVisibilityEffect = false;
195
+ this.enableTabClose = false;
196
+ this.handleWindowResize = () => {
197
+ this.portalManager.updatePortalAppendPosition();
198
+ };
199
+ this.handleWindowScroll = () => {
200
+ this.portalManager.updatePortalAppendPosition();
201
+ };
196
202
  /** All active IntersectionObservers for visibility detection */
197
203
  this.anchorVisibilityObservers = [];
198
204
  /** Handles tab visibility (page hidden / tab switched) */
@@ -208,12 +214,6 @@ let NileSelect = class NileSelect extends NileElement {
208
214
  });
209
215
  }
210
216
  };
211
- this.handleWindowResize = () => {
212
- this.portalManager.updatePortalAppendPosition();
213
- };
214
- this.handleWindowScroll = () => {
215
- this.portalManager.updatePortalAppendPosition();
216
- };
217
217
  }
218
218
  connectedCallback() {
219
219
  super.connectedCallback();
@@ -319,63 +319,6 @@ let NileSelect = class NileSelect extends NileElement {
319
319
  this.hide();
320
320
  }
321
321
  }
322
- /** Utility: find ALL scrollable ancestors (not just the nearest) */
323
- getScrollableAncestors(element) {
324
- const scrollables = [];
325
- let parent = element.parentElement;
326
- while (parent) {
327
- const style = getComputedStyle(parent);
328
- const canScroll = /(auto|scroll)/.test(style.overflow + style.overflowY + style.overflowX);
329
- if (canScroll) {
330
- scrollables.push(parent);
331
- }
332
- parent = parent.parentElement;
333
- }
334
- return scrollables;
335
- }
336
- /** Sets up visibility tracking for all relevant contexts */
337
- setupAnchorVisibilityObserver() {
338
- if (!this.enableVisibilityEffect)
339
- return;
340
- this.cleanupAnchorVisibilityObserver();
341
- const combobox = this.combobox;
342
- if (!combobox)
343
- return;
344
- // Get all scrollable ancestors and viewport
345
- const scrollContainers = [...this.getScrollableAncestors(this), null];
346
- scrollContainers.forEach((rootContainer) => {
347
- const observer = new IntersectionObserver((entries) => {
348
- for (const entry of entries) {
349
- if (!entry.isIntersecting && this.open) {
350
- this.hide();
351
- this.emit('nile-visibility-change', {
352
- visible: false,
353
- reason: 'anchor-out-of-view',
354
- name: this.name,
355
- root: rootContainer,
356
- });
357
- return; // stop further triggers
358
- }
359
- }
360
- }, {
361
- root: rootContainer,
362
- threshold: 0.1, // 10% visible = visible
363
- });
364
- observer.observe(combobox);
365
- this.anchorVisibilityObservers.push(observer);
366
- });
367
- // Attach tab visibility listener only if property enabled
368
- if (this.enableTabClose) {
369
- document.addEventListener('visibilitychange', this.handleDocumentVisibilityChange);
370
- }
371
- }
372
- /** Cleans up all visibility observers and listeners */
373
- cleanupAnchorVisibilityObserver() {
374
- this.anchorVisibilityObservers.forEach((o) => o.disconnect());
375
- this.anchorVisibilityObservers = [];
376
- // Always remove listener to avoid stale callbacks
377
- document.removeEventListener('visibilitychange', this.handleDocumentVisibilityChange);
378
- }
379
322
  /**
380
323
  * Handles the click event on the footer.
381
324
  * @param event - The click event.
@@ -529,6 +472,63 @@ let NileSelect = class NileSelect extends NileElement {
529
472
  this.displayInput.focus();
530
473
  this.hide();
531
474
  }
475
+ /** Utility: find ALL scrollable ancestors (not just the nearest) */
476
+ getScrollableAncestors(element) {
477
+ const scrollables = [];
478
+ let parent = element.parentElement;
479
+ while (parent) {
480
+ const style = getComputedStyle(parent);
481
+ const canScroll = /(auto|scroll)/.test(style.overflow + style.overflowY + style.overflowX);
482
+ if (canScroll) {
483
+ scrollables.push(parent);
484
+ }
485
+ parent = parent.parentElement;
486
+ }
487
+ return scrollables;
488
+ }
489
+ /** Sets up visibility tracking for all relevant contexts */
490
+ setupAnchorVisibilityObserver() {
491
+ if (!this.enableVisibilityEffect)
492
+ return;
493
+ this.cleanupAnchorVisibilityObserver();
494
+ const combobox = this.combobox;
495
+ if (!combobox)
496
+ return;
497
+ // Get all scrollable ancestors and viewport
498
+ const scrollContainers = [...this.getScrollableAncestors(this), null];
499
+ scrollContainers.forEach((rootContainer) => {
500
+ const observer = new IntersectionObserver((entries) => {
501
+ for (const entry of entries) {
502
+ if (!entry.isIntersecting && this.open) {
503
+ this.hide();
504
+ this.emit('nile-visibility-change', {
505
+ visible: false,
506
+ reason: 'anchor-out-of-view',
507
+ name: this.name,
508
+ root: rootContainer,
509
+ });
510
+ return; // stop further triggers
511
+ }
512
+ }
513
+ }, {
514
+ root: rootContainer,
515
+ threshold: 0.1, // 10% visible = visible
516
+ });
517
+ observer.observe(combobox);
518
+ this.anchorVisibilityObservers.push(observer);
519
+ });
520
+ // Attach tab visibility listener only if property enabled
521
+ if (this.enableTabClose) {
522
+ document.addEventListener('visibilitychange', this.handleDocumentVisibilityChange);
523
+ }
524
+ }
525
+ /** Cleans up all visibility observers and listeners */
526
+ cleanupAnchorVisibilityObserver() {
527
+ this.anchorVisibilityObservers.forEach((o) => o.disconnect());
528
+ this.anchorVisibilityObservers = [];
529
+ // Always remove listener to avoid stale callbacks
530
+ document.removeEventListener('visibilitychange', this.handleDocumentVisibilityChange);
531
+ }
532
532
  handleComboboxMouseDown(event) {
533
533
  const path = event.composedPath();
534
534
  const isIconButton = path.some(el => el instanceof Element && el.tagName.toLowerCase() === 'nile-icon-button');
@@ -1469,9 +1469,6 @@ __decorate([
1469
1469
  __decorate([
1470
1470
  property({ attribute: 'internal-search-placeholder' })
1471
1471
  ], NileSelect.prototype, "internalSearchPlaceHolder", void 0);
1472
- __decorate([
1473
- property({ type: Boolean, reflect: true, attribute: true })
1474
- ], NileSelect.prototype, "enableVisibilityEffect", void 0);
1475
1472
  __decorate([
1476
1473
  property({ type: Boolean, reflect: true })
1477
1474
  ], NileSelect.prototype, "blockValueChange", void 0);
@@ -1564,9 +1561,6 @@ __decorate([
1564
1561
  __decorate([
1565
1562
  state()
1566
1563
  ], NileSelect.prototype, "oldMaxOptionsVisible", void 0);
1567
- __decorate([
1568
- property({ type: Boolean, reflect: true, attribute: true })
1569
- ], NileSelect.prototype, "enableTabClose", void 0);
1570
1564
  __decorate([
1571
1565
  property({ type: Boolean })
1572
1566
  ], NileSelect.prototype, "showNoResults", void 0);
@@ -1591,6 +1585,12 @@ __decorate([
1591
1585
  __decorate([
1592
1586
  property({ type: Boolean, reflect: true, attribute: true })
1593
1587
  ], NileSelect.prototype, "loading", void 0);
1588
+ __decorate([
1589
+ property({ type: Boolean, reflect: true, attribute: true })
1590
+ ], NileSelect.prototype, "enableVisibilityEffect", void 0);
1591
+ __decorate([
1592
+ property({ type: Boolean, reflect: true, attribute: true })
1593
+ ], NileSelect.prototype, "enableTabClose", void 0);
1594
1594
  __decorate([
1595
1595
  watch('disabled', { waitUntilFirstUpdate: true })
1596
1596
  ], NileSelect.prototype, "handleDisabledChange", null);