@smilodon/core 1.10.0 → 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 +130 -371
- package/dist/index.cjs +1918 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1918 -21
- 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 +1918 -20
- 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 +70 -7
- 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 +5 -3
- 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/index.d.ts +2 -0
- package/dist/types/src/native-types.d.ts +5 -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/package.json +7 -4
- package/dist/types/src/themes/importer.d.ts +0 -112
- package/dist/types/tests/accessibility-contract.spec.d.ts +0 -1
- 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/enhanced-select-accessibility-integration.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-active-authority.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-active-parity.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-authority.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-compatibility-projection.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-selection-parity.spec.d.ts +0 -1
- package/dist/types/tests/enhanced-select-virtualization-integration.spec.d.ts +0 -1
- package/dist/types/tests/interaction.spec.d.ts +0 -1
- package/dist/types/tests/item-adapter.spec.d.ts +0 -1
- package/dist/types/tests/item-registry.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/select-accessibility.spec.d.ts +0 -1
- package/dist/types/tests/select-selection.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/virtualization-contract.spec.d.ts +0 -1
- package/dist/types/tests/virtualizer.spec.d.ts +0 -1
- package/dist/types/tests/web-accessibility-effects.spec.d.ts +0 -1
|
@@ -5,10 +5,10 @@
|
|
|
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
12
|
static get observedAttributes(): string[];
|
|
13
13
|
/** live set of all connected instances; used to auto-close siblings */
|
|
14
14
|
private static _instances;
|
|
@@ -16,6 +16,12 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
16
16
|
private static readonly _MIRRORED_STYLESHEET_CACHE_LIMIT;
|
|
17
17
|
private static readonly _mirroredStylesheetTextCache;
|
|
18
18
|
private _config;
|
|
19
|
+
private _dataLoadingConfig;
|
|
20
|
+
private _dataLoadingConfigErrorCallback?;
|
|
21
|
+
private _dataRequestCancelCallback?;
|
|
22
|
+
private _dataProjectionCallback?;
|
|
23
|
+
private _hasLastInvalidDataLoadingCandidate;
|
|
24
|
+
private _lastInvalidDataLoadingCandidate?;
|
|
19
25
|
private _shadow;
|
|
20
26
|
private _container;
|
|
21
27
|
private _inputContainer;
|
|
@@ -24,6 +30,7 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
24
30
|
private _dropdown;
|
|
25
31
|
private _optionsContainer;
|
|
26
32
|
private _loadMoreTrigger?;
|
|
33
|
+
private _acknowledgedSentinel?;
|
|
27
34
|
private _busyBucket?;
|
|
28
35
|
private _liveRegion?;
|
|
29
36
|
private _errorDescription?;
|
|
@@ -53,6 +60,27 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
53
60
|
private _selectedRecordsByKey;
|
|
54
61
|
private _registryItemsRef;
|
|
55
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;
|
|
56
84
|
private _resizeObserver?;
|
|
57
85
|
private _intersectionObserver?;
|
|
58
86
|
private _busyTimeout?;
|
|
@@ -89,6 +117,9 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
89
117
|
private _tracking;
|
|
90
118
|
private _suppressBlurClose;
|
|
91
119
|
private _renderCycleId;
|
|
120
|
+
private _completedRenderCycleId;
|
|
121
|
+
private _renderCycleWaiters;
|
|
122
|
+
private _renderCycleWaiterTimeouts;
|
|
92
123
|
private _suppressNextOpenClick;
|
|
93
124
|
private _resolvedDropdownPlacement;
|
|
94
125
|
private _multiScrollDrag;
|
|
@@ -101,8 +132,8 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
101
132
|
* call this function for each group during rendering. The returned element
|
|
102
133
|
* will receive `.group-header` and `part="group-header"` automatically.
|
|
103
134
|
*/
|
|
104
|
-
get groupHeaderRenderer(): import('../types').GroupHeaderRenderer | undefined;
|
|
105
|
-
set groupHeaderRenderer(renderer: import('../types').GroupHeaderRenderer | undefined);
|
|
135
|
+
get groupHeaderRenderer(): import('../types.js').GroupHeaderRenderer | undefined;
|
|
136
|
+
set groupHeaderRenderer(renderer: import('../types.js').GroupHeaderRenderer | undefined);
|
|
106
137
|
constructor();
|
|
107
138
|
connectedCallback(): void;
|
|
108
139
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
@@ -303,7 +334,16 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
303
334
|
/**
|
|
304
335
|
* Update component configuration
|
|
305
336
|
*/
|
|
306
|
-
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;
|
|
307
347
|
private _mergeConfig;
|
|
308
348
|
private _handleClearControlClick;
|
|
309
349
|
private _syncClearControlState;
|
|
@@ -344,6 +384,25 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
344
384
|
private _scheduleGuardedVirtualWindowUpdate;
|
|
345
385
|
private _cancelGuardedVirtualWindowUpdate;
|
|
346
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;
|
|
347
406
|
private _updateGuardedVirtualWindow;
|
|
348
407
|
private _destroyGuardedVirtualizer;
|
|
349
408
|
private _invalidateGuardedMeasurements;
|
|
@@ -354,8 +413,12 @@ export declare class EnhancedSelect extends HTMLElement {
|
|
|
354
413
|
private _materializeGuardedVirtualKey;
|
|
355
414
|
private _refreshVirtualizationScope;
|
|
356
415
|
private _renderOptions;
|
|
416
|
+
private _waitForRenderCycle;
|
|
417
|
+
private _resolveRenderCycle;
|
|
418
|
+
private _resolvePendingRenderCycles;
|
|
357
419
|
private _unobserveGuardedOptionResizeTargets;
|
|
358
420
|
private _renderSingleOption;
|
|
359
421
|
private _normalizeCustomOptionElement;
|
|
360
422
|
private _addLoadMoreTrigger;
|
|
423
|
+
private _shouldRenderLoadMoreTrigger;
|
|
361
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 */
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-independent coordinator for the opt-in acknowledged data-loading
|
|
3
|
+
* protocol. This module is intentionally not re-exported from the package
|
|
4
|
+
* entry point; public component/adapter integration is a later increment.
|
|
5
|
+
*/
|
|
6
|
+
export type DataRequestId = string;
|
|
7
|
+
export type QueryGeneration = number;
|
|
8
|
+
export type PageCursor = string | number;
|
|
9
|
+
export type DataRequestProtocol = 'legacy' | 'acknowledged';
|
|
10
|
+
export type DataSearchMode = 'local' | 'remote' | 'hybrid';
|
|
11
|
+
export type DataPaginationMode = 'page' | 'cursor';
|
|
12
|
+
export interface DataLoadingConfig {
|
|
13
|
+
protocol?: DataRequestProtocol;
|
|
14
|
+
searchMode?: DataSearchMode;
|
|
15
|
+
paginationMode?: DataPaginationMode;
|
|
16
|
+
firstPage?: number;
|
|
17
|
+
fetchLimit?: number;
|
|
18
|
+
/** Internal acknowledged-cursor policy; not a public component option yet. */
|
|
19
|
+
maxCursorPages?: number;
|
|
20
|
+
/** UTF-8 bytes per opaque cursor; internal until component integration is authorized. */
|
|
21
|
+
maxCursorTokenBytes?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface DataCoordinatorConfig {
|
|
24
|
+
dataLoading?: DataLoadingConfig;
|
|
25
|
+
infiniteScroll?: {
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
initialPage?: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface DataRequestBase {
|
|
31
|
+
readonly requestId: DataRequestId;
|
|
32
|
+
readonly queryGeneration: QueryGeneration;
|
|
33
|
+
readonly query: string;
|
|
34
|
+
readonly normalizedQuery: string;
|
|
35
|
+
readonly fetchLimit: number;
|
|
36
|
+
readonly position: PagePosition;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchDataRequest extends DataRequestBase {
|
|
39
|
+
readonly kind: 'search';
|
|
40
|
+
readonly mode: 'remote' | 'hybrid';
|
|
41
|
+
}
|
|
42
|
+
export type PagePosition = Readonly<{
|
|
43
|
+
mode: 'page';
|
|
44
|
+
page: number;
|
|
45
|
+
}> | Readonly<{
|
|
46
|
+
mode: 'cursor';
|
|
47
|
+
cursor?: PageCursor;
|
|
48
|
+
ordinal: number;
|
|
49
|
+
}>;
|
|
50
|
+
export interface LoadMoreDataRequest extends DataRequestBase {
|
|
51
|
+
readonly kind: 'loadMore';
|
|
52
|
+
}
|
|
53
|
+
export type DataRequest = SearchDataRequest | LoadMoreDataRequest;
|
|
54
|
+
export interface DataRequestError {
|
|
55
|
+
readonly message: string;
|
|
56
|
+
readonly code?: string;
|
|
57
|
+
readonly retryable?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface DataRequestCancelNotification {
|
|
60
|
+
readonly requestId: DataRequestId;
|
|
61
|
+
readonly queryGeneration: QueryGeneration;
|
|
62
|
+
readonly reason: 'query-changed' | 'config-changed' | 'disconnected';
|
|
63
|
+
}
|
|
64
|
+
export type DataRequestCompletion = Readonly<{
|
|
65
|
+
requestId: DataRequestId;
|
|
66
|
+
queryGeneration: QueryGeneration;
|
|
67
|
+
status: 'succeeded';
|
|
68
|
+
items: readonly unknown[];
|
|
69
|
+
hasMore: true;
|
|
70
|
+
nextCursor?: PageCursor;
|
|
71
|
+
}> | Readonly<{
|
|
72
|
+
requestId: DataRequestId;
|
|
73
|
+
queryGeneration: QueryGeneration;
|
|
74
|
+
status: 'empty';
|
|
75
|
+
hasMore: true;
|
|
76
|
+
advance: 'next' | 'retry';
|
|
77
|
+
nextCursor?: PageCursor;
|
|
78
|
+
}> | Readonly<{
|
|
79
|
+
requestId: DataRequestId;
|
|
80
|
+
queryGeneration: QueryGeneration;
|
|
81
|
+
status: 'exhausted';
|
|
82
|
+
items: readonly unknown[];
|
|
83
|
+
hasMore: false;
|
|
84
|
+
}> | Readonly<{
|
|
85
|
+
requestId: DataRequestId;
|
|
86
|
+
queryGeneration: QueryGeneration;
|
|
87
|
+
status: 'failed';
|
|
88
|
+
error: DataRequestError;
|
|
89
|
+
}> | Readonly<{
|
|
90
|
+
requestId: DataRequestId;
|
|
91
|
+
queryGeneration: QueryGeneration;
|
|
92
|
+
status: 'cancelled';
|
|
93
|
+
reason?: 'host-cancelled';
|
|
94
|
+
}>;
|
|
95
|
+
export type DataRequestCompletionResult = 'accepted' | 'stale' | 'unknown-request' | 'invalid' | 'resource-limit';
|
|
96
|
+
export type DataCoordinatorStatus = 'idle' | 'requested' | 'loading' | 'succeeded' | 'empty' | 'exhausted' | 'failed' | 'cancelled' | 'resource-limited';
|
|
97
|
+
export type DataCoordinatorResourceLimit = Readonly<{
|
|
98
|
+
reason: 'cursor-depth';
|
|
99
|
+
maxCursorPages: number;
|
|
100
|
+
requestId?: DataRequestId;
|
|
101
|
+
}> | Readonly<{
|
|
102
|
+
reason: 'cursor-token-size';
|
|
103
|
+
maxCursorTokenBytes: number;
|
|
104
|
+
actualCursorTokenBytes: number;
|
|
105
|
+
requestId: DataRequestId;
|
|
106
|
+
}>;
|
|
107
|
+
export type DataCoordinatorAction = Readonly<{
|
|
108
|
+
type: 'request';
|
|
109
|
+
request: DataRequest;
|
|
110
|
+
}> | Readonly<{
|
|
111
|
+
type: 'cancel';
|
|
112
|
+
notification: DataRequestCancelNotification;
|
|
113
|
+
}>;
|
|
114
|
+
export interface CoordinatorValidationIssue {
|
|
115
|
+
readonly field: string;
|
|
116
|
+
readonly message: string;
|
|
117
|
+
}
|
|
118
|
+
export type ConfigurationValidation = Readonly<{
|
|
119
|
+
valid: true;
|
|
120
|
+
value: ResolvedDataCoordinatorConfig;
|
|
121
|
+
}> | Readonly<{
|
|
122
|
+
valid: false;
|
|
123
|
+
errors: readonly CoordinatorValidationIssue[];
|
|
124
|
+
}>;
|
|
125
|
+
export interface ResolvedDataCoordinatorConfig {
|
|
126
|
+
readonly protocol: DataRequestProtocol;
|
|
127
|
+
readonly searchMode: DataSearchMode;
|
|
128
|
+
readonly paginationMode: DataPaginationMode;
|
|
129
|
+
readonly firstPage: number;
|
|
130
|
+
readonly initialPage: number;
|
|
131
|
+
readonly fetchLimit?: number;
|
|
132
|
+
readonly maxCursorPages: number;
|
|
133
|
+
readonly maxCursorTokenBytes: number;
|
|
134
|
+
}
|
|
135
|
+
export interface DataRequestCoordinatorOptions {
|
|
136
|
+
config?: DataCoordinatorConfig;
|
|
137
|
+
initialQuery?: string;
|
|
138
|
+
initialItems?: readonly unknown[];
|
|
139
|
+
/** Whether another page/position is available for an acknowledged local list. */
|
|
140
|
+
hasMore?: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface DataCoordinatorSnapshot {
|
|
143
|
+
readonly status: DataCoordinatorStatus;
|
|
144
|
+
readonly connected: boolean;
|
|
145
|
+
readonly busy: boolean;
|
|
146
|
+
readonly query: string;
|
|
147
|
+
readonly normalizedQuery: string;
|
|
148
|
+
readonly queryGeneration: QueryGeneration;
|
|
149
|
+
readonly items: readonly unknown[];
|
|
150
|
+
readonly hasMore: boolean;
|
|
151
|
+
readonly activeRequest: DataRequest | null;
|
|
152
|
+
readonly lastCommittedPage?: number;
|
|
153
|
+
readonly nextEligiblePosition: PagePosition;
|
|
154
|
+
readonly error: DataRequestError | null;
|
|
155
|
+
/** A bounded-resource outcome; never aliases server exhaustion. */
|
|
156
|
+
readonly resourceLimit: DataCoordinatorResourceLimit | null;
|
|
157
|
+
readonly sentinelBlocked: boolean;
|
|
158
|
+
readonly sentinelIntersecting: boolean;
|
|
159
|
+
}
|
|
160
|
+
export type ConfigurationUpdateResult = Readonly<{
|
|
161
|
+
status: 'accepted';
|
|
162
|
+
actions: readonly DataCoordinatorAction[];
|
|
163
|
+
}> | Readonly<{
|
|
164
|
+
status: 'invalid';
|
|
165
|
+
errors: readonly CoordinatorValidationIssue[];
|
|
166
|
+
}>;
|
|
167
|
+
export declare function validateDataCoordinatorConfig(config?: DataCoordinatorConfig): ConfigurationValidation;
|
|
168
|
+
/**
|
|
169
|
+
* Owns request identity and pagination state only. It has no DOM, framework,
|
|
170
|
+
* observer, timer, or network dependencies. Returned actions are instructions
|
|
171
|
+
* for a future facade/host boundary; cancellation never performs transport.
|
|
172
|
+
*/
|
|
173
|
+
export declare class DataRequestCoordinator {
|
|
174
|
+
private readonly instanceId;
|
|
175
|
+
private readonly requestIdSecret;
|
|
176
|
+
private requestSequence;
|
|
177
|
+
private rawConfig;
|
|
178
|
+
private config;
|
|
179
|
+
private connected;
|
|
180
|
+
private hasConnected;
|
|
181
|
+
private query;
|
|
182
|
+
private queryGeneration;
|
|
183
|
+
private items;
|
|
184
|
+
private hasMore;
|
|
185
|
+
private active;
|
|
186
|
+
private status;
|
|
187
|
+
private lastCommittedPage;
|
|
188
|
+
private nextEligiblePosition;
|
|
189
|
+
/**
|
|
190
|
+
* Exact cycle detection for the current pagination epoch. One cursor is
|
|
191
|
+
* retained per accepted advancement; there is intentionally no LRU eviction.
|
|
192
|
+
*/
|
|
193
|
+
private committedCursors;
|
|
194
|
+
private generationHasAcceptedResult;
|
|
195
|
+
private needsInitialRemoteSearch;
|
|
196
|
+
private retryAvailable;
|
|
197
|
+
private retryPosition;
|
|
198
|
+
private retryKind;
|
|
199
|
+
private error;
|
|
200
|
+
private resourceLimit;
|
|
201
|
+
private sentinelBlocked;
|
|
202
|
+
private sentinelIntersecting;
|
|
203
|
+
constructor(options?: DataRequestCoordinatorOptions);
|
|
204
|
+
getSnapshot(): DataCoordinatorSnapshot;
|
|
205
|
+
/** Connect once, dispatching the initial remote/hybrid query when required. */
|
|
206
|
+
connect(query?: string): readonly DataCoordinatorAction[];
|
|
207
|
+
/**
|
|
208
|
+
* Advance the request transition from synchronous `requested` to `loading`
|
|
209
|
+
* immediately before a future facade dispatches event/callback notifications.
|
|
210
|
+
*/
|
|
211
|
+
markNotificationsDispatched(requestId: DataRequestId): boolean;
|
|
212
|
+
setQuery(query: string): readonly DataCoordinatorAction[];
|
|
213
|
+
/** Update effective config; non-protocol changes do not rewrite active requests. */
|
|
214
|
+
updateConfig(update: DataCoordinatorConfig): ConfigurationUpdateResult;
|
|
215
|
+
/** Request another page or explicitly retry the still-eligible position. */
|
|
216
|
+
requestLoadMore(trigger?: 'manual' | 'sentinel'): readonly DataCoordinatorAction[];
|
|
217
|
+
/** Feed observer state into the pure sentinel rearm state machine. */
|
|
218
|
+
setSentinelIntersecting(intersecting: boolean): readonly DataCoordinatorAction[];
|
|
219
|
+
/** Invalidate pending work before returning its best-effort host cancellation action. */
|
|
220
|
+
disconnect(): readonly DataCoordinatorAction[];
|
|
221
|
+
completeDataRequest(completion: unknown): DataRequestCompletionResult;
|
|
222
|
+
private isRemoteMode;
|
|
223
|
+
private initialPosition;
|
|
224
|
+
private resetPaginationForRemoteQuery;
|
|
225
|
+
/** Re-evaluate the local cursor cap without resetting accepted history. */
|
|
226
|
+
private refreshCursorDepthLimit;
|
|
227
|
+
private createSearchRequest;
|
|
228
|
+
private createLoadMoreRequest;
|
|
229
|
+
private createRequest;
|
|
230
|
+
private invalidateActive;
|
|
231
|
+
private classifyInactiveRequest;
|
|
232
|
+
private hasValidCompletionEnvelope;
|
|
233
|
+
private validateCompletionPayload;
|
|
234
|
+
private hasCommittedCursor;
|
|
235
|
+
private advanceFrom;
|
|
236
|
+
}
|
|
@@ -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 type * from './data-loading/public-types.js';
|
|
12
|
+
export { validateDataLoadingConfig } from './data-loading/public-config.js';
|
|
11
13
|
export type { SelectionConfig } from './config/global-config.js';
|
|
12
14
|
export type { SelectionConfig as EngineSelectionConfig } from './engine/selection-policy.js';
|
|
13
15
|
export { FenwickTree } from './utils/fenwick-tree.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-neutral public configuration types for native adapters.
|
|
3
|
+
* This entry intentionally excludes Core's browser-only component declarations.
|
|
4
|
+
*/
|
|
5
|
+
export type { GlobalSelectConfig, SelectionConfig, MultiSelectDisplayConfig, ScrollToSelectedConfig, StyleConfig, } from './config/global-config.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RendererHelpers } from '../types';
|
|
1
|
+
import type { RendererHelpers } from '../types.js';
|
|
2
2
|
export type OptionTemplate = (item: unknown, index: number) => string;
|
|
3
3
|
export type OptionRenderer = (item: unknown, index: number, helpers: RendererHelpers) => HTMLElement;
|
|
4
4
|
export declare const createRendererHelpers: (onSelect: (item: unknown, index: number) => void) => RendererHelpers;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type KnownLimitationId = 'variableItemHeight' | 'builtInFetchPaginationApi' | 'virtualizationOverheadSmallLists' | 'runtimeModeSwitching' | 'legacyBrowserSupport' | 'webkitArchLinux';
|
|
2
|
+
export type LimitationControlMode = 'default' | 'suppress' | 'strict';
|
|
3
|
+
export interface LimitationPolicy {
|
|
4
|
+
mode: LimitationControlMode;
|
|
5
|
+
note?: string;
|
|
6
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { KnownLimitationId, LimitationControlMode, LimitationPolicy } from './types/limitation.js';
|
|
2
|
+
export type { KnownLimitationId, LimitationControlMode, LimitationPolicy } from './types/limitation.js';
|
|
1
3
|
export type Placement = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
2
4
|
export type Strategy = 'fixed' | 'absolute';
|
|
3
5
|
export interface GroupedItem {
|
|
@@ -64,12 +66,6 @@ export interface ClearEventDetail {
|
|
|
64
66
|
clearedSelection: boolean;
|
|
65
67
|
clearedSearch: boolean;
|
|
66
68
|
}
|
|
67
|
-
export type KnownLimitationId = 'variableItemHeight' | 'builtInFetchPaginationApi' | 'virtualizationOverheadSmallLists' | 'runtimeModeSwitching' | 'legacyBrowserSupport' | 'webkitArchLinux';
|
|
68
|
-
export type LimitationControlMode = 'default' | 'suppress' | 'strict';
|
|
69
|
-
export interface LimitationPolicy {
|
|
70
|
-
mode: LimitationControlMode;
|
|
71
|
-
note?: string;
|
|
72
|
-
}
|
|
73
69
|
export type LimitationPolicyMap = Partial<Record<KnownLimitationId, LimitationPolicy>>;
|
|
74
70
|
export interface LimitationState {
|
|
75
71
|
id: KnownLimitationId;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Manages lifecycle and recycling of custom option components for optimal performance.
|
|
5
5
|
* Uses object pooling pattern to minimize allocation/deallocation overhead.
|
|
6
6
|
*/
|
|
7
|
-
import type { CustomOptionContract, CustomOptionContext, CustomOptionFactory } from '../types/custom-option';
|
|
7
|
+
import type { CustomOptionContract, CustomOptionContext, CustomOptionFactory } from '../types/custom-option.js';
|
|
8
8
|
/**
|
|
9
9
|
* Manages a pool of reusable custom option component instances
|
|
10
10
|
*/
|