@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,4 +1,4 @@
1
- import { Signal, InjectionToken, Provider } from '@angular/core';
1
+ import { Signal, Provider, InjectionToken } from '@angular/core';
2
2
 
3
3
  /**
4
4
  * A single registrable command - a labelled action the command palette can
@@ -10,8 +10,7 @@ import { Signal, InjectionToken, Provider } from '@angular/core';
10
10
  * parameter: a payload rides on `data` as `unknown` and the row slot narrows
11
11
  * it at the use-site.
12
12
  *
13
- * @category common/command
14
- * @since 0.1.0
13
+ * @since 0.3.0
15
14
  */
16
15
  interface CngxCommand {
17
16
  /** Stable identity. Drives the merge `equal` and the `aria-activedescendant` id. */
@@ -42,8 +41,7 @@ interface CngxCommand {
42
41
  * an empty query, then categories) and the consumer's async result source is a
43
42
  * `CngxAsyncState<CngxCommandGroup[]>`.
44
43
  *
45
- * @category common/command
46
- * @since 0.1.0
44
+ * @since 0.3.0
47
45
  */
48
46
  interface CngxCommandGroup {
49
47
  /** Stable identity for the group header slot and change detection. */
@@ -57,8 +55,7 @@ interface CngxCommandGroup {
57
55
  * @deprecated Use {@link CngxCommandGroup}. Published under the unprefixed
58
56
  * name by mistake; the alias remains for compatibility and will be removed in
59
57
  * a future major.
60
- * @category common/command
61
- * @since 0.1.0
58
+ * @since 0.3.0
62
59
  */
63
60
  type CommandGroup = CngxCommandGroup;
64
61
 
@@ -67,43 +64,67 @@ type CommandGroup = CngxCommandGroup;
67
64
  * commands - a signal source lets a contributor add or remove commands (or
68
65
  * flip a command's `disabled`) live, and `injectCommands` tracks it.
69
66
  *
70
- * @category common/command
71
- * @since 0.1.0
67
+ * @since 0.3.0
72
68
  */
73
69
  type CngxCommandSource = Signal<readonly CngxCommand[]> | readonly CngxCommand[];
74
70
  /**
75
- * Multi-token every `provideCommands` call contributes to. App parts register
76
- * command sets against it without a central list, mirroring `provideCngxMenu`.
77
- * The generic is the collected array (as with Angular's `HTTP_INTERCEPTORS`),
78
- * so `inject(CNGX_COMMAND_SOURCE)` returns every contributed source.
79
- *
80
- * @category common/command
81
- * @since 0.1.0
71
+ * A source that needs injection. `provideCommands` runs it once, as a provider
72
+ * factory in the injection context of the level it is registered at, so it can
73
+ * call `inject()`. It is not a `computed`: a factory returning a plain array is
74
+ * frozen at that first call. Return a `Signal` to stay reactive. A factory that
75
+ * returns anything else contributes no commands and warns in dev mode
76
+ * ([`CNGX1070`](/error-codes/cngx1070.md)).
77
+ *
78
+ * The factory must not call `injectCommands()`, directly or through a service
79
+ * it injects at the same level: that reads the registry the factory is still
80
+ * building, and Angular throws a circular-dependency error (NG0200).
81
+ *
82
+ * @relatedTo provideCommands
83
+ * @since 0.3.0
82
84
  */
83
- declare const CNGX_COMMAND_SOURCE: InjectionToken<readonly CngxCommandSource[]>;
85
+ type CngxCommandSourceFactory = () => CngxCommandSource;
84
86
  /**
85
- * Registers one or more command sources. Each source becomes a `multi` entry
86
- * on {@link CNGX_COMMAND_SOURCE}; call `provideCommands` from several app parts
87
- * and `injectCommands` merges all of them.
87
+ * Registers one or more command sources. Call `provideCommands` from several
88
+ * app parts and `injectCommands` merges all of them, without a central list.
88
89
  *
89
90
  * Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any
90
91
  * injector scope - app root, a lazy route, or a component's `providers` /
91
92
  * `viewProviders` - letting a route or component contribute a scoped command
92
- * set without reaching for the raw {@link CNGX_COMMAND_SOURCE} multi-provider.
93
+ * set.
94
+ *
95
+ * A source is a static list, a `Signal` of commands, or a
96
+ * {@link CngxCommandSourceFactory} for a source that needs injection. The
97
+ * factory runs once in the injection context of the level it is registered
98
+ * at. Return a `Signal` from it to stay reactive: a factory returning a plain
99
+ * array (`() => store.items()`) is read at that first call and never again.
100
+ *
101
+ * ```ts
102
+ * // a source owned by a service
103
+ * { path: 'editor', providers: [provideCommands(() => inject(EditorStore).commands)] }
104
+ * ```
105
+ *
106
+ * A scoped call adds to the sets above it and never hides them, across route
107
+ * and component scopes: root and route scopes come first (outer to inner), then
108
+ * component scopes outer to inner. The same source reference registered at two
109
+ * levels is listed once. Command ids are unique in the merged list: a command
110
+ * whose `id` is already registered further out replaces that command in place,
111
+ * so a scope can swap a global command for its own version.
93
112
  *
94
113
  * ```ts
95
114
  * // app root
96
115
  * bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });
116
+ * // a lazy route adds its set; its pages see fileCommands + reportCommands
117
+ * { path: 'reports', providers: [provideCommands(reportCommands)], component: Reports }
97
118
  * // or component scope
98
119
  * @Component({ viewProviders: [provideCommands(editorCommands)] })
99
120
  * ```
100
121
  *
101
- * @category common/command
102
- * @since 0.1.0
122
+ * @since 0.3.0
103
123
  */
104
- declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
124
+ declare function provideCommands(...sources: (CngxCommandSource | CngxCommandSourceFactory)[]): Provider[];
105
125
  /**
106
- * Merges every registered {@link CNGX_COMMAND_SOURCE} into one reactive
126
+ * Merges the command sources registered at this injector level and every level
127
+ * above it - route and component scopes alike - into one reactive
107
128
  * `Signal<readonly CngxCommand[]>`. The merge carries an explicit `equal`
108
129
  * (length + per-command identity) so re-emitting an identical set - the same
109
130
  * command references in the same order - does not produce a fresh array and
@@ -111,8 +132,7 @@ declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
111
132
  *
112
133
  * Must run in an injection context.
113
134
  *
114
- * @category common/command
115
- * @since 0.1.0
135
+ * @since 0.3.0
116
136
  */
117
137
  declare function injectCommands(): Signal<readonly CngxCommand[]>;
118
138
 
@@ -121,8 +141,7 @@ declare function injectCommands(): Signal<readonly CngxCommand[]>;
121
141
  * first. The palette renders these in order; the row slot reads `command` and
122
142
  * the term to highlight.
123
143
  *
124
- * @category common/command
125
- * @since 0.1.0
144
+ * @since 0.3.0
126
145
  */
127
146
  interface CngxRankedCommand {
128
147
  /** The matched command. */
@@ -134,8 +153,7 @@ interface CngxRankedCommand {
134
153
  * @deprecated Use {@link CngxRankedCommand}. Published under the unprefixed
135
154
  * name by mistake; the alias remains for compatibility and will be removed in
136
155
  * a future major.
137
- * @category common/command
138
- * @since 0.1.0
156
+ * @since 0.3.0
139
157
  */
140
158
  type RankedCommand = CngxRankedCommand;
141
159
  /**
@@ -143,8 +161,7 @@ type RankedCommand = CngxRankedCommand;
143
161
  * via {@link CNGX_COMMAND_MATCH_FACTORY} - a consumer drops in Levenshtein or a
144
162
  * fuzzy engine without touching the panel.
145
163
  *
146
- * @category common/command
147
- * @since 0.1.0
164
+ * @since 0.3.0
148
165
  */
149
166
  type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope?: string) => readonly CngxRankedCommand[];
150
167
  /**
@@ -160,8 +177,7 @@ type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope
160
177
  * by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale
161
178
  * switch re-ranks.
162
179
  *
163
- * @category common/command
164
- * @since 0.1.0
180
+ * @since 0.3.0
165
181
  */
166
182
  declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxCommandMatcher;
167
183
 
@@ -170,8 +186,7 @@ declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxComma
170
186
  * captured so an override matches it precisely. The panel calls it in an
171
187
  * injection context, so a factory may `inject()` what its matcher needs.
172
188
  *
173
- * @category common/command
174
- * @since 0.1.0
189
+ * @since 0.3.0
175
190
  */
176
191
  type CngxCommandMatchFactory = () => CngxCommandMatcher;
177
192
  /**
@@ -181,10 +196,9 @@ type CngxCommandMatchFactory = () => CngxCommandMatcher;
181
196
  * without touching the panel. The fuzzy engine stays a consumer swap; the
182
197
  * default bundle ships only the pure ranker.
183
198
  *
184
- * @category common/command
185
- * @since 0.1.0
199
+ * @since 0.3.0
186
200
  */
187
201
  declare const CNGX_COMMAND_MATCH_FACTORY: InjectionToken<CngxCommandMatchFactory>;
188
202
 
189
- export { CNGX_COMMAND_MATCH_FACTORY, CNGX_COMMAND_SOURCE, createDefaultCommandMatcher, injectCommands, provideCommands };
190
- export type { CngxCommand, CngxCommandGroup, CngxCommandMatchFactory, CngxCommandMatcher, CngxCommandSource, CngxRankedCommand, CommandGroup, RankedCommand };
203
+ export { CNGX_COMMAND_MATCH_FACTORY, createDefaultCommandMatcher, injectCommands, provideCommands };
204
+ export type { CngxCommand, CngxCommandGroup, CngxCommandMatchFactory, CngxCommandMatcher, CngxCommandSource, CngxCommandSourceFactory, CngxRankedCommand, CommandGroup, RankedCommand };