@cngx/common 0.1.0-rc.8 → 0.3.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.
Files changed (90) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +42 -2
  4. package/data/README.md +15 -12
  5. package/fesm2022/cngx-common-a11y.mjs +1076 -319
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +99 -77
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-button.mjs +1084 -0
  10. package/fesm2022/cngx-common-button.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +138 -78
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +799 -327
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +101 -25
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +861 -423
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +198 -160
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +693 -329
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7303 -2774
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2174 -442
  26. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  27. package/fesm2022/cngx-common-menu-button.mjs +557 -0
  28. package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
  29. package/fesm2022/cngx-common-popover.mjs +2109 -557
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +548 -419
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +442 -331
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +44 -71
  36. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  37. package/fesm2022/cngx-common.mjs +10 -10
  38. package/fesm2022/cngx-common.mjs.map +1 -1
  39. package/interactive/README.md +30 -19
  40. package/layout/README.md +17 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +31 -8
  43. package/popover/README.md +81 -4
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/collection.json +9 -0
  46. package/schematics/ng-add/index.js +9 -0
  47. package/schematics/ng-add/schema.json +96 -0
  48. package/schematics/package.json +3 -0
  49. package/stepper/README.md +5 -5
  50. package/theming/components/cngx-accordion.css +36 -7
  51. package/theming/components/cngx-async.css +185 -37
  52. package/theming/components/cngx-backdrop.css +3 -1
  53. package/theming/components/cngx-badge.css +20 -5
  54. package/theming/components/cngx-bottom-sheet.css +2 -0
  55. package/theming/components/cngx-breadcrumb.css +3 -1
  56. package/theming/components/cngx-button-group.css +325 -0
  57. package/theming/components/cngx-button-toggle.css +55 -23
  58. package/theming/components/cngx-button.css +975 -0
  59. package/theming/components/cngx-data-grid.css +2 -0
  60. package/theming/components/cngx-dialog.css +3 -1
  61. package/theming/components/cngx-divider.css +24 -9
  62. package/theming/components/cngx-drawer.css +153 -0
  63. package/theming/components/cngx-icon-glyph.css +76 -0
  64. package/theming/components/cngx-listbox.css +79 -25
  65. package/theming/components/cngx-menu.css +112 -52
  66. package/theming/components/cngx-nav.css +1220 -0
  67. package/theming/components/cngx-popover-sheet.css +434 -0
  68. package/theming/components/cngx-popover.css +37 -9
  69. package/theming/components/cngx-recycler-placeholder.css +2 -0
  70. package/theming/components/cngx-ripple.css +74 -16
  71. package/theming/components/cngx-sidebar.css +71 -0
  72. package/theming/components/cngx-slider.css +3 -1
  73. package/theming/components/cngx-tooltip.css +2 -0
  74. package/timeline/README.md +2 -2
  75. package/types/cngx-common-a11y.d.ts +488 -112
  76. package/types/cngx-common-audio.d.ts +60 -88
  77. package/types/cngx-common-button.d.ts +698 -0
  78. package/types/cngx-common-card.d.ts +104 -78
  79. package/types/cngx-common-chart.d.ts +677 -389
  80. package/types/cngx-common-command.d.ts +55 -41
  81. package/types/cngx-common-data.d.ts +506 -360
  82. package/types/cngx-common-dialog.d.ts +94 -127
  83. package/types/cngx-common-display.d.ts +475 -300
  84. package/types/cngx-common-interactive.d.ts +4383 -1721
  85. package/types/cngx-common-layout.d.ts +1399 -288
  86. package/types/cngx-common-menu-button.d.ts +382 -0
  87. package/types/cngx-common-popover.d.ts +990 -268
  88. package/types/cngx-common-stepper.d.ts +374 -465
  89. package/types/cngx-common-tabs.d.ts +309 -403
  90. package/types/cngx-common-timeline.d.ts +50 -109
@@ -1,14 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, makeEnvironmentProviders, signal, DestroyRef, effect, isDevMode, SkipSelf, Optional, ElementRef, input, booleanAttribute, computed, untracked, afterNextRender, Directive, linkedSignal } from '@angular/core';
2
+ import { InjectionToken, inject, makeEnvironmentProviders, signal, DestroyRef, effect, SkipSelf, Optional, ElementRef, input, booleanAttribute, computed, untracked, afterNextRender, Directive, linkedSignal } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { injectMediaQuery } from '@cngx/common/layout';
5
+ import { cngxDevWarn, cngxDevError } from '@cngx/utils';
5
6
  import { CNGX_STATEFUL, createTransitionTracker } from '@cngx/core/utils';
