@smilodon/core 1.19.0 → 1.20.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 +50 -4
- package/dist/index.cjs +807 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +805 -110
- 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 +807 -109
- 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 +28 -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
|
@@ -43,6 +43,11 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
43
43
|
private _engine;
|
|
44
44
|
private _virtualizationScope;
|
|
45
45
|
private _renderPlan;
|
|
46
|
+
private _selectedOptionsSelectionAtOpen;
|
|
47
|
+
private _selectedOptionsConfigAtOpen;
|
|
48
|
+
private _scrollToSelectedConfigAtOpen;
|
|
49
|
+
private _closedOptionsViewportAnchor;
|
|
50
|
+
private _openOptionsViewportAnchor;
|
|
46
51
|
private _emptyStateContext;
|
|
47
52
|
private _guardedVirtualWindow;
|
|
48
53
|
private _guardedVirtualizer;
|
|
@@ -102,7 +107,7 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
102
107
|
private _clearControlIcon?;
|
|
103
108
|
private _pendingFirstRenderMark;
|
|
104
109
|
private _pendingSearchRenderMark;
|
|
105
|
-
private
|
|
110
|
+
private _rangeAnchorKey;
|
|
106
111
|
/** Chip identity is tracked independently of dropdown option positions. */
|
|
107
112
|
private _lastRenderedChipKeys;
|
|
108
113
|
private _latestChipScrollGeneration;
|
|
@@ -125,6 +130,9 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
125
130
|
private _lifecycleTimers;
|
|
126
131
|
private _lifecycleRafs;
|
|
127
132
|
private _keyboardActiveChangeGeneration;
|
|
133
|
+
/** Invalidates selected-option positioning scheduled by an earlier opening. */
|
|
134
|
+
private _openSelectedScrollGeneration;
|
|
135
|
+
private _openSelectedScrollCleanup;
|
|
128
136
|
private _tracking;
|
|
129
137
|
private _suppressBlurClose;
|
|
130
138
|
private _renderCycleId;
|
|
@@ -250,6 +258,18 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
250
258
|
private _applyFocusIntent;
|
|
251
259
|
private _handleOpen;
|
|
252
260
|
private _handleClose;
|
|
261
|
+
/**
|
|
262
|
+
* Defer the one automatic selected-option positioning operation until the
|
|
263
|
+
* dropdown's own entrance geometry has settled. Logical active/ARIA state
|
|
264
|
+
* remains synchronous in _setInitialActiveOption().
|
|
265
|
+
*/
|
|
266
|
+
private _scheduleOpenSelectedScroll;
|
|
267
|
+
private _cancelOpenSelectedScroll;
|
|
268
|
+
private _captureOptionsViewportAnchor;
|
|
269
|
+
/** Restore the previous visible option only when this opening changed order. */
|
|
270
|
+
private _restorePreservedOptionsViewport;
|
|
271
|
+
/** Used only when Element.getAnimations() is unavailable. */
|
|
272
|
+
private _getDropdownEntranceFallbackDurationMs;
|
|
253
273
|
/** Stop an outstanding exit before reopening, disconnecting or starting another one. */
|
|
254
274
|
private _cancelDropdownExit;
|
|
255
275
|
private _finishDropdownExit;
|
|
@@ -274,6 +294,12 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
274
294
|
private _handleSearch;
|
|
275
295
|
private _handleKeydown;
|
|
276
296
|
private _moveActive;
|
|
297
|
+
private _usesSelectedFirstVisualOrder;
|
|
298
|
+
private _getVisualNavigationModel;
|
|
299
|
+
private _setActiveForVisualKey;
|
|
300
|
+
private _moveToVisualBoundary;
|
|
301
|
+
private _selectKeyboardRange;
|
|
302
|
+
private _selectVisualRange;
|
|
277
303
|
/** Return true only when boundary navigation is held for an in-flight/new page. */
|
|
278
304
|
private _requestKeyboardLoadMore;
|
|
279
305
|
private _setActive;
|
|
@@ -295,6 +321,7 @@ export declare class EnhancedSelect extends HTMLElement implements EnhancedSelec
|
|
|
295
321
|
private _isActivelyEditingSearchInput;
|
|
296
322
|
private _renderOptionsWithAnimation;
|
|
297
323
|
private _scrollToSelected;
|
|
324
|
+
private _scrollOptionWithinOptionsContainer;
|
|
298
325
|
private _loadMoreItems;
|
|
299
326
|
private _setBusy;
|
|
300
327
|
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