@smilodon/core 1.19.0 → 1.21.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.
- package/README.md +104 -5
- package/dist/index.cjs +1539 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1537 -190
- 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 +1539 -189
- 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/dist/types/src/components/enhanced-select.d.ts +72 -1
- package/dist/types/src/config/global-config.d.ts +21 -3
- package/dist/types/src/config/public-config.d.ts +21 -0
- package/dist/types/src/data-loading/public-types.d.ts +4 -2
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/native-types.d.ts +1 -1
- package/dist/types/src/utils/selected-options-projection.d.ts +18 -0
- package/dist/types/src/utils/selected-target-resolver.d.ts +2 -0
- package/dist/types/src/utils/visual-navigation.d.ts +15 -0
- package/package.json +1 -1
|
@@ -27,6 +27,16 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
27
27
|
private _inputContainer;
|
|
28
28
|
private _inputContent;
|
|
29
29
|
private _input;
|
|
30
|
+
private _selectedLabelTooltip;
|
|
31
|
+
private _selectedLabelTooltipTrigger;
|
|
32
|
+
private _selectedLabelTooltipPointerTrigger;
|
|
33
|
+
private _selectedLabelTooltipFocusTrigger;
|
|
34
|
+
private _selectedLabelTooltipPointerInside;
|
|
35
|
+
private _selectedLabelTooltipDismissedTrigger;
|
|
36
|
+
private _selectedLabelTooltipHideTimer;
|
|
37
|
+
private _selectedLabelTooltipResizeObserver;
|
|
38
|
+
private _selectedLabelTooltipMeasureFrame;
|
|
39
|
+
private _selectedLabelKeys;
|
|
30
40
|
private _dropdown;
|
|
31
41
|
private _optionsContainer;
|
|
32
42
|
private _loadMoreTrigger?;
|
|
@@ -43,6 +53,11 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
43
53
|
private _engine;
|
|
44
54
|
private _virtualizationScope;
|
|
45
55
|
private _renderPlan;
|
|
56
|
+
private _selectedOptionsSelectionAtOpen;
|
|
57
|
+
private _selectedOptionsConfigAtOpen;
|
|
58
|
+
private _scrollToSelectedConfigAtOpen;
|
|
59
|
+
private _closedOptionsViewportAnchor;
|
|
60
|
+
private _openOptionsViewportAnchor;
|
|
46
61
|
private _emptyStateContext;
|
|
47
62
|
private _guardedVirtualWindow;
|
|
48
63
|
private _guardedVirtualizer;
|
|
@@ -102,9 +117,12 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
102
117
|
private _clearControlIcon?;
|
|
103
118
|
private _pendingFirstRenderMark;
|
|
104
119
|
private _pendingSearchRenderMark;
|
|
105
|
-
private
|
|
120
|
+
private _rangeAnchorKey;
|
|
106
121
|
/** Chip identity is tracked independently of dropdown option positions. */
|
|
107
122
|
private _lastRenderedChipKeys;
|
|
123
|
+
/** Stable presentation nodes keyed by the engine's selected-item identity. */
|
|
124
|
+
private _chipElements;
|
|
125
|
+
private _chipExitStates;
|
|
108
126
|
private _latestChipScrollGeneration;
|
|
109
127
|
private _latestChipScrollFrame;
|
|
110
128
|
private _optionRenderer?;
|
|
@@ -125,6 +143,9 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
125
143
|
private _lifecycleTimers;
|
|
126
144
|
private _lifecycleRafs;
|
|
127
145
|
private _keyboardActiveChangeGeneration;
|
|
146
|
+
/** Invalidates selected-option positioning scheduled by an earlier opening. */
|
|
147
|
+
private _openSelectedScrollGeneration;
|
|
148
|
+
private _openSelectedScrollCleanup;
|
|
128
149
|
private _tracking;
|
|
129
150
|
private _suppressBlurClose;
|
|
130
151
|
private _renderCycleId;
|
|
@@ -231,6 +252,7 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
231
252
|
private _updateMultiScrollDrag;
|
|
232
253
|
private _endMultiScrollDrag;
|
|
233
254
|
private _createInput;
|
|
255
|
+
private _createSelectedLabelTooltip;
|
|
234
256
|
private _createDropdown;
|
|
235
257
|
private _createOptionsContainer;
|
|
236
258
|
private _createLiveRegion;
|
|
@@ -239,17 +261,49 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
239
261
|
private _createClearControl;
|
|
240
262
|
private _assembleDOM;
|
|
241
263
|
private _initializeStyles;
|
|
264
|
+
private _isArrowOrClearControlEvent;
|
|
242
265
|
private _attachEventListeners;
|
|
243
266
|
private _initializeObservers;
|
|
244
267
|
private _loadInitialSelectedItems;
|
|
245
268
|
private _runEngineEffects;
|
|
246
269
|
private _syncPopupAria;
|
|
247
270
|
private _syncComboboxAccessibility;
|
|
271
|
+
private _selectedLabelTriggerFromTarget;
|
|
272
|
+
private _getSelectedLabelForTrigger;
|
|
273
|
+
private _isSelectedLabelTruncated;
|
|
274
|
+
private _handleSelectedLabelPointerOver;
|
|
275
|
+
private _handleSelectedLabelPointerOut;
|
|
276
|
+
private _handleSelectedLabelFocusIn;
|
|
277
|
+
private _handleSelectedLabelFocusOut;
|
|
278
|
+
private _showSelectedLabelTooltip;
|
|
279
|
+
private _positionSelectedLabelTooltip;
|
|
280
|
+
private _syncSelectedLabelTooltipDescription;
|
|
281
|
+
private _removeSelectedLabelTooltipDescription;
|
|
282
|
+
private _dismissSelectedLabelTooltip;
|
|
283
|
+
private _hideSelectedLabelTooltip;
|
|
284
|
+
private _clearSelectedLabelTooltipHideTimer;
|
|
285
|
+
private _scheduleSelectedLabelTooltipHide;
|
|
286
|
+
private _isSelectedLabelVisibleInViewport;
|
|
287
|
+
private _observeSelectedLabelTooltipTargets;
|
|
288
|
+
private _scheduleSelectedLabelTooltipMeasure;
|
|
289
|
+
private _refreshSelectedLabelTooltipMeasurements;
|
|
248
290
|
private _syncListboxAccessibility;
|
|
249
291
|
private _syncRenderedOptionAccessibility;
|
|
250
292
|
private _applyFocusIntent;
|
|
251
293
|
private _handleOpen;
|
|
252
294
|
private _handleClose;
|
|
295
|
+
/**
|
|
296
|
+
* Defer the one automatic selected-option positioning operation until the
|
|
297
|
+
* dropdown's own entrance geometry has settled. Logical active/ARIA state
|
|
298
|
+
* remains synchronous in _setInitialActiveOption().
|
|
299
|
+
*/
|
|
300
|
+
private _scheduleOpenSelectedScroll;
|
|
301
|
+
private _cancelOpenSelectedScroll;
|
|
302
|
+
private _captureOptionsViewportAnchor;
|
|
303
|
+
/** Restore the previous visible option only when this opening changed order. */
|
|
304
|
+
private _restorePreservedOptionsViewport;
|
|
305
|
+
/** Used only when Element.getAnimations() is unavailable. */
|
|
306
|
+
private _getDropdownEntranceFallbackDurationMs;
|
|
253
307
|
/** Stop an outstanding exit before reopening, disconnecting or starting another one. */
|
|
254
308
|
private _cancelDropdownExit;
|
|
255
309
|
private _finishDropdownExit;
|
|
@@ -274,6 +328,12 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
274
328
|
private _handleSearch;
|
|
275
329
|
private _handleKeydown;
|
|
276
330
|
private _moveActive;
|
|
331
|
+
private _usesSelectedFirstVisualOrder;
|
|
332
|
+
private _getVisualNavigationModel;
|
|
333
|
+
private _setActiveForVisualKey;
|
|
334
|
+
private _moveToVisualBoundary;
|
|
335
|
+
private _selectKeyboardRange;
|
|
336
|
+
private _selectVisualRange;
|
|
277
337
|
/** Return true only when boundary navigation is held for an in-flight/new page. */
|
|
278
338
|
private _requestKeyboardLoadMore;
|
|
279
339
|
private _setActive;
|
|
@@ -289,12 +349,23 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
289
349
|
private _announce;
|
|
290
350
|
private _selectOption;
|
|
291
351
|
private _handleOptionRemove;
|
|
352
|
+
private _getActiveChipBadges;
|
|
353
|
+
private _getActiveChipRemoveButtons;
|
|
354
|
+
private _clearChipPresentation;
|
|
355
|
+
private _cancelChipExit;
|
|
356
|
+
private _finishChipExit;
|
|
357
|
+
private _moveFocusOutOfChip;
|
|
358
|
+
private _beginChipExit;
|
|
359
|
+
private _createChip;
|
|
360
|
+
private _updateChip;
|
|
361
|
+
private _renderSelectedChips;
|
|
292
362
|
private _updateInputDisplay;
|
|
293
363
|
private _cancelLatestChipScroll;
|
|
294
364
|
private _scheduleLatestChipScroll;
|
|
295
365
|
private _isActivelyEditingSearchInput;
|
|
296
366
|
private _renderOptionsWithAnimation;
|
|
297
367
|
private _scrollToSelected;
|
|
368
|
+
private _scrollOptionWithinOptionsContainer;
|
|
298
369
|
private _loadMoreItems;
|
|
299
370
|
private _setBusy;
|
|
300
371
|
private _handleError;
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* Allows users to define default behaviors that can be overridden at component level
|
|
4
4
|
*/
|
|
5
5
|
import type { KnownLimitationId, LimitationPolicy } from '../types/limitation.js';
|
|
6
|
+
export type SelectedOptionsPlacement = 'original' | 'selected-first';
|
|
7
|
+
export type SelectedOptionsGroupedPlacement = 'within-group';
|
|
8
|
+
export type ScrollToSelectedOnOpen = 'preserve' | 'reveal' | 'align';
|
|
9
|
+
export interface SelectedOptionsConfig {
|
|
10
|
+
/** Presentation order; does not mutate the caller's source collection. */
|
|
11
|
+
placement: SelectedOptionsPlacement;
|
|
12
|
+
/** Selected-item presentation policy when source options are grouped. */
|
|
13
|
+
groupedPlacement: SelectedOptionsGroupedPlacement;
|
|
14
|
+
}
|
|
6
15
|
type ScrollToSelectedBehavior = 'auto' | 'instant' | 'smooth';
|
|
7
16
|
type ScrollToSelectedBlock = 'start' | 'center' | 'end' | 'nearest';
|
|
8
17
|
export interface ScrollToSelectedConfig {
|
|
@@ -10,6 +19,8 @@ export interface ScrollToSelectedConfig {
|
|
|
10
19
|
enabled: boolean;
|
|
11
20
|
/** Which selected item to scroll to in multi-select mode: 'first' | 'last' */
|
|
12
21
|
multiSelectTarget: 'first' | 'last';
|
|
22
|
+
/** Positioning policy when the dropdown opens. */
|
|
23
|
+
onOpen: ScrollToSelectedOnOpen;
|
|
13
24
|
/** Scroll behavior */
|
|
14
25
|
behavior?: ScrollToSelectedBehavior;
|
|
15
26
|
/** Scroll block alignment */
|
|
@@ -264,6 +275,8 @@ export interface GlobalSelectConfig {
|
|
|
264
275
|
multiSelectDisplay: MultiSelectDisplayConfig;
|
|
265
276
|
/** Scroll to selected configuration */
|
|
266
277
|
scrollToSelected: ScrollToSelectedConfig;
|
|
278
|
+
/** Selected-option presentation policy */
|
|
279
|
+
selectedOptions: SelectedOptionsConfig;
|
|
267
280
|
/** Load more configuration */
|
|
268
281
|
loadMore: LoadMoreConfig;
|
|
269
282
|
/** Busy bucket configuration */
|
|
@@ -295,6 +308,11 @@ export interface GlobalSelectConfig {
|
|
|
295
308
|
/** Estimated row height used by the guarded EnhancedSelect viewport-windowing test path. */
|
|
296
309
|
estimatedItemHeight?: number;
|
|
297
310
|
}
|
|
311
|
+
/** Partial global/per-instance update shape for nested selected-option settings. */
|
|
312
|
+
export type SelectConfigUpdate = Omit<Partial<GlobalSelectConfig>, 'selectedOptions' | 'scrollToSelected'> & {
|
|
313
|
+
selectedOptions?: Partial<SelectedOptionsConfig>;
|
|
314
|
+
scrollToSelected?: Partial<ScrollToSelectedConfig>;
|
|
315
|
+
};
|
|
298
316
|
/**
|
|
299
317
|
* Global configuration instance
|
|
300
318
|
*/
|
|
@@ -308,7 +326,7 @@ declare class SelectConfigManager {
|
|
|
308
326
|
/**
|
|
309
327
|
* Update global configuration (deep merge)
|
|
310
328
|
*/
|
|
311
|
-
updateConfig(updates:
|
|
329
|
+
updateConfig(updates: SelectConfigUpdate): void;
|
|
312
330
|
/**
|
|
313
331
|
* Reset to default configuration
|
|
314
332
|
*/
|
|
@@ -317,7 +335,7 @@ declare class SelectConfigManager {
|
|
|
317
335
|
* Merge component-level config with global config
|
|
318
336
|
* Component-level config takes precedence
|
|
319
337
|
*/
|
|
320
|
-
mergeWithComponentConfig(componentConfig:
|
|
338
|
+
mergeWithComponentConfig(componentConfig: SelectConfigUpdate): GlobalSelectConfig;
|
|
321
339
|
private deepClone;
|
|
322
340
|
private deepMerge;
|
|
323
341
|
}
|
|
@@ -328,7 +346,7 @@ export declare const selectConfig: SelectConfigManager;
|
|
|
328
346
|
/**
|
|
329
347
|
* Helper function to configure select globally
|
|
330
348
|
*/
|
|
331
|
-
export declare function configureSelect(config:
|
|
349
|
+
export declare function configureSelect(config: SelectConfigUpdate): void;
|
|
332
350
|
/**
|
|
333
351
|
* Helper function to reset select configuration
|
|
334
352
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ScrollToSelectedConfig, SelectedOptionsConfig, SelectConfigUpdate } from './global-config.js';
|
|
2
|
+
export interface PublicConfigIssue {
|
|
3
|
+
path: string;
|
|
4
|
+
code: 'invalid-type' | 'invalid-value' | 'unknown-field';
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export type PublicConfigValidationResult<T> = {
|
|
8
|
+
valid: true;
|
|
9
|
+
value: T;
|
|
10
|
+
} | {
|
|
11
|
+
valid: false;
|
|
12
|
+
issues: readonly PublicConfigIssue[];
|
|
13
|
+
};
|
|
14
|
+
type ConfigPatch<T> = Partial<T>;
|
|
15
|
+
/** Validate a partial selected-options configuration update. */
|
|
16
|
+
export declare function validateSelectedOptionsConfig(candidate: unknown): PublicConfigValidationResult<ConfigPatch<SelectedOptionsConfig>>;
|
|
17
|
+
/** Validate a partial scroll-to-selected configuration update. */
|
|
18
|
+
export declare function validateScrollToSelectedConfig(candidate: unknown): PublicConfigValidationResult<ConfigPatch<ScrollToSelectedConfig>>;
|
|
19
|
+
/** Validate and copy only the new public configuration sections. */
|
|
20
|
+
export declare function validateSelectedOptionsConfigUpdate(config: SelectConfigUpdate): SelectConfigUpdate;
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallbackConfig, GlobalSelectConfig } from '../config/global-config.js';
|
|
1
|
+
import type { CallbackConfig, GlobalSelectConfig, ScrollToSelectedConfig, SelectedOptionsConfig } from '../config/global-config.js';
|
|
2
2
|
export type DataRequestId = string;
|
|
3
3
|
export type QueryGeneration = number;
|
|
4
4
|
export type PageCursor = string | number;
|
|
@@ -23,9 +23,11 @@ export type AcknowledgedCoreCallbacks = Omit<Partial<CallbackConfig>, 'onSearch'
|
|
|
23
23
|
onSearch?: (query: string, request?: SearchDataRequest) => void;
|
|
24
24
|
onLoadMore?: (page: number, request?: LoadMoreDataRequest) => void;
|
|
25
25
|
} & AcknowledgedCallbackAdditions;
|
|
26
|
-
export type SelectInstanceConfig = Omit<Partial<GlobalSelectConfig>, 'callbacks'> & {
|
|
26
|
+
export type SelectInstanceConfig = Omit<Partial<GlobalSelectConfig>, 'callbacks' | 'selectedOptions' | 'scrollToSelected'> & {
|
|
27
27
|
callbacks?: AcknowledgedCoreCallbacks;
|
|
28
28
|
dataLoading?: Partial<DataLoadingConfig>;
|
|
29
|
+
selectedOptions?: Partial<SelectedOptionsConfig>;
|
|
30
|
+
scrollToSelected?: Partial<ScrollToSelectedConfig>;
|
|
29
31
|
};
|
|
30
32
|
export type DataLoadingConfigIssueCode = 'unknown-field' | 'invalid-type' | 'invalid-value' | 'invalid-positive-integer' | 'requires-acknowledged-protocol';
|
|
31
33
|
export interface DataLoadingConfigIssue {
|
|
@@ -8,6 +8,8 @@ export * from './components/native-select.js';
|
|
|
8
8
|
export * from './components/enhanced-select.js';
|
|
9
9
|
export * from './components/select-option.js';
|
|
10
10
|
export * from './config/global-config.js';
|
|
11
|
+
export { validateScrollToSelectedConfig, validateSelectedOptionsConfig, validateSelectedOptionsConfigUpdate, } from './config/public-config.js';
|
|
12
|
+
export type { PublicConfigIssue, PublicConfigValidationResult } from './config/public-config.js';
|
|
11
13
|
export type * from './data-loading/public-types.js';
|
|
12
14
|
export { validateDataLoadingConfig } from './data-loading/public-config.js';
|
|
13
15
|
export type { SelectionConfig } from './config/global-config.js';
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Platform-neutral public configuration types for native adapters.
|
|
3
3
|
* This entry intentionally excludes Core's browser-only component declarations.
|
|
4
4
|
*/
|
|
5
|
-
export type { GlobalSelectConfig, SelectionConfig, MultiSelectDisplayConfig, ScrollToSelectedConfig, StyleConfig, } from './config/global-config.js';
|
|
5
|
+
export type { GlobalSelectConfig, SelectedOptionsConfig, SelectConfigUpdate, SelectionConfig, MultiSelectDisplayConfig, ScrollToSelectedConfig, StyleConfig, } from './config/global-config.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return a presentation-only ordering for option keys.
|
|
3
|
+
*
|
|
4
|
+
* The source array and selection set are never mutated. Callers remain
|
|
5
|
+
* responsible for retaining the returned order as the displayed ordering for
|
|
6
|
+
* the relevant render/open transaction.
|
|
7
|
+
*/
|
|
8
|
+
export declare function projectSelectedOptionKeys<K>(orderedKeys: readonly K[], selectedKeys: ReadonlySet<K>, placement: 'original' | 'selected-first'): K[];
|
|
9
|
+
export interface GroupedOptionKeys<GroupIdentity, K> {
|
|
10
|
+
/** Opaque identity; labels must not be used as a substitute for identity. */
|
|
11
|
+
groupIdentity: GroupIdentity;
|
|
12
|
+
orderedKeys: readonly K[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Stably partitions selected keys to the front of each group independently.
|
|
16
|
+
* Group order, identity, membership, and the source arrays are preserved.
|
|
17
|
+
*/
|
|
18
|
+
export declare function projectSelectedOptionGroups<GroupIdentity, K>(groups: readonly GroupedOptionKeys<GroupIdentity, K>[], selectedKeys: ReadonlySet<K>): GroupedOptionKeys<GroupIdentity, K>[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A stable-key navigation view of the options in their rendered order. */
|
|
2
|
+
export interface VisualNavigationModel<K> {
|
|
3
|
+
orderedKeys: readonly K[];
|
|
4
|
+
selectableKeys: readonly K[];
|
|
5
|
+
/** Zero-based rendered position for every key, including non-selectable keys. */
|
|
6
|
+
positionByKey: ReadonlyMap<K, number>;
|
|
7
|
+
/** Position among keyboard eligible keys. */
|
|
8
|
+
selectablePositionByKey: ReadonlyMap<K, number>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createVisualNavigationModel<K>(orderedKeys: readonly K[], isSelectable: (key: K) => boolean): VisualNavigationModel<K>;
|
|
11
|
+
/** Resolve a clamped keyboard movement in visual order. */
|
|
12
|
+
export declare function resolveVisualMovement<K>(model: VisualNavigationModel<K>, currentKey: K | null, delta: number): K | null;
|
|
13
|
+
export declare function resolveVisualBoundary<K>(model: VisualNavigationModel<K>, boundary: 'first' | 'last'): K | null;
|
|
14
|
+
/** Return selectable keys in the inclusive visual interval between two keys. */
|
|
15
|
+
export declare function resolveVisualRange<K>(model: VisualNavigationModel<K>, startKey: K, endKey: K): K[];
|
package/package.json
CHANGED