@smilodon/core 1.9.3 → 1.10.1
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 +140 -377
- package/dist/index.cjs +4030 -297
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4014 -298
- 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 +4030 -297
- 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 +172 -8
- package/dist/types/src/components/native-select.d.ts +1 -1
- package/dist/types/src/components/select-option.d.ts +2 -2
- package/dist/types/src/config/global-config.d.ts +7 -5
- package/dist/types/src/data-loading/public-config.d.ts +3 -0
- package/dist/types/src/data-loading/public-types.d.ts +171 -0
- package/dist/types/src/data-loading/request-coordinator.d.ts +236 -0
- package/dist/types/src/engine/accessibility.d.ts +109 -0
- package/dist/types/src/engine/contracts.d.ts +4 -0
- package/dist/types/src/engine/index.d.ts +9 -0
- package/dist/types/src/engine/item-adapter.d.ts +23 -0
- package/dist/types/src/engine/item-registry.d.ts +31 -0
- package/dist/types/src/engine/select-effects.d.ts +20 -0
- package/dist/types/src/engine/select-events.d.ts +55 -0
- package/dist/types/src/engine/select-machine.d.ts +9 -0
- package/dist/types/src/engine/select-state.d.ts +17 -0
- package/dist/types/src/engine/selection-policy.d.ts +33 -0
- package/dist/types/src/engine/selectors.d.ts +10 -0
- package/dist/types/src/engine/virtualization.d.ts +56 -0
- package/dist/types/src/index.d.ts +6 -0
- package/dist/types/src/native-types.d.ts +5 -0
- package/dist/types/src/platform/web/accessibility-effects.d.ts +19 -0
- package/dist/types/src/platform/web/index.d.ts +2 -0
- package/dist/types/src/platform/web/select-effect-runner.d.ts +15 -0
- package/dist/types/src/platform/web/select-engine-bridge.d.ts +10 -0
- package/dist/types/src/renderers/contracts.d.ts +1 -1
- package/dist/types/src/types/limitation.d.ts +6 -0
- package/dist/types/src/types.d.ts +2 -6
- package/dist/types/src/utils/custom-option-pool.d.ts +1 -1
- package/dist/types/src/utils/virtualizer.d.ts +48 -1
- package/package.json +7 -4
- package/dist/types/src/themes/importer.d.ts +0 -112
- package/dist/types/tests/capabilities-tracking.spec.d.ts +0 -1
- package/dist/types/tests/csp.spec.d.ts +0 -5
- package/dist/types/tests/enhanced-option-renderer.spec.d.ts +0 -1
- package/dist/types/tests/interaction.spec.d.ts +0 -1
- package/dist/types/tests/lifecycle.spec.d.ts +0 -1
- package/dist/types/tests/memory-lifecycle.spec.d.ts +0 -1
- package/dist/types/tests/setup.d.ts +0 -6
- package/dist/types/tests/shadow-dom.spec.d.ts +0 -5
- package/dist/types/tests/smoke.spec.d.ts +0 -1
- package/dist/types/tests/stress.spec.d.ts +0 -5
- package/dist/types/tests/styling-contract.spec.d.ts +0 -1
- package/dist/types/tests/virtualizer.spec.d.ts +0 -1
|
@@ -3,18 +3,25 @@
|
|
|
3
3
|
* Implements all advanced features: infinite scroll, load more, busy state,
|
|
4
4
|
* server-side selection, and full customization
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Redesigned with formal elegance, refined microinteractions, and polished UX
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
import type { GroupedItem, ClassMap, SelectCapabilitiesReport, LimitationState, LimitationPolicyMap, TrackingSnapshot } from '../types';
|
|
10
|
-
import type { OptionRenderer as OptionRendererFn } from '../renderers/contracts';
|
|
11
|
-
export declare class EnhancedSelect extends HTMLElement {
|
|
8
|
+
import type { DataLoadingStateSnapshot, DataRequestCompletion, DataRequestCompletionResult, EnhancedSelectAcknowledgedSurface, SelectInstanceConfig } from '../data-loading/public-types.js';
|
|
9
|
+
import type { GroupedItem, ClassMap, SelectCapabilitiesReport, LimitationState, LimitationPolicyMap, TrackingSnapshot } from '../types.js';
|
|
10
|
+
import type { OptionRenderer as OptionRendererFn } from '../renderers/contracts.js';
|
|
11
|
+
export declare class EnhancedSelect extends HTMLElement implements EnhancedSelectAcknowledgedSurface {
|
|
12
|
+
static get observedAttributes(): string[];
|
|
12
13
|
/** live set of all connected instances; used to auto-close siblings */
|
|
13
14
|
private static _instances;
|
|
14
15
|
private static readonly _MIRRORED_STYLES_SCOPE_CLASS;
|
|
15
16
|
private static readonly _MIRRORED_STYLESHEET_CACHE_LIMIT;
|
|
16
17
|
private static readonly _mirroredStylesheetTextCache;
|
|
17
18
|
private _config;
|
|
19
|
+
private _dataLoadingConfig;
|
|
20
|
+
private _dataLoadingConfigErrorCallback?;
|
|
21
|
+
private _dataRequestCancelCallback?;
|
|
22
|
+
private _dataProjectionCallback?;
|
|
23
|
+
private _hasLastInvalidDataLoadingCandidate;
|
|
24
|
+
private _lastInvalidDataLoadingCandidate?;
|
|
18
25
|
private _shadow;
|
|
19
26
|
private _container;
|
|
20
27
|
private _inputContainer;
|
|
@@ -23,10 +30,57 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
23
30
|
private _dropdown;
|
|
24
31
|
private _optionsContainer;
|
|
25
32
|
private _loadMoreTrigger?;
|
|
33
|
+
private _acknowledgedSentinel?;
|
|
26
34
|
private _busyBucket?;
|
|
27
35
|
private _liveRegion?;
|
|
36
|
+
private _errorDescription?;
|
|
28
37
|
private _state;
|
|
38
|
+
private _engine;
|
|
39
|
+
private _virtualizationScope;
|
|
40
|
+
private _renderPlan;
|
|
41
|
+
private _guardedVirtualWindow;
|
|
42
|
+
private _guardedVirtualizer;
|
|
43
|
+
private _guardedVirtualizationRequested;
|
|
44
|
+
private _guardedVirtualizerKeys;
|
|
45
|
+
private _guardedMeasurementQuery;
|
|
46
|
+
private _guardedOptionResizeObserver;
|
|
47
|
+
private _guardedObservedOptions;
|
|
48
|
+
private _guardedObserverSeenOptions;
|
|
49
|
+
private _guardedOptionMeasurements;
|
|
50
|
+
private _guardedMeasurementGeneration;
|
|
51
|
+
private _guardedVirtualScrollTop;
|
|
52
|
+
private _guardedVirtualViewportHeight;
|
|
53
|
+
private _guardedVirtualOverscan;
|
|
54
|
+
private _guardedVirtualWindowRafId;
|
|
55
|
+
private _guardedScrollListenerAttached;
|
|
56
|
+
private _onGuardedVirtualScroll;
|
|
57
|
+
private _effectRunner;
|
|
58
|
+
private _itemAdapter;
|
|
59
|
+
private _itemRegistry;
|
|
60
|
+
private _selectedRecordsByKey;
|
|
61
|
+
private _registryItemsRef;
|
|
29
62
|
private _pageCache;
|
|
63
|
+
private _dataRequestCoordinator;
|
|
64
|
+
private _acknowledgedSearchMode;
|
|
65
|
+
private _acknowledgedReady;
|
|
66
|
+
private _acknowledgedDeferredStart;
|
|
67
|
+
private _hasEverConnected;
|
|
68
|
+
private _acknowledgedStartTask;
|
|
69
|
+
private _clearAcknowledgedCoordinatorAfterProjection;
|
|
70
|
+
private _acknowledgedConfigUpdatePending;
|
|
71
|
+
private _acknowledgedDeferredModeChange;
|
|
72
|
+
private _acknowledgedProjectionPending;
|
|
73
|
+
private _acknowledgedProjectionSettling;
|
|
74
|
+
private _acknowledgedPendingSearchQuery;
|
|
75
|
+
private _acknowledgedProjectionFailureStageForTest;
|
|
76
|
+
private _acknowledgedProjectionRunning;
|
|
77
|
+
private _acknowledgedProjectionTask;
|
|
78
|
+
private _acknowledgedProjectionScrollTop;
|
|
79
|
+
private _acknowledgedLastRequest;
|
|
80
|
+
private _acknowledgedProjectionCommitsPosition;
|
|
81
|
+
private _acknowledgedProjectionRequest;
|
|
82
|
+
private _acknowledgedProjectionAttempt;
|
|
83
|
+
private _acknowledgedProjectionDiagnostic;
|
|
30
84
|
private _resizeObserver?;
|
|
31
85
|
private _intersectionObserver?;
|
|
32
86
|
private _busyTimeout?;
|
|
@@ -48,6 +102,8 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
48
102
|
private _classMap?;
|
|
49
103
|
private _rendererHelpers;
|
|
50
104
|
private _customOptionBoundElements;
|
|
105
|
+
private _customOptionNormalizedIds;
|
|
106
|
+
private _customOptionNormalizedLabels;
|
|
51
107
|
private _mirrorGlobalStylesForCustomOptions;
|
|
52
108
|
private _globalStylesObserver;
|
|
53
109
|
private _globalStylesContainer;
|
|
@@ -57,9 +113,13 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
57
113
|
private _asyncGeneration;
|
|
58
114
|
private _lifecycleTimers;
|
|
59
115
|
private _lifecycleRafs;
|
|
116
|
+
private _keyboardActiveChangeGeneration;
|
|
60
117
|
private _tracking;
|
|
61
118
|
private _suppressBlurClose;
|
|
62
119
|
private _renderCycleId;
|
|
120
|
+
private _completedRenderCycleId;
|
|
121
|
+
private _renderCycleWaiters;
|
|
122
|
+
private _renderCycleWaiterTimeouts;
|
|
63
123
|
private _suppressNextOpenClick;
|
|
64
124
|
private _resolvedDropdownPlacement;
|
|
65
125
|
private _multiScrollDrag;
|
|
@@ -72,10 +132,11 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
72
132
|
* call this function for each group during rendering. The returned element
|
|
73
133
|
* will receive `.group-header` and `part="group-header"` automatically.
|
|
74
134
|
*/
|
|
75
|
-
get groupHeaderRenderer(): import('../types').GroupHeaderRenderer | undefined;
|
|
76
|
-
set groupHeaderRenderer(renderer: import('../types').GroupHeaderRenderer | undefined);
|
|
135
|
+
get groupHeaderRenderer(): import('../types.js').GroupHeaderRenderer | undefined;
|
|
136
|
+
set groupHeaderRenderer(renderer: import('../types.js').GroupHeaderRenderer | undefined);
|
|
77
137
|
constructor();
|
|
78
138
|
connectedCallback(): void;
|
|
139
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
79
140
|
disconnectedCallback(): void;
|
|
80
141
|
private _setGlobalStylesMirroring;
|
|
81
142
|
private _setLifecycleTimeout;
|
|
@@ -109,6 +170,40 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
109
170
|
private _getDisabledOptionBehavior;
|
|
110
171
|
private _isDisabledOptionSelectable;
|
|
111
172
|
private _isOptionSelectionBlocked;
|
|
173
|
+
private _isPhase2DevRuntime;
|
|
174
|
+
private _getDuplicateKeyPolicy;
|
|
175
|
+
private _warnPhase2;
|
|
176
|
+
private _getItemValue;
|
|
177
|
+
private _getItemLabel;
|
|
178
|
+
private _createEngineItemAdapter;
|
|
179
|
+
private _getBlockedDisabledKeys;
|
|
180
|
+
private _syncEngineSelectionConfig;
|
|
181
|
+
private _rebuildItemRegistry;
|
|
182
|
+
private _ensureRegistryCurrent;
|
|
183
|
+
private _getRecordByIndex;
|
|
184
|
+
private _getSelectedEntries;
|
|
185
|
+
private _syncLegacySelectionFromEngine;
|
|
186
|
+
private _projectedSelectedKeysSnapshot;
|
|
187
|
+
private _assertSelectionProjection;
|
|
188
|
+
private _projectedActiveKeySnapshot;
|
|
189
|
+
private _syncLegacyActiveFromEngine;
|
|
190
|
+
private _assertActiveProjection;
|
|
191
|
+
private _dispatchActiveKey;
|
|
192
|
+
private _clearDisabledEngineActive;
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated Test/backward-compatibility shim. Production active-state authority is engine.activeKey.
|
|
195
|
+
* Kept for existing renderer tests; component mutation paths dispatch by key.
|
|
196
|
+
*/
|
|
197
|
+
private _mirrorLegacyActive;
|
|
198
|
+
private _dispatchSelection;
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Test/backward-compatibility shim. Production selection authority is engine.selectedKeys.
|
|
201
|
+
* Kept for existing styling tests; dispatches to engine authority.
|
|
202
|
+
*/
|
|
203
|
+
private _mirrorLegacySelection;
|
|
204
|
+
private _requestSelectionReplacement;
|
|
205
|
+
private _registerShadowItems;
|
|
206
|
+
private _syncLegacyActiveAria;
|
|
112
207
|
private _syncStyleConfigVariables;
|
|
113
208
|
private _resolveDropdownPlacement;
|
|
114
209
|
private _syncDropdownPlacement;
|
|
@@ -126,6 +221,7 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
126
221
|
private _createDropdown;
|
|
127
222
|
private _createOptionsContainer;
|
|
128
223
|
private _createLiveRegion;
|
|
224
|
+
private _createErrorDescription;
|
|
129
225
|
private _createArrowContainer;
|
|
130
226
|
private _createClearControl;
|
|
131
227
|
private _assembleDOM;
|
|
@@ -133,6 +229,12 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
133
229
|
private _attachEventListeners;
|
|
134
230
|
private _initializeObservers;
|
|
135
231
|
private _loadInitialSelectedItems;
|
|
232
|
+
private _runEngineEffects;
|
|
233
|
+
private _syncPopupAria;
|
|
234
|
+
private _syncComboboxAccessibility;
|
|
235
|
+
private _syncListboxAccessibility;
|
|
236
|
+
private _syncRenderedOptionAccessibility;
|
|
237
|
+
private _applyFocusIntent;
|
|
136
238
|
private _handleOpen;
|
|
137
239
|
private _handleClose;
|
|
138
240
|
private _updateDropdownVisibility;
|
|
@@ -161,6 +263,7 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
161
263
|
private _handleTypeAhead;
|
|
162
264
|
private _selectAll;
|
|
163
265
|
private _selectRange;
|
|
266
|
+
private _getSelectEventDetail;
|
|
164
267
|
private _setInitialActiveOption;
|
|
165
268
|
private _announce;
|
|
166
269
|
private _selectOption;
|
|
@@ -187,6 +290,7 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
187
290
|
* Set items to display in the select
|
|
188
291
|
*/
|
|
189
292
|
setItems(items: unknown[]): void;
|
|
293
|
+
private _groupItemsByProperty;
|
|
190
294
|
/**
|
|
191
295
|
* Set grouped items
|
|
192
296
|
*/
|
|
@@ -230,7 +334,16 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
230
334
|
/**
|
|
231
335
|
* Update component configuration
|
|
232
336
|
*/
|
|
233
|
-
updateConfig(config:
|
|
337
|
+
updateConfig(config: SelectInstanceConfig): void;
|
|
338
|
+
/** Open the acknowledged request lifecycle after the host has installed listeners. */
|
|
339
|
+
startDataLoading(): void;
|
|
340
|
+
/** Return detached coordinator state without exposing its canonical item storage. */
|
|
341
|
+
getDataLoadingState(): DataLoadingStateSnapshot;
|
|
342
|
+
/** Synchronously accept/classify a host completion; DOM projection proceeds asynchronously. */
|
|
343
|
+
completeDataRequest(completion: DataRequestCompletion): DataRequestCompletionResult;
|
|
344
|
+
private _createCoordinatorConfig;
|
|
345
|
+
private _ensureDataRequestCoordinator;
|
|
346
|
+
private _startAcknowledgedDataLoading;
|
|
234
347
|
private _mergeConfig;
|
|
235
348
|
private _handleClearControlClick;
|
|
236
349
|
private _syncClearControlState;
|
|
@@ -253,8 +366,59 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
253
366
|
/**
|
|
254
367
|
* Render options based on current state
|
|
255
368
|
*/
|
|
369
|
+
private _deriveVirtualizationScope;
|
|
370
|
+
private _getMountedVirtualizationKeys;
|
|
371
|
+
private _refreshMountedVirtualizationScope;
|
|
372
|
+
private _appendMountedVirtualizationTargets;
|
|
373
|
+
private _createLegacyRenderPlan;
|
|
374
|
+
private _createVirtualRenderPlan;
|
|
375
|
+
private _ensureGuardedVirtualizer;
|
|
376
|
+
private _resolveGuardedEstimatedItemHeight;
|
|
377
|
+
private _resolveGuardedViewportHeight;
|
|
378
|
+
private _clampGuardedScrollPosition;
|
|
379
|
+
private _createGuardedSpacer;
|
|
380
|
+
private _appendGuardedTopSpacer;
|
|
381
|
+
private _appendGuardedBottomSpacer;
|
|
382
|
+
private _resolveGuardedOverscan;
|
|
383
|
+
private _applyGuardedWindowUpdate;
|
|
384
|
+
private _scheduleGuardedVirtualWindowUpdate;
|
|
385
|
+
private _cancelGuardedVirtualWindowUpdate;
|
|
386
|
+
private _applyGuardedScrollResult;
|
|
387
|
+
/** Test-only activation seam; deliberately absent from public config/types. */
|
|
388
|
+
private _enableAcknowledgedDataLoadingForTest;
|
|
389
|
+
/** Listener installation must precede this private test-only readiness gate. */
|
|
390
|
+
private _setAcknowledgedDataLoadingReadyForTest;
|
|
391
|
+
private _dispatchAcknowledgedActions;
|
|
392
|
+
private _dispatchAcknowledgedEvent;
|
|
393
|
+
/** Test-only completion seam; accepted snapshots are projected from coordinator state. */
|
|
394
|
+
private _completeDataRequestForTest;
|
|
395
|
+
private _failNextAcknowledgedProjectionForTest;
|
|
396
|
+
/** Retries only from the canonical accepted coordinator snapshot, never a host payload. */
|
|
397
|
+
private _retryAcknowledgedProjectionForTest;
|
|
398
|
+
private _retryAcknowledgedProjection;
|
|
399
|
+
private _projectAcknowledgedSnapshot;
|
|
400
|
+
private _applyAcknowledgedSnapshot;
|
|
401
|
+
private _recordAcknowledgedProjectionFailure;
|
|
402
|
+
private _dispatchDataProjectionNotification;
|
|
403
|
+
private _dispatchPendingAcknowledgedSearchIntent;
|
|
404
|
+
/** Apply config/query changes coalesced while an accepted snapshot projected. */
|
|
405
|
+
private _finishAcknowledgedProjectionSettlement;
|
|
406
|
+
private _updateGuardedVirtualWindow;
|
|
407
|
+
private _destroyGuardedVirtualizer;
|
|
408
|
+
private _invalidateGuardedMeasurements;
|
|
409
|
+
private _createGuardedOptionResizeObserver;
|
|
410
|
+
private _captureGuardedScrollAnchor;
|
|
411
|
+
private _syncGuardedOptionResizeTargets;
|
|
412
|
+
private _teardownGuardedOptionResizeObserver;
|
|
413
|
+
private _materializeGuardedVirtualKey;
|
|
414
|
+
private _refreshVirtualizationScope;
|
|
256
415
|
private _renderOptions;
|
|
416
|
+
private _waitForRenderCycle;
|
|
417
|
+
private _resolveRenderCycle;
|
|
418
|
+
private _resolvePendingRenderCycles;
|
|
419
|
+
private _unobserveGuardedOptionResizeTargets;
|
|
257
420
|
private _renderSingleOption;
|
|
258
421
|
private _normalizeCustomOptionElement;
|
|
259
422
|
private _addLoadMoreTrigger;
|
|
423
|
+
private _shouldRenderLoadMoreTrigger;
|
|
260
424
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionRenderer, OptionTemplate } from "../renderers/contracts";
|
|
1
|
+
import { OptionRenderer, OptionTemplate } from "../renderers/contracts.js";
|
|
2
2
|
export declare class NativeSelectElement extends HTMLElement {
|
|
3
3
|
static get observedAttributes(): string[];
|
|
4
4
|
private _options;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Independent Option Component
|
|
3
3
|
* High cohesion, low coupling - handles its own selection state and events
|
|
4
4
|
*/
|
|
5
|
-
import type { DisabledOptionBehaviorConfig } from '../config/global-config';
|
|
6
|
-
import { ClassMap } from '../types';
|
|
5
|
+
import type { DisabledOptionBehaviorConfig } from '../config/global-config.js';
|
|
6
|
+
import { ClassMap } from '../types.js';
|
|
7
7
|
export interface OptionConfig {
|
|
8
8
|
/** The data item this option represents */
|
|
9
9
|
item: unknown;
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* Global Configuration System for Select Components
|
|
3
3
|
* Allows users to define default behaviors that can be overridden at component level
|
|
4
4
|
*/
|
|
5
|
-
import type { KnownLimitationId, LimitationPolicy } from '../types';
|
|
5
|
+
import type { KnownLimitationId, LimitationPolicy } from '../types/limitation.js';
|
|
6
|
+
type ScrollToSelectedBehavior = 'auto' | 'instant' | 'smooth';
|
|
7
|
+
type ScrollToSelectedBlock = 'start' | 'center' | 'end' | 'nearest';
|
|
6
8
|
export interface ScrollToSelectedConfig {
|
|
7
9
|
/** Whether to scroll to selected item when dropdown opens/closes */
|
|
8
10
|
enabled: boolean;
|
|
9
11
|
/** Which selected item to scroll to in multi-select mode: 'first' | 'last' */
|
|
10
12
|
multiSelectTarget: 'first' | 'last';
|
|
11
13
|
/** Scroll behavior */
|
|
12
|
-
behavior?:
|
|
14
|
+
behavior?: ScrollToSelectedBehavior;
|
|
13
15
|
/** Scroll block alignment */
|
|
14
|
-
block?:
|
|
16
|
+
block?: ScrollToSelectedBlock;
|
|
15
17
|
}
|
|
16
18
|
export interface LoadMoreConfig {
|
|
17
19
|
/** Enable load more functionality */
|
|
@@ -280,9 +282,9 @@ export interface GlobalSelectConfig {
|
|
|
280
282
|
searchable?: boolean;
|
|
281
283
|
/** Placeholder text */
|
|
282
284
|
placeholder?: string;
|
|
283
|
-
/**
|
|
285
|
+
/** Legacy chunked rendering toggle for large flat EnhancedSelect lists; not viewport windowing. */
|
|
284
286
|
virtualize?: boolean;
|
|
285
|
-
/** Estimated
|
|
287
|
+
/** Estimated row height used by the guarded EnhancedSelect viewport-windowing test path. */
|
|
286
288
|
estimatedItemHeight?: number;
|
|
287
289
|
}
|
|
288
290
|
/**
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { CallbackConfig, GlobalSelectConfig } from '../config/global-config.js';
|
|
2
|
+
export type DataRequestId = string;
|
|
3
|
+
export type QueryGeneration = number;
|
|
4
|
+
export type PageCursor = string | number;
|
|
5
|
+
export interface DataLoadingConfig {
|
|
6
|
+
protocol?: 'legacy' | 'acknowledged';
|
|
7
|
+
searchMode?: 'local' | 'remote' | 'hybrid';
|
|
8
|
+
paginationMode?: 'page' | 'cursor';
|
|
9
|
+
firstPage?: number;
|
|
10
|
+
fetchLimit?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedDataLoadingConfig {
|
|
13
|
+
readonly protocol: 'legacy' | 'acknowledged';
|
|
14
|
+
readonly searchMode: 'local' | 'remote' | 'hybrid';
|
|
15
|
+
readonly paginationMode: 'page' | 'cursor';
|
|
16
|
+
readonly firstPage: number;
|
|
17
|
+
readonly fetchLimit?: number;
|
|
18
|
+
}
|
|
19
|
+
export type AcknowledgedCoreCallbacks = Omit<Partial<CallbackConfig>, 'onSearch' | 'onLoadMore'> & {
|
|
20
|
+
onSearch?: (query: string, request?: SearchDataRequest) => void;
|
|
21
|
+
onLoadMore?: (page: number, request?: LoadMoreDataRequest) => void;
|
|
22
|
+
} & AcknowledgedCallbackAdditions;
|
|
23
|
+
export type SelectInstanceConfig = Omit<Partial<GlobalSelectConfig>, 'callbacks'> & {
|
|
24
|
+
callbacks?: AcknowledgedCoreCallbacks;
|
|
25
|
+
dataLoading?: Partial<DataLoadingConfig>;
|
|
26
|
+
};
|
|
27
|
+
export type DataLoadingConfigIssueCode = 'unknown-field' | 'invalid-type' | 'invalid-value' | 'invalid-positive-integer' | 'requires-acknowledged-protocol';
|
|
28
|
+
export interface DataLoadingConfigIssue {
|
|
29
|
+
path: string;
|
|
30
|
+
code: DataLoadingConfigIssueCode;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
export type DataLoadingConfigValidationResult = {
|
|
34
|
+
valid: true;
|
|
35
|
+
value: ResolvedDataLoadingConfig;
|
|
36
|
+
} | {
|
|
37
|
+
valid: false;
|
|
38
|
+
issues: readonly DataLoadingConfigIssue[];
|
|
39
|
+
};
|
|
40
|
+
export interface DataRequestBase {
|
|
41
|
+
readonly requestId: DataRequestId;
|
|
42
|
+
readonly queryGeneration: QueryGeneration;
|
|
43
|
+
readonly query: string;
|
|
44
|
+
readonly normalizedQuery: string;
|
|
45
|
+
readonly fetchLimit: number;
|
|
46
|
+
readonly position: PagePosition;
|
|
47
|
+
}
|
|
48
|
+
export interface SearchDataRequest extends DataRequestBase {
|
|
49
|
+
readonly kind: 'search';
|
|
50
|
+
readonly mode: 'remote' | 'hybrid';
|
|
51
|
+
}
|
|
52
|
+
export interface LoadMoreDataRequest extends DataRequestBase {
|
|
53
|
+
readonly kind: 'loadMore';
|
|
54
|
+
}
|
|
55
|
+
export type PagePosition = Readonly<{
|
|
56
|
+
mode: 'page';
|
|
57
|
+
page: number;
|
|
58
|
+
}> | Readonly<{
|
|
59
|
+
mode: 'cursor';
|
|
60
|
+
cursor?: PageCursor;
|
|
61
|
+
ordinal: number;
|
|
62
|
+
}>;
|
|
63
|
+
export type DataRequest = SearchDataRequest | LoadMoreDataRequest;
|
|
64
|
+
export interface DataRequestError {
|
|
65
|
+
readonly message: string;
|
|
66
|
+
readonly code?: string;
|
|
67
|
+
readonly retryable?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface DataRequestCancelNotification {
|
|
70
|
+
readonly requestId: DataRequestId;
|
|
71
|
+
readonly queryGeneration: QueryGeneration;
|
|
72
|
+
readonly reason: 'query-changed' | 'config-changed' | 'disconnected';
|
|
73
|
+
}
|
|
74
|
+
export type DataRequestCompletion = Readonly<{
|
|
75
|
+
requestId: DataRequestId;
|
|
76
|
+
queryGeneration: QueryGeneration;
|
|
77
|
+
status: 'succeeded';
|
|
78
|
+
items: readonly unknown[];
|
|
79
|
+
hasMore: true;
|
|
80
|
+
nextCursor?: PageCursor;
|
|
81
|
+
}> | Readonly<{
|
|
82
|
+
requestId: DataRequestId;
|
|
83
|
+
queryGeneration: QueryGeneration;
|
|
84
|
+
status: 'empty';
|
|
85
|
+
hasMore: true;
|
|
86
|
+
advance: 'next' | 'retry';
|
|
87
|
+
nextCursor?: PageCursor;
|
|
88
|
+
}> | Readonly<{
|
|
89
|
+
requestId: DataRequestId;
|
|
90
|
+
queryGeneration: QueryGeneration;
|
|
91
|
+
status: 'exhausted';
|
|
92
|
+
items: readonly unknown[];
|
|
93
|
+
hasMore: false;
|
|
94
|
+
}> | Readonly<{
|
|
95
|
+
requestId: DataRequestId;
|
|
96
|
+
queryGeneration: QueryGeneration;
|
|
97
|
+
status: 'failed';
|
|
98
|
+
error: DataRequestError;
|
|
99
|
+
}> | Readonly<{
|
|
100
|
+
requestId: DataRequestId;
|
|
101
|
+
queryGeneration: QueryGeneration;
|
|
102
|
+
status: 'cancelled';
|
|
103
|
+
reason?: 'host-cancelled';
|
|
104
|
+
}>;
|
|
105
|
+
export type DataRequestCompletionResult = 'accepted' | 'stale' | 'unknown-request' | 'invalid' | 'resource-limit';
|
|
106
|
+
export type DataLoadingStatus = 'idle' | 'requested' | 'loading' | 'succeeded' | 'empty' | 'exhausted' | 'failed' | 'cancelled' | 'resource-limited';
|
|
107
|
+
export type DataLoadingResourceLimit = Readonly<{
|
|
108
|
+
reason: 'cursor-depth';
|
|
109
|
+
maxCursorPages: number;
|
|
110
|
+
requestId?: DataRequestId;
|
|
111
|
+
}> | Readonly<{
|
|
112
|
+
reason: 'cursor-token-size';
|
|
113
|
+
maxCursorTokenBytes: number;
|
|
114
|
+
actualCursorTokenBytes: number;
|
|
115
|
+
requestId: DataRequestId;
|
|
116
|
+
}>;
|
|
117
|
+
export interface DataLoadingStateSnapshot {
|
|
118
|
+
readonly status: DataLoadingStatus;
|
|
119
|
+
readonly connected: boolean;
|
|
120
|
+
/** Core request or accepted-snapshot projection is still pending; excludes external presentation loading. */
|
|
121
|
+
readonly busy: boolean;
|
|
122
|
+
readonly projectionPending: boolean;
|
|
123
|
+
readonly queryGeneration: QueryGeneration;
|
|
124
|
+
readonly activeRequest: DataRequest | null;
|
|
125
|
+
readonly hasMore: boolean;
|
|
126
|
+
readonly nextEligiblePosition: PagePosition;
|
|
127
|
+
readonly error: DataRequestError | null;
|
|
128
|
+
readonly resourceLimit: DataLoadingResourceLimit | null;
|
|
129
|
+
}
|
|
130
|
+
export type DataProjectionEventDetail = Readonly<{
|
|
131
|
+
requestId: DataRequestId;
|
|
132
|
+
queryGeneration: QueryGeneration;
|
|
133
|
+
attempt: number;
|
|
134
|
+
status: 'complete';
|
|
135
|
+
}> | Readonly<{
|
|
136
|
+
requestId: DataRequestId;
|
|
137
|
+
queryGeneration: QueryGeneration;
|
|
138
|
+
attempt: number;
|
|
139
|
+
status: 'failed';
|
|
140
|
+
error: {
|
|
141
|
+
readonly message: string;
|
|
142
|
+
};
|
|
143
|
+
}>;
|
|
144
|
+
export interface DataLoadingConfigErrorDetail {
|
|
145
|
+
readonly issues: readonly DataLoadingConfigIssue[];
|
|
146
|
+
}
|
|
147
|
+
export type DataLoadingConfigErrorEventDetail = DataLoadingConfigErrorDetail;
|
|
148
|
+
export interface AcknowledgedCallbackAdditions {
|
|
149
|
+
onDataRequestCancel?: (detail: DataRequestCancelNotification) => void;
|
|
150
|
+
onDataProjection?: (detail: DataProjectionEventDetail) => void;
|
|
151
|
+
onDataLoadingConfigError?: (detail: DataLoadingConfigErrorEventDetail) => void;
|
|
152
|
+
}
|
|
153
|
+
export interface EnhancedSelectAcknowledgedSurface {
|
|
154
|
+
updateConfig(config: SelectInstanceConfig): void;
|
|
155
|
+
startDataLoading(): void;
|
|
156
|
+
getDataLoadingState(): DataLoadingStateSnapshot;
|
|
157
|
+
completeDataRequest(completion: DataRequestCompletion): DataRequestCompletionResult;
|
|
158
|
+
}
|
|
159
|
+
declare module '../types.js' {
|
|
160
|
+
interface SearchEventDetail {
|
|
161
|
+
request?: SearchDataRequest;
|
|
162
|
+
}
|
|
163
|
+
interface LoadMoreEventDetail {
|
|
164
|
+
request?: LoadMoreDataRequest;
|
|
165
|
+
}
|
|
166
|
+
interface SelectEventsDetailMap {
|
|
167
|
+
dataRequestCancel: DataRequestCancelNotification;
|
|
168
|
+
dataProjection: DataProjectionEventDetail;
|
|
169
|
+
dataLoadingConfigError: DataLoadingConfigErrorEventDetail;
|
|
170
|
+
}
|
|
171
|
+
}
|