@cngx/common 0.1.0-rc.9 → 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 (88) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +19 -8
  4. package/data/README.md +10 -10
  5. package/fesm2022/cngx-common-a11y.mjs +701 -263
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +83 -64
  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 +135 -76
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +749 -296
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +51 -29
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +695 -405
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +112 -112
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +668 -308
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7066 -2739
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2121 -492
  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 +1207 -569
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +256 -261
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +202 -262
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +28 -61
  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 +1 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +14 -4
  43. package/popover/README.md +42 -5
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/ng-add/index.js +7 -7
  46. package/schematics/ng-add/schema.json +5 -0
  47. package/stepper/README.md +0 -1
  48. package/theming/components/cngx-accordion.css +36 -7
  49. package/theming/components/cngx-async.css +185 -37
  50. package/theming/components/cngx-backdrop.css +3 -1
  51. package/theming/components/cngx-badge.css +20 -5
  52. package/theming/components/cngx-bottom-sheet.css +2 -0
  53. package/theming/components/cngx-breadcrumb.css +3 -1
  54. package/theming/components/cngx-button-group.css +325 -0
  55. package/theming/components/cngx-button-toggle.css +55 -23
  56. package/theming/components/cngx-button.css +975 -0
  57. package/theming/components/cngx-data-grid.css +2 -0
  58. package/theming/components/cngx-dialog.css +3 -1
  59. package/theming/components/cngx-divider.css +24 -9
  60. package/theming/components/cngx-drawer.css +153 -0
  61. package/theming/components/cngx-icon-glyph.css +76 -0
  62. package/theming/components/cngx-listbox.css +79 -25
  63. package/theming/components/cngx-menu.css +112 -52
  64. package/theming/components/cngx-nav.css +1220 -0
  65. package/theming/components/cngx-popover-sheet.css +43 -11
  66. package/theming/components/cngx-popover.css +37 -13
  67. package/theming/components/cngx-recycler-placeholder.css +2 -0
  68. package/theming/components/cngx-ripple.css +74 -16
  69. package/theming/components/cngx-sidebar.css +71 -0
  70. package/theming/components/cngx-slider.css +3 -1
  71. package/theming/components/cngx-tooltip.css +2 -0
  72. package/timeline/README.md +2 -2
  73. package/types/cngx-common-a11y.d.ts +343 -120
  74. package/types/cngx-common-audio.d.ts +60 -88
  75. package/types/cngx-common-button.d.ts +698 -0
  76. package/types/cngx-common-card.d.ts +104 -78
  77. package/types/cngx-common-chart.d.ts +671 -384
  78. package/types/cngx-common-command.d.ts +44 -47
  79. package/types/cngx-common-data.d.ts +350 -342
  80. package/types/cngx-common-dialog.d.ts +91 -120
  81. package/types/cngx-common-display.d.ts +475 -300
  82. package/types/cngx-common-interactive.d.ts +4350 -1723
  83. package/types/cngx-common-layout.d.ts +1365 -286
  84. package/types/cngx-common-menu-button.d.ts +382 -0
  85. package/types/cngx-common-popover.d.ts +671 -289
  86. package/types/cngx-common-stepper.d.ts +217 -347
  87. package/types/cngx-common-tabs.d.ts +173 -386
  88. package/types/cngx-common-timeline.d.ts +25 -104
@@ -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,36 +64,44 @@ 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 the sources of the nearest level
79
- * that provides it.
80
- *
81
- * This is the low-level form. Register through `provideCommands`, which also
82
- * carries a level's sources into every scope below it. A raw multi-provider on
83
- * this token is carried down only from a level that also calls
84
- * `provideCommands`; on any other level it is read only when that level is the
85
- * one `injectCommands` resolves as nearest.
86
- *
87
- * @category common/command
88
- * @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
89
84
  */
