@dereekb/dbx-web 13.17.0 → 13.18.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.
- package/_index.scss +4 -1
- package/eslint/package.json +4 -4
- package/fesm2022/dereekb-dbx-web-mapbox.mjs +2 -2
- package/fesm2022/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-web-style-demo.mjs +1698 -0
- package/fesm2022/dereekb-dbx-web-style-demo.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-web-table.mjs +1 -1
- package/fesm2022/dereekb-dbx-web-table.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-web.mjs +460 -333
- package/fesm2022/dereekb-dbx-web.mjs.map +1 -1
- package/lib/button/_button.scss +74 -98
- package/lib/extension/pdf/_pdf.scss +5 -5
- package/lib/extension/table/_table.scss +2 -2
- package/lib/interaction/detach/_detach.scss +22 -2
- package/lib/interaction/dialog/_dialog.scss +4 -8
- package/lib/interaction/popup/_popup.scss +1 -2
- package/lib/interaction/prompt/_prompt.scss +7 -2
- package/lib/layout/avatar/_avatar.scss +8 -0
- package/lib/layout/bar/_bar.scss +41 -2
- package/lib/layout/card/_card.scss +191 -3
- package/lib/layout/column/_column.scss +3 -3
- package/lib/layout/content/_content.scss +24 -9
- package/lib/layout/list/_list.scss +83 -6
- package/lib/layout/section/_section.scss +7 -8
- package/lib/layout/style/_style.scss +44 -9
- package/lib/layout/text/_text.scss +73 -29
- package/lib/loading/_loading.scss +9 -2
- package/lib/router/layout/navbar/_navbar.scss +14 -0
- package/lib/router/layout/sidenav/_sidenav.scss +2 -2
- package/lib/style/_core.scss +4 -0
- package/lib/style/_corners.scss +79 -0
- package/lib/style/_root-variables.scss +17 -0
- package/lib/style/_shapes.scss +56 -0
- package/lib/style/_style-demo.scss +183 -0
- package/lib/style/_variables.scss +8 -1
- package/package.json +11 -7
- package/style-demo/README.md +12 -0
- package/types/dereekb-dbx-web-style-demo.d.ts +883 -0
- package/types/dereekb-dbx-web.d.ts +170 -79
- package/lib/style/_m2-visual-compat.scss +0 -120
|
@@ -0,0 +1,1698 @@
|
|
|
1
|
+
import { asArray, cssClassesSet, useIterableOrValue, spaceSeparatedCssClasses, makeValuesGroupMap } from '@dereekb/util';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, Injectable, input, computed, Directive, InjectionToken, makeEnvironmentProviders, signal, viewChild, ElementRef, effect, ChangeDetectionStrategy, Component, provideEnvironmentInitializer } from '@angular/core';
|
|
4
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { DbxDetachService, DbxPopoverService, DbxStyleService, DbxButtonComponent, DbxFlexGroupDirective, DbxFlexSizeDirective, DbxButtonSpacerDirective, DbxColorService, DbxColorDirective, DBX_THEME_COLORS_MAIN, DBX_THEME_COLORS_EXTRA, DbxPagebarComponent, DbxBarDirective, DbxBarHeaderComponent, DbxAnchorListComponent } from '@dereekb/dbx-web';
|
|
6
|
+
import { NgComponentOutlet } from '@angular/common';
|
|
7
|
+
import * as i1 from '@angular/material/card';
|
|
8
|
+
import { MatCardModule } from '@angular/material/card';
|
|
9
|
+
import { DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent } from '@dereekb/dbx-web/docs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Merges an ordered list of {@link DbxStyleDemoStyleTemplate} entries into a single {@link DbxStyleDemoStyleSet}.
|
|
13
|
+
*
|
|
14
|
+
* Style POJOs are merged with `{ ...acc, ...template.style }` so later templates override earlier ones on
|
|
15
|
+
* conflicting token keys; classes accumulate across all templates and are de-duplicated order-preserving via
|
|
16
|
+
* {@link cssClassesSet}.
|
|
17
|
+
*
|
|
18
|
+
* @param templates - The templates to merge, in precedence order (earliest first, latest wins).
|
|
19
|
+
* @returns The merged style set.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* mergeDbxStyleDemoStyleTemplates([
|
|
24
|
+
* { key: 'a', style: { '--mat-sys-primary': 'red' }, className: 'x' },
|
|
25
|
+
* { key: 'b', style: { '--mat-sys-primary': 'blue' }, className: ['x', 'y'] }
|
|
26
|
+
* ]);
|
|
27
|
+
* // -> { style: { '--mat-sys-primary': 'blue' }, classes: ['x', 'y'] }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function mergeDbxStyleDemoStyleTemplates(templates) {
|
|
31
|
+
let style = {};
|
|
32
|
+
const classInputs = [];
|
|
33
|
+
templates.forEach((template) => {
|
|
34
|
+
if (template.style) {
|
|
35
|
+
style = { ...style, ...template.style };
|
|
36
|
+
}
|
|
37
|
+
if (template.className != null) {
|
|
38
|
+
classInputs.push(...asArray(template.className));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return { style, classes: [...cssClassesSet(classInputs)] };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Type guard: true when the value is a {@link DbxStyleDemoStyleTemplate} object (not a bare template-key string).
|
|
45
|
+
*
|
|
46
|
+
* @param value - The value to test.
|
|
47
|
+
* @returns `true` when the value is an object carrying a string `key`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* isDbxStyleDemoStyleTemplate('corner-shape-large'); // false
|
|
52
|
+
* isDbxStyleDemoStyleTemplate({ key: 'corner-shape-large' }); // true
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
function isDbxStyleDemoStyleTemplate(value) {
|
|
56
|
+
return typeof value === 'object' && value !== null && typeof value.key === 'string';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Type guard: true when the directive input is a {@link DbxStyleDemoStyleLoaderConfig} (rather than a key / array of keys).
|
|
60
|
+
*
|
|
61
|
+
* @param value - The value to test.
|
|
62
|
+
* @returns `true` when the value is a non-array object carrying a `templates` property.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* isDbxStyleDemoStyleLoaderConfig('corner-shape-large'); // false
|
|
67
|
+
* isDbxStyleDemoStyleLoaderConfig(['a', 'b']); // false
|
|
68
|
+
* isDbxStyleDemoStyleLoaderConfig({ templates: ['a'] }); // true
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function isDbxStyleDemoStyleLoaderConfig(value) {
|
|
72
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && 'templates' in value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Configuration provided in the root environment for seeding {@link DbxStyleDemoStyleLoaderService} with initial templates.
|
|
77
|
+
*
|
|
78
|
+
* Registered via `provideDbxStyleDemo({ templates: [...] })`.
|
|
79
|
+
*/
|
|
80
|
+
class DbxStyleDemoStyleLoaderServiceConfig {
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Registry of named {@link DbxStyleDemoStyleTemplate} levers used by the style-demo playground.
|
|
84
|
+
*
|
|
85
|
+
* Mirrors the shape of `DbxColorService`: app-provided templates are seeded from an optional
|
|
86
|
+
* {@link DbxStyleDemoStyleLoaderServiceConfig}, then resolved by key at render time by the
|
|
87
|
+
* `[dbxStyleDemoStyleLoader]` directive. Ships with no built-in templates — every lever is contributed by an app.
|
|
88
|
+
*
|
|
89
|
+
* This service is demo/debug-only and disposable — it is not a dbx-web core runtime primitive.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const loader = inject(DbxStyleDemoStyleLoaderService);
|
|
94
|
+
* loader.register({ key: 'pink', style: { '--mat-sys-primary': '#ff0066' } });
|
|
95
|
+
* loader.mergeTemplates(['pink']);
|
|
96
|
+
* // -> { style: { '--mat-sys-primary': '#ff0066' }, classes: [] }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
class DbxStyleDemoStyleLoaderService {
|
|
100
|
+
_templates = new Map();
|
|
101
|
+
constructor() {
|
|
102
|
+
const initialConfig = inject(DbxStyleDemoStyleLoaderServiceConfig, { optional: true });
|
|
103
|
+
if (initialConfig?.templates) {
|
|
104
|
+
this.register(initialConfig.templates);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Registers one or more {@link DbxStyleDemoStyleTemplate} entries.
|
|
109
|
+
*
|
|
110
|
+
* @param templates - The template(s) to register.
|
|
111
|
+
* @param override - Whether existing entries with the same key should be replaced (default true)
|
|
112
|
+
*/
|
|
113
|
+
register(templates, override = true) {
|
|
114
|
+
useIterableOrValue(templates, (template) => {
|
|
115
|
+
if (override || !this._templates.has(template.key)) {
|
|
116
|
+
this._templates.set(template.key, template);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Returns whether a template with the given key has been registered.
|
|
122
|
+
*
|
|
123
|
+
* @param key - The template key to check.
|
|
124
|
+
* @returns True when a template is registered under the given key.
|
|
125
|
+
*/
|
|
126
|
+
hasTemplate(key) {
|
|
127
|
+
return this._templates.has(key);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the {@link DbxStyleDemoStyleTemplate} registered under the given key, or undefined if none.
|
|
131
|
+
*
|
|
132
|
+
* @param key - The template key to look up.
|
|
133
|
+
* @returns The registered template, or undefined when no template matches.
|
|
134
|
+
*/
|
|
135
|
+
getTemplate(key) {
|
|
136
|
+
return this._templates.get(key);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Returns all currently registered template keys, in registration order.
|
|
140
|
+
*
|
|
141
|
+
* @returns Array of all registered template keys.
|
|
142
|
+
*/
|
|
143
|
+
getAllRegisteredTemplateKeys() {
|
|
144
|
+
return [...this._templates.keys()];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns all registered templates flagged {@link DbxStyleDemoStyleTemplate.curated}, in registration order.
|
|
148
|
+
*
|
|
149
|
+
* @returns The curated templates in insertion order.
|
|
150
|
+
*/
|
|
151
|
+
getCuratedTemplates() {
|
|
152
|
+
return [...this._templates.values()].filter((template) => template.curated === true);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Resolves a mix of template keys and inline templates into a single merged {@link DbxStyleDemoStyleSet}.
|
|
156
|
+
*
|
|
157
|
+
* String keys are resolved through the registry; unknown keys are skipped. Inline template objects are
|
|
158
|
+
* used as-is. Resolution preserves input order so later entries win on conflicting style keys.
|
|
159
|
+
*
|
|
160
|
+
* @param keysOrTemplates - Template keys and/or inline templates to merge, in precedence order.
|
|
161
|
+
* @returns The merged style set.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* loader.register({ key: 'pink', style: { '--mat-sys-primary': '#ff0066' } });
|
|
166
|
+
* loader.mergeTemplates(['pink', 'unknown', { key: 'inline', className: 'demo' }]);
|
|
167
|
+
* // -> { style: { '--mat-sys-primary': '#ff0066' }, classes: ['demo'] }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
mergeTemplates(keysOrTemplates) {
|
|
171
|
+
const resolved = [];
|
|
172
|
+
asArray(keysOrTemplates).forEach((keyOrTemplate) => {
|
|
173
|
+
if (isDbxStyleDemoStyleTemplate(keyOrTemplate)) {
|
|
174
|
+
resolved.push(keyOrTemplate);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
const template = this._templates.get(keyOrTemplate);
|
|
178
|
+
if (template) {
|
|
179
|
+
resolved.push(template);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return mergeDbxStyleDemoStyleTemplates(resolved);
|
|
184
|
+
}
|
|
185
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoStyleLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
186
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoStyleLoaderService });
|
|
187
|
+
}
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoStyleLoaderService, decorators: [{
|
|
189
|
+
type: Injectable
|
|
190
|
+
}], ctorParameters: () => [] });
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Applies a merged bundle of style-demo template levers to its host element, repainting every dbx component
|
|
194
|
+
* beneath it via the CSS custom-property cascade.
|
|
195
|
+
*
|
|
196
|
+
* The input accepts either one or more registered template keys (`ArrayOrValue<DbxStyleDemoStyleTemplateKey>`) or a
|
|
197
|
+
* {@link DbxStyleDemoStyleLoaderConfig} carrying inline template objects. The {@link DbxStyleDemoStyleLoaderService} is
|
|
198
|
+
* optional-injected: when present, string keys are resolved through the registry (unknown keys skipped); when absent,
|
|
199
|
+
* only inline template objects are merged (string keys are unresolvable and skipped). Merged inline CSS-token overrides
|
|
200
|
+
* bind to the host `[style]` and merged debug classes bind to the host `[class]`.
|
|
201
|
+
*
|
|
202
|
+
* This directive is demo/debug-only and disposable — it is not a dbx-web core runtime primitive.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```html
|
|
206
|
+
* <div [dbxStyleDemoStyleLoader]="['corner-shape-large', 'surface-tint']">…</div>
|
|
207
|
+
* <div [dbxStyleDemoStyleLoader]="{ templates: [{ key: 'pink', style: { '--mat-sys-primary': '#ff0066' } }] }">…</div>
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
class DbxStyleDemoStyleLoaderDirective {
|
|
211
|
+
_loaderService = inject(DbxStyleDemoStyleLoaderService, { optional: true });
|
|
212
|
+
/**
|
|
213
|
+
* Template keys to resolve through the service, or a config object carrying inline templates.
|
|
214
|
+
*/
|
|
215
|
+
dbxStyleDemoStyleLoader = input(undefined, ...(ngDevMode ? [{ debugName: "dbxStyleDemoStyleLoader" }] : /* istanbul ignore next */ []));
|
|
216
|
+
_mergedSignal = computed(() => {
|
|
217
|
+
const input = this.dbxStyleDemoStyleLoader();
|
|
218
|
+
const keysOrTemplates = isDbxStyleDemoStyleLoaderConfig(input) ? input.templates : input;
|
|
219
|
+
const service = this._loaderService;
|
|
220
|
+
let result;
|
|
221
|
+
if (service) {
|
|
222
|
+
result = service.mergeTemplates(keysOrTemplates ?? []);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// No service: only inline template objects can be merged; string keys are unresolvable and skipped.
|
|
226
|
+
result = mergeDbxStyleDemoStyleTemplates(asArray(keysOrTemplates).filter(isDbxStyleDemoStyleTemplate));
|
|
227
|
+
}
|
|
228
|
+
return result;
|
|
229
|
+
}, ...(ngDevMode ? [{ debugName: "_mergedSignal" }] : /* istanbul ignore next */ []));
|
|
230
|
+
styleSignal = computed(() => {
|
|
231
|
+
const { style } = this._mergedSignal();
|
|
232
|
+
return Object.keys(style).length > 0 ? style : null;
|
|
233
|
+
}, ...(ngDevMode ? [{ debugName: "styleSignal" }] : /* istanbul ignore next */ []));
|
|
234
|
+
classesSignal = computed(() => spaceSeparatedCssClasses(this._mergedSignal().classes), ...(ngDevMode ? [{ debugName: "classesSignal" }] : /* istanbul ignore next */ []));
|
|
235
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoStyleLoaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
236
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.11", type: DbxStyleDemoStyleLoaderDirective, isStandalone: true, selector: "[dbxStyleDemoStyleLoader]", inputs: { dbxStyleDemoStyleLoader: { classPropertyName: "dbxStyleDemoStyleLoader", publicName: "dbxStyleDemoStyleLoader", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classesSignal()", "style": "styleSignal()" } }, ngImport: i0 });
|
|
237
|
+
}
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoStyleLoaderDirective, decorators: [{
|
|
239
|
+
type: Directive,
|
|
240
|
+
args: [{
|
|
241
|
+
selector: '[dbxStyleDemoStyleLoader]',
|
|
242
|
+
host: {
|
|
243
|
+
'[class]': 'classesSignal()',
|
|
244
|
+
'[style]': 'styleSignal()'
|
|
245
|
+
},
|
|
246
|
+
standalone: true
|
|
247
|
+
}]
|
|
248
|
+
}], propDecorators: { dbxStyleDemoStyleLoader: [{ type: i0.Input, args: [{ isSignal: true, alias: "dbxStyleDemoStyleLoader", required: false }] }] } });
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Multi-provider injection token collecting every {@link DbxStyleDemoSectionGroup} contributed by an app's libraries.
|
|
252
|
+
*
|
|
253
|
+
* Injected by {@link DbxStyleDemoSectionRegistry} (as an array) to assemble the full set of showcase sections.
|
|
254
|
+
*/
|
|
255
|
+
const DBX_STYLE_DEMO_SECTION_GROUP = new InjectionToken('DbxStyleDemoSectionGroup');
|
|
256
|
+
/**
|
|
257
|
+
* Registers a library's {@link DbxStyleDemoSectionGroup} with the style-demo playground.
|
|
258
|
+
*
|
|
259
|
+
* Each call contributes one group via the {@link DBX_STYLE_DEMO_SECTION_GROUP} multi-provider, so several libraries
|
|
260
|
+
* (e.g. `provideDbxWebStyleDemo()`, `provideDbxFormStyleDemo()`) can each add their own sections.
|
|
261
|
+
*
|
|
262
|
+
* @param group - The section group to register.
|
|
263
|
+
* @returns EnvironmentProviders contributing the group.
|
|
264
|
+
*
|
|
265
|
+
* @__NO_SIDE_EFFECTS__
|
|
266
|
+
*/
|
|
267
|
+
function provideDbxStyleDemoSections(group) {
|
|
268
|
+
return makeEnvironmentProviders([
|
|
269
|
+
{
|
|
270
|
+
provide: DBX_STYLE_DEMO_SECTION_GROUP,
|
|
271
|
+
useValue: group,
|
|
272
|
+
multi: true
|
|
273
|
+
}
|
|
274
|
+
]);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Root service that flattens every {@link DbxStyleDemoSectionGroup} registered via {@link provideDbxStyleDemoSections}
|
|
279
|
+
* into a single ordered list of {@link DbxStyleDemoSection} entries.
|
|
280
|
+
*
|
|
281
|
+
* Consumed by the `<dbx-style-demo>` playground to determine which sections are available to render.
|
|
282
|
+
*/
|
|
283
|
+
class DbxStyleDemoSectionRegistry {
|
|
284
|
+
/**
|
|
285
|
+
* All registered sections, in library-registration then section-declaration order.
|
|
286
|
+
*/
|
|
287
|
+
sectionsSignal;
|
|
288
|
+
constructor() {
|
|
289
|
+
const groups = inject(DBX_STYLE_DEMO_SECTION_GROUP, { optional: true }) ?? [];
|
|
290
|
+
this.sectionsSignal = signal(groups.flatMap((group) => group.sections), ...(ngDevMode ? [{ debugName: "sectionsSignal" }] : /* istanbul ignore next */ []));
|
|
291
|
+
}
|
|
292
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoSectionRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
293
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoSectionRegistry, providedIn: 'root' });
|
|
294
|
+
}
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoSectionRegistry, decorators: [{
|
|
296
|
+
type: Injectable,
|
|
297
|
+
args: [{ providedIn: 'root' }]
|
|
298
|
+
}], ctorParameters: () => [] });
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Clusters template toggles by their {@link DbxStyleDemoTemplateToggle.group} label for grouped rendering.
|
|
302
|
+
*
|
|
303
|
+
* The ungrouped cluster (`label: null`) is emitted first when any ungrouped toggle exists, followed by each named
|
|
304
|
+
* group in first-seen order. Toggle order within a cluster is preserved.
|
|
305
|
+
*
|
|
306
|
+
* @param toggles - The toggles to cluster.
|
|
307
|
+
* @returns The clusters in render order.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* groupDbxStyleDemoTemplateToggles([
|
|
312
|
+
* { templateName: 'a', label: 'A' },
|
|
313
|
+
* { templateName: 'b', label: 'B', group: 'Shape' },
|
|
314
|
+
* { templateName: 'c', label: 'C', group: 'Shape' }
|
|
315
|
+
* ]);
|
|
316
|
+
* // -> [{ label: null, toggles: [A] }, { label: 'Shape', toggles: [B, C] }]
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
function groupDbxStyleDemoTemplateToggles(toggles) {
|
|
320
|
+
const groupMap = makeValuesGroupMap(toggles, (toggle) => toggle.group ?? null);
|
|
321
|
+
const result = [];
|
|
322
|
+
const ungrouped = groupMap.get(null);
|
|
323
|
+
if (ungrouped != null) {
|
|
324
|
+
result.push({ label: null, toggles: ungrouped });
|
|
325
|
+
}
|
|
326
|
+
groupMap.forEach((groupToggles, label) => {
|
|
327
|
+
if (label != null) {
|
|
328
|
+
result.push({ label, toggles: groupToggles });
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Multi-provider injection token collecting every {@link DbxStyleDemoTemplateToggle} contributed by an app's libraries.
|
|
336
|
+
*
|
|
337
|
+
* Injected by the `<dbx-style-demo>` playground (as an array) to populate the template-lever list in the controls UI.
|
|
338
|
+
*/
|
|
339
|
+
const DBX_STYLE_DEMO_TEMPLATE_TOGGLE = new InjectionToken('DbxStyleDemoTemplateToggle');
|
|
340
|
+
/**
|
|
341
|
+
* Registers one or more {@link DbxStyleDemoTemplateToggle} levers with the style-demo playground.
|
|
342
|
+
*
|
|
343
|
+
* Each toggle is contributed via the {@link DBX_STYLE_DEMO_TEMPLATE_TOGGLE} multi-provider, so several libraries can
|
|
344
|
+
* each add their own levers.
|
|
345
|
+
*
|
|
346
|
+
* @param toggles - The template toggles to register.
|
|
347
|
+
* @returns EnvironmentProviders contributing the toggles.
|
|
348
|
+
*
|
|
349
|
+
* @__NO_SIDE_EFFECTS__
|
|
350
|
+
*/
|
|
351
|
+
function provideDbxStyleDemoTemplateToggles(...toggles) {
|
|
352
|
+
const providers = toggles.map((toggle) => ({
|
|
353
|
+
provide: DBX_STYLE_DEMO_TEMPLATE_TOGGLE,
|
|
354
|
+
useValue: toggle,
|
|
355
|
+
multi: true
|
|
356
|
+
}));
|
|
357
|
+
return makeEnvironmentProviders(providers);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Detach key used by the style-demo controls detach panel.
|
|
362
|
+
*/
|
|
363
|
+
const DBX_STYLE_DEMO_CONTROLS_DETACH_KEY = 'dbx-style-demo-controls';
|
|
364
|
+
/**
|
|
365
|
+
* Injection token carrying the component class rendered inside the style-demo controls detach panel.
|
|
366
|
+
*
|
|
367
|
+
* `DbxStyleDemoControlsService` opens this component via `DbxDetachService` (so it survives navigation and is available
|
|
368
|
+
* app-wide) reading the service's {@link DbxStyleDemoControls} state. When unregistered, the controls buttons are hidden.
|
|
369
|
+
*
|
|
370
|
+
* `@dereekb/dbx-form/style-demo` registers `DbxFormStyleDemoControlsDetachComponent` (a presets chip-field controls UI)
|
|
371
|
+
* here — the controls UI lives in dbx-form because it depends on `@dereekb/dbx-form`'s pickable chip field, which dbx-web
|
|
372
|
+
* cannot import.
|
|
373
|
+
*/
|
|
374
|
+
const DBX_STYLE_DEMO_CONTROLS_COMPONENT = new InjectionToken('DbxStyleDemoControlsComponent');
|
|
375
|
+
/**
|
|
376
|
+
* Popover key used by the style-demo sections popover, opened from the playground header.
|
|
377
|
+
*/
|
|
378
|
+
const DBX_STYLE_DEMO_SECTIONS_POPOVER_KEY = 'dbx-style-demo-sections';
|
|
379
|
+
/**
|
|
380
|
+
* Injection token carrying the component class rendered inside the style-demo sections popover.
|
|
381
|
+
*
|
|
382
|
+
* `DbxStyleDemoControlsService` opens this component via `DbxPopoverService`, anchored to the playground header's
|
|
383
|
+
* "Sections" button, because sections only affect the `<dbx-style-demo>` playground page (unlike presets, which restyle
|
|
384
|
+
* the whole app). When unregistered, the playground's "Sections" button is hidden.
|
|
385
|
+
*
|
|
386
|
+
* `@dereekb/dbx-form/style-demo` registers `DbxFormStyleDemoSectionsPopoverComponent` (a sections chip-field controls
|
|
387
|
+
* UI) here — the controls UI lives in dbx-form because it depends on `@dereekb/dbx-form`'s pickable chip field, which
|
|
388
|
+
* dbx-web cannot import.
|
|
389
|
+
*/
|
|
390
|
+
const DBX_STYLE_DEMO_SECTIONS_COMPONENT = new InjectionToken('DbxStyleDemoSectionsComponent');
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Configuration for the {@link DbxStyleDemoControlsService}, provided in the root environment via `provideDbxStyleDemo()`.
|
|
394
|
+
*/
|
|
395
|
+
class DbxStyleDemoControlsServiceConfig {
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Root-level state holder for the `<dbx-style-demo>` controls, implementing {@link DbxStyleDemoControls}.
|
|
399
|
+
*
|
|
400
|
+
* Owning the enabled-sections / active-template state here (rather than in the playground component) lets the controls
|
|
401
|
+
* panel open through {@link DbxDetachService} so it survives navigation and is available app-wide. When a
|
|
402
|
+
* {@link DbxStyleService} is available (and {@link DbxStyleDemoControlsServiceConfig.applyStylesToApp} is not false), the
|
|
403
|
+
* active levers are forwarded into the style service as a body supplement so they repaint the entire app.
|
|
404
|
+
*
|
|
405
|
+
* This service is demo/debug-only and disposable — it is not a dbx-web core runtime primitive.
|
|
406
|
+
*/
|
|
407
|
+
class DbxStyleDemoControlsService {
|
|
408
|
+
_registry = inject(DbxStyleDemoSectionRegistry);
|
|
409
|
+
_toggles = inject(DBX_STYLE_DEMO_TEMPLATE_TOGGLE, { optional: true }) ?? [];
|
|
410
|
+
_loaderService = inject(DbxStyleDemoStyleLoaderService);
|
|
411
|
+
_detachService = inject(DbxDetachService);
|
|
412
|
+
_popoverService = inject(DbxPopoverService, { optional: true });
|
|
413
|
+
_controlsComponentClass = inject(DBX_STYLE_DEMO_CONTROLS_COMPONENT, { optional: true });
|
|
414
|
+
_sectionsComponentClass = inject(DBX_STYLE_DEMO_SECTIONS_COMPONENT, { optional: true });
|
|
415
|
+
_styleService = inject(DbxStyleService, { optional: true });
|
|
416
|
+
_config = inject(DbxStyleDemoControlsServiceConfig, { optional: true });
|
|
417
|
+
_sectionEnabledOverrides = signal(new Map(), ...(ngDevMode ? [{ debugName: "_sectionEnabledOverrides" }] : /* istanbul ignore next */ []));
|
|
418
|
+
_activeTemplateKeysOverride = signal(undefined, ...(ngDevMode ? [{ debugName: "_activeTemplateKeysOverride" }] : /* istanbul ignore next */ []));
|
|
419
|
+
_defaultActiveTemplateKeys = signal([], ...(ngDevMode ? [{ debugName: "_defaultActiveTemplateKeys" }] : /* istanbul ignore next */ []));
|
|
420
|
+
/**
|
|
421
|
+
* True when a controls component is registered, gating the controls buttons.
|
|
422
|
+
*/
|
|
423
|
+
hasControlsSignal = signal(this._controlsComponentClass != null, ...(ngDevMode ? [{ debugName: "hasControlsSignal" }] : /* istanbul ignore next */ []));
|
|
424
|
+
/**
|
|
425
|
+
* True when a sections component is registered (and a popover service is available), gating the playground's
|
|
426
|
+
* "Sections" button.
|
|
427
|
+
*/
|
|
428
|
+
hasSectionsSignal = signal(this._sectionsComponentClass != null && this._popoverService != null, ...(ngDevMode ? [{ debugName: "hasSectionsSignal" }] : /* istanbul ignore next */ []));
|
|
429
|
+
/**
|
|
430
|
+
* All registered sections, unfiltered (the global controls list every section).
|
|
431
|
+
*/
|
|
432
|
+
sectionsSignal = this._registry.sectionsSignal;
|
|
433
|
+
templateTogglesSignal = signal(this._toggles, ...(ngDevMode ? [{ debugName: "templateTogglesSignal" }] : /* istanbul ignore next */ []));
|
|
434
|
+
enabledIdsSignal = computed(() => {
|
|
435
|
+
const overrides = this._sectionEnabledOverrides();
|
|
436
|
+
return new Set(this.sectionsSignal()
|
|
437
|
+
.filter((section) => overrides.get(section.id) ?? section.defaultEnabled !== false)
|
|
438
|
+
.map((section) => section.id));
|
|
439
|
+
}, ...(ngDevMode ? [{ debugName: "enabledIdsSignal" }] : /* istanbul ignore next */ []));
|
|
440
|
+
activeTemplateKeysSignal = computed(() => {
|
|
441
|
+
const _defaultActiveTemplateKeys = this._defaultActiveTemplateKeys();
|
|
442
|
+
const override = this._activeTemplateKeysOverride();
|
|
443
|
+
return override ?? new Set(_defaultActiveTemplateKeys);
|
|
444
|
+
}, ...(ngDevMode ? [{ debugName: "activeTemplateKeysSignal" }] : /* istanbul ignore next */ []));
|
|
445
|
+
activeTemplateKeysArraySignal = computed(() => [...this.activeTemplateKeysSignal()], ...(ngDevMode ? [{ debugName: "activeTemplateKeysArraySignal" }] : /* istanbul ignore next */ []));
|
|
446
|
+
constructor() {
|
|
447
|
+
const styleService = this._styleService;
|
|
448
|
+
if (styleService != null && this._config?.applyStylesToApp !== false) {
|
|
449
|
+
const supplementSignal = computed(() => {
|
|
450
|
+
const { style, classes } = this._loaderService.mergeTemplates([...this.activeTemplateKeysSignal()]);
|
|
451
|
+
return { style, classes };
|
|
452
|
+
}, ...(ngDevMode ? [{ debugName: "supplementSignal" }] : /* istanbul ignore next */ []));
|
|
453
|
+
styleService.setSupplement(toObservable(supplementSignal));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
setSectionEnabled(id, enabled) {
|
|
457
|
+
const next = new Map(this._sectionEnabledOverrides());
|
|
458
|
+
next.set(id, enabled);
|
|
459
|
+
this._sectionEnabledOverrides.set(next);
|
|
460
|
+
}
|
|
461
|
+
setTemplateActive(key, active) {
|
|
462
|
+
const next = new Set(this.activeTemplateKeysSignal());
|
|
463
|
+
if (active) {
|
|
464
|
+
// Levers sharing a non-null group are mutually exclusive (radio-like): deactivate the others before activating this one.
|
|
465
|
+
const group = this._toggles.find((toggle) => toggle.templateName === key)?.group;
|
|
466
|
+
if (group != null) {
|
|
467
|
+
this._toggles.forEach((toggle) => {
|
|
468
|
+
if (toggle.group === group && toggle.templateName !== key) {
|
|
469
|
+
next.delete(toggle.templateName);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
next.add(key);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
next.delete(key);
|
|
477
|
+
}
|
|
478
|
+
this._activeTemplateKeysOverride.set(next);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Seeds the default active template keys. Has no effect once the user has set an override via {@link setTemplateActive}.
|
|
482
|
+
*
|
|
483
|
+
* @param keys - The template keys to activate by default.
|
|
484
|
+
*/
|
|
485
|
+
setDefaultActiveTemplates(keys) {
|
|
486
|
+
this._defaultActiveTemplateKeys.set(keys);
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Opens the registered controls component in a draggable detached overlay. No-op when no controls component is registered.
|
|
490
|
+
*/
|
|
491
|
+
openControls() {
|
|
492
|
+
const componentClass = this._controlsComponentClass;
|
|
493
|
+
if (componentClass != null) {
|
|
494
|
+
this._detachService
|
|
495
|
+
.init({
|
|
496
|
+
key: DBX_STYLE_DEMO_CONTROLS_DETACH_KEY,
|
|
497
|
+
componentClass,
|
|
498
|
+
overlay: { width: '420px', height: '560px', isDraggable: true }
|
|
499
|
+
})
|
|
500
|
+
.detach();
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Opens the registered sections component in a popover anchored to the given origin. No-op when no sections component
|
|
505
|
+
* is registered (or no popover service is available). Symmetric with {@link openControls}.
|
|
506
|
+
*
|
|
507
|
+
* @param config - The popover configuration.
|
|
508
|
+
* @param config.origin - The element the popover anchors to (the playground header's "Sections" button).
|
|
509
|
+
*/
|
|
510
|
+
openSectionsPopover(config) {
|
|
511
|
+
const componentClass = this._sectionsComponentClass;
|
|
512
|
+
const popoverService = this._popoverService;
|
|
513
|
+
if (componentClass != null && popoverService != null) {
|
|
514
|
+
popoverService.open({
|
|
515
|
+
key: DBX_STYLE_DEMO_SECTIONS_POPOVER_KEY,
|
|
516
|
+
origin: config.origin,
|
|
517
|
+
componentClass
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoControlsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
522
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoControlsService });
|
|
523
|
+
}
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoControlsService, decorators: [{
|
|
525
|
+
type: Injectable
|
|
526
|
+
}], ctorParameters: () => [] });
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Drop-in styling showcase for dbx-components apps.
|
|
530
|
+
*
|
|
531
|
+
* Renders the registered {@link DbxStyleDemoSection} components beneath a `[dbxStyleDemoStyleLoader]` host so they
|
|
532
|
+
* paint purely through the host app's `--mat-sys-*` / `--dbx-*` tokens and `.dbx-*` utilities — the playground emits
|
|
533
|
+
* no theme of its own. The "Style controls" button opens the shared {@link DbxStyleDemoControlsService} detach panel
|
|
534
|
+
* (also reachable from the app toolbar); flipping a lever re-points CSS tokens that ripple through every rendered
|
|
535
|
+
* section live via the custom-property cascade. The button only appears when a controls component is registered.
|
|
536
|
+
*
|
|
537
|
+
* Section enablement and active levers are held globally in {@link DbxStyleDemoControlsService}; this playground only
|
|
538
|
+
* adds its own tag filtering on top of the global enabled state.
|
|
539
|
+
*
|
|
540
|
+
* This component is demo/debug-only and disposable — it is not a dbx-web core runtime primitive.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```html
|
|
544
|
+
* <dbx-style-demo [config]="{ defaultActiveTemplates: ['corner-shape-full'] }"></dbx-style-demo>
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
class DbxStyleDemoComponent {
|
|
548
|
+
_registry = inject(DbxStyleDemoSectionRegistry);
|
|
549
|
+
_controlsService = inject(DbxStyleDemoControlsService);
|
|
550
|
+
/**
|
|
551
|
+
* Playground configuration.
|
|
552
|
+
*/
|
|
553
|
+
config = input(undefined, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
554
|
+
/**
|
|
555
|
+
* True when a controls component is registered, gating the "Style controls" button.
|
|
556
|
+
*/
|
|
557
|
+
hasControlsSignal = this._controlsService.hasControlsSignal;
|
|
558
|
+
/**
|
|
559
|
+
* True when a sections component is registered, gating the "Sections" button (which opens the sections popover).
|
|
560
|
+
*/
|
|
561
|
+
hasSectionsSignal = this._controlsService.hasSectionsSignal;
|
|
562
|
+
/**
|
|
563
|
+
* The "Sections" button element, used as the sections popover's anchor origin (present only while the button renders).
|
|
564
|
+
*/
|
|
565
|
+
sectionsButton = viewChild('sectionsButton', { ...(ngDevMode ? { debugName: "sectionsButton" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
566
|
+
/**
|
|
567
|
+
* The active template keys held by the controls service, applied to this playground's style-loader host.
|
|
568
|
+
*/
|
|
569
|
+
activeTemplatesSignal = this._controlsService.activeTemplateKeysArraySignal;
|
|
570
|
+
/**
|
|
571
|
+
* The registry sections this playground instance considers, filtered by its configured tags (enablement stays global).
|
|
572
|
+
*/
|
|
573
|
+
sectionsSignal = computed(() => {
|
|
574
|
+
const tags = this.config()?.tags;
|
|
575
|
+
const sections = this._registry.sectionsSignal();
|
|
576
|
+
let result;
|
|
577
|
+
if (tags && tags.length > 0) {
|
|
578
|
+
const tagSet = new Set(tags);
|
|
579
|
+
result = sections.filter((section) => (section.tags ?? []).some((tag) => tagSet.has(tag)));
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
result = sections;
|
|
583
|
+
}
|
|
584
|
+
return result;
|
|
585
|
+
}, ...(ngDevMode ? [{ debugName: "sectionsSignal" }] : /* istanbul ignore next */ []));
|
|
586
|
+
visibleSectionsSignal = computed(() => {
|
|
587
|
+
const enabledIds = this._controlsService.enabledIdsSignal();
|
|
588
|
+
return this.sectionsSignal().filter((section) => enabledIds.has(section.id));
|
|
589
|
+
}, ...(ngDevMode ? [{ debugName: "visibleSectionsSignal" }] : /* istanbul ignore next */ []));
|
|
590
|
+
/**
|
|
591
|
+
* Seeds the controls service with this playground's configured default active templates.
|
|
592
|
+
*/
|
|
593
|
+
_seedDefaultTemplatesEffect = effect(() => {
|
|
594
|
+
const defaults = this.config()?.defaultActiveTemplates;
|
|
595
|
+
this._controlsService.setDefaultActiveTemplates(defaults ?? []);
|
|
596
|
+
}, ...(ngDevMode ? [{ debugName: "_seedDefaultTemplatesEffect" }] : /* istanbul ignore next */ []));
|
|
597
|
+
openControls() {
|
|
598
|
+
this._controlsService.openControls();
|
|
599
|
+
}
|
|
600
|
+
openSectionsPopover() {
|
|
601
|
+
const origin = this.sectionsButton();
|
|
602
|
+
if (origin != null) {
|
|
603
|
+
this._controlsService.openSectionsPopover({ origin });
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoComponent, isStandalone: true, selector: "dbx-style-demo", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "sectionsButton", first: true, predicate: ["sectionsButton"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
|
|
608
|
+
<div class="dbx-style-demo dbx-flex-column dbx-p3">
|
|
609
|
+
<div class="dbx-flex-bar dbx-pb3">
|
|
610
|
+
<span class="dbx-text-title-large">Style Demo</span>
|
|
611
|
+
<span class="dbx-flex-fill"></span>
|
|
612
|
+
@if (hasSectionsSignal()) {
|
|
613
|
+
<dbx-button class="dbx-button-spacer" #sectionsButton stroked icon="tune" text="Sections" (buttonClick)="openSectionsPopover()"></dbx-button>
|
|
614
|
+
}
|
|
615
|
+
@if (hasControlsSignal()) {
|
|
616
|
+
<dbx-button stroked icon="palette" text="Style controls" (buttonClick)="openControls()"></dbx-button>
|
|
617
|
+
}
|
|
618
|
+
</div>
|
|
619
|
+
<div [dbxStyleDemoStyleLoader]="activeTemplatesSignal()">
|
|
620
|
+
<div dbxFlexGroup>
|
|
621
|
+
@for (section of visibleSectionsSignal(); track section.id) {
|
|
622
|
+
<div [dbxFlexSize]="3">
|
|
623
|
+
<mat-card appearance="outlined" class="dbx-mb3">
|
|
624
|
+
<mat-card-content class="dbx-p3">
|
|
625
|
+
<ng-container *ngComponentOutlet="section.component"></ng-container>
|
|
626
|
+
</mat-card-content>
|
|
627
|
+
</mat-card>
|
|
628
|
+
</div>
|
|
629
|
+
} @empty {
|
|
630
|
+
<p class="dbx-hint">No sections enabled.</p>
|
|
631
|
+
}
|
|
632
|
+
</div>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "directive", type: DbxFlexGroupDirective, selector: "[dbxFlexGroup]", inputs: ["content", "breakToColumn", "relative", "breakpoint"] }, { kind: "directive", type: DbxFlexSizeDirective, selector: "[dbxFlexSize]", inputs: ["dbxFlexSize"] }, { kind: "directive", type: DbxStyleDemoStyleLoaderDirective, selector: "[dbxStyleDemoStyleLoader]", inputs: ["dbxStyleDemoStyleLoader"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
636
|
+
}
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoComponent, decorators: [{
|
|
638
|
+
type: Component,
|
|
639
|
+
args: [{
|
|
640
|
+
selector: 'dbx-style-demo',
|
|
641
|
+
template: `
|
|
642
|
+
<div class="dbx-style-demo dbx-flex-column dbx-p3">
|
|
643
|
+
<div class="dbx-flex-bar dbx-pb3">
|
|
644
|
+
<span class="dbx-text-title-large">Style Demo</span>
|
|
645
|
+
<span class="dbx-flex-fill"></span>
|
|
646
|
+
@if (hasSectionsSignal()) {
|
|
647
|
+
<dbx-button class="dbx-button-spacer" #sectionsButton stroked icon="tune" text="Sections" (buttonClick)="openSectionsPopover()"></dbx-button>
|
|
648
|
+
}
|
|
649
|
+
@if (hasControlsSignal()) {
|
|
650
|
+
<dbx-button stroked icon="palette" text="Style controls" (buttonClick)="openControls()"></dbx-button>
|
|
651
|
+
}
|
|
652
|
+
</div>
|
|
653
|
+
<div [dbxStyleDemoStyleLoader]="activeTemplatesSignal()">
|
|
654
|
+
<div dbxFlexGroup>
|
|
655
|
+
@for (section of visibleSectionsSignal(); track section.id) {
|
|
656
|
+
<div [dbxFlexSize]="3">
|
|
657
|
+
<mat-card appearance="outlined" class="dbx-mb3">
|
|
658
|
+
<mat-card-content class="dbx-p3">
|
|
659
|
+
<ng-container *ngComponentOutlet="section.component"></ng-container>
|
|
660
|
+
</mat-card-content>
|
|
661
|
+
</mat-card>
|
|
662
|
+
</div>
|
|
663
|
+
} @empty {
|
|
664
|
+
<p class="dbx-hint">No sections enabled.</p>
|
|
665
|
+
}
|
|
666
|
+
</div>
|
|
667
|
+
</div>
|
|
668
|
+
</div>
|
|
669
|
+
`,
|
|
670
|
+
standalone: true,
|
|
671
|
+
imports: [NgComponentOutlet, MatCardModule, DbxButtonComponent, DbxFlexGroupDirective, DbxFlexSizeDirective, DbxStyleDemoStyleLoaderDirective],
|
|
672
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
673
|
+
}]
|
|
674
|
+
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], sectionsButton: [{ type: i0.ViewChild, args: ['sectionsButton', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Style-demo section showing every `dbx-button` appearance (basic, stroked, flat, raised, tonal) across the core
|
|
678
|
+
* theme colors, plus an icon-only and a FAB button. Buttons paint their container colour and corner radius from the
|
|
679
|
+
* `--mat-button-*` tokens, so they respond live to the playground's Shape levers and flip with light/dark.
|
|
680
|
+
*
|
|
681
|
+
* @dbxDocsUiExample
|
|
682
|
+
* @dbxDocsUiExampleSlug style-demo-buttons
|
|
683
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
684
|
+
* @dbxDocsUiExampleSummary dbx-button appearances across theme colors, plus icon-only and FAB modes.
|
|
685
|
+
* @dbxDocsUiExampleRelated button, icon-button
|
|
686
|
+
*/
|
|
687
|
+
class DbxStyleDemoButtonsSectionComponent {
|
|
688
|
+
variants = ['basic', 'stroked', 'flat', 'raised', 'tonal'];
|
|
689
|
+
colors = [undefined, 'primary', 'accent', 'warn', 'success'];
|
|
690
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoButtonsSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
691
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoButtonsSectionComponent, isStandalone: true, selector: "dbx-style-demo-buttons-section", ngImport: i0, template: `
|
|
692
|
+
<dbx-docs-ui-example header="Buttons" hint="dbx-button appearances across theme colors.">
|
|
693
|
+
<dbx-docs-ui-example-info>
|
|
694
|
+
<p>
|
|
695
|
+
Each row is one Material button appearance —
|
|
696
|
+
<code>basic</code>
|
|
697
|
+
,
|
|
698
|
+
<code>stroked</code>
|
|
699
|
+
,
|
|
700
|
+
<code>flat</code>
|
|
701
|
+
,
|
|
702
|
+
<code>raised</code>
|
|
703
|
+
,
|
|
704
|
+
<code>tonal</code>
|
|
705
|
+
— rendered across the core theme colors. Buttons draw their container colour and corner radius from the
|
|
706
|
+
<code>--mat-button-*</code>
|
|
707
|
+
tokens, so they respond live to the Shape levers and flip with light/dark.
|
|
708
|
+
</p>
|
|
709
|
+
</dbx-docs-ui-example-info>
|
|
710
|
+
<dbx-docs-ui-example-content>
|
|
711
|
+
<div class="dbx-flex-column">
|
|
712
|
+
@for (variant of variants; track variant) {
|
|
713
|
+
<div class="dbx-pb2">
|
|
714
|
+
<div class="dbx-text-label-small dbx-hint dbx-pb1">{{ variant }}</div>
|
|
715
|
+
<div class="dbx-flex">
|
|
716
|
+
@for (color of colors; track color; let last = $last) {
|
|
717
|
+
<dbx-button [basic]="variant === 'basic'" [stroked]="variant === 'stroked'" [flat]="variant === 'flat'" [raised]="variant === 'raised'" [tonal]="variant === 'tonal'" [color]="color" [text]="color ?? 'default'"></dbx-button>
|
|
718
|
+
@if (!last) {
|
|
719
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
}
|
|
725
|
+
<div class="dbx-flex">
|
|
726
|
+
<dbx-button iconOnly icon="palette"></dbx-button>
|
|
727
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
728
|
+
<dbx-button fab icon="add"></dbx-button>
|
|
729
|
+
</div>
|
|
730
|
+
</div>
|
|
731
|
+
</dbx-docs-ui-example-content>
|
|
732
|
+
</dbx-docs-ui-example>
|
|
733
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "directive", type: DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
734
|
+
}
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoButtonsSectionComponent, decorators: [{
|
|
736
|
+
type: Component,
|
|
737
|
+
args: [{
|
|
738
|
+
selector: 'dbx-style-demo-buttons-section',
|
|
739
|
+
standalone: true,
|
|
740
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
741
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, DbxButtonComponent, DbxButtonSpacerDirective],
|
|
742
|
+
template: `
|
|
743
|
+
<dbx-docs-ui-example header="Buttons" hint="dbx-button appearances across theme colors.">
|
|
744
|
+
<dbx-docs-ui-example-info>
|
|
745
|
+
<p>
|
|
746
|
+
Each row is one Material button appearance —
|
|
747
|
+
<code>basic</code>
|
|
748
|
+
,
|
|
749
|
+
<code>stroked</code>
|
|
750
|
+
,
|
|
751
|
+
<code>flat</code>
|
|
752
|
+
,
|
|
753
|
+
<code>raised</code>
|
|
754
|
+
,
|
|
755
|
+
<code>tonal</code>
|
|
756
|
+
— rendered across the core theme colors. Buttons draw their container colour and corner radius from the
|
|
757
|
+
<code>--mat-button-*</code>
|
|
758
|
+
tokens, so they respond live to the Shape levers and flip with light/dark.
|
|
759
|
+
</p>
|
|
760
|
+
</dbx-docs-ui-example-info>
|
|
761
|
+
<dbx-docs-ui-example-content>
|
|
762
|
+
<div class="dbx-flex-column">
|
|
763
|
+
@for (variant of variants; track variant) {
|
|
764
|
+
<div class="dbx-pb2">
|
|
765
|
+
<div class="dbx-text-label-small dbx-hint dbx-pb1">{{ variant }}</div>
|
|
766
|
+
<div class="dbx-flex">
|
|
767
|
+
@for (color of colors; track color; let last = $last) {
|
|
768
|
+
<dbx-button [basic]="variant === 'basic'" [stroked]="variant === 'stroked'" [flat]="variant === 'flat'" [raised]="variant === 'raised'" [tonal]="variant === 'tonal'" [color]="color" [text]="color ?? 'default'"></dbx-button>
|
|
769
|
+
@if (!last) {
|
|
770
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
</div>
|
|
774
|
+
</div>
|
|
775
|
+
}
|
|
776
|
+
<div class="dbx-flex">
|
|
777
|
+
<dbx-button iconOnly icon="palette"></dbx-button>
|
|
778
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
779
|
+
<dbx-button fab icon="add"></dbx-button>
|
|
780
|
+
</div>
|
|
781
|
+
</div>
|
|
782
|
+
</dbx-docs-ui-example-content>
|
|
783
|
+
</dbx-docs-ui-example>
|
|
784
|
+
`
|
|
785
|
+
}]
|
|
786
|
+
}] });
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Style-demo section showing the three Material 3 card appearances (outlined, raised, filled) painted purely
|
|
790
|
+
* from `--mat-sys-*` surface tokens, so they respond live to the playground's surface-tint and corner-shape levers.
|
|
791
|
+
*
|
|
792
|
+
* @dbxDocsUiExample
|
|
793
|
+
* @dbxDocsUiExampleSlug style-demo-cards
|
|
794
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
795
|
+
* @dbxDocsUiExampleSummary Material 3 card appearances (outlined, elevated, filled) painted from system surface tokens.
|
|
796
|
+
* @dbxDocsUiExampleRelated mat-card, dbx-card-box
|
|
797
|
+
*/
|
|
798
|
+
class DbxStyleDemoCardsSectionComponent {
|
|
799
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoCardsSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
800
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DbxStyleDemoCardsSectionComponent, isStandalone: true, selector: "dbx-style-demo-cards-section", ngImport: i0, template: `
|
|
801
|
+
<dbx-docs-ui-example header="Cards" hint="Material 3 card appearances painted from system surface tokens.">
|
|
802
|
+
<dbx-docs-ui-example-info>
|
|
803
|
+
<p>
|
|
804
|
+
The three M3 card appearances —
|
|
805
|
+
<code>outlined</code>
|
|
806
|
+
,
|
|
807
|
+
<code>raised</code>
|
|
808
|
+
, and
|
|
809
|
+
<code>filled</code>
|
|
810
|
+
— draw their container colour and shape from
|
|
811
|
+
<code>--mat-sys-surface*</code>
|
|
812
|
+
and the
|
|
813
|
+
<code>--mat-card-*-container-shape</code>
|
|
814
|
+
tokens. No hard-coded colours or radii, so they flip with light/dark and respond live to the surface-tint and corner-shape levers.
|
|
815
|
+
</p>
|
|
816
|
+
</dbx-docs-ui-example-info>
|
|
817
|
+
<dbx-docs-ui-example-content>
|
|
818
|
+
<div dbxFlexGroup>
|
|
819
|
+
<div [dbxFlexSize]="2">
|
|
820
|
+
<mat-card appearance="outlined">
|
|
821
|
+
<mat-card-content class="dbx-p3">
|
|
822
|
+
<div class="dbx-text-title-medium dbx-mb1">Outlined</div>
|
|
823
|
+
<p class="dbx-text-body-medium">Surface with a hairline outline.</p>
|
|
824
|
+
<dbx-button stroked text="Action"></dbx-button>
|
|
825
|
+
</mat-card-content>
|
|
826
|
+
</mat-card>
|
|
827
|
+
</div>
|
|
828
|
+
<div [dbxFlexSize]="2">
|
|
829
|
+
<mat-card appearance="raised">
|
|
830
|
+
<mat-card-content class="dbx-p3">
|
|
831
|
+
<div class="dbx-text-title-medium dbx-mb1">Raised</div>
|
|
832
|
+
<p class="dbx-text-body-medium">Surface lifted by a shadow.</p>
|
|
833
|
+
<dbx-button flat text="Action"></dbx-button>
|
|
834
|
+
</mat-card-content>
|
|
835
|
+
</mat-card>
|
|
836
|
+
</div>
|
|
837
|
+
<div [dbxFlexSize]="2">
|
|
838
|
+
<mat-card appearance="filled">
|
|
839
|
+
<mat-card-content class="dbx-p3">
|
|
840
|
+
<div class="dbx-text-title-medium dbx-mb1">Filled</div>
|
|
841
|
+
<p class="dbx-text-body-medium">Tonal surface container.</p>
|
|
842
|
+
<dbx-button basic text="Action"></dbx-button>
|
|
843
|
+
</mat-card-content>
|
|
844
|
+
</mat-card>
|
|
845
|
+
</div>
|
|
846
|
+
</div>
|
|
847
|
+
</dbx-docs-ui-example-content>
|
|
848
|
+
</dbx-docs-ui-example>
|
|
849
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "directive", type: DbxFlexGroupDirective, selector: "[dbxFlexGroup]", inputs: ["content", "breakToColumn", "relative", "breakpoint"] }, { kind: "directive", type: DbxFlexSizeDirective, selector: "[dbxFlexSize]", inputs: ["dbxFlexSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
850
|
+
}
|
|
851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoCardsSectionComponent, decorators: [{
|
|
852
|
+
type: Component,
|
|
853
|
+
args: [{
|
|
854
|
+
selector: 'dbx-style-demo-cards-section',
|
|
855
|
+
standalone: true,
|
|
856
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
857
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, MatCardModule, DbxButtonComponent, DbxFlexGroupDirective, DbxFlexSizeDirective],
|
|
858
|
+
template: `
|
|
859
|
+
<dbx-docs-ui-example header="Cards" hint="Material 3 card appearances painted from system surface tokens.">
|
|
860
|
+
<dbx-docs-ui-example-info>
|
|
861
|
+
<p>
|
|
862
|
+
The three M3 card appearances —
|
|
863
|
+
<code>outlined</code>
|
|
864
|
+
,
|
|
865
|
+
<code>raised</code>
|
|
866
|
+
, and
|
|
867
|
+
<code>filled</code>
|
|
868
|
+
— draw their container colour and shape from
|
|
869
|
+
<code>--mat-sys-surface*</code>
|
|
870
|
+
and the
|
|
871
|
+
<code>--mat-card-*-container-shape</code>
|
|
872
|
+
tokens. No hard-coded colours or radii, so they flip with light/dark and respond live to the surface-tint and corner-shape levers.
|
|
873
|
+
</p>
|
|
874
|
+
</dbx-docs-ui-example-info>
|
|
875
|
+
<dbx-docs-ui-example-content>
|
|
876
|
+
<div dbxFlexGroup>
|
|
877
|
+
<div [dbxFlexSize]="2">
|
|
878
|
+
<mat-card appearance="outlined">
|
|
879
|
+
<mat-card-content class="dbx-p3">
|
|
880
|
+
<div class="dbx-text-title-medium dbx-mb1">Outlined</div>
|
|
881
|
+
<p class="dbx-text-body-medium">Surface with a hairline outline.</p>
|
|
882
|
+
<dbx-button stroked text="Action"></dbx-button>
|
|
883
|
+
</mat-card-content>
|
|
884
|
+
</mat-card>
|
|
885
|
+
</div>
|
|
886
|
+
<div [dbxFlexSize]="2">
|
|
887
|
+
<mat-card appearance="raised">
|
|
888
|
+
<mat-card-content class="dbx-p3">
|
|
889
|
+
<div class="dbx-text-title-medium dbx-mb1">Raised</div>
|
|
890
|
+
<p class="dbx-text-body-medium">Surface lifted by a shadow.</p>
|
|
891
|
+
<dbx-button flat text="Action"></dbx-button>
|
|
892
|
+
</mat-card-content>
|
|
893
|
+
</mat-card>
|
|
894
|
+
</div>
|
|
895
|
+
<div [dbxFlexSize]="2">
|
|
896
|
+
<mat-card appearance="filled">
|
|
897
|
+
<mat-card-content class="dbx-p3">
|
|
898
|
+
<div class="dbx-text-title-medium dbx-mb1">Filled</div>
|
|
899
|
+
<p class="dbx-text-body-medium">Tonal surface container.</p>
|
|
900
|
+
<dbx-button basic text="Action"></dbx-button>
|
|
901
|
+
</mat-card-content>
|
|
902
|
+
</mat-card>
|
|
903
|
+
</div>
|
|
904
|
+
</div>
|
|
905
|
+
</dbx-docs-ui-example-content>
|
|
906
|
+
</dbx-docs-ui-example>
|
|
907
|
+
`
|
|
908
|
+
}]
|
|
909
|
+
}] });
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Style-demo section that dumps every template registered with the host app's {@link DbxColorService} as a
|
|
913
|
+
* `[dbxColor]` swatch, marking the curated ones. This makes both the built-in curated set and any app-seeded
|
|
914
|
+
* templates visible in one place; when the service is not provided, an empty-state hint is shown instead.
|
|
915
|
+
*
|
|
916
|
+
* @dbxDocsUiExample
|
|
917
|
+
* @dbxDocsUiExampleSlug style-demo-color-templates
|
|
918
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
919
|
+
* @dbxDocsUiExampleSummary Every registered DbxColorService template dumped as a [dbxColor] swatch, curated ones marked.
|
|
920
|
+
* @dbxDocsUiExampleRelated color, color-service
|
|
921
|
+
*/
|
|
922
|
+
class DbxStyleDemoColorTemplatesSectionComponent {
|
|
923
|
+
_colorService = inject(DbxColorService, { optional: true });
|
|
924
|
+
templates = (this._colorService?.getAllRegisteredTemplateKeys() ?? []).map((key) => ({ key, curated: this._colorService?.getTemplate(key)?.curated === true }));
|
|
925
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoColorTemplatesSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
926
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoColorTemplatesSectionComponent, isStandalone: true, selector: "dbx-style-demo-color-templates-section", ngImport: i0, template: `
|
|
927
|
+
<dbx-docs-ui-example header="Color Templates" hint="Registered DbxColorService templates.">
|
|
928
|
+
<dbx-docs-ui-example-info>
|
|
929
|
+
<p>
|
|
930
|
+
A
|
|
931
|
+
<code>DbxColorConfigTemplate</code>
|
|
932
|
+
is a named, reusable color preset registered with
|
|
933
|
+
<code>DbxColorService</code>
|
|
934
|
+
— via
|
|
935
|
+
<code>provideDbxStyleService({ dbxColorServiceConfig: { templates } })</code>
|
|
936
|
+
at the app root or
|
|
937
|
+
<code>DbxColorService.register(...)</code>
|
|
938
|
+
at runtime. Each swatch below is painted with
|
|
939
|
+
<code>[dbxColor]="{ template: key }"</code>
|
|
940
|
+
; the
|
|
941
|
+
<code>curated</code>
|
|
942
|
+
ones also feed the deterministic name-derived color pickers.
|
|
943
|
+
</p>
|
|
944
|
+
</dbx-docs-ui-example-info>
|
|
945
|
+
<dbx-docs-ui-example-content>
|
|
946
|
+
@if (templates.length > 0) {
|
|
947
|
+
<div class="dbx-flex" [style.flex-wrap]="'wrap'">
|
|
948
|
+
@for (template of templates; track template.key) {
|
|
949
|
+
<div class="dbx-pr1 dbx-pb1">
|
|
950
|
+
<div class="dbx-p2 dbx-color-bg" [dbxColor]="{ template: template.key }">
|
|
951
|
+
<span class="dbx-text-label-small">{{ template.key }}</span>
|
|
952
|
+
@if (template.curated) {
|
|
953
|
+
<span class="dbx-text-label-small">· curated</span>
|
|
954
|
+
}
|
|
955
|
+
</div>
|
|
956
|
+
</div>
|
|
957
|
+
}
|
|
958
|
+
</div>
|
|
959
|
+
} @else {
|
|
960
|
+
<p class="dbx-hint">No DbxColorService templates are registered (or the service is not provided by the host app).</p>
|
|
961
|
+
}
|
|
962
|
+
</dbx-docs-ui-example-content>
|
|
963
|
+
</dbx-docs-ui-example>
|
|
964
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "directive", type: DbxColorDirective, selector: "[dbxColor]", inputs: ["dbxColor", "dbxColorTone"], outputs: ["dbxColorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
965
|
+
}
|
|
966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoColorTemplatesSectionComponent, decorators: [{
|
|
967
|
+
type: Component,
|
|
968
|
+
args: [{
|
|
969
|
+
selector: 'dbx-style-demo-color-templates-section',
|
|
970
|
+
standalone: true,
|
|
971
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
972
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, DbxColorDirective],
|
|
973
|
+
template: `
|
|
974
|
+
<dbx-docs-ui-example header="Color Templates" hint="Registered DbxColorService templates.">
|
|
975
|
+
<dbx-docs-ui-example-info>
|
|
976
|
+
<p>
|
|
977
|
+
A
|
|
978
|
+
<code>DbxColorConfigTemplate</code>
|
|
979
|
+
is a named, reusable color preset registered with
|
|
980
|
+
<code>DbxColorService</code>
|
|
981
|
+
— via
|
|
982
|
+
<code>provideDbxStyleService({ dbxColorServiceConfig: { templates } })</code>
|
|
983
|
+
at the app root or
|
|
984
|
+
<code>DbxColorService.register(...)</code>
|
|
985
|
+
at runtime. Each swatch below is painted with
|
|
986
|
+
<code>[dbxColor]="{ template: key }"</code>
|
|
987
|
+
; the
|
|
988
|
+
<code>curated</code>
|
|
989
|
+
ones also feed the deterministic name-derived color pickers.
|
|
990
|
+
</p>
|
|
991
|
+
</dbx-docs-ui-example-info>
|
|
992
|
+
<dbx-docs-ui-example-content>
|
|
993
|
+
@if (templates.length > 0) {
|
|
994
|
+
<div class="dbx-flex" [style.flex-wrap]="'wrap'">
|
|
995
|
+
@for (template of templates; track template.key) {
|
|
996
|
+
<div class="dbx-pr1 dbx-pb1">
|
|
997
|
+
<div class="dbx-p2 dbx-color-bg" [dbxColor]="{ template: template.key }">
|
|
998
|
+
<span class="dbx-text-label-small">{{ template.key }}</span>
|
|
999
|
+
@if (template.curated) {
|
|
1000
|
+
<span class="dbx-text-label-small">· curated</span>
|
|
1001
|
+
}
|
|
1002
|
+
</div>
|
|
1003
|
+
</div>
|
|
1004
|
+
}
|
|
1005
|
+
</div>
|
|
1006
|
+
} @else {
|
|
1007
|
+
<p class="dbx-hint">No DbxColorService templates are registered (or the service is not provided by the host app).</p>
|
|
1008
|
+
}
|
|
1009
|
+
</dbx-docs-ui-example-content>
|
|
1010
|
+
</dbx-docs-ui-example>
|
|
1011
|
+
`
|
|
1012
|
+
}]
|
|
1013
|
+
}] });
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Style-demo section showing `[dbxColor]` themed backgrounds at full strength and as `[dbxColorTone]` tonal washes,
|
|
1017
|
+
* across the core and extra theme colors, so the color tokens are easy to compare under the host app's theme.
|
|
1018
|
+
*
|
|
1019
|
+
* @dbxDocsUiExample
|
|
1020
|
+
* @dbxDocsUiExampleSlug style-demo-color-tones
|
|
1021
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
1022
|
+
* @dbxDocsUiExampleSummary Themed [dbxColor] backgrounds at full strength and as [dbxColorTone] tonal washes.
|
|
1023
|
+
* @dbxDocsUiExampleRelated color, text-color, color-service
|
|
1024
|
+
*/
|
|
1025
|
+
class DbxStyleDemoColorTonesSectionComponent {
|
|
1026
|
+
colors = [...DBX_THEME_COLORS_MAIN, ...DBX_THEME_COLORS_EXTRA];
|
|
1027
|
+
tones = [40, 18, 8];
|
|
1028
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoColorTonesSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1029
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoColorTonesSectionComponent, isStandalone: true, selector: "dbx-style-demo-color-tones-section", ngImport: i0, template: `
|
|
1030
|
+
<dbx-docs-ui-example header="Color & Tones" hint="Themed [dbxColor] backgrounds, full and tonal.">
|
|
1031
|
+
<dbx-docs-ui-example-info>
|
|
1032
|
+
<p>
|
|
1033
|
+
<code>[dbxColor]</code>
|
|
1034
|
+
paints an element from a named theme color token; adding
|
|
1035
|
+
<code>[dbxColorTone]</code>
|
|
1036
|
+
(0–100) mixes it toward the surface for a muted tonal wash. Every core and extra theme color is shown below at full strength and at tones of 40, 18, and 8, so each token reads correctly under any theme.
|
|
1037
|
+
</p>
|
|
1038
|
+
</dbx-docs-ui-example-info>
|
|
1039
|
+
<dbx-docs-ui-example-content>
|
|
1040
|
+
<div dbxFlexGroup>
|
|
1041
|
+
@for (color of colors; track color) {
|
|
1042
|
+
<div [dbxFlexSize]="3">
|
|
1043
|
+
<div class="dbx-p3 dbx-mb1 dbx-color-bg" [dbxColor]="color">
|
|
1044
|
+
<span class="dbx-text-label-large">{{ color }}</span>
|
|
1045
|
+
</div>
|
|
1046
|
+
@for (tone of tones; track tone) {
|
|
1047
|
+
<div class="dbx-p3 dbx-mb1 dbx-color-bg" [dbxColor]="color" [dbxColorTone]="tone">
|
|
1048
|
+
<span class="dbx-text-label-large">{{ color }} · tone {{ tone }}</span>
|
|
1049
|
+
</div>
|
|
1050
|
+
}
|
|
1051
|
+
</div>
|
|
1052
|
+
}
|
|
1053
|
+
</div>
|
|
1054
|
+
</dbx-docs-ui-example-content>
|
|
1055
|
+
</dbx-docs-ui-example>
|
|
1056
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "directive", type: DbxColorDirective, selector: "[dbxColor]", inputs: ["dbxColor", "dbxColorTone"], outputs: ["dbxColorChange"] }, { kind: "directive", type: DbxFlexGroupDirective, selector: "[dbxFlexGroup]", inputs: ["content", "breakToColumn", "relative", "breakpoint"] }, { kind: "directive", type: DbxFlexSizeDirective, selector: "[dbxFlexSize]", inputs: ["dbxFlexSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1057
|
+
}
|
|
1058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoColorTonesSectionComponent, decorators: [{
|
|
1059
|
+
type: Component,
|
|
1060
|
+
args: [{
|
|
1061
|
+
selector: 'dbx-style-demo-color-tones-section',
|
|
1062
|
+
standalone: true,
|
|
1063
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1064
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, DbxColorDirective, DbxFlexGroupDirective, DbxFlexSizeDirective],
|
|
1065
|
+
template: `
|
|
1066
|
+
<dbx-docs-ui-example header="Color & Tones" hint="Themed [dbxColor] backgrounds, full and tonal.">
|
|
1067
|
+
<dbx-docs-ui-example-info>
|
|
1068
|
+
<p>
|
|
1069
|
+
<code>[dbxColor]</code>
|
|
1070
|
+
paints an element from a named theme color token; adding
|
|
1071
|
+
<code>[dbxColorTone]</code>
|
|
1072
|
+
(0–100) mixes it toward the surface for a muted tonal wash. Every core and extra theme color is shown below at full strength and at tones of 40, 18, and 8, so each token reads correctly under any theme.
|
|
1073
|
+
</p>
|
|
1074
|
+
</dbx-docs-ui-example-info>
|
|
1075
|
+
<dbx-docs-ui-example-content>
|
|
1076
|
+
<div dbxFlexGroup>
|
|
1077
|
+
@for (color of colors; track color) {
|
|
1078
|
+
<div [dbxFlexSize]="3">
|
|
1079
|
+
<div class="dbx-p3 dbx-mb1 dbx-color-bg" [dbxColor]="color">
|
|
1080
|
+
<span class="dbx-text-label-large">{{ color }}</span>
|
|
1081
|
+
</div>
|
|
1082
|
+
@for (tone of tones; track tone) {
|
|
1083
|
+
<div class="dbx-p3 dbx-mb1 dbx-color-bg" [dbxColor]="color" [dbxColorTone]="tone">
|
|
1084
|
+
<span class="dbx-text-label-large">{{ color }} · tone {{ tone }}</span>
|
|
1085
|
+
</div>
|
|
1086
|
+
}
|
|
1087
|
+
</div>
|
|
1088
|
+
}
|
|
1089
|
+
</div>
|
|
1090
|
+
</dbx-docs-ui-example-content>
|
|
1091
|
+
</dbx-docs-ui-example>
|
|
1092
|
+
`
|
|
1093
|
+
}]
|
|
1094
|
+
}] });
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Style-demo section showing the router-free navigation building blocks — `dbx-pagebar`, `dbx-bar` + `dbx-bar-header`,
|
|
1098
|
+
* and a nested `dbx-anchor-list` — painted from the host theme's bar / surface tokens. The anchors are click-only, so
|
|
1099
|
+
* this section needs no router; the route-bound `dbx-navbar` demo is contributed by the host app instead.
|
|
1100
|
+
*
|
|
1101
|
+
* @dbxDocsUiExample
|
|
1102
|
+
* @dbxDocsUiExampleSlug style-demo-navigation
|
|
1103
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
1104
|
+
* @dbxDocsUiExampleSummary Router-free navigation building blocks — pagebar, bar, bar-header, and a nested anchor list.
|
|
1105
|
+
* @dbxDocsUiExampleRelated pagebar, bar, bar-header, anchor-list
|
|
1106
|
+
*/
|
|
1107
|
+
class DbxStyleDemoNavigationSectionComponent {
|
|
1108
|
+
navAnchors = [
|
|
1109
|
+
{ title: 'Dashboard', icon: 'dashboard', onClick: () => undefined },
|
|
1110
|
+
{
|
|
1111
|
+
title: 'Settings',
|
|
1112
|
+
icon: 'settings',
|
|
1113
|
+
onClick: () => undefined,
|
|
1114
|
+
children: [
|
|
1115
|
+
{ title: 'Profile', icon: 'person', onClick: () => undefined },
|
|
1116
|
+
{ title: 'Security', icon: 'lock', onClick: () => undefined }
|
|
1117
|
+
]
|
|
1118
|
+
},
|
|
1119
|
+
{ title: 'Help', icon: 'help', onClick: () => undefined }
|
|
1120
|
+
];
|
|
1121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoNavigationSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DbxStyleDemoNavigationSectionComponent, isStandalone: true, selector: "dbx-style-demo-navigation-section", ngImport: i0, template: `
|
|
1123
|
+
<dbx-docs-ui-example header="Navigation" hint="Router-free navigation building blocks.">
|
|
1124
|
+
<dbx-docs-ui-example-info>
|
|
1125
|
+
<p>
|
|
1126
|
+
<code>dbx-pagebar</code>
|
|
1127
|
+
,
|
|
1128
|
+
<code>dbx-bar</code>
|
|
1129
|
+
,
|
|
1130
|
+
<code>dbx-bar-header</code>
|
|
1131
|
+
, and
|
|
1132
|
+
<code>dbx-anchor-list</code>
|
|
1133
|
+
all paint from the host theme's bar / surface tokens. The anchors here are click-only (no
|
|
1134
|
+
<code>ref</code>
|
|
1135
|
+
), so the section is router-free; the route-bound
|
|
1136
|
+
<code>dbx-navbar</code>
|
|
1137
|
+
tab demo is the app-contributed Navbar section.
|
|
1138
|
+
</p>
|
|
1139
|
+
</dbx-docs-ui-example-info>
|
|
1140
|
+
<dbx-docs-ui-example-content>
|
|
1141
|
+
<div class="dbx-flex-column">
|
|
1142
|
+
<dbx-pagebar>
|
|
1143
|
+
<span left class="dbx-text-title-medium">Page title</span>
|
|
1144
|
+
<span right>
|
|
1145
|
+
<dbx-button iconOnly icon="search"></dbx-button>
|
|
1146
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
1147
|
+
<dbx-button iconOnly icon="more_vert"></dbx-button>
|
|
1148
|
+
</span>
|
|
1149
|
+
</dbx-pagebar>
|
|
1150
|
+
<dbx-bar-header class="dbx-pt2" text="Section divider" icon="folder"></dbx-bar-header>
|
|
1151
|
+
<dbx-bar class="dbx-pt2">
|
|
1152
|
+
<dbx-button stroked text="Cancel"></dbx-button>
|
|
1153
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
1154
|
+
<dbx-button flat color="primary" text="Save"></dbx-button>
|
|
1155
|
+
</dbx-bar>
|
|
1156
|
+
<dbx-anchor-list class="dbx-pt2" [anchors]="navAnchors"></dbx-anchor-list>
|
|
1157
|
+
</div>
|
|
1158
|
+
</dbx-docs-ui-example-content>
|
|
1159
|
+
</dbx-docs-ui-example>
|
|
1160
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "component", type: DbxPagebarComponent, selector: "dbx-pagebar" }, { kind: "directive", type: DbxBarDirective, selector: "dbx-bar,[dbxBar]" }, { kind: "component", type: DbxBarHeaderComponent, selector: "dbx-bar-header", inputs: ["text", "icon"] }, { kind: "component", type: DbxAnchorListComponent, selector: "dbx-anchor-list", inputs: ["anchors"] }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "directive", type: DbxButtonSpacerDirective, selector: "dbx-button-spacer,[dbxButtonSpacer]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1161
|
+
}
|
|
1162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoNavigationSectionComponent, decorators: [{
|
|
1163
|
+
type: Component,
|
|
1164
|
+
args: [{
|
|
1165
|
+
selector: 'dbx-style-demo-navigation-section',
|
|
1166
|
+
standalone: true,
|
|
1167
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1168
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, DbxPagebarComponent, DbxBarDirective, DbxBarHeaderComponent, DbxAnchorListComponent, DbxButtonComponent, DbxButtonSpacerDirective],
|
|
1169
|
+
template: `
|
|
1170
|
+
<dbx-docs-ui-example header="Navigation" hint="Router-free navigation building blocks.">
|
|
1171
|
+
<dbx-docs-ui-example-info>
|
|
1172
|
+
<p>
|
|
1173
|
+
<code>dbx-pagebar</code>
|
|
1174
|
+
,
|
|
1175
|
+
<code>dbx-bar</code>
|
|
1176
|
+
,
|
|
1177
|
+
<code>dbx-bar-header</code>
|
|
1178
|
+
, and
|
|
1179
|
+
<code>dbx-anchor-list</code>
|
|
1180
|
+
all paint from the host theme's bar / surface tokens. The anchors here are click-only (no
|
|
1181
|
+
<code>ref</code>
|
|
1182
|
+
), so the section is router-free; the route-bound
|
|
1183
|
+
<code>dbx-navbar</code>
|
|
1184
|
+
tab demo is the app-contributed Navbar section.
|
|
1185
|
+
</p>
|
|
1186
|
+
</dbx-docs-ui-example-info>
|
|
1187
|
+
<dbx-docs-ui-example-content>
|
|
1188
|
+
<div class="dbx-flex-column">
|
|
1189
|
+
<dbx-pagebar>
|
|
1190
|
+
<span left class="dbx-text-title-medium">Page title</span>
|
|
1191
|
+
<span right>
|
|
1192
|
+
<dbx-button iconOnly icon="search"></dbx-button>
|
|
1193
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
1194
|
+
<dbx-button iconOnly icon="more_vert"></dbx-button>
|
|
1195
|
+
</span>
|
|
1196
|
+
</dbx-pagebar>
|
|
1197
|
+
<dbx-bar-header class="dbx-pt2" text="Section divider" icon="folder"></dbx-bar-header>
|
|
1198
|
+
<dbx-bar class="dbx-pt2">
|
|
1199
|
+
<dbx-button stroked text="Cancel"></dbx-button>
|
|
1200
|
+
<dbx-button-spacer></dbx-button-spacer>
|
|
1201
|
+
<dbx-button flat color="primary" text="Save"></dbx-button>
|
|
1202
|
+
</dbx-bar>
|
|
1203
|
+
<dbx-anchor-list class="dbx-pt2" [anchors]="navAnchors"></dbx-anchor-list>
|
|
1204
|
+
</div>
|
|
1205
|
+
</dbx-docs-ui-example-content>
|
|
1206
|
+
</dbx-docs-ui-example>
|
|
1207
|
+
`
|
|
1208
|
+
}]
|
|
1209
|
+
}] });
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Style-demo section showing the full Material 3 corner-radius scale (per
|
|
1213
|
+
* https://m3.material.io/styles/shape/corner-radius-scale) as fixed-size tiles, flagging the spec steps that have no
|
|
1214
|
+
* web token. A live outlined card + stroked button below follow whichever Shape lever is active, demonstrating that
|
|
1215
|
+
* the levers override the component shape tokens (`--mat-card-*` / `--mat-button-*`), not `--mat-sys-corner-*`.
|
|
1216
|
+
*
|
|
1217
|
+
* @dbxDocsUiExample
|
|
1218
|
+
* @dbxDocsUiExampleSlug style-demo-shape-scale
|
|
1219
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
1220
|
+
* @dbxDocsUiExampleSummary The Material 3 corner-radius scale as fixed tiles, flagging spec steps with no web token.
|
|
1221
|
+
* @dbxDocsUiExampleRelated cards, button
|
|
1222
|
+
*/
|
|
1223
|
+
class DbxStyleDemoShapeScaleSectionComponent {
|
|
1224
|
+
steps = [
|
|
1225
|
+
{ label: 'none', radius: 'var(--mat-sys-corner-none)', webToken: '--mat-sys-corner-none' },
|
|
1226
|
+
{ label: 'extra-small', radius: 'var(--mat-sys-corner-extra-small)', webToken: '--mat-sys-corner-extra-small' },
|
|
1227
|
+
{ label: 'small', radius: 'var(--mat-sys-corner-small)', webToken: '--mat-sys-corner-small' },
|
|
1228
|
+
{ label: 'medium', radius: 'var(--mat-sys-corner-medium)', webToken: '--mat-sys-corner-medium' },
|
|
1229
|
+
{ label: 'large', radius: 'var(--mat-sys-corner-large)', webToken: '--mat-sys-corner-large' },
|
|
1230
|
+
{ label: 'large-increased', radius: '20px' },
|
|
1231
|
+
{ label: 'extra-large', radius: 'var(--mat-sys-corner-extra-large)', webToken: '--mat-sys-corner-extra-large' },
|
|
1232
|
+
{ label: 'extra-large-increased', radius: '32px' },
|
|
1233
|
+
{ label: 'extra-extra-large', radius: '48px' },
|
|
1234
|
+
{ label: 'full', radius: 'var(--mat-sys-corner-full)', webToken: '--mat-sys-corner-full' }
|
|
1235
|
+
];
|
|
1236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoShapeScaleSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1237
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoShapeScaleSectionComponent, isStandalone: true, selector: "dbx-style-demo-shape-scale-section", ngImport: i0, template: `
|
|
1238
|
+
<dbx-docs-ui-example header="Shape Scale" hint="The Material 3 corner-radius scale.">
|
|
1239
|
+
<dbx-docs-ui-example-info>
|
|
1240
|
+
<p>
|
|
1241
|
+
The
|
|
1242
|
+
<a href="https://m3.material.io/styles/shape/corner-radius-scale" target="_blank" rel="noopener">M3 corner-radius scale</a>
|
|
1243
|
+
runs from
|
|
1244
|
+
<code>none</code>
|
|
1245
|
+
to
|
|
1246
|
+
<code>full</code>
|
|
1247
|
+
. Each tile below is rounded by the matching
|
|
1248
|
+
<code>--mat-sys-corner-*</code>
|
|
1249
|
+
token; a few spec steps (large-increased, extra-large-increased, extra-extra-large) have no web token and use a literal value. The Shape levers in the controls do not change these
|
|
1250
|
+
<code>--mat-sys-corner-*</code>
|
|
1251
|
+
values — they re-point the per-component shape tokens (
|
|
1252
|
+
<code>--mat-card-*-container-shape</code>
|
|
1253
|
+
,
|
|
1254
|
+
<code>--mat-button-*-container-shape</code>
|
|
1255
|
+
), which is why the card and button below re-round while the tiles stay fixed.
|
|
1256
|
+
</p>
|
|
1257
|
+
</dbx-docs-ui-example-info>
|
|
1258
|
+
<dbx-docs-ui-example-content>
|
|
1259
|
+
<div class="dbx-flex" [style.flex-wrap]="'wrap'">
|
|
1260
|
+
@for (step of steps; track step.label) {
|
|
1261
|
+
<div class="dbx-pr3 dbx-pb3">
|
|
1262
|
+
<div [style.border-radius]="step.radius" [style.width.px]="64" [style.height.px]="64" [style.background]="'var(--mat-sys-surface-container-high)'" [style.border]="'1px solid var(--mat-sys-outline-variant)'"></div>
|
|
1263
|
+
<div class="dbx-text-label-small dbx-pt1">{{ step.label }}</div>
|
|
1264
|
+
@if (step.webToken) {
|
|
1265
|
+
<div class="dbx-text-label-small dbx-hint">
|
|
1266
|
+
<code>{{ step.webToken }}</code>
|
|
1267
|
+
</div>
|
|
1268
|
+
} @else {
|
|
1269
|
+
<div class="dbx-text-label-small dbx-hint">no web token</div>
|
|
1270
|
+
}
|
|
1271
|
+
</div>
|
|
1272
|
+
}
|
|
1273
|
+
</div>
|
|
1274
|
+
<div class="dbx-pt2">
|
|
1275
|
+
<p class="dbx-hint">The card and button below follow the active Shape lever:</p>
|
|
1276
|
+
<mat-card appearance="outlined">
|
|
1277
|
+
<mat-card-content class="dbx-p3">
|
|
1278
|
+
<div class="dbx-text-title-medium dbx-mb1">Outlined card</div>
|
|
1279
|
+
<dbx-button stroked text="Action"></dbx-button>
|
|
1280
|
+
</mat-card-content>
|
|
1281
|
+
</mat-card>
|
|
1282
|
+
</div>
|
|
1283
|
+
</dbx-docs-ui-example-content>
|
|
1284
|
+
</dbx-docs-ui-example>
|
|
1285
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1286
|
+
}
|
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoShapeScaleSectionComponent, decorators: [{
|
|
1288
|
+
type: Component,
|
|
1289
|
+
args: [{
|
|
1290
|
+
selector: 'dbx-style-demo-shape-scale-section',
|
|
1291
|
+
standalone: true,
|
|
1292
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1293
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent, MatCardModule, DbxButtonComponent],
|
|
1294
|
+
template: `
|
|
1295
|
+
<dbx-docs-ui-example header="Shape Scale" hint="The Material 3 corner-radius scale.">
|
|
1296
|
+
<dbx-docs-ui-example-info>
|
|
1297
|
+
<p>
|
|
1298
|
+
The
|
|
1299
|
+
<a href="https://m3.material.io/styles/shape/corner-radius-scale" target="_blank" rel="noopener">M3 corner-radius scale</a>
|
|
1300
|
+
runs from
|
|
1301
|
+
<code>none</code>
|
|
1302
|
+
to
|
|
1303
|
+
<code>full</code>
|
|
1304
|
+
. Each tile below is rounded by the matching
|
|
1305
|
+
<code>--mat-sys-corner-*</code>
|
|
1306
|
+
token; a few spec steps (large-increased, extra-large-increased, extra-extra-large) have no web token and use a literal value. The Shape levers in the controls do not change these
|
|
1307
|
+
<code>--mat-sys-corner-*</code>
|
|
1308
|
+
values — they re-point the per-component shape tokens (
|
|
1309
|
+
<code>--mat-card-*-container-shape</code>
|
|
1310
|
+
,
|
|
1311
|
+
<code>--mat-button-*-container-shape</code>
|
|
1312
|
+
), which is why the card and button below re-round while the tiles stay fixed.
|
|
1313
|
+
</p>
|
|
1314
|
+
</dbx-docs-ui-example-info>
|
|
1315
|
+
<dbx-docs-ui-example-content>
|
|
1316
|
+
<div class="dbx-flex" [style.flex-wrap]="'wrap'">
|
|
1317
|
+
@for (step of steps; track step.label) {
|
|
1318
|
+
<div class="dbx-pr3 dbx-pb3">
|
|
1319
|
+
<div [style.border-radius]="step.radius" [style.width.px]="64" [style.height.px]="64" [style.background]="'var(--mat-sys-surface-container-high)'" [style.border]="'1px solid var(--mat-sys-outline-variant)'"></div>
|
|
1320
|
+
<div class="dbx-text-label-small dbx-pt1">{{ step.label }}</div>
|
|
1321
|
+
@if (step.webToken) {
|
|
1322
|
+
<div class="dbx-text-label-small dbx-hint">
|
|
1323
|
+
<code>{{ step.webToken }}</code>
|
|
1324
|
+
</div>
|
|
1325
|
+
} @else {
|
|
1326
|
+
<div class="dbx-text-label-small dbx-hint">no web token</div>
|
|
1327
|
+
}
|
|
1328
|
+
</div>
|
|
1329
|
+
}
|
|
1330
|
+
</div>
|
|
1331
|
+
<div class="dbx-pt2">
|
|
1332
|
+
<p class="dbx-hint">The card and button below follow the active Shape lever:</p>
|
|
1333
|
+
<mat-card appearance="outlined">
|
|
1334
|
+
<mat-card-content class="dbx-p3">
|
|
1335
|
+
<div class="dbx-text-title-medium dbx-mb1">Outlined card</div>
|
|
1336
|
+
<dbx-button stroked text="Action"></dbx-button>
|
|
1337
|
+
</mat-card-content>
|
|
1338
|
+
</mat-card>
|
|
1339
|
+
</div>
|
|
1340
|
+
</dbx-docs-ui-example-content>
|
|
1341
|
+
</dbx-docs-ui-example>
|
|
1342
|
+
`
|
|
1343
|
+
}]
|
|
1344
|
+
}] });
|
|
1345
|
+
|
|
1346
|
+
/**
|
|
1347
|
+
* Style-demo section showing the full Material 3 surface ramp (`surface-dim` → `surface-container-highest`, plus
|
|
1348
|
+
* `inverse-surface`) painted straight from the `--mat-sys-*` tokens, so the host theme's neutral palette and the
|
|
1349
|
+
* playground's surface-tint lever are easy to read under light and dark.
|
|
1350
|
+
*
|
|
1351
|
+
* @dbxDocsUiExample
|
|
1352
|
+
* @dbxDocsUiExampleSlug style-demo-surfaces
|
|
1353
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
1354
|
+
* @dbxDocsUiExampleSummary The Material 3 surface ramp painted from --mat-sys-surface* tokens, plus outline samples.
|
|
1355
|
+
* @dbxDocsUiExampleRelated cards, color
|
|
1356
|
+
*/
|
|
1357
|
+
class DbxStyleDemoSurfacesSectionComponent {
|
|
1358
|
+
surfaces = [
|
|
1359
|
+
{ label: 'surface-dim', background: 'var(--mat-sys-surface-dim)', color: 'var(--mat-sys-on-surface)' },
|
|
1360
|
+
{ label: 'surface', background: 'var(--mat-sys-surface)', color: 'var(--mat-sys-on-surface)' },
|
|
1361
|
+
{ label: 'surface-bright', background: 'var(--mat-sys-surface-bright)', color: 'var(--mat-sys-on-surface)' },
|
|
1362
|
+
{ label: 'surface-container-lowest', background: 'var(--mat-sys-surface-container-lowest)', color: 'var(--mat-sys-on-surface)' },
|
|
1363
|
+
{ label: 'surface-container-low', background: 'var(--mat-sys-surface-container-low)', color: 'var(--mat-sys-on-surface)' },
|
|
1364
|
+
{ label: 'surface-container', background: 'var(--mat-sys-surface-container)', color: 'var(--mat-sys-on-surface)' },
|
|
1365
|
+
{ label: 'surface-container-high', background: 'var(--mat-sys-surface-container-high)', color: 'var(--mat-sys-on-surface)' },
|
|
1366
|
+
{ label: 'surface-container-highest', background: 'var(--mat-sys-surface-container-highest)', color: 'var(--mat-sys-on-surface)' },
|
|
1367
|
+
{ label: 'inverse-surface', background: 'var(--mat-sys-inverse-surface)', color: 'var(--mat-sys-inverse-on-surface)' }
|
|
1368
|
+
];
|
|
1369
|
+
outlines = [
|
|
1370
|
+
{ label: 'outline', border: '1px solid var(--mat-sys-outline)' },
|
|
1371
|
+
{ label: 'outline-variant', border: '1px solid var(--mat-sys-outline-variant)' }
|
|
1372
|
+
];
|
|
1373
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoSurfacesSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1374
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoSurfacesSectionComponent, isStandalone: true, selector: "dbx-style-demo-surfaces-section", ngImport: i0, template: `
|
|
1375
|
+
<dbx-docs-ui-example header="Surfaces" hint="The Material 3 surface ramp from system tokens.">
|
|
1376
|
+
<dbx-docs-ui-example-info>
|
|
1377
|
+
<p>
|
|
1378
|
+
The M3 neutral ramp —
|
|
1379
|
+
<code>--mat-sys-surface-dim</code>
|
|
1380
|
+
through
|
|
1381
|
+
<code>--mat-sys-surface-container-highest</code>
|
|
1382
|
+
, plus the
|
|
1383
|
+
<code>inverse-surface</code>
|
|
1384
|
+
pair — is what every dbx surface (cards, menus, sheets) is layered from. Each swatch reads its colour straight from the token, so the surface-tint lever shifts the
|
|
1385
|
+
<code>surface</code>
|
|
1386
|
+
/
|
|
1387
|
+
<code>-container</code>
|
|
1388
|
+
/
|
|
1389
|
+
<code>-container-high</code>
|
|
1390
|
+
rows live, and all of them flip with light/dark.
|
|
1391
|
+
</p>
|
|
1392
|
+
</dbx-docs-ui-example-info>
|
|
1393
|
+
<dbx-docs-ui-example-content>
|
|
1394
|
+
<div class="dbx-flex-column">
|
|
1395
|
+
@for (surface of surfaces; track surface.label) {
|
|
1396
|
+
<div class="dbx-p2" [style.background]="surface.background" [style.color]="surface.color">
|
|
1397
|
+
<span class="dbx-text-label-medium">{{ surface.label }}</span>
|
|
1398
|
+
</div>
|
|
1399
|
+
}
|
|
1400
|
+
<p class="dbx-pt2" [style.color]="'var(--mat-sys-on-surface-variant)'">
|
|
1401
|
+
Secondary text uses
|
|
1402
|
+
<code>--mat-sys-on-surface-variant</code>
|
|
1403
|
+
against these surfaces.
|
|
1404
|
+
</p>
|
|
1405
|
+
<div class="dbx-flex">
|
|
1406
|
+
@for (outline of outlines; track outline.label) {
|
|
1407
|
+
<div class="dbx-p2 dbx-pr3" [style.border]="outline.border">
|
|
1408
|
+
<span class="dbx-text-label-small">{{ outline.label }}</span>
|
|
1409
|
+
</div>
|
|
1410
|
+
}
|
|
1411
|
+
</div>
|
|
1412
|
+
</div>
|
|
1413
|
+
</dbx-docs-ui-example-content>
|
|
1414
|
+
</dbx-docs-ui-example>
|
|
1415
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1416
|
+
}
|
|
1417
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoSurfacesSectionComponent, decorators: [{
|
|
1418
|
+
type: Component,
|
|
1419
|
+
args: [{
|
|
1420
|
+
selector: 'dbx-style-demo-surfaces-section',
|
|
1421
|
+
standalone: true,
|
|
1422
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1423
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent],
|
|
1424
|
+
template: `
|
|
1425
|
+
<dbx-docs-ui-example header="Surfaces" hint="The Material 3 surface ramp from system tokens.">
|
|
1426
|
+
<dbx-docs-ui-example-info>
|
|
1427
|
+
<p>
|
|
1428
|
+
The M3 neutral ramp —
|
|
1429
|
+
<code>--mat-sys-surface-dim</code>
|
|
1430
|
+
through
|
|
1431
|
+
<code>--mat-sys-surface-container-highest</code>
|
|
1432
|
+
, plus the
|
|
1433
|
+
<code>inverse-surface</code>
|
|
1434
|
+
pair — is what every dbx surface (cards, menus, sheets) is layered from. Each swatch reads its colour straight from the token, so the surface-tint lever shifts the
|
|
1435
|
+
<code>surface</code>
|
|
1436
|
+
/
|
|
1437
|
+
<code>-container</code>
|
|
1438
|
+
/
|
|
1439
|
+
<code>-container-high</code>
|
|
1440
|
+
rows live, and all of them flip with light/dark.
|
|
1441
|
+
</p>
|
|
1442
|
+
</dbx-docs-ui-example-info>
|
|
1443
|
+
<dbx-docs-ui-example-content>
|
|
1444
|
+
<div class="dbx-flex-column">
|
|
1445
|
+
@for (surface of surfaces; track surface.label) {
|
|
1446
|
+
<div class="dbx-p2" [style.background]="surface.background" [style.color]="surface.color">
|
|
1447
|
+
<span class="dbx-text-label-medium">{{ surface.label }}</span>
|
|
1448
|
+
</div>
|
|
1449
|
+
}
|
|
1450
|
+
<p class="dbx-pt2" [style.color]="'var(--mat-sys-on-surface-variant)'">
|
|
1451
|
+
Secondary text uses
|
|
1452
|
+
<code>--mat-sys-on-surface-variant</code>
|
|
1453
|
+
against these surfaces.
|
|
1454
|
+
</p>
|
|
1455
|
+
<div class="dbx-flex">
|
|
1456
|
+
@for (outline of outlines; track outline.label) {
|
|
1457
|
+
<div class="dbx-p2 dbx-pr3" [style.border]="outline.border">
|
|
1458
|
+
<span class="dbx-text-label-small">{{ outline.label }}</span>
|
|
1459
|
+
</div>
|
|
1460
|
+
}
|
|
1461
|
+
</div>
|
|
1462
|
+
</div>
|
|
1463
|
+
</dbx-docs-ui-example-content>
|
|
1464
|
+
</dbx-docs-ui-example>
|
|
1465
|
+
`
|
|
1466
|
+
}]
|
|
1467
|
+
}] });
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Style-demo section showing the Material 3 typescale roles via the `.dbx-text-<role>` utility classes, so the
|
|
1471
|
+
* host theme's type ramp (family, size, weight, tracking) is visible at a glance.
|
|
1472
|
+
*
|
|
1473
|
+
* @dbxDocsUiExample
|
|
1474
|
+
* @dbxDocsUiExampleSlug style-demo-type-roles
|
|
1475
|
+
* @dbxDocsUiExampleCategory style-demo
|
|
1476
|
+
* @dbxDocsUiExampleSummary Material 3 typescale roles rendered via the .dbx-text-<role> utility classes.
|
|
1477
|
+
* @dbxDocsUiExampleRelated text
|
|
1478
|
+
*/
|
|
1479
|
+
class DbxStyleDemoTypeRolesSectionComponent {
|
|
1480
|
+
roles = [
|
|
1481
|
+
{ cssClass: 'dbx-text-display-small', label: 'Display Small' },
|
|
1482
|
+
{ cssClass: 'dbx-text-headline-medium', label: 'Headline Medium' },
|
|
1483
|
+
{ cssClass: 'dbx-text-title-large', label: 'Title Large' },
|
|
1484
|
+
{ cssClass: 'dbx-text-body-large', label: 'Body Large — the quick brown fox jumps over the lazy dog.' },
|
|
1485
|
+
{ cssClass: 'dbx-text-label-medium', label: 'Label Medium' }
|
|
1486
|
+
];
|
|
1487
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoTypeRolesSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1488
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxStyleDemoTypeRolesSectionComponent, isStandalone: true, selector: "dbx-style-demo-type-roles-section", ngImport: i0, template: `
|
|
1489
|
+
<dbx-docs-ui-example header="Type Roles" hint="Material 3 typescale via .dbx-text-* utilities.">
|
|
1490
|
+
<dbx-docs-ui-example-info>
|
|
1491
|
+
<p>
|
|
1492
|
+
The
|
|
1493
|
+
<code>.dbx-text-<role></code>
|
|
1494
|
+
utilities map to the M3 typescale tokens (
|
|
1495
|
+
<code>--mat-sys-headline-large</code>
|
|
1496
|
+
,
|
|
1497
|
+
<code>--mat-sys-title-medium</code>
|
|
1498
|
+
, …). They inherit the host theme's plain/brand families and weights, so a downstream app changing its typography ramp updates every role here without any local font rules.
|
|
1499
|
+
</p>
|
|
1500
|
+
</dbx-docs-ui-example-info>
|
|
1501
|
+
<dbx-docs-ui-example-content>
|
|
1502
|
+
<div class="dbx-flex-column">
|
|
1503
|
+
@for (role of roles; track role.cssClass) {
|
|
1504
|
+
<div class="dbx-pb1" [class]="role.cssClass">{{ role.label }}</div>
|
|
1505
|
+
}
|
|
1506
|
+
</div>
|
|
1507
|
+
</dbx-docs-ui-example-content>
|
|
1508
|
+
</dbx-docs-ui-example>
|
|
1509
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxDocsUiExampleComponent, selector: "dbx-docs-ui-example", inputs: ["header", "hint"] }, { kind: "component", type: DbxDocsUiExampleInfoComponent, selector: "dbx-docs-ui-example-info" }, { kind: "component", type: DbxDocsUiExampleContentComponent, selector: "dbx-docs-ui-example-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1510
|
+
}
|
|
1511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxStyleDemoTypeRolesSectionComponent, decorators: [{
|
|
1512
|
+
type: Component,
|
|
1513
|
+
args: [{
|
|
1514
|
+
selector: 'dbx-style-demo-type-roles-section',
|
|
1515
|
+
standalone: true,
|
|
1516
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1517
|
+
imports: [DbxDocsUiExampleComponent, DbxDocsUiExampleInfoComponent, DbxDocsUiExampleContentComponent],
|
|
1518
|
+
template: `
|
|
1519
|
+
<dbx-docs-ui-example header="Type Roles" hint="Material 3 typescale via .dbx-text-* utilities.">
|
|
1520
|
+
<dbx-docs-ui-example-info>
|
|
1521
|
+
<p>
|
|
1522
|
+
The
|
|
1523
|
+
<code>.dbx-text-<role></code>
|
|
1524
|
+
utilities map to the M3 typescale tokens (
|
|
1525
|
+
<code>--mat-sys-headline-large</code>
|
|
1526
|
+
,
|
|
1527
|
+
<code>--mat-sys-title-medium</code>
|
|
1528
|
+
, …). They inherit the host theme's plain/brand families and weights, so a downstream app changing its typography ramp updates every role here without any local font rules.
|
|
1529
|
+
</p>
|
|
1530
|
+
</dbx-docs-ui-example-info>
|
|
1531
|
+
<dbx-docs-ui-example-content>
|
|
1532
|
+
<div class="dbx-flex-column">
|
|
1533
|
+
@for (role of roles; track role.cssClass) {
|
|
1534
|
+
<div class="dbx-pb1" [class]="role.cssClass">{{ role.label }}</div>
|
|
1535
|
+
}
|
|
1536
|
+
</div>
|
|
1537
|
+
</dbx-docs-ui-example-content>
|
|
1538
|
+
</dbx-docs-ui-example>
|
|
1539
|
+
`
|
|
1540
|
+
}]
|
|
1541
|
+
}] });
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* The starter set of style-lever templates contributed by `@dereekb/dbx-web/style-demo`.
|
|
1545
|
+
*
|
|
1546
|
+
* The five `corner-shape-*` levers, the controls-only `pill-controls`, the component-scoped `button-corner-*` /
|
|
1547
|
+
* `list-corner-*` / `anchor-list-corner-*` levers, and `surface-tint` reference the disposable
|
|
1548
|
+
* `.dbx-style-demo-template-*` debug classes (emitted by the `dbx-style-demo-debug-classes()` SCSS mixin); the
|
|
1549
|
+
* `vivid-primary` `style` lever applies an inline CSS-token override directly. The `corner-shape-*` levers share the
|
|
1550
|
+
* `'Shape'` toggle group, so only one is active at a time; `pill-controls` (`'Controls'`), `button-corner-*`
|
|
1551
|
+
* (`'Button Shape'`), `list-corner-*` (`'List Shape'`) and `anchor-list-corner-*` (`'Anchor List Shape'`) each live in
|
|
1552
|
+
* their own group so they compose on top of a corner lever instead of radio-excluding it — their debug classes are
|
|
1553
|
+
* emitted after `corner-shape-*` / `pill-controls` so they win the shape tokens they share.
|
|
1554
|
+
*/
|
|
1555
|
+
const DBX_WEB_STYLE_DEMO_TEMPLATES = [
|
|
1556
|
+
{ key: 'corner-shape-none', className: 'dbx-style-demo-template-corner-shape-none', label: 'Corners: none', curated: true },
|
|
1557
|
+
{ key: 'corner-shape-extra-small', className: 'dbx-style-demo-template-corner-shape-extra-small', label: 'Corners: extra-small', curated: true },
|
|
1558
|
+
{ key: 'corner-shape-medium', className: 'dbx-style-demo-template-corner-shape-medium', label: 'Corners: medium', curated: true },
|
|
1559
|
+
{ key: 'corner-shape-large', className: 'dbx-style-demo-template-corner-shape-large', label: 'Corners: large', curated: true },
|
|
1560
|
+
{ key: 'corner-shape-extra-large', className: 'dbx-style-demo-template-corner-shape-extra-large', label: 'Corners: extra-large', curated: true },
|
|
1561
|
+
{ key: 'pill-controls', className: 'dbx-style-demo-template-pill-controls', label: 'Pill controls', curated: true },
|
|
1562
|
+
// Button-only corner levers ('Button Shape' group) — compose on top of a corner-shape-* lever.
|
|
1563
|
+
{ key: 'button-corner-none', className: 'dbx-style-demo-template-button-corner-none', label: 'Button corners: none', curated: true },
|
|
1564
|
+
{ key: 'button-corner-extra-small', className: 'dbx-style-demo-template-button-corner-extra-small', label: 'Button corners: extra-small', curated: true },
|
|
1565
|
+
{ key: 'button-corner-medium', className: 'dbx-style-demo-template-button-corner-medium', label: 'Button corners: medium', curated: true },
|
|
1566
|
+
{ key: 'button-corner-large', className: 'dbx-style-demo-template-button-corner-large', label: 'Button corners: large', curated: true },
|
|
1567
|
+
{ key: 'button-corner-extra-large', className: 'dbx-style-demo-template-button-corner-extra-large', label: 'Button corners: extra-large', curated: true },
|
|
1568
|
+
// dbx-list-only corner levers ('List Shape' group) — re-round selection/standard + card list rows.
|
|
1569
|
+
{ key: 'list-corner-none', className: 'dbx-style-demo-template-list-corner-none', label: 'List corners: none', curated: true },
|
|
1570
|
+
{ key: 'list-corner-small', className: 'dbx-style-demo-template-list-corner-small', label: 'List corners: small', curated: true },
|
|
1571
|
+
{ key: 'list-corner-medium', className: 'dbx-style-demo-template-list-corner-medium', label: 'List corners: medium', curated: true },
|
|
1572
|
+
{ key: 'list-corner-large', className: 'dbx-style-demo-template-list-corner-large', label: 'List corners: large', curated: true },
|
|
1573
|
+
{ key: 'list-corner-extra-large', className: 'dbx-style-demo-template-list-corner-extra-large', label: 'List corners: extra-large', curated: true },
|
|
1574
|
+
// dbx-anchor-list-only corner levers ('Anchor List Shape' group) — re-round nav/anchor list rows, independent of List Shape.
|
|
1575
|
+
{ key: 'anchor-list-corner-none', className: 'dbx-style-demo-template-anchor-list-corner-none', label: 'Anchor list corners: none', curated: true },
|
|
1576
|
+
{ key: 'anchor-list-corner-small', className: 'dbx-style-demo-template-anchor-list-corner-small', label: 'Anchor list corners: small', curated: true },
|
|
1577
|
+
{ key: 'anchor-list-corner-medium', className: 'dbx-style-demo-template-anchor-list-corner-medium', label: 'Anchor list corners: medium', curated: true },
|
|
1578
|
+
{ key: 'anchor-list-corner-large', className: 'dbx-style-demo-template-anchor-list-corner-large', label: 'Anchor list corners: large', curated: true },
|
|
1579
|
+
{ key: 'anchor-list-corner-extra-large', className: 'dbx-style-demo-template-anchor-list-corner-extra-large', label: 'Anchor list corners: extra-large', curated: true },
|
|
1580
|
+
{ key: 'surface-tint', className: 'dbx-style-demo-template-surface-tint', label: 'Surface tint', curated: true },
|
|
1581
|
+
// Inline-style POJO lever — an intentional demo override value, no debug class needed.
|
|
1582
|
+
{ key: 'vivid-primary', style: { '--mat-sys-primary': '#ff0066', '--mat-sys-on-primary': '#ffffff' }, label: 'Vivid primary', curated: true }
|
|
1583
|
+
];
|
|
1584
|
+
/**
|
|
1585
|
+
* The controls levers exposed for {@link DBX_WEB_STYLE_DEMO_TEMPLATES}.
|
|
1586
|
+
*
|
|
1587
|
+
* The `corner-shape-*` levers share the `'Shape'` group (mutually exclusive); the component-scoped `button-corner-*`
|
|
1588
|
+
* (`'Button Shape'`), `list-corner-*` (`'List Shape'`) and `anchor-list-corner-*` (`'Anchor List Shape'`) levers are
|
|
1589
|
+
* mutually exclusive within their own groups but compose with `'Shape'` and `'Controls'`, letting a global corner
|
|
1590
|
+
* preset be overridden for just buttons, just `dbx-list` rows, or just `dbx-anchor-list` (nav) rows. `pill-controls`
|
|
1591
|
+
* (`'Controls'`), `surface-tint` and `vivid-primary` are independent toggles in their own groups.
|
|
1592
|
+
*/
|
|
1593
|
+
const DBX_WEB_STYLE_DEMO_TEMPLATE_TOGGLES = [
|
|
1594
|
+
{ templateName: 'corner-shape-none', label: 'Corners: none', group: 'Shape' },
|
|
1595
|
+
{ templateName: 'corner-shape-extra-small', label: 'Corners: extra-small', group: 'Shape' },
|
|
1596
|
+
{ templateName: 'corner-shape-medium', label: 'Corners: medium', group: 'Shape' },
|
|
1597
|
+
{ templateName: 'corner-shape-large', label: 'Corners: large', group: 'Shape' },
|
|
1598
|
+
{ templateName: 'corner-shape-extra-large', label: 'Corners: extra-large', group: 'Shape' },
|
|
1599
|
+
{ templateName: 'pill-controls', label: 'Pill controls', group: 'Controls' },
|
|
1600
|
+
{ templateName: 'button-corner-none', label: 'Button corners: none', group: 'Button Shape' },
|
|
1601
|
+
{ templateName: 'button-corner-extra-small', label: 'Button corners: extra-small', group: 'Button Shape' },
|
|
1602
|
+
{ templateName: 'button-corner-medium', label: 'Button corners: medium', group: 'Button Shape' },
|
|
1603
|
+
{ templateName: 'button-corner-large', label: 'Button corners: large', group: 'Button Shape' },
|
|
1604
|
+
{ templateName: 'button-corner-extra-large', label: 'Button corners: extra-large', group: 'Button Shape' },
|
|
1605
|
+
{ templateName: 'list-corner-none', label: 'List corners: none', group: 'List Shape' },
|
|
1606
|
+
{ templateName: 'list-corner-small', label: 'List corners: small', group: 'List Shape' },
|
|
1607
|
+
{ templateName: 'list-corner-medium', label: 'List corners: medium', group: 'List Shape' },
|
|
1608
|
+
{ templateName: 'list-corner-large', label: 'List corners: large', group: 'List Shape' },
|
|
1609
|
+
{ templateName: 'list-corner-extra-large', label: 'List corners: extra-large', group: 'List Shape' },
|
|
1610
|
+
{ templateName: 'anchor-list-corner-none', label: 'Anchor list corners: none', group: 'Anchor List Shape' },
|
|
1611
|
+
{ templateName: 'anchor-list-corner-small', label: 'Anchor list corners: small', group: 'Anchor List Shape' },
|
|
1612
|
+
{ templateName: 'anchor-list-corner-medium', label: 'Anchor list corners: medium', group: 'Anchor List Shape' },
|
|
1613
|
+
{ templateName: 'anchor-list-corner-large', label: 'Anchor list corners: large', group: 'Anchor List Shape' },
|
|
1614
|
+
{ templateName: 'anchor-list-corner-extra-large', label: 'Anchor list corners: extra-large', group: 'Anchor List Shape' },
|
|
1615
|
+
{ templateName: 'surface-tint', label: 'Surface tint', group: 'Surface' },
|
|
1616
|
+
{ templateName: 'vivid-primary', label: 'Vivid primary', group: 'Color' }
|
|
1617
|
+
];
|
|
1618
|
+
/**
|
|
1619
|
+
* The `@dereekb/dbx-web/style-demo` section group.
|
|
1620
|
+
*/
|
|
1621
|
+
const DBX_WEB_STYLE_DEMO_SECTION_GROUP = {
|
|
1622
|
+
libId: 'dbx-web',
|
|
1623
|
+
sections: [
|
|
1624
|
+
{ id: 'dbx-web-cards', title: 'Cards', group: 'cards', tags: ['dbx-web', 'cards', 'surface'], component: DbxStyleDemoCardsSectionComponent, defaultEnabled: true },
|
|
1625
|
+
{ id: 'dbx-web-buttons', title: 'Buttons', group: 'buttons', tags: ['dbx-web', 'button'], component: DbxStyleDemoButtonsSectionComponent, defaultEnabled: true },
|
|
1626
|
+
{ id: 'dbx-web-surfaces', title: 'Surfaces', group: 'surface', tags: ['dbx-web', 'surface'], component: DbxStyleDemoSurfacesSectionComponent, defaultEnabled: true },
|
|
1627
|
+
{ id: 'dbx-web-color-tones', title: 'Color & Tones', group: 'color', tags: ['dbx-web', 'color'], component: DbxStyleDemoColorTonesSectionComponent, defaultEnabled: true },
|
|
1628
|
+
{ id: 'dbx-web-color-templates', title: 'Color Templates', group: 'color', tags: ['dbx-web', 'color'], component: DbxStyleDemoColorTemplatesSectionComponent, defaultEnabled: true },
|
|
1629
|
+
{ id: 'dbx-web-type-roles', title: 'Type Roles', group: 'type', tags: ['dbx-web', 'type'], component: DbxStyleDemoTypeRolesSectionComponent, defaultEnabled: true },
|
|
1630
|
+
{ id: 'dbx-web-shape-scale', title: 'Shape Scale', group: 'shape', tags: ['dbx-web', 'shape'], component: DbxStyleDemoShapeScaleSectionComponent, defaultEnabled: true },
|
|
1631
|
+
{ id: 'dbx-web-navigation', title: 'Navigation', group: 'navigation', tags: ['dbx-web', 'navigation'], component: DbxStyleDemoNavigationSectionComponent, defaultEnabled: true }
|
|
1632
|
+
]
|
|
1633
|
+
};
|
|
1634
|
+
/**
|
|
1635
|
+
* Registers the `@dereekb/dbx-web/style-demo` sections and style levers with the `<dbx-style-demo>` playground.
|
|
1636
|
+
*
|
|
1637
|
+
* Contributes the web section group and template toggles via their multi-providers, and seeds the
|
|
1638
|
+
* {@link DbxStyleDemoStyleLoaderService} with the matching templates via an environment initializer.
|
|
1639
|
+
*
|
|
1640
|
+
* Pair with `provideDbxStyleDemo()` (the shell).
|
|
1641
|
+
*
|
|
1642
|
+
* @returns EnvironmentProviders contributing the web sections and levers.
|
|
1643
|
+
*
|
|
1644
|
+
* @__NO_SIDE_EFFECTS__
|
|
1645
|
+
*/
|
|
1646
|
+
function provideDbxWebStyleDemo() {
|
|
1647
|
+
const toggleProviders = DBX_WEB_STYLE_DEMO_TEMPLATE_TOGGLES.map((toggle) => ({
|
|
1648
|
+
provide: DBX_STYLE_DEMO_TEMPLATE_TOGGLE,
|
|
1649
|
+
useValue: toggle,
|
|
1650
|
+
multi: true
|
|
1651
|
+
}));
|
|
1652
|
+
return makeEnvironmentProviders([
|
|
1653
|
+
{
|
|
1654
|
+
provide: DBX_STYLE_DEMO_SECTION_GROUP,
|
|
1655
|
+
useValue: DBX_WEB_STYLE_DEMO_SECTION_GROUP,
|
|
1656
|
+
multi: true
|
|
1657
|
+
},
|
|
1658
|
+
...toggleProviders,
|
|
1659
|
+
provideEnvironmentInitializer(() => {
|
|
1660
|
+
inject(DbxStyleDemoStyleLoaderService).register(DBX_WEB_STYLE_DEMO_TEMPLATES);
|
|
1661
|
+
})
|
|
1662
|
+
]);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Provides the `<dbx-style-demo>` showcase shell: the {@link DbxStyleDemoStyleLoaderService}, the
|
|
1667
|
+
* {@link DbxStyleDemoControlsService}, and an optional seed config.
|
|
1668
|
+
*
|
|
1669
|
+
* Pair with `provideDbxWebStyleDemo()` (and the per-library plumbing providers) to register the sections and style levers.
|
|
1670
|
+
*
|
|
1671
|
+
* @param config - Optional configuration seeding the loader service with templates and toggling app-wide style forwarding.
|
|
1672
|
+
* @returns EnvironmentProviders for the showcase shell.
|
|
1673
|
+
*
|
|
1674
|
+
* @__NO_SIDE_EFFECTS__
|
|
1675
|
+
*/
|
|
1676
|
+
function provideDbxStyleDemo(config) {
|
|
1677
|
+
const providers = [DbxStyleDemoStyleLoaderService, DbxStyleDemoControlsService];
|
|
1678
|
+
if (config?.templates) {
|
|
1679
|
+
providers.push({
|
|
1680
|
+
provide: DbxStyleDemoStyleLoaderServiceConfig,
|
|
1681
|
+
useValue: { templates: config.templates }
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
if (config?.applyStylesToApp != null) {
|
|
1685
|
+
providers.push({
|
|
1686
|
+
provide: DbxStyleDemoControlsServiceConfig,
|
|
1687
|
+
useValue: { applyStylesToApp: config.applyStylesToApp }
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
return makeEnvironmentProviders(providers);
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Generated bundle index. Do not edit.
|
|
1695
|
+
*/
|
|
1696
|
+
|
|
1697
|
+
export { DBX_STYLE_DEMO_CONTROLS_COMPONENT, DBX_STYLE_DEMO_CONTROLS_DETACH_KEY, DBX_STYLE_DEMO_SECTIONS_COMPONENT, DBX_STYLE_DEMO_SECTIONS_POPOVER_KEY, DBX_STYLE_DEMO_SECTION_GROUP, DBX_STYLE_DEMO_TEMPLATE_TOGGLE, DBX_WEB_STYLE_DEMO_SECTION_GROUP, DBX_WEB_STYLE_DEMO_TEMPLATES, DBX_WEB_STYLE_DEMO_TEMPLATE_TOGGLES, DbxStyleDemoButtonsSectionComponent, DbxStyleDemoCardsSectionComponent, DbxStyleDemoColorTemplatesSectionComponent, DbxStyleDemoColorTonesSectionComponent, DbxStyleDemoComponent, DbxStyleDemoControlsService, DbxStyleDemoControlsServiceConfig, DbxStyleDemoNavigationSectionComponent, DbxStyleDemoSectionRegistry, DbxStyleDemoShapeScaleSectionComponent, DbxStyleDemoStyleLoaderDirective, DbxStyleDemoStyleLoaderService, DbxStyleDemoStyleLoaderServiceConfig, DbxStyleDemoSurfacesSectionComponent, DbxStyleDemoTypeRolesSectionComponent, groupDbxStyleDemoTemplateToggles, isDbxStyleDemoStyleLoaderConfig, isDbxStyleDemoStyleTemplate, mergeDbxStyleDemoStyleTemplates, provideDbxStyleDemo, provideDbxStyleDemoSections, provideDbxStyleDemoTemplateToggles, provideDbxWebStyleDemo };
|
|
1698
|
+
//# sourceMappingURL=dereekb-dbx-web-style-demo.mjs.map
|