6
7
 
7
8
  /**
8
9
  * Library defaults - English, browser-native.
9
- * @category common/audio
10
10
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
11
- * @since 0.1.0
11
+ * @since 0.3.0
12
12
  */
13
13
  const CNGX_AUDIO_DEFAULTS = {
14
14
  muted: false,
@@ -22,10 +22,9 @@ const CNGX_AUDIO_DEFAULTS = {
22
22
  * `provideCngxAudio(...)`. Read the resolved, defaults-merged config with
23
23
  * {@link injectAudioConfig}.
24
24
  *
25
- * @category common/audio
26
25
  * @relatedTo provideCngxAudio, injectAudioConfig
27
26
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
28
- * @since 0.1.0
27
+ * @since 0.3.0
29
28
  */
30
29
  const CNGX_AUDIO_CONFIG = new InjectionToken('CngxAudioConfig', {
31
30
  providedIn: 'root',
@@ -35,9 +34,8 @@ const CNGX_AUDIO_CONFIG = new InjectionToken('CngxAudioConfig', {
35
34
  * Resolve the effective audio config: library defaults merged with whatever
36
35
  * `provideCngxAudio(...)` contributed. Runs in an injection context.
37
36
  *
38
- * @category common/audio
39
37
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
40
- * @since 0.1.0
38
+ * @since 0.3.0
41
39
  */
42
40
  function injectAudioConfig() {
43
41
  return { ...CNGX_AUDIO_DEFAULTS, ...inject(CNGX_AUDIO_CONFIG, { optional: true }) };
@@ -76,10 +74,9 @@ function foldAudioFeatures(features) {
76
74
  * configure a subtree, use `provideCngxAudioAt(...)` in `viewProviders` - it
77
75
  * layers over this one and re-provides the engine so the scope actually applies.
78
76
  *
79
- * @category common/audio
80
77
  * @relatedTo provideCngxAudioAt, injectAudioConfig
81
78
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
82
- * @since 0.1.0
79
+ * @since 0.3.0
83
80
  */
84
81
  function provideCngxAudio(...features) {
85
82
  return makeEnvironmentProviders([
@@ -90,9 +87,8 @@ function provideCngxAudio(...features) {
90
87
  * Register or override earcons globally. Merged over the six built-ins and over
91
88
  * any earlier `withEarcons` in the same `provideCngxAudio` call.
92
89
  *
93
- * @category common/audio
94
90
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
95
- * @since 0.1.0
91
+ * @since 0.3.0
96
92
  */
97
93
  function withEarcons(earcons) {
98
94
  return { _apply: (c) => ({ ...c, earcons: { ...c.earcons, ...earcons } }) };
@@ -100,9 +96,8 @@ function withEarcons(earcons) {
100
96
  /**
101
97
  * Set the master volume in `[0, 1]`.
102
98
  *
103
- * @category common/audio
104
99
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
105
- * @since 0.1.0
100
+ * @since 0.3.0
106
101
  */
107
102
  function withVolume(volume) {
108
103
  return { _apply: (c) => ({ ...c, volume }) };
@@ -110,9 +105,8 @@ function withVolume(volume) {
110
105
  /**
111
106
  * Start muted (or explicitly unmuted with `withMuted(false)`).
112
107
  *
113
- * @category common/audio
114
108
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
115
- * @since 0.1.0
109
+ * @since 0.3.0
116
110
  */
117
111
  function withMuted(muted = true) {
118
112
  return { _apply: (c) => ({ ...c, muted }) };
@@ -121,9 +115,8 @@ function withMuted(muted = true) {
121
115
  * Toggle the `prefers-reduced-motion` mute gate. `true` by default in the
122
116
  * library; pass `false` to keep audio playing under reduced-motion.
123
117
  *
124
- * @category common/audio
125
118
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
126
- * @since 0.1.0
119
+ * @since 0.3.0
127
120
  */
128
121
  function withRespectReducedMotion(respect) {
129
122
  return { _apply: (c) => ({ ...c, respectReducedMotion: respect }) };
@@ -131,9 +124,8 @@ function withRespectReducedMotion(respect) {
131
124
  /**
132
125
  * Set the same-name suppression window in milliseconds.
133
126
  *
134
- * @category common/audio
135
127
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts
136
- * @since 0.1.0
128
+ * @since 0.3.0
137
129
  */
138
130
  function withDebounceMs(ms) {
139
131
  return { _apply: (c) => ({ ...c, debounceMs: ms }) };
@@ -156,9 +148,8 @@ const GESTURE_EVENTS = ['pointerdown', 'keydown', 'touchstart'];
156
148
  *
157
149
  * @param deps.target The event target to listen on (typically the `Document`).
158
150
  * @param deps.destroyRef Cleanup owner - removes any surviving listeners on destroy.
159
- * @category common/audio
160
151
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts
161
- * @since 0.1.0
152
+ * @since 0.3.0
162
153
  */
163
154
  function createAutoplayGate(deps) {
164
155
  const { target, destroyRef } = deps;
@@ -208,9 +199,8 @@ const DEFAULT_WINDOW_MS = 100;
208
199
  *
209
200
  * @param options.windowMs Suppression window, or a getter for it. `<= 0` disables debouncing. Default `100`.
210
201
  * @param options.now Clock source in ms. Default `Date.now`.
211
- * @category common/audio
212
202
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/debouncer/debouncer.ts
213
- * @since 0.1.0
203
+ * @since 0.3.0
214
204
  */
215
205
  function createDebouncer(options) {
216
206
  const windowOption = options?.windowMs ?? DEFAULT_WINDOW_MS;
@@ -240,8 +230,8 @@ function createDebouncer(options) {
240
230
 
241
231
  /**
242
232
  * The six built-in earcons, synthesised entirely from `OscillatorNode` - zero
243
- * audio assets. Plain `as const` (mirrors `CNGX_SELECT_GLYPHS`): tree-shakeable,
244
- * compile-time exhaustive keys, and NOT exported from `public-api.ts`. The
233
+ * audio assets. Plain `as const`: tree-shakeable, compile-time exhaustive keys,
234
+ * and NOT exported from `public-api.ts`. The
245
235
  * consumer override surface is `withEarcons({...})` and the engine's runtime
246
236
  * `register()`, never this const.
247
237
  *
@@ -298,9 +288,9 @@ const MIN_DURATION_SEC = ATTACK_SEC + RELEASE_SEC;
298
288
  * Default peak gain for a single tone (before the engine's master volume).
299
289
  * Exported so a per-element volume multiplier can scale against the same
300
290
  * baseline the generator uses.
301
- * @category common/audio
302
291
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts
303
- * @since 0.1.0
292
+ * @since 0.3.0
293
+ * @internal
304
294
  */
305
295
  const DEFAULT_TONE_GAIN = 0.2;
306
296
  /**
@@ -312,9 +302,8 @@ const DEFAULT_TONE_GAIN = 0.2;
312
302
  *
313
303
  * `create*` pure factory (no `inject()`), so it composes inside the engine and
314
304
  * runs against the shared `createAudioContextMock` in specs.
315
- * @category common/audio
316
305
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts
317
- * @since 0.1.0
306
+ * @since 0.3.0
318
307
  */
319
308
  const createToneGenerator = (deps) => {
320
309
  function schedule(freq, durationMs, opts, whenSec) {
@@ -362,9 +351,8 @@ const createToneGenerator = (deps) => {
362
351
  * forking the engine - the documented second consumer of this boundary token.
363
352
  *
364
353
  * @relatedTo createToneGenerator, CNGX_AUDIO_ENGINE_FACTORY
365
- * @category common/audio
366
354
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts
367
- * @since 0.1.0
355
+ * @since 0.3.0
368
356
  */
369
357
  const CNGX_AUDIO_TONE_GENERATOR_FACTORY = new InjectionToken('CngxAudioToneGeneratorFactory', { providedIn: 'root', factory: () => createToneGenerator });
370
358
 
@@ -424,9 +412,8 @@ function scaleSteps(steps, scale) {
424
412
  * tone-generator factory, and the reduced-motion query). The engine instance is
425
413
  * resolved through {@link CNGX_AUDIO_ENGINE_FACTORY}; scope it to a subtree with
426
414
  * `provideCngxAudioAt(...)` rather than calling this directly.
427
- * @category common/audio
428
415
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts
429
- * @since 0.1.0
416
+ * @since 0.3.0
430
417
  */
431
418
  const createAudioEngine = (options) => {
432
419
  const doc = inject(DOCUMENT);
@@ -540,9 +527,9 @@ const createAudioEngine = (options) => {
540
527
  }
541
528
  const earcon = earcons.get(name);
542
529
  if (!earcon) {
543
- if (isDevMode() && !warnedUnknownEarcons.has(name)) {
530
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && !warnedUnknownEarcons.has(name)) {
544
531
  warnedUnknownEarcons.add(name);
545
- console.warn(`[cngxAudio] Unknown earcon "${name}". Register it via withEarcons({...}) or engine.register(name, config).`);
532
+ cngxDevWarn('CNGX1001', `[cngxAudio] Unknown earcon "${name}". Register it via withEarcons({...}) or engine.register(name, config).`);
546
533
  }
547
534
  return;
548
535
  }
@@ -597,9 +584,8 @@ const createAudioEngine = (options) => {
597
584
  * the library baseline. Both are exported from `@cngx/common/audio`.
598
585
  *
599
586
  * @relatedTo createAudioEngine, injectCngxAudio, injectAudioConfig
600
- * @category common/audio
601
587
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts
602
- * @since 0.1.0
588
+ * @since 0.3.0
603
589
  */
604
590
  const CNGX_AUDIO_ENGINE_FACTORY = new InjectionToken('CngxAudioEngineFactory', { providedIn: 'root', factory: () => createAudioEngine });
605
591
 
@@ -631,9 +617,8 @@ const CNGX_AUDIO_ENGINE = new InjectionToken('CngxAudioEngineInstance', {
631
617
  * }
632
618
  * ```
633
619
  *
634
- * @category common/audio
635
620
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts
636
- * @since 0.1.0
621
+ * @since 0.3.0
637
622
  */
638
623
  function injectCngxAudio() {
639
624
  return inject(CNGX_AUDIO_ENGINE);
@@ -673,10 +658,9 @@ function injectCngxAudio() {
673
658
  * independent audio scope - per-element `[audioVolume]` / `[audioDisabled]`
674
659
  * cover the common case without a second context.
675
660
  *
676
- * @category common/audio
677
661
  * @relatedTo provideCngxAudio, injectCngxAudio
678
662
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts
679
- * @since 0.1.0
663
+ * @since 0.3.0
680
664
  */
681
665
  function provideCngxAudioAt(...features) {
682
666
  return [
@@ -715,7 +699,10 @@ function sameStringMap(a, b) {
715
699
  return true;
716
700
  }
717
701
 
718
- /** DOM events `[cngxAudio]` may bind an earcon to. */
702
+ /**
703
+ * DOM events `[cngxAudio]` may bind an earcon to.
704
+ * @internal
705
+ */
719
706
  const CNGX_AUDIO_DOM_EVENTS = [
720
707
  'click',
721
708
  'focus',
@@ -744,6 +731,7 @@ const LIFECYCLE_SET = new Set(LIFECYCLE_KEYS);
744
731
  * DOM-event map. Pure - no DOM, no `inject()`. Keys are categorised so the
745
732
  * directive can dev-warn on unknown earcon keys and, separately, on lifecycle
746
733
  * keys that should have used `[cngxAudioStatus]`.
734
+ * @internal
747
735
  */
748
736
  function parseEventBindings(spec) {
749
737
  const bindings = new Map();
@@ -803,17 +791,16 @@ function parseEventBindings(spec) {
803
791
  * cost alone. Either way the engine's `lastPlayed` and `status` are signals, so
804
792
  * anything a template binds to them stays current.
805
793
  *
806
- * @category common/audio
807
- * @docsKind primary
808
794
  * @wcag AA
809
795
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/event-mode/audio.directive.ts
810
- * @since 0.1.0
796
+ * @since 0.3.0
811
797
  * @relatedTo injectCngxAudio, provideCngxAudio, CngxAudioStatus
812
- * <example-url>http://localhost:4200/#/common/audio/event-mode/basic</example-url>
813
- * <example-url>http://localhost:4200/#/common/audio/event-mode/custom-earcons</example-url>
814
- * <example-url>http://localhost:4200/#/common/audio/event-mode/earcon-palette</example-url>
815
- * <example-url>http://localhost:4200/#/common/audio/event-mode/form-feedback</example-url>
816
- * <example-url>http://localhost:4200/#/common/audio/event-mode/hover-and-focus</example-url>
798
+ * <example-url>/#/common/audio/event-mode/basic</example-url>
799
+ * <example-url>/#/common/audio/event-mode/custom-earcons</example-url>
800
+ * <example-url>/#/common/audio/event-mode/earcon-palette</example-url>
801
+ * <example-url>/#/common/audio/event-mode/form-feedback</example-url>
802
+ * <example-url>/#/common/audio/event-mode/hover-and-focus</example-url>
803
+ * @axis level atom
817
804
  */
818
805
  class CngxAudio {
819
806
  audio = injectCngxAudio();
@@ -834,16 +821,16 @@ class CngxAudio {
834
821
  untracked(() => this.syncListeners(wanted));
835
822
  });
836
823
  this.destroyRef.onDestroy(() => this.unbindAll());
837
- if (isDevMode()) {
824
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
838
825
  // One-shot post-binding check, not a reactive node.
839
826
  afterNextRender(() => {
840
827
  const parsed = parseEventBindings(this.spec());
841
828
  if (parsed.lifecycleKeys.length > 0) {
842
- console.error(`[cngxAudio] Lifecycle keys "${parsed.lifecycleKeys.join(', ')}" are not DOM events. ` +
829
+ cngxDevError('CNGX1002', `[cngxAudio] Lifecycle keys "${parsed.lifecycleKeys.join(', ')}" are not DOM events. ` +
843
830
  'Use [cngxAudioStatus] for lifecycle bindings.');
844
831
  }
845
832
  if (parsed.unknownKeys.length > 0) {
846
- console.warn(`[cngxAudio] Unrecognised event keys "${parsed.unknownKeys.join(', ')}". ` +
833
+ cngxDevWarn('CNGX1003', `[cngxAudio] Unrecognised event keys "${parsed.unknownKeys.join(', ')}". ` +
847
834
  'Expected one of: click, focus, blur, pointerenter, pointerleave, submit, change, input.');
848
835
  }
849
836
  });
@@ -934,9 +921,13 @@ const DOM_EVENT_SET = new Set(CNGX_AUDIO_STATUS_DOM_EVENTS);
934
921
  /**
935
922
  * Parse the `status:earcon` grammar (`'pending:tap, succeeded:success'`) into a
936
923
  * status map. Pure - no DOM, no `inject()`. Keys are categorised so the
937
- * directive can dev-error on DOM-event keys that should have used `[cngxAudio]`
938
- * and dev-warn on unknown keys. `succeeded`/`failed` normalise to
939
- * `success`/`error` so a lookup by the tracker's raw `AsyncStatus` hits.
924
+ * directive can dev-error on DOM-event keys that should have used `[cngxAudio]`;
925
+ * unknown keys are collected in `unknownKeys` and not reported by the directive.
926
+ * Only own keys of the alias table resolve, so `constructor` or `toString` is
927
+ * an unknown key. `succeeded`/`failed` normalise to `success`/`error` so a
928
+ * lookup by the tracker's raw `AsyncStatus` hits.
929
+ *
930
+ * @internal
940
931
  */
941
932
  function parseStatusBindings(spec) {
942
933
  const bindings = new Map();
@@ -954,7 +945,7 @@ function parseStatusBindings(spec) {
954
945
  }
955
946
  const key = trimmed.slice(0, colon).trim();
956
947
  const earcon = trimmed.slice(colon + 1).trim();
957
- const status = STATUS_ALIASES[key];
948
+ const status = Object.hasOwn(STATUS_ALIASES, key) ? STATUS_ALIASES[key] : undefined;
958
949
  if (status) {
959
950
  if (earcon) {
960
951
  bindings.set(status, earcon);
@@ -991,13 +982,12 @@ function parseStatusBindings(spec) {
991
982
  * keys (`click`, `focus`, …) belong to `[cngxAudio]` and are rejected with a
992
983
  * dev-error. `succeeded`/`failed` are accepted as aliases for `success`/`error`.
993
984
  *
994
- * @category common/audio
995
- * @docsKind primary
996
985
  * @wcag AA
997
986
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/status-mode/audio-status.directive.ts
998
- * @since 0.1.0
987
+ * @since 0.3.0
999
988
  * @relatedTo CngxAudio, injectCngxAudio, CngxAsyncClick
1000
- * <example-url>http://localhost:4200/#/common/audio/status-bridge/async-click</example-url>
989
+ * <example-url>/#/common/audio/status-bridge/async-click</example-url>
990
+ * @axis level atom
1001
991
  */
1002
992
  class CngxAudioStatus {
1003
993
  audio = injectCngxAudio();
@@ -1018,16 +1008,16 @@ class CngxAudioStatus {
1018
1008
  effectiveState = computed(() => this.state() ?? this.statefulFallback?.state, ...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
1019
1009
  bindings = computed(() => parseStatusBindings(this.spec()).bindings, { ...(ngDevMode ? { debugName: "bindings" } : /* istanbul ignore next */ {}), equal: sameStringMap });
1020
1010
  constructor() {
1021
- if (isDevMode()) {
1011
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1022
1012
  // One-shot post-binding check, not a reactive node.
1023
1013
  afterNextRender(() => {
1024
1014
  const parsed = parseStatusBindings(this.spec());
1025
1015
  if (parsed.domEventKeys.length > 0) {
1026
- console.error(`[cngxAudioStatus] DOM-event keys "${parsed.domEventKeys.join(', ')}" are not lifecycle ` +
1016
+ cngxDevError('CNGX1004', `[cngxAudioStatus] DOM-event keys "${parsed.domEventKeys.join(', ')}" are not lifecycle ` +
1027
1017
  'statuses. Use [cngxAudio] for DOM-event bindings.');
1028
1018
  }
1029
1019
  if (this.state() === undefined && !this.statefulFallback) {
1030
- console.error('[cngxAudioStatus] No state source. Bind [state]="state" explicitly or place inside a ' +
1020
+ cngxDevError('CNGX1005', '[cngxAudioStatus] No state source. Bind [state]="state" explicitly or place inside a ' +
1031
1021
  'component that provides CNGX_STATEFUL.');
1032
1022
  }
1033
1023
  });
@@ -1077,13 +1067,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1077
1067
  * `[audioDisabled]`, muted, reduced-motion-gated, autoplay-not-armed, or still
1078
1068
  * within the debounce window. `[audioVolume]` scales just this element's plays.
1079
1069
  *
1080
- * @category common/audio
1081
- * @docsKind primary
1082
1070
  * @wcag AA
1083
1071
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/zone-mode/audio-zone.directive.ts
1084
- * @since 0.1.0
1072
+ * @since 0.3.0
1085
1073
  * @relatedTo CngxAudio, injectCngxAudio
1086
- * <example-url>http://localhost:4200/#/common/audio/zone/enter-leave</example-url>
1074
+ * <example-url>/#/common/audio/zone/enter-leave</example-url>
1075
+ * @axis level atom
1087
1076
  */
1088
1077
  class CngxAudioZone {
1089
1078
  audio = injectCngxAudio();
@@ -1133,6 +1122,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1133
1122
 
1134
1123
  /** Throttle key - the pitch directive plays a single ad-hoc voice. */
1135
1124
  const PITCH_VOICE = 'pitch';
1125
+ /** No span to interpolate across: equal ends, or an end that is `NaN` / infinite. */
1126
+ function isDegenerateDomain(lo, hi) {
1127
+ return lo === hi || !Number.isFinite(lo) || !Number.isFinite(hi);
1128
+ }
1136
1129
  /**
1137
1130
  * Pitch-mode audio binder. Sonifies a continuous numeric value: each change of
1138
1131
  * `[cngxAudioPitch]` clamps against a fixed domain, linear-scales into an output
@@ -1153,13 +1146,12 @@ const PITCH_VOICE = 'pitch';
1153
1146
  * values, so the directive holds no hidden state. Value-to-frequency is a pure
1154
1147
  * derivation; rapid sweeps are throttled through the shared `createDebouncer`.
1155
1148
  *
1156
- * @category common/audio
1157
- * @docsKind primary
1158
1149
  * @wcag AA
1159
1150
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/pitch-mode/audio-pitch.directive.ts
1160
- * @since 0.1.0
1151
+ * @since 0.3.0
1161
1152
  * @relatedTo CngxAudio, injectCngxAudio
1162
- * <example-url>http://localhost:4200/#/common/audio/pitch/slider</example-url>
1153
+ * <example-url>/#/common/audio/pitch/slider</example-url>
1154
+ * @axis level atom
1163
1155
  */
1164
1156
  class CngxAudioPitch {
1165
1157
  audio = injectCngxAudio();
@@ -1167,7 +1159,12 @@ class CngxAudioPitch {
1167
1159
  value = input.required({ ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), alias: 'cngxAudioPitch' });
1168
1160
  /** Output frequency range `[lo, hi]` in Hz. Default `[220, 880]`. */
1169
1161
  pitchRange = input([220, 880], ...(ngDevMode ? [{ debugName: "pitchRange" }] : /* istanbul ignore next */ []));
1170
- /** Fixed input domain `[min, max]` the value is clamped against. */
1162
+ /**
1163
+ * Fixed input domain `[lo, hi]` the value is clamped against; `lo > hi`
1164
+ * inverts the mapping. An empty domain (`lo === hi`) or one with a `NaN` /
1165
+ * infinite end plays the range low for every value and warns in dev mode
1166
+ * ([`CNGX1069`](/error-codes/cngx1069.md)).
1167
+ */
1171
1168
  pitchDomain = input.required(...(ngDevMode ? [{ debugName: "pitchDomain" }] : /* istanbul ignore next */ []));
1172
1169
  /** Tone duration in ms. Default `120`. */
1173
1170
  pitchDurationMs = input(120, ...(ngDevMode ? [{ debugName: "pitchDurationMs" }] : /* istanbul ignore next */ []));
@@ -1204,15 +1201,40 @@ class CngxAudioPitch {
1204
1201
  this.audio.tone(this.scale(current), this.pitchDurationMs(), undefined, this.audioVolume());
1205
1202
  });
1206
1203
  });
1204
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1205
+ // [pitchDomain] is a live input, so the check re-runs on every change;
1206
+ // the key keeps a re-bound identical empty tuple silent.
1207
+ let lastWarned = null;
1208
+ effect(() => {
1209
+ const [lo, hi] = this.pitchDomain();
1210
+ if (!isDegenerateDomain(lo, hi)) {
1211
+ lastWarned = null;
1212
+ return;
1213
+ }
1214
+ const key = `${lo},${hi}`;
1215
+ if (key === lastWarned) {
1216
+ return;
1217
+ }
1218
+ lastWarned = key;
1219
+ const rangeLo = untracked(() => this.pitchRange()[0]);
1220
+ cngxDevWarn('CNGX1069', `[cngxAudioPitch] [pitchDomain] [${lo}, ${hi}] is empty or not finite; every value plays ${rangeLo} Hz, the low end of [pitchRange].`);
1221
+ });
1222
+ }
1207
1223
  }
1208
- /** Clamp to the domain, then linear-scale into the frequency range. */
1224
+ /**
1225
+ * Clamp to the domain, then linear-scale into the frequency range. The
1226
+ * interpolation runs against the declared pair, so an inverted domain maps
1227
+ * `lo` to the range low and `hi` to the range high.
1228
+ */
1209
1229
  scale(value) {
1210
1230
  const [domainLo, domainHi] = this.pitchDomain();
1211
1231
  const [rangeLo, rangeHi] = this.pitchRange();
1212
- const clamped = Math.max(domainLo, Math.min(domainHi, value));
1213
- if (domainHi === domainLo) {
1232
+ if (isDegenerateDomain(domainLo, domainHi)) {
1214
1233
  return rangeLo;
1215
1234
  }
1235
+ const min = Math.min(domainLo, domainHi);
1236
+ const max = Math.max(domainLo, domainHi);
1237
+ const clamped = Math.max(min, Math.min(max, value));
1216
1238
  const t = (clamped - domainLo) / (domainHi - domainLo);
1217
1239
  return rangeLo + t * (rangeHi - rangeLo);
1218
1240
  }
@@ -1228,7 +1250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1228
1250
  }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxAudioPitch", required: true }] }], pitchRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "pitchRange", required: false }] }], pitchDomain: [{ type: i0.Input, args: [{ isSignal: true, alias: "pitchDomain", required: true }] }], pitchDurationMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pitchDurationMs", required: false }] }], pitchThrottleMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pitchThrottleMs", required: false }] }], audioVolume: [{ type: i0.Input, args: [{ isSignal: true, alias: "audioVolume", required: false }] }], audioDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "audioDisabled", required: false }] }] } });
1229
1251
 
1230
1252
  /**
1231
- * @module @cngx/common/audio
1253
+ * @module `@cngx/common/audio`
1232
1254
  *
1233
1255
  * Signal-first audio-feedback system. A thin directive layer over a small
1234
1256
  * Web Audio adapter: zero asset weight (earcons synthesised from