90
- declare const CNGX_COMMAND_SOURCE: InjectionToken<readonly CngxCommandSource[]>;
85
+ type CngxCommandSourceFactory = () => CngxCommandSource;
91
86
  /**
92
- * Registers one or more command sources. Each source becomes a `multi` entry
93
- * on {@link CNGX_COMMAND_SOURCE}; call `provideCommands` from several app parts
94
- * 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.
95
89
  *
96
90
  * Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any
97
91
  * injector scope - app root, a lazy route, or a component's `providers` /
98
92
  * `viewProviders` - letting a route or component contribute a scoped command
99
- * 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
+ * ```
100
105
  *
101
106
  * A scoped call adds to the sets above it and never hides them, across route
102
107
  * and component scopes: root and route scopes come first (outer to inner), then
@@ -114,10 +119,9 @@ declare const CNGX_COMMAND_SOURCE: InjectionToken<readonly CngxCommandSource[]>;
114
119
  * @Component({ viewProviders: [provideCommands(editorCommands)] })
115
120
  * ```
116
121
  *
117
- * @category common/command
118
- * @since 0.1.0
122
+ * @since 0.3.0
119
123
  */
120
- declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
124
+ declare function provideCommands(...sources: (CngxCommandSource | CngxCommandSourceFactory)[]): Provider[];
121
125
  /**
122
126
  * Merges the command sources registered at this injector level and every level
123
127
  * above it - route and component scopes alike - into one reactive
@@ -128,8 +132,7 @@ declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
128
132
  *
129
133
  * Must run in an injection context.
130
134
  *
131
- * @category common/command
132
- * @since 0.1.0
135
+ * @since 0.3.0
133
136
  */
134
137
  declare function injectCommands(): Signal<readonly CngxCommand[]>;
135
138
 
@@ -138,8 +141,7 @@ declare function injectCommands(): Signal<readonly CngxCommand[]>;
138
141
  * first. The palette renders these in order; the row slot reads `command` and
139
142
  * the term to highlight.
140
143
  *
141
- * @category common/command
142
- * @since 0.1.0
144
+ * @since 0.3.0
143
145
  */
144
146
  interface CngxRankedCommand {
145
147
  /** The matched command. */
@@ -151,8 +153,7 @@ interface CngxRankedCommand {
151
153
  * @deprecated Use {@link CngxRankedCommand}. Published under the unprefixed
152
154
  * name by mistake; the alias remains for compatibility and will be removed in
153
155
  * a future major.
154
- * @category common/command
155
- * @since 0.1.0
156
+ * @since 0.3.0
156
157
  */
157
158
  type RankedCommand = CngxRankedCommand;
158
159
  /**
@@ -160,8 +161,7 @@ type RankedCommand = CngxRankedCommand;
160
161
  * via {@link CNGX_COMMAND_MATCH_FACTORY} - a consumer drops in Levenshtein or a
161
162
  * fuzzy engine without touching the panel.
162
163
  *
163
- * @category common/command
164
- * @since 0.1.0
164
+ * @since 0.3.0
165
165
  */
166
166
  type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope?: string) => readonly CngxRankedCommand[];
167
167
  /**
@@ -177,8 +177,7 @@ type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope
177
177
  * by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale
178
178
  * switch re-ranks.
179
179
  *
180
- * @category common/command
181
- * @since 0.1.0
180
+ * @since 0.3.0
182
181
  */
183
182
  declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxCommandMatcher;
184
183
 
@@ -187,8 +186,7 @@ declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxComma
187
186
  * captured so an override matches it precisely. The panel calls it in an
188
187
  * injection context, so a factory may `inject()` what its matcher needs.
189
188
  *
190
- * @category common/command
191
- * @since 0.1.0
189
+ * @since 0.3.0
192
190
  */
193
191
  type CngxCommandMatchFactory = () => CngxCommandMatcher;
194
192
  /**
@@ -198,10 +196,9 @@ type CngxCommandMatchFactory = () => CngxCommandMatcher;
198
196
  * without touching the panel. The fuzzy engine stays a consumer swap; the
199
197
  * default bundle ships only the pure ranker.
200
198
  *
201
- * @category common/command
202
- * @since 0.1.0
199
+ * @since 0.3.0
203
200
  */
204
201
  declare const CNGX_COMMAND_MATCH_FACTORY: InjectionToken<CngxCommandMatchFactory>;
205
202
 
206
- export { CNGX_COMMAND_MATCH_FACTORY, CNGX_COMMAND_SOURCE, createDefaultCommandMatcher, injectCommands, provideCommands };
207
- 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 };