@cngx/ui 0.0.1-rc.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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +550 -0
  3. package/action-button/README.md +98 -0
  4. package/empty-state/README.md +103 -0
  5. package/feedback/README.md +33 -0
  6. package/fesm2022/cngx-ui-action-button.mjs +319 -0
  7. package/fesm2022/cngx-ui-action-button.mjs.map +1 -0
  8. package/fesm2022/cngx-ui-empty-state.mjs +138 -0
  9. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -0
  10. package/fesm2022/cngx-ui-feedback.mjs +2962 -0
  11. package/fesm2022/cngx-ui-feedback.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-layout.mjs +89 -0
  13. package/fesm2022/cngx-ui-layout.mjs.map +1 -0
  14. package/fesm2022/cngx-ui-mat-stepper.mjs +567 -0
  15. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -0
  16. package/fesm2022/cngx-ui-mat-tabs.mjs +1405 -0
  17. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -0
  18. package/fesm2022/cngx-ui-material.mjs +79 -0
  19. package/fesm2022/cngx-ui-material.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-overlay.mjs +91 -0
  21. package/fesm2022/cngx-ui-overlay.mjs.map +1 -0
  22. package/fesm2022/cngx-ui-sidenav.mjs +521 -0
  23. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-skeleton.mjs +158 -0
  25. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-speak.mjs +112 -0
  27. package/fesm2022/cngx-ui-speak.mjs.map +1 -0
  28. package/fesm2022/cngx-ui-stepper.mjs +312 -0
  29. package/fesm2022/cngx-ui-stepper.mjs.map +1 -0
  30. package/fesm2022/cngx-ui-tabs.mjs +507 -0
  31. package/fesm2022/cngx-ui-tabs.mjs.map +1 -0
  32. package/fesm2022/cngx-ui.mjs +45 -0
  33. package/fesm2022/cngx-ui.mjs.map +1 -0
  34. package/layout/README.md +133 -0
  35. package/mat-stepper/README.md +34 -0
  36. package/mat-tabs/README.md +163 -0
  37. package/mat-tabs/styles/mat-tabs.css +233 -0
  38. package/material/README.md +90 -0
  39. package/overlay/README.md +99 -0
  40. package/package.json +98 -0
  41. package/sidenav/README.md +127 -0
  42. package/skeleton/README.md +98 -0
  43. package/speak/README.md +93 -0
  44. package/speak/speak-button-theme.scss +78 -0
  45. package/stepper/README.md +40 -0
  46. package/tabs/README.md +28 -0
  47. package/types/cngx-ui-action-button.d.ts +126 -0
  48. package/types/cngx-ui-empty-state.d.ts +41 -0
  49. package/types/cngx-ui-feedback.d.ts +1174 -0
  50. package/types/cngx-ui-layout.d.ts +56 -0
  51. package/types/cngx-ui-mat-stepper.d.ts +234 -0
  52. package/types/cngx-ui-mat-tabs.d.ts +664 -0
  53. package/types/cngx-ui-material.d.ts +36 -0
  54. package/types/cngx-ui-overlay.d.ts +57 -0
  55. package/types/cngx-ui-sidenav.d.ts +209 -0
  56. package/types/cngx-ui-skeleton.d.ts +97 -0
  57. package/types/cngx-ui-speak.d.ts +31 -0
  58. package/types/cngx-ui-stepper.d.ts +129 -0
  59. package/types/cngx-ui-tabs.d.ts +165 -0
  60. package/types/cngx-ui.d.ts +18 -0
