@cngx/common 0.1.0-rc.4 → 0.1.0-rc.6
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/audio/README.md +180 -0
- package/fesm2022/cngx-common-audio.mjs +1205 -0
- package/fesm2022/cngx-common-audio.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2 -2
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +309 -7
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +8 -8
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +37 -12
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +5 -1
- package/theming/components/cngx-accordion.css +17 -6
- package/theming/components/cngx-breadcrumb.css +1 -1
- package/theming/components/cngx-data-grid.css +3 -4
- package/theming/components/cngx-slider.css +1 -1
- package/types/cngx-common-audio.d.ts +736 -0
- package/types/cngx-common-data.d.ts +191 -3
- package/types/cngx-common-interactive.d.ts +14 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { Signal, TemplateRef, OnInit, InjectionToken, Resource, ElementRef, Injector, DestroyRef } from '@angular/core';
|
|
2
|
+
import { Signal, TemplateRef, OnInit, InjectionToken, Resource, EnvironmentProviders, ElementRef, Injector, DestroyRef } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState, AsyncStatus } from '@cngx/core/utils';
|
|
4
4
|
import { DataSource } from '@angular/cdk/collections';
|
|
5
5
|
import { Observable, MonoTypeOperatorFunction, OperatorFunction } from 'rxjs';
|
|
6
|
+
import { HttpContextToken, HttpContext, HttpInterceptorFn } from '@angular/common/http';
|
|
6
7
|
import { CngxRovingTabindex, CngxActiveDescendant } from '@cngx/common/a11y';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -1101,6 +1102,18 @@ interface InjectAsyncStateOptions {
|
|
|
1101
1102
|
* @default 50
|
|
1102
1103
|
*/
|
|
1103
1104
|
debounce?: number;
|
|
1105
|
+
/**
|
|
1106
|
+
* Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.
|
|
1107
|
+
* Display only - never the registry key. Ignored unless `register` is set.
|
|
1108
|
+
*/
|
|
1109
|
+
label?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* When `true`, register this state in the ambient `CngxAsyncRegistry` (if
|
|
1112
|
+
* one is provided via `provideAsyncRegistry()`) for the injector's lifetime,
|
|
1113
|
+
* and unregister automatically on destroy. Defaults to `false` - a no-op for
|
|
1114
|
+
* existing callers, and a no-op when no registry is provided.
|
|
1115
|
+
*/
|
|
1116
|
+
register?: boolean;
|
|
1104
1117
|
}
|
|
1105
1118
|
/**
|
|
1106
1119
|
* Reactive async state returned by `injectAsyncState`.
|
|
@@ -1316,6 +1329,181 @@ declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1316
1329
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
1317
1330
|
}): OperatorFunction<unknown, T>;
|
|
1318
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Read-only snapshot of one registered async operation.
|
|
1334
|
+
*
|
|
1335
|
+
* @category common/data/async-registry
|
|
1336
|
+
*/
|
|
1337
|
+
interface CngxAsyncOperation {
|
|
1338
|
+
/** Per-operation uid minted at registration (`register`'s return value). */
|
|
1339
|
+
readonly id: string;
|
|
1340
|
+
/** Human-readable label, if one was supplied. Display only, never a key. */
|
|
1341
|
+
readonly label?: string;
|
|
1342
|
+
/** The operation's current status. */
|
|
1343
|
+
readonly status: AsyncStatus;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Opt-in aggregation registry for in-flight async operations.
|
|
1347
|
+
*
|
|
1348
|
+
* A single derived source for "is anything loading?" across a whole app: the
|
|
1349
|
+
* shell binds one `isAnythingLoading()` instead of N hand-maintained flags.
|
|
1350
|
+
* Producers register their `CngxAsyncState` (via `injectAsyncState({ register:
|
|
1351
|
+
* true })`, the HTTP interceptor, or directly) and unregister on teardown.
|
|
1352
|
+
*
|
|
1353
|
+
* Not `providedIn: 'root'` - consumers opt in with {@link provideAsyncRegistry}.
|
|
1354
|
+
* When the registry is absent, producers skip registration entirely.
|
|
1355
|
+
*
|
|
1356
|
+
* **Keyed by a per-operation uid, not the human label.** Async operations are
|
|
1357
|
+
* transient and collide on label; uid identity keeps N concurrent same-label
|
|
1358
|
+
* (or unlabeled) operations independent, so one `unregister` evicts exactly
|
|
1359
|
+
* its own entry. This is the one deliberate divergence from `CngxErrorRegistry`
|
|
1360
|
+
* (which keys by a stable scope name).
|
|
1361
|
+
*
|
|
1362
|
+
* Both views are `computed()` only - no `effect`, no service calls. Inner
|
|
1363
|
+
* status reactivity flows through each entry's `CngxAsyncState` signals; the
|
|
1364
|
+
* Map signal's `mapKeySetEqual` short-circuits register/unregister churn
|
|
1365
|
+
* without hiding status changes.
|
|
1366
|
+
*
|
|
1367
|
+
* @category common/data/async-registry
|
|
1368
|
+
*/
|
|
1369
|
+
declare class CngxAsyncRegistry {
|
|
1370
|
+
private readonly entriesState;
|
|
1371
|
+
/**
|
|
1372
|
+
* `true` when at least one registered operation reports `isLoading()`
|
|
1373
|
+
* (`loading`, `pending`, or `refreshing`).
|
|
1374
|
+
*/
|
|
1375
|
+
readonly isAnythingLoading: Signal<boolean>;
|
|
1376
|
+
/** Every registered operation with its current status, in registration order. */
|
|
1377
|
+
readonly activeOperations: Signal<readonly CngxAsyncOperation[]>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Registers an async state under a fresh per-operation uid and returns it.
|
|
1380
|
+
* The optional `label` is display metadata only - never the map key, so
|
|
1381
|
+
* concurrent same-label (or unlabeled) operations stay independent.
|
|
1382
|
+
*/
|
|
1383
|
+
register(state: CngxAsyncState<unknown>, label?: string): string;
|
|
1384
|
+
/** Removes the operation with the given uid. No-op if absent. */
|
|
1385
|
+
unregister(id: string): void;
|
|
1386
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncRegistry, never>;
|
|
1387
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxAsyncRegistry>;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Provides {@link CngxAsyncRegistry} in the host environment.
|
|
1392
|
+
*
|
|
1393
|
+
* Opt-in - not `providedIn: 'root'`. Add it to `bootstrapApplication`
|
|
1394
|
+
* providers to enable app-wide async observability; producers that opt in
|
|
1395
|
+
* (`injectAsyncState({ register: true })`, `provideAsyncHttpObservability()`)
|
|
1396
|
+
* then surface in `isAnythingLoading()` / `activeOperations()`.
|
|
1397
|
+
*
|
|
1398
|
+
* ```ts
|
|
1399
|
+
* bootstrapApplication(AppComponent, {
|
|
1400
|
+
* providers: [provideAsyncRegistry()],
|
|
1401
|
+
* });
|
|
1402
|
+
* ```
|
|
1403
|
+
*
|
|
1404
|
+
* @category common/data/async-registry
|
|
1405
|
+
*/
|
|
1406
|
+
declare function provideAsyncRegistry(): EnvironmentProviders;
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer
|
|
1409
|
+
* did not opt in via {@link provideAsyncRegistry}. Must run in an injection
|
|
1410
|
+
* context.
|
|
1411
|
+
*
|
|
1412
|
+
* @category common/data/async-registry
|
|
1413
|
+
*/
|
|
1414
|
+
declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the
|
|
1418
|
+
* request is tracked by `cngxAsyncInterceptor`. Display only, never a key.
|
|
1419
|
+
*
|
|
1420
|
+
* @category common/data/async-registry
|
|
1421
|
+
*/
|
|
1422
|
+
declare const CNGX_ASYNC_LABEL: HttpContextToken<string | undefined>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request
|
|
1425
|
+
* through without registering it - keeps polling / telemetry pings out of the
|
|
1426
|
+
* aggregate without a global allow-list.
|
|
1427
|
+
*
|
|
1428
|
+
* @category common/data/async-registry
|
|
1429
|
+
*/
|
|
1430
|
+
declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Returns an `HttpContext` that labels the request for async observability.
|
|
1433
|
+
* Pass an existing context to chain with other tokens.
|
|
1434
|
+
*
|
|
1435
|
+
* ```typescript
|
|
1436
|
+
* this.http.get('/api/users', { context: withAsyncLabel('users') });
|
|
1437
|
+
* ```
|
|
1438
|
+
*
|
|
1439
|
+
* @category common/data/async-registry
|
|
1440
|
+
*/
|
|
1441
|
+
declare function withAsyncLabel(label: string, context?: HttpContext): HttpContext;
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns an `HttpContext` that opts the request out of async observability.
|
|
1444
|
+
* Pass an existing context to chain with other tokens.
|
|
1445
|
+
*
|
|
1446
|
+
* ```typescript
|
|
1447
|
+
* this.http.get('/api/ping', { context: withAsyncSkip() });
|
|
1448
|
+
* ```
|
|
1449
|
+
*
|
|
1450
|
+
* @category common/data/async-registry
|
|
1451
|
+
*/
|
|
1452
|
+
declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Functional HTTP interceptor that surfaces every in-flight `HttpRequest` in
|
|
1456
|
+
* the ambient {@link CngxAsyncRegistry}, so `isAnythingLoading()` aggregates
|
|
1457
|
+
* raw HTTP traffic alongside explicit component states.
|
|
1458
|
+
*
|
|
1459
|
+
* Fully opt-in and self-contained:
|
|
1460
|
+
* - Resolves `inject(CngxAsyncRegistry, { optional: true })` and passes the
|
|
1461
|
+
* request straight through when no registry is provided - zero behaviour
|
|
1462
|
+
* change for consumers who do not opt in.
|
|
1463
|
+
* - Passes through without registering when `CNGX_ASYNC_SKIP` is set.
|
|
1464
|
+
* - Otherwise registers a fresh `createManualState` (set `loading`) under a
|
|
1465
|
+
* per-request uid, maps the final response / error onto it, and
|
|
1466
|
+
* `unregister`s in a `finalize` that fires on success **and** error (and on
|
|
1467
|
+
* unsubscribe), so a request can never pin the global loading state.
|
|
1468
|
+
*
|
|
1469
|
+
* Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests
|
|
1470
|
+
* sharing a label never evict one another - completing one leaves the other
|
|
1471
|
+
* tracked. The interceptor does not swallow errors: `setError` records the
|
|
1472
|
+
* failure, then the error propagates to the caller unchanged.
|
|
1473
|
+
*
|
|
1474
|
+
* @category common/data/async-registry
|
|
1475
|
+
*/
|
|
1476
|
+
declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
1477
|
+
/**
|
|
1478
|
+
* Sets up `HttpClient` with {@link cngxAsyncInterceptor} so every request
|
|
1479
|
+
* surfaces in {@link CngxAsyncRegistry}. Opt-in - add it to
|
|
1480
|
+
* `bootstrapApplication` providers alongside `provideAsyncRegistry()`.
|
|
1481
|
+
*
|
|
1482
|
+
* ```ts
|
|
1483
|
+
* bootstrapApplication(AppComponent, {
|
|
1484
|
+
* providers: [
|
|
1485
|
+
* provideAsyncRegistry(),
|
|
1486
|
+
* provideAsyncHttpObservability(),
|
|
1487
|
+
* ],
|
|
1488
|
+
* });
|
|
1489
|
+
* ```
|
|
1490
|
+
*
|
|
1491
|
+
* **Use this only when cngx owns the `HttpClient` setup.** It calls
|
|
1492
|
+
* `provideHttpClient(withInterceptors([cngxAsyncInterceptor]))` internally, so
|
|
1493
|
+
* an app that already calls `provideHttpClient` (especially with `withFetch()`
|
|
1494
|
+
* or other features) would get a second, feature-less `HttpClient`
|
|
1495
|
+
* configuration - last-provider-wins on `HttpBackend` can silently revert
|
|
1496
|
+
* `withFetch()` to the XHR backend. In that case do not call this; add the
|
|
1497
|
+
* exported {@link cngxAsyncInterceptor} to your own `withInterceptors` instead:
|
|
1498
|
+
*
|
|
1499
|
+
* ```ts
|
|
1500
|
+
* provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))
|
|
1501
|
+
* ```
|
|
1502
|
+
*
|
|
1503
|
+
* @category common/data/async-registry
|
|
1504
|
+
*/
|
|
1505
|
+
declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
1506
|
+
|
|
1319
1507
|
/**
|
|
1320
1508
|
* Template context for the `*cngxAsync` content template.
|
|
1321
1509
|
* `$implicit` provides the data value, typed via `ngTemplateContextGuard`.
|
|
@@ -2515,5 +2703,5 @@ interface CngxMaterialBidirectionalSyncHandle {
|
|
|
2515
2703
|
*/
|
|
2516
2704
|
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): CngxMaterialBidirectionalSyncHandle;
|
|
2517
2705
|
|
|
2518
|
-
export { CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CNGX_STAT, CngxAsync, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxStatus, CngxTrend, CngxVirtualItem, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState };
|
|
2519
|
-
export type { AsyncView, CngxAsyncContext, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxPaginateEmitHandlers, CngxRecycler, CngxSmartDataSourceOptions, CngxStatRegistry, CngxStatSlotKind, DeltaMode, DeltaPolarity, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry, SortHeaderState, StatusTone };
|
|
2706
|
+
export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CNGX_STAT, CngxAsync, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxStatus, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip };
|
|
2707
|
+
export type { AsyncView, CngxAsyncContext, CngxAsyncOperation, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxPaginateEmitHandlers, CngxRecycler, CngxSmartDataSourceOptions, CngxStatRegistry, CngxStatSlotKind, DeltaMode, DeltaPolarity, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry, SortHeaderState, StatusTone };
|
|
@@ -2097,7 +2097,21 @@ declare class CngxToggle implements CngxControlValue<boolean>, CngxFormFieldCont
|
|
|
2097
2097
|
readonly labelPosition: _angular_core.InputSignal<"before" | "after">;
|
|
2098
2098
|
readonly thumbGlyph: _angular_core.InputSignal<TemplateRef<void> | null>;
|
|
2099
2099
|
protected readonly describedId: string;
|
|
2100
|
+
protected readonly labelId: string;
|
|
2100
2101
|
protected readonly describedById: _angular_core.Signal<string | null>;
|
|
2102
|
+
private readonly labelRef;
|
|
2103
|
+
private readonly hasProjectedLabelState;
|
|
2104
|
+
/**
|
|
2105
|
+
* True when static content is projected into the label span. Gates
|
|
2106
|
+
* `aria-labelledby`: Chrome's name-from-contents for `role="switch"`
|
|
2107
|
+
* does not recurse into the nested `.cngx-toggle__label`, so a
|
|
2108
|
+
* projected label would otherwise yield an empty accessible name
|
|
2109
|
+
* (Pillar 2). Emitting `aria-labelledby` only when a label is present
|
|
2110
|
+
* leaves an icon-only toggle's consumer `aria-label` in force -
|
|
2111
|
+
* pointing labelledby at an empty span would blank the name instead.
|
|
2112
|
+
*/
|
|
2113
|
+
protected readonly hasProjectedLabel: _angular_core.Signal<boolean>;
|
|
2114
|
+
constructor();
|
|
2101
2115
|
/** Stable per-instance id used for `<label for>` wiring. */
|
|
2102
2116
|
readonly id: _angular_core.Signal<string>;
|
|
2103
2117
|
private readonly focusedState;
|