@@ -0,0 +1,158 @@
1
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, TemplateRef, Directive, input, computed, contentChild, signal, DestroyRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+
5
+ /**
6
+ * Marks a template as the skeleton placeholder inside `cngx-skeleton`.
7
+ *
8
+ * The template is repeated `count` times while loading. Context provides the
9
+ * current index as `$implicit`.
10
+ *
11
+ * ```html
12
+ * <cngx-skeleton [loading]="loading()" [count]="3">
13
+ * <ng-template cngxSkeletonPlaceholder let-i>
14
+ * <div class="skeleton-line" [style.width]="i === 0 ? '60%' : '100%'"></div>
15
+ * </ng-template>
16
+ * <p>Real content</p>
17
+ * </cngx-skeleton>
18
+ * ```
19
+ */
20
+ class CngxSkeletonPlaceholder {
21
+ /** Reference to the projected template. Used internally by `CngxSkeletonContainer`. */
22
+ templateRef = inject(TemplateRef);
23
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSkeletonPlaceholder, deps: [], target: i0.ɵɵFactoryTarget.Directive });
24
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxSkeletonPlaceholder, isStandalone: true, selector: "ng-template[cngxSkeletonPlaceholder]", ngImport: i0 });
25
+ }
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSkeletonPlaceholder, decorators: [{
27
+ type: Directive,
28
+ args: [{
29
+ selector: 'ng-template[cngxSkeletonPlaceholder]',
30
+ standalone: true,
31
+ }]
32
+ }] });
33
+
34
+ /**
35
+ * Skeleton loading container with built-in placeholder repetition.
36
+ *
37
+ * Manages CSS classes, ARIA, and reduced-motion handling internally
38
+ * (same behavior as the `CngxSkeleton` atom directive). Adds template projection
39
+ * so the consumer doesn't need `@if`/`@for` boilerplate.
40
+ *
41
+ * - Project a `<ng-template cngxSkeletonPlaceholder>` for the loading state (repeated `count` times).
42
+ * - Project content directly for the loaded state.
43
+ * - Uses `display: contents` — no extra DOM wrapper.
44
+ *
45
+ * ### Basic usage
46
+ * ```html
47
+ * <cngx-skeleton [loading]="loading()" [count]="3">
48
+ * <ng-template cngxSkeletonPlaceholder>
49
+ * <div class="skeleton-card"></div>
50
+ * </ng-template>
51
+ * <app-real-content />
52
+ * </cngx-skeleton>
53
+ * ```
54
+ *
55
+ * ### With template context (index, first, last)
56
+ * ```html
57
+ * <cngx-skeleton [loading]="loading()" [count]="5">
58
+ * <ng-template cngxSkeletonPlaceholder let-i let-last="last">
59
+ * <div class="skeleton-line" [style.width]="last ? '60%' : '100%'"></div>
60
+ * </ng-template>
61
+ * <p>Loaded content here</p>
62
+ * </cngx-skeleton>
63
+ * ```
64
+ */
65
+ class CngxSkeletonContainer {
66
+ /** Controls the loading state directly. */
67
+ loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
68
+ /** Bind an async state — shows skeleton during first load. Takes precedence over `loading`. */
69
+ state = input(undefined, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
70
+ /** Enables the `.cngx-skeleton--shimmer` class (respects `prefers-reduced-motion`). */
71
+ shimmer = input(true, ...(ngDevMode ? [{ debugName: "shimmer" }] : /* istanbul ignore next */ []));
72
+ /** Repeat count for the placeholder template. */
73
+ count = input(1, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
74
+ /** Derived loading state: `state.isFirstLoad` takes precedence over `loading` input. */
75
+ isLoading = computed(() => this.state()?.isFirstLoad() ?? this.loading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
76
+ /** @internal — projected placeholder template. */
77
+ placeholderTpl = contentChild(CngxSkeletonPlaceholder, ...(ngDevMode ? [{ debugName: "placeholderTpl" }] : /* istanbul ignore next */ []));
78
+ /** Array of indices for internal `@for` rendering. */
79
+ indices = computed(() => Array.from({ length: this.count() }, (_, i) => i), ...(ngDevMode ? [{ debugName: "indices" }] : /* istanbul ignore next */ []));
80
+ prefersReducedMotion;
81
+ constructor() {
82
+ const win = inject(DOCUMENT).defaultView;
83
+ const pref = signal(false, ...(ngDevMode ? [{ debugName: "pref" }] : /* istanbul ignore next */ []));
84
+ if (win?.matchMedia) {
85
+ const mq = win.matchMedia('(prefers-reduced-motion: reduce)');
86
+ pref.set(mq.matches);
87
+ const listener = (e) => pref.set(e.matches);
88
+ mq.addEventListener('change', listener);
89
+ inject(DestroyRef).onDestroy(() => mq.removeEventListener('change', listener));
90
+ }
91
+ this.prefersReducedMotion = pref.asReadonly();
92
+ }
93
+ /** @internal */
94
+ showShimmer = computed(() => this.isLoading() && this.shimmer() && !this.prefersReducedMotion(), ...(ngDevMode ? [{ debugName: "showShimmer" }] : /* istanbul ignore next */ []));
95
+ /** @internal */
96
+ getContext(index) {
97
+ const total = this.count();
98
+ return {
99
+ $implicit: index,
100
+ index,
101
+ count: total,
102
+ first: index === 0,
103
+ last: index === total - 1,
104
+ };
105
+ }
106
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSkeletonContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
107
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSkeletonContainer, isStandalone: true, selector: "cngx-skeleton", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, shimmer: { classPropertyName: "shimmer", publicName: "shimmer", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-skeleton--loading": "isLoading()", "class.cngx-skeleton--shimmer": "showShimmer()", "attr.aria-busy": "isLoading() || null" }, styleAttribute: "display: contents", classAttribute: "cngx-skeleton" }, queries: [{ propertyName: "placeholderTpl", first: true, predicate: CngxSkeletonPlaceholder, descendants: true, isSignal: true }], exportAs: ["cngxSkeletonContainer"], ngImport: i0, template: `
108
+ @if (isLoading()) {
109
+ @for (i of indices(); track i) {
110
+ <ng-container
111
+ *ngTemplateOutlet="placeholderTpl()?.templateRef ?? null; context: getContext(i)"
112
+ />
113
+ }
114
+ } @else {
115
+ <ng-content />
116
+ }
117
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
118
+ }
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSkeletonContainer, decorators: [{
120
+ type: Component,
121
+ args: [{
122
+ selector: 'cngx-skeleton',
123
+ standalone: true,
124
+ imports: [NgTemplateOutlet],
125
+ changeDetection: ChangeDetectionStrategy.OnPush,
126
+ encapsulation: ViewEncapsulation.None,
127
+ exportAs: 'cngxSkeletonContainer',
128
+ host: {
129
+ style: 'display: contents',
130
+ class: 'cngx-skeleton',
131
+ '[class.cngx-skeleton--loading]': 'isLoading()',
132
+ '[class.cngx-skeleton--shimmer]': 'showShimmer()',
133
+ '[attr.aria-busy]': 'isLoading() || null',
134
+ },
135
+ template: `
136
+ @if (isLoading()) {
137
+ @for (i of indices(); track i) {
138
+ <ng-container
139
+ *ngTemplateOutlet="placeholderTpl()?.templateRef ?? null; context: getContext(i)"
140
+ />
141
+ }
142
+ } @else {
143
+ <ng-content />
144
+ }
145
+ `,
146
+ }]
147
+ }], ctorParameters: () => [], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], shimmer: [{ type: i0.Input, args: [{ isSignal: true, alias: "shimmer", required: false }] }], count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], placeholderTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxSkeletonPlaceholder), { isSignal: true }] }] } });
148
+
149
+ /**
150
+ * @module @cngx/ui/skeleton
151
+ */
152
+
153
+ /**
154
+ * Generated bundle index. Do not edit.
155
+ */
156
+
157
+ export { CngxSkeletonContainer, CngxSkeletonPlaceholder };
158
+ //# sourceMappingURL=cngx-ui-skeleton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cngx-ui-skeleton.mjs","sources":["../../../projects/ui/skeleton/skeleton-placeholder.ts","../../../projects/ui/skeleton/skeleton-container.ts","../../../projects/ui/skeleton/public-api.ts","../../../projects/ui/skeleton/cngx-ui-skeleton.ts"],"sourcesContent":["import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Marks a template as the skeleton placeholder inside `cngx-skeleton`.\n *\n * The template is repeated `count` times while loading. Context provides the\n * current index as `$implicit`.\n *\n * ```html\n * <cngx-skeleton [loading]=\"loading()\" [count]=\"3\">\n * <ng-template cngxSkeletonPlaceholder let-i>\n * <div class=\"skeleton-line\" [style.width]=\"i === 0 ? '60%' : '100%'\"></div>\n * </ng-template>\n * <p>Real content</p>\n * </cngx-skeleton>\n * ```\n */\n@Directive({\n selector: 'ng-template[cngxSkeletonPlaceholder]',\n standalone: true,\n})\nexport class CngxSkeletonPlaceholder {\n /** Reference to the projected template. Used internally by `CngxSkeletonContainer`. */\n readonly templateRef = inject<TemplateRef<CngxSkeletonPlaceholderContext>>(TemplateRef);\n}\n\n/** Template context for `cngxSkeletonPlaceholder`. */\nexport interface CngxSkeletonPlaceholderContext {\n /** Current index (0-based). */\n $implicit: number;\n /** Current index (named). */\n index: number;\n /** Total count. */\n count: number;\n /** Whether this is the first item. */\n first: boolean;\n /** Whether this is the last item. */\n last: boolean;\n}\n","import { DOCUMENT, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n DestroyRef,\n inject,\n input,\n signal,\n type Signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport {\n CngxSkeletonPlaceholder,\n type CngxSkeletonPlaceholderContext,\n} from './skeleton-placeholder';\n\n/**\n * Skeleton loading container with built-in placeholder repetition.\n *\n * Manages CSS classes, ARIA, and reduced-motion handling internally\n * (same behavior as the `CngxSkeleton` atom directive). Adds template projection\n * so the consumer doesn't need `@if`/`@for` boilerplate.\n *\n * - Project a `<ng-template cngxSkeletonPlaceholder>` for the loading state (repeated `count` times).\n * - Project content directly for the loaded state.\n * - Uses `display: contents` — no extra DOM wrapper.\n *\n * ### Basic usage\n * ```html\n * <cngx-skeleton [loading]=\"loading()\" [count]=\"3\">\n * <ng-template cngxSkeletonPlaceholder>\n * <div class=\"skeleton-card\"></div>\n * </ng-template>\n * <app-real-content />\n * </cngx-skeleton>\n * ```\n *\n * ### With template context (index, first, last)\n * ```html\n * <cngx-skeleton [loading]=\"loading()\" [count]=\"5\">\n * <ng-template cngxSkeletonPlaceholder let-i let-last=\"last\">\n * <div class=\"skeleton-line\" [style.width]=\"last ? '60%' : '100%'\"></div>\n * </ng-template>\n * <p>Loaded content here</p>\n * </cngx-skeleton>\n * ```\n */\n@Component({\n selector: 'cngx-skeleton',\n standalone: true,\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n exportAs: 'cngxSkeletonContainer',\n host: {\n style: 'display: contents',\n class: 'cngx-skeleton',\n '[class.cngx-skeleton--loading]': 'isLoading()',\n '[class.cngx-skeleton--shimmer]': 'showShimmer()',\n '[attr.aria-busy]': 'isLoading() || null',\n },\n template: `\n @if (isLoading()) {\n @for (i of indices(); track i) {\n <ng-container\n *ngTemplateOutlet=\"placeholderTpl()?.templateRef ?? null; context: getContext(i)\"\n />\n }\n } @else {\n <ng-content />\n }\n `,\n})\nexport class CngxSkeletonContainer {\n /** Controls the loading state directly. */\n readonly loading = input<boolean>(false);\n\n /** Bind an async state — shows skeleton during first load. Takes precedence over `loading`. */\n readonly state = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /** Enables the `.cngx-skeleton--shimmer` class (respects `prefers-reduced-motion`). */\n readonly shimmer = input<boolean>(true);\n\n /** Repeat count for the placeholder template. */\n readonly count = input<number>(1);\n\n /** Derived loading state: `state.isFirstLoad` takes precedence over `loading` input. */\n protected readonly isLoading = computed(() => this.state()?.isFirstLoad() ?? this.loading());\n\n /** @internal — projected placeholder template. */\n protected readonly placeholderTpl = contentChild(CngxSkeletonPlaceholder);\n\n /** Array of indices for internal `@for` rendering. */\n readonly indices = computed(() => Array.from({ length: this.count() }, (_, i) => i));\n\n private readonly prefersReducedMotion: Signal<boolean>;\n\n constructor() {\n const win = inject(DOCUMENT).defaultView;\n const pref = signal(false);\n if (win?.matchMedia) {\n const mq = win.matchMedia('(prefers-reduced-motion: reduce)');\n pref.set(mq.matches);\n const listener = (e: MediaQueryListEvent) => pref.set(e.matches);\n mq.addEventListener('change', listener);\n inject(DestroyRef).onDestroy(() => mq.removeEventListener('change', listener));\n }\n this.prefersReducedMotion = pref.asReadonly();\n }\n\n /** @internal */\n protected readonly showShimmer = computed(\n () => this.isLoading() && this.shimmer() && !this.prefersReducedMotion(),\n );\n\n /** @internal */\n protected getContext(index: number): CngxSkeletonPlaceholderContext {\n const total = this.count();\n return {\n $implicit: index,\n index,\n count: total,\n first: index === 0,\n last: index === total - 1,\n };\n }\n}\n","/**\n * @module @cngx/ui/skeleton\n */\n\nexport { CngxSkeletonContainer } from './skeleton-container';\nexport {\n CngxSkeletonPlaceholder,\n type CngxSkeletonPlaceholderContext,\n} from './skeleton-placeholder';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;AAcG;MAKU,uBAAuB,CAAA;;AAEzB,IAAA,WAAW,GAAG,MAAM,CAA8C,WAAW,CAAC;uGAF5E,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sCAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sCAAsC;AAChD,oBAAA,UAAU,EAAE,IAAI;AACjB,iBA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AA,KAAK,EAAE,mBAAmB;AAC1B,wBAAA,KAAK,EAAE,eAAe;AACtB,wBAAA,gCAAgC,EAAE,aAAa;AAC/C,wBAAA,gCAAgC,EAAE,eAAe;AACjD,wBAAA,kBAAkB,EAAE,qBAAqB;AAC1C,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;AAUT,EAAA,CAAA;AACF,iBAAA;6eAkBkD,uBAAuB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC9F1E;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,112 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+
4
+ /**
5
+ * Ready-made speaker button that connects to a {@link CngxSpeak} directive
6
+ * via an explicit `[speakRef]` input — no ancestor injection.
7
+ *
8
+ * Ships with a speaker/stop SVG icon and CSS custom properties for full
9
+ * theming control. Include `speak-button-theme.scss` for automatic Material
10
+ * theme integration.
11
+ *
12
+ * ### Basic usage
13
+ * ```html
14
+ * <span [cngxSpeak]="text" #tts="cngxSpeak">{{ text }}</span>
15
+ * <cngx-speak-button [speakRef]="tts" />
16
+ * ```
17
+ *
18
+ * ### Material theme integration
19
+ * ```scss
20
+ * @use '@cngx/ui/speak/speak-button-theme' as speak;
21
+ * @include speak.theme($theme);
22
+ * ```
23
+ */
24
+ class CngxSpeakButton {
25
+ /** The `CngxSpeak` directive instance to connect to. */
26
+ speakRef = input.required(...(ngDevMode ? [{ debugName: "speakRef" }] : /* istanbul ignore next */ []));
27
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSpeakButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
28
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSpeakButton, isStandalone: true, selector: "cngx-speak-button", inputs: { speakRef: { classPropertyName: "speakRef", publicName: "speakRef", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.cngx-speak-button--speaking": "speakRef().speaking()" } }, ngImport: i0, template: `
29
+ <button
30
+ type="button"
31
+ class="cngx-speak-button__btn"
32
+ [attr.aria-label]="speakRef().speaking() ? 'Stop speaking' : 'Read aloud'"
33
+ (click)="speakRef().toggle()"
34
+ >
35
+ @if (speakRef().speaking()) {
36
+ <svg
37
+ class="cngx-speak-button__icon"
38
+ viewBox="0 0 24 24"
39
+ fill="currentColor"
40
+ aria-hidden="true"
41
+ >
42
+ <rect x="6" y="6" width="12" height="12" rx="2" />
43
+ </svg>
44
+ } @else {
45
+ <svg
46
+ class="cngx-speak-button__icon"
47
+ viewBox="0 0 24 24"
48
+ fill="none"
49
+ stroke="currentColor"
50
+ stroke-width="2"
51
+ stroke-linecap="round"
52
+ stroke-linejoin="round"
53
+ aria-hidden="true"
54
+ >
55
+ <path d="M11 5L6 9H2v6h4l5 4V5z" />
56
+ <path d="M15.54 8.46a5 5 0 010 7.07" />
57
+ <path d="M19.07 4.93a10 10 0 010 14.14" />
58
+ </svg>
59
+ }
60
+ </button>
61
+ `, isInline: true, styles: ["cngx-speak-button{display:inline-flex}.cngx-speak-button__btn{display:inline-flex;align-items:center;justify-content:center;width:var(--cngx-speak-btn-size, 36px);height:var(--cngx-speak-btn-size, 36px);padding:0;border:var(--cngx-speak-btn-border-width, 1px) solid var(--cngx-border, #ddd);border-radius:var(--cngx-speak-btn-radius, 8px);background:var(--cngx-speak-btn-bg, var(--cngx-surface, #fff));color:var(--cngx-speak-btn-color, var(--cngx-text-secondary, #666));cursor:pointer;transition:color var(--cngx-speak-btn-transition, .15s),background var(--cngx-speak-btn-transition, .15s),border-color var(--cngx-speak-btn-transition, .15s);flex-shrink:0}.cngx-speak-button__btn:hover{color:var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));border-color:var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));background:var( --cngx-speak-btn-hover-bg, var(--cngx-speak-btn-bg, var(--cngx-surface, #fff)) )}.cngx-speak-button--speaking .cngx-speak-button__btn{color:var(--cngx-speak-btn-speaking-color, #fff);background:var( --cngx-speak-btn-speaking-bg, var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623)) );border-color:var( --cngx-speak-btn-speaking-bg, var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623)) )}.cngx-speak-button__icon{width:var(--cngx-speak-btn-icon-size, 18px);height:var(--cngx-speak-btn-icon-size, 18px);transform:translate(1px)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSpeakButton, decorators: [{
64
+ type: Component,
65
+ args: [{ selector: 'cngx-speak-button', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
66
+ '[class.cngx-speak-button--speaking]': 'speakRef().speaking()',
67
+ }, template: `
68
+ <button
69
+ type="button"
70
+ class="cngx-speak-button__btn"
71
+ [attr.aria-label]="speakRef().speaking() ? 'Stop speaking' : 'Read aloud'"
72
+ (click)="speakRef().toggle()"
73
+ >
74
+ @if (speakRef().speaking()) {
75
+ <svg
76
+ class="cngx-speak-button__icon"
77
+ viewBox="0 0 24 24"
78
+ fill="currentColor"
79
+ aria-hidden="true"
80
+ >
81
+ <rect x="6" y="6" width="12" height="12" rx="2" />
82
+ </svg>
83
+ } @else {
84
+ <svg
85
+ class="cngx-speak-button__icon"
86
+ viewBox="0 0 24 24"
87
+ fill="none"
88
+ stroke="currentColor"
89
+ stroke-width="2"
90
+ stroke-linecap="round"
91
+ stroke-linejoin="round"
92
+ aria-hidden="true"
93
+ >
94
+ <path d="M11 5L6 9H2v6h4l5 4V5z" />
95
+ <path d="M15.54 8.46a5 5 0 010 7.07" />
96
+ <path d="M19.07 4.93a10 10 0 010 14.14" />
97
+ </svg>
98
+ }
99
+ </button>
100
+ `, styles: ["cngx-speak-button{display:inline-flex}.cngx-speak-button__btn{display:inline-flex;align-items:center;justify-content:center;width:var(--cngx-speak-btn-size, 36px);height:var(--cngx-speak-btn-size, 36px);padding:0;border:var(--cngx-speak-btn-border-width, 1px) solid var(--cngx-border, #ddd);border-radius:var(--cngx-speak-btn-radius, 8px);background:var(--cngx-speak-btn-bg, var(--cngx-surface, #fff));color:var(--cngx-speak-btn-color, var(--cngx-text-secondary, #666));cursor:pointer;transition:color var(--cngx-speak-btn-transition, .15s),background var(--cngx-speak-btn-transition, .15s),border-color var(--cngx-speak-btn-transition, .15s);flex-shrink:0}.cngx-speak-button__btn:hover{color:var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));border-color:var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));background:var( --cngx-speak-btn-hover-bg, var(--cngx-speak-btn-bg, var(--cngx-surface, #fff)) )}.cngx-speak-button--speaking .cngx-speak-button__btn{color:var(--cngx-speak-btn-speaking-color, #fff);background:var( --cngx-speak-btn-speaking-bg, var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623)) );border-color:var( --cngx-speak-btn-speaking-bg, var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623)) )}.cngx-speak-button__icon{width:var(--cngx-speak-btn-icon-size, 18px);height:var(--cngx-speak-btn-icon-size, 18px);transform:translate(1px)}\n"] }]
101
+ }], propDecorators: { speakRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "speakRef", required: true }] }] } });
102
+
103
+ /**
104
+ * @module @cngx/ui/speak
105
+ */
106
+
107
+ /**
108
+ * Generated bundle index. Do not edit.
109
+ */
110
+
111
+ export { CngxSpeakButton };
112
+ //# sourceMappingURL=cngx-ui-speak.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cngx-ui-speak.mjs","sources":["../../../projects/ui/speak/speak-button.ts","../../../projects/ui/speak/public-api.ts","../../../projects/ui/speak/cngx-ui-speak.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, ViewEncapsulation } from '@angular/core';\nimport { type CngxSpeak } from '@cngx/common';\n\n/**\n * Ready-made speaker button that connects to a {@link CngxSpeak} directive\n * via an explicit `[speakRef]` input — no ancestor injection.\n *\n * Ships with a speaker/stop SVG icon and CSS custom properties for full\n * theming control. Include `speak-button-theme.scss` for automatic Material\n * theme integration.\n *\n * ### Basic usage\n * ```html\n * <span [cngxSpeak]=\"text\" #tts=\"cngxSpeak\">{{ text }}</span>\n * <cngx-speak-button [speakRef]=\"tts\" />\n * ```\n *\n * ### Material theme integration\n * ```scss\n * @use '@cngx/ui/speak/speak-button-theme' as speak;\n * @include speak.theme($theme);\n * ```\n */\n@Component({\n selector: 'cngx-speak-button',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.cngx-speak-button--speaking]': 'speakRef().speaking()',\n },\n styles: `\n cngx-speak-button {\n display: inline-flex;\n }\n\n .cngx-speak-button__btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--cngx-speak-btn-size, 36px);\n height: var(--cngx-speak-btn-size, 36px);\n padding: 0;\n border: var(--cngx-speak-btn-border-width, 1px) solid var(--cngx-border, #ddd);\n border-radius: var(--cngx-speak-btn-radius, 8px);\n background: var(--cngx-speak-btn-bg, var(--cngx-surface, #fff));\n color: var(--cngx-speak-btn-color, var(--cngx-text-secondary, #666));\n cursor: pointer;\n transition:\n color var(--cngx-speak-btn-transition, 0.15s),\n background var(--cngx-speak-btn-transition, 0.15s),\n border-color var(--cngx-speak-btn-transition, 0.15s);\n flex-shrink: 0;\n }\n\n .cngx-speak-button__btn:hover {\n color: var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));\n border-color: var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623));\n background: var(\n --cngx-speak-btn-hover-bg,\n var(--cngx-speak-btn-bg, var(--cngx-surface, #fff))\n );\n }\n\n .cngx-speak-button--speaking .cngx-speak-button__btn {\n color: var(--cngx-speak-btn-speaking-color, #fff);\n background: var(\n --cngx-speak-btn-speaking-bg,\n var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623))\n );\n border-color: var(\n --cngx-speak-btn-speaking-bg,\n var(--cngx-speak-btn-active-color, var(--cngx-accent, #f5a623))\n );\n }\n\n .cngx-speak-button__icon {\n width: var(--cngx-speak-btn-icon-size, 18px);\n height: var(--cngx-speak-btn-icon-size, 18px);\n transform: translateX(1px);\n }\n `,\n template: `\n <button\n type=\"button\"\n class=\"cngx-speak-button__btn\"\n [attr.aria-label]=\"speakRef().speaking() ? 'Stop speaking' : 'Read aloud'\"\n (click)=\"speakRef().toggle()\"\n >\n @if (speakRef().speaking()) {\n <svg\n class=\"cngx-speak-button__icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" />\n </svg>\n } @else {\n <svg\n class=\"cngx-speak-button__icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M11 5L6 9H2v6h4l5 4V5z\" />\n <path d=\"M15.54 8.46a5 5 0 010 7.07\" />\n <path d=\"M19.07 4.93a10 10 0 010 14.14\" />\n </svg>\n }\n </button>\n `,\n})\nexport class CngxSpeakButton {\n /** The `CngxSpeak` directive instance to connect to. */\n readonly speakRef = input.required<CngxSpeak>();\n}\n","/**\n * @module @cngx/ui/speak\n */\n\nexport { CngxSpeakButton } from './speak-button';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;AAmBG;MA+FU,eAAe,CAAA;;AAEjB,IAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ,8EAAa;uGAFpC,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