dasar-ui 1.5.0 → 1.9.2
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/CHANGELOG.md +53 -0
- package/README.md +40 -34
- package/docs/_config.yml +3 -0
- package/docs/getting-started.md +89 -0
- package/docs/index.md +9 -0
- package/docs/installation.md +46 -0
- package/package.json +7 -6
- package/projects/dasar-ui/package.json +1 -1
- package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.ts +2 -2
- package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.spec.ts +8 -0
- package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.ts +2 -2
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.spec.ts +89 -0
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +23 -0
- package/projects/dasar-ui/src/lib/models/theme.model.ts +64 -0
- package/projects/dasar-ui/src/lib/services/theme.service.spec.ts +65 -0
- package/projects/dasar-ui/src/lib/services/theme.service.ts +70 -0
- package/projects/dasar-ui/src/public-api.ts +1 -0
- package/projects/documentation/src/app/app.html +33 -6
- package/projects/documentation/src/app/app.ts +36 -2
- package/projects/documentation/src/app/components/doc-customize-modal.component.ts +56 -2
- package/projects/documentation/src/app/components/doc-markdown.component.ts +154 -0
- package/projects/documentation/src/app/layouts/doc.layout.ts +23 -3
- package/projects/documentation/src/app/pages/button/button.page.html +1 -1
- package/projects/documentation/src/app/pages/chip/chip.page.html +1 -1
- package/projects/documentation/src/app/pages/getting-started/getting-started.page.ts +21 -0
- package/projects/documentation/src/app/pages/icon/icon.page.html +1 -1
- package/projects/documentation/src/app/pages/installation/installation.page.ts +18 -0
- package/projects/documentation/src/app/pages/introduction/introduction.page.ts +18 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.html +29 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.ts +33 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.html +13 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.ts +30 -0
- package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.html +5 -0
- package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.html +11 -0
- package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.ts +19 -0
- package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.html +7 -0
- package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.ts +22 -0
- package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.html +9 -0
- package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.ts +16 -0
- package/projects/documentation/src/app/pages/list/examples/size/list-size.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/size/list-size.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/list.page.html +95 -0
- package/projects/documentation/src/app/pages/list/list.page.ts +238 -0
- package/projects/documentation/src/app/pages/modal/modal.page.ts +15 -6
- package/projects/documentation/src/app/pages/table/table.page.html +1 -1
- package/projects/documentation/src/app/pages/tabs/tabs.page.ts +7 -0
- package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.html +13 -0
- package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.ts +20 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.html +8 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.scss +4 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.ts +11 -0
- package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.html +13 -0
- package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.ts +33 -0
- package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.html +6 -0
- package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.ts +20 -0
- package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.html +15 -0
- package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.ts +31 -0
- package/projects/documentation/src/app/pages/theming/theming-component-config.page.ts +52 -0
- package/projects/documentation/src/app/pages/theming/theming-css-variables.page.ts +71 -0
- package/projects/documentation/src/app/pages/theming/theming-tokens.page.ts +56 -0
- package/projects/documentation/src/app/pages/theming/theming.data.ts +947 -0
- package/projects/documentation/src/app/pages/theming/theming.page.html +56 -0
- package/projects/documentation/src/app/pages/theming/theming.page.ts +144 -0
- package/projects/documentation/src/app/routes/app.routes.ts +63 -15
- package/projects/documentation/src/app/services/doc-customize.service.ts +12 -0
- package/projects/documentation/src/styles.scss +12 -0
|
@@ -192,15 +192,17 @@ export class ModalDocPage {
|
|
|
192
192
|
},
|
|
193
193
|
{
|
|
194
194
|
name: 'overlay-blur',
|
|
195
|
-
type: 'string',
|
|
196
|
-
defaultValue:
|
|
197
|
-
description:
|
|
195
|
+
type: 'string | null',
|
|
196
|
+
defaultValue: 'null',
|
|
197
|
+
description:
|
|
198
|
+
'Backdrop blur radius, forwarded to the underlying dasar-overlay. Falls back to the --overlay-blur theme token, then 4px.',
|
|
198
199
|
},
|
|
199
200
|
{
|
|
200
201
|
name: 'overlay-background',
|
|
201
|
-
type: 'string',
|
|
202
|
-
defaultValue:
|
|
203
|
-
description:
|
|
202
|
+
type: 'string | null',
|
|
203
|
+
defaultValue: 'null',
|
|
204
|
+
description:
|
|
205
|
+
'Backdrop color, forwarded to the underlying dasar-overlay. Falls back to the --overlay-background theme token, then rgba(0, 0, 0, 0.45).',
|
|
204
206
|
},
|
|
205
207
|
{
|
|
206
208
|
name: 'fluid / ...-fluid',
|
|
@@ -247,6 +249,13 @@ export class ModalDocPage {
|
|
|
247
249
|
description:
|
|
248
250
|
'Injects footer action elements. The actions stay visible while the body scrolls.',
|
|
249
251
|
},
|
|
252
|
+
{
|
|
253
|
+
name: 'theme tokens',
|
|
254
|
+
type: 'DasarThemeModal',
|
|
255
|
+
defaultValue: '-',
|
|
256
|
+
description:
|
|
257
|
+
'Set through tokens.light.modal (or tokens.dark.modal) in DasarThemeService.setGlobalTheme, or [tokenConfig] on dasar-theme-provider. Each key writes one CSS variable, for example widthMd -> --modal-width-md.',
|
|
258
|
+
},
|
|
250
259
|
{
|
|
251
260
|
name: 'default slot',
|
|
252
261
|
type: 'Content Slot',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<docs-layout
|
|
2
2
|
title="Table"
|
|
3
|
-
description="
|
|
3
|
+
description="A data table driven by column definitions, with sorting, pagination, expandable rows, loading and empty states, and cell, header and body slots for custom content."
|
|
4
4
|
[apiData]="apiProps"
|
|
5
5
|
>
|
|
6
6
|
<doc-example-component
|
|
@@ -322,6 +322,13 @@ export class TabsDocPage {
|
|
|
322
322
|
defaultValue: '-',
|
|
323
323
|
description: 'Replaces the content of the right arrow button.',
|
|
324
324
|
},
|
|
325
|
+
{
|
|
326
|
+
name: 'theme tokens',
|
|
327
|
+
type: 'DasarThemeTabs',
|
|
328
|
+
defaultValue: '-',
|
|
329
|
+
description:
|
|
330
|
+
'Set through tokens.light.tabs (or tokens.dark.tabs) in DasarThemeService.setGlobalTheme, or [tokenConfig] on dasar-theme-provider. Each key writes one CSS variable, for example gapNormal -> --tabs-gap-normal and scrollFade -> --tabs-scroll-fade.',
|
|
331
|
+
},
|
|
325
332
|
{
|
|
326
333
|
name: '[tab-item-slot]',
|
|
327
334
|
type: 'Content Slot',
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<dasar-theme-provider [componentConfig]="componentConfig">
|
|
2
|
+
<dasar-card label="From component config">
|
|
3
|
+
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap">
|
|
4
|
+
<dasar-button variant="primary">Outline sm</dasar-button>
|
|
5
|
+
<dasar-button variant="secondary">Outline sm</dasar-button>
|
|
6
|
+
</div>
|
|
7
|
+
</dasar-card>
|
|
8
|
+
</dasar-theme-provider>
|
|
9
|
+
|
|
10
|
+
<p style="font-size: 12px; margin-top: 8px; color: gray">
|
|
11
|
+
components.button sets appearance and size. components.card sets the elevated look and compact
|
|
12
|
+
spacing. Explicit inputs on a component always win over these defaults.
|
|
13
|
+
</p>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
DasarButtonComponent,
|
|
4
|
+
DasarCardComponent,
|
|
5
|
+
DasarComponentConfig,
|
|
6
|
+
DasarThemeProviderComponent,
|
|
7
|
+
} from 'dasar-ui';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
templateUrl: './theming-component-config.example.html',
|
|
11
|
+
selector: 'app-theming-component-config-example',
|
|
12
|
+
imports: [DasarThemeProviderComponent, DasarButtonComponent, DasarCardComponent],
|
|
13
|
+
standalone: true,
|
|
14
|
+
})
|
|
15
|
+
export class ThemingComponentConfigExample {
|
|
16
|
+
protected componentConfig: DasarComponentConfig = {
|
|
17
|
+
button: { appearance: 'outline', size: 'sm' },
|
|
18
|
+
card: { appearance: 'elevated', spacing: 'compact' },
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div class="theming-override-scope">
|
|
2
|
+
<dasar-button variant="primary">Square button</dasar-button>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<p style="font-size: 12px; margin-top: 8px; color: gray">
|
|
6
|
+
The CSS tab sets --btn-radius-md to 0 inside .theming-override-scope. Only buttons in that scope
|
|
7
|
+
are affected.
|
|
8
|
+
</p>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { DasarButtonComponent } from 'dasar-ui';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
templateUrl: './theming-css-override.example.html',
|
|
6
|
+
styleUrl: './theming-css-override.example.scss',
|
|
7
|
+
selector: 'app-theming-css-override-example',
|
|
8
|
+
imports: [DasarButtonComponent],
|
|
9
|
+
standalone: true,
|
|
10
|
+
})
|
|
11
|
+
export class ThemingCssOverrideExample {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<dasar-theme-provider [componentConfig]="componentConfig" [tokenConfig]="tokenConfig">
|
|
2
|
+
<dasar-card label="Scoped theme">
|
|
3
|
+
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap">
|
|
4
|
+
<dasar-button variant="primary">Themed button</dasar-button>
|
|
5
|
+
<dasar-chip variant="primary">Themed chip</dasar-chip>
|
|
6
|
+
</div>
|
|
7
|
+
</dasar-card>
|
|
8
|
+
</dasar-theme-provider>
|
|
9
|
+
|
|
10
|
+
<p style="font-size: 12px; margin-top: 8px; color: gray">
|
|
11
|
+
tokens.light.common sets the primary color, tokens.light.button sets the md radius and the font
|
|
12
|
+
weight. Only content inside this provider is affected.
|
|
13
|
+
</p>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
DasarButtonComponent,
|
|
4
|
+
DasarCardComponent,
|
|
5
|
+
DasarChipComponent,
|
|
6
|
+
DasarComponentConfig,
|
|
7
|
+
DasarThemeConfig,
|
|
8
|
+
DasarThemeProviderComponent,
|
|
9
|
+
} from 'dasar-ui';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
templateUrl: './theming-custom-tokens.example.html',
|
|
13
|
+
selector: 'app-theming-custom-tokens-example',
|
|
14
|
+
imports: [
|
|
15
|
+
DasarThemeProviderComponent,
|
|
16
|
+
DasarButtonComponent,
|
|
17
|
+
DasarCardComponent,
|
|
18
|
+
DasarChipComponent,
|
|
19
|
+
],
|
|
20
|
+
standalone: true,
|
|
21
|
+
})
|
|
22
|
+
export class ThemingCustomTokensExample {
|
|
23
|
+
protected componentConfig: DasarComponentConfig = {
|
|
24
|
+
button: { appearance: 'solid', size: 'sm' },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
protected tokenConfig: DasarThemeConfig['tokens'] = {
|
|
28
|
+
light: {
|
|
29
|
+
common: { primaryColor: '#7c3aed' },
|
|
30
|
+
button: { radiusMd: '999px', fontWeight: '700' },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<dasar-button variant="primary">Unthemed by this example</dasar-button>
|
|
2
|
+
|
|
3
|
+
<p style="font-size: 12px; margin-top: 8px; color: gray">
|
|
4
|
+
The TypeScript tab shows setGlobalTheme. This preview is intentionally not themed, because calling
|
|
5
|
+
it here would restyle the whole docs site.
|
|
6
|
+
</p>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { DasarButtonComponent, DasarThemeService } from 'dasar-ui';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
templateUrl: './theming-global-theme.example.html',
|
|
6
|
+
selector: 'app-theming-global-theme-example',
|
|
7
|
+
imports: [DasarButtonComponent],
|
|
8
|
+
standalone: true,
|
|
9
|
+
})
|
|
10
|
+
export class ThemingGlobalThemeExample {
|
|
11
|
+
private themes = inject(DasarThemeService);
|
|
12
|
+
|
|
13
|
+
protected applyTheme() {
|
|
14
|
+
this.themes.setGlobalTheme({
|
|
15
|
+
mode: 'light',
|
|
16
|
+
components: { button: { appearance: 'solid', size: 'md' } },
|
|
17
|
+
tokens: { light: { common: { primaryColor: '#2563eb' } } },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<dasar-theme-provider [mode]="mode()" [tokenConfig]="tokenConfig">
|
|
2
|
+
<dasar-card label="Light and dark">
|
|
3
|
+
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap">
|
|
4
|
+
<dasar-button variant="primary" (click)="toggle()">
|
|
5
|
+
<span style="text-transform: capitalize">Theme: {{ mode() }}</span>
|
|
6
|
+
</dasar-button>
|
|
7
|
+
<dasar-button variant="secondary" appearance="outline">Secondary</dasar-button>
|
|
8
|
+
</div>
|
|
9
|
+
</dasar-card>
|
|
10
|
+
</dasar-theme-provider>
|
|
11
|
+
|
|
12
|
+
<p style="font-size: 12px; margin-top: 8px; color: gray">
|
|
13
|
+
The provider sets data-theme on its host and picks tokens.light or tokens.dark. Click the button
|
|
14
|
+
to switch modes.
|
|
15
|
+
</p>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Component, signal } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
DasarButtonComponent,
|
|
4
|
+
DasarCardComponent,
|
|
5
|
+
DasarThemeConfig,
|
|
6
|
+
DasarThemeMode,
|
|
7
|
+
DasarThemeProviderComponent,
|
|
8
|
+
} from 'dasar-ui';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
templateUrl: './theming-light-dark.example.html',
|
|
12
|
+
selector: 'app-theming-light-dark-example',
|
|
13
|
+
imports: [DasarThemeProviderComponent, DasarButtonComponent, DasarCardComponent],
|
|
14
|
+
standalone: true,
|
|
15
|
+
})
|
|
16
|
+
export class ThemingLightDarkExample {
|
|
17
|
+
protected mode = signal<DasarThemeMode>('light');
|
|
18
|
+
|
|
19
|
+
protected tokenConfig: DasarThemeConfig['tokens'] = {
|
|
20
|
+
light: {
|
|
21
|
+
common: { primaryColor: '#2563eb' },
|
|
22
|
+
},
|
|
23
|
+
dark: {
|
|
24
|
+
common: { primaryColor: '#60a5fa' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
protected toggle() {
|
|
29
|
+
this.mode.update((current) => (current === 'light' ? 'dark' : 'light'));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { DasarTableComponent, DasarTableColumn } from 'dasar-ui';
|
|
4
|
+
import { DocsLayoutComponent } from '../../layouts/doc.layout';
|
|
5
|
+
import { COMPONENT_CONFIG_DOCS } from './theming.data';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
imports: [CommonModule, DocsLayoutComponent, DasarTableComponent],
|
|
9
|
+
template: `<docs-layout
|
|
10
|
+
title="Component Config"
|
|
11
|
+
description="Every components.* key of DasarComponentConfig. Set them in setGlobalTheme or [componentConfig] on dasar-theme-provider. Explicit inputs on a component always win over these defaults."
|
|
12
|
+
>
|
|
13
|
+
@for (group of groups; track group.component) {
|
|
14
|
+
<h2 class="theming-group-title">components.{{ group.component }}</h2>
|
|
15
|
+
<dasar-table
|
|
16
|
+
[columns]="columns"
|
|
17
|
+
[hoverable]="true"
|
|
18
|
+
[striped]="true"
|
|
19
|
+
[data]="group.rows"
|
|
20
|
+
appearance="outline"
|
|
21
|
+
spacing="normal"
|
|
22
|
+
/>
|
|
23
|
+
}
|
|
24
|
+
</docs-layout>`,
|
|
25
|
+
styles: [
|
|
26
|
+
`
|
|
27
|
+
.theming-group-title {
|
|
28
|
+
margin: var(--space-6) 0 var(--space-3);
|
|
29
|
+
font-size: var(--font-size-lg);
|
|
30
|
+
}
|
|
31
|
+
dasar-table {
|
|
32
|
+
display: block;
|
|
33
|
+
margin-bottom: var(--space-6);
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
],
|
|
37
|
+
selector: 'app-theming-component-config-page',
|
|
38
|
+
standalone: true,
|
|
39
|
+
})
|
|
40
|
+
export class ThemingComponentConfigDocPage {
|
|
41
|
+
protected columns: DasarTableColumn[] = [
|
|
42
|
+
{ key: 'name', label: 'Property' },
|
|
43
|
+
{ key: 'type', label: 'Type' },
|
|
44
|
+
{ key: 'defaultValue', label: 'Default' },
|
|
45
|
+
{ key: 'description', label: 'Description' },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
protected groups = Object.entries(COMPONENT_CONFIG_DOCS).map(([component, rows]) => ({
|
|
49
|
+
component,
|
|
50
|
+
rows,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Component, computed, signal } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { DasarInputComponent, DasarTableComponent, DasarTableColumn } from 'dasar-ui';
|
|
5
|
+
import { DocsLayoutComponent } from '../../layouts/doc.layout';
|
|
6
|
+
import { TOKEN_ROWS } from './theming.data';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
imports: [
|
|
10
|
+
CommonModule,
|
|
11
|
+
FormsModule,
|
|
12
|
+
DocsLayoutComponent,
|
|
13
|
+
DasarTableComponent,
|
|
14
|
+
DasarInputComponent,
|
|
15
|
+
],
|
|
16
|
+
template: `<docs-layout
|
|
17
|
+
title="CSS Variables"
|
|
18
|
+
description="Flat list of every CSS variable the library reads, with the component and token behind it. Override any of them in plain CSS."
|
|
19
|
+
>
|
|
20
|
+
<dasar-input
|
|
21
|
+
label="Search variables"
|
|
22
|
+
placeholder="For example --btn- or --list-"
|
|
23
|
+
[ngModel]="query()"
|
|
24
|
+
(ngModelChange)="query.set($event)"
|
|
25
|
+
/>
|
|
26
|
+
<p class="theming-count">{{ rows().length }} variables</p>
|
|
27
|
+
<dasar-table
|
|
28
|
+
[columns]="columns"
|
|
29
|
+
[hoverable]="true"
|
|
30
|
+
[striped]="true"
|
|
31
|
+
[data]="rows()"
|
|
32
|
+
appearance="outline"
|
|
33
|
+
spacing="normal"
|
|
34
|
+
/>
|
|
35
|
+
</docs-layout>`,
|
|
36
|
+
styles: [
|
|
37
|
+
`
|
|
38
|
+
.theming-count {
|
|
39
|
+
font-size: var(--font-size-sm);
|
|
40
|
+
color: var(--theme-text-secondary-color);
|
|
41
|
+
}
|
|
42
|
+
dasar-table {
|
|
43
|
+
display: block;
|
|
44
|
+
margin-top: var(--space-4);
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
],
|
|
48
|
+
selector: 'app-theming-css-variables-page',
|
|
49
|
+
standalone: true,
|
|
50
|
+
})
|
|
51
|
+
export class ThemingCssVariablesDocPage {
|
|
52
|
+
protected query = signal('');
|
|
53
|
+
|
|
54
|
+
protected columns: DasarTableColumn[] = [
|
|
55
|
+
{ key: 'cssVar', label: 'CSS variable' },
|
|
56
|
+
{ key: 'component', label: 'Component' },
|
|
57
|
+
{ key: 'token', label: 'Token key' },
|
|
58
|
+
{ key: 'path', label: 'Config path' },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
protected rows = computed(() => {
|
|
62
|
+
const q = this.query().trim().toLowerCase();
|
|
63
|
+
if (!q) return TOKEN_ROWS;
|
|
64
|
+
return TOKEN_ROWS.filter(
|
|
65
|
+
(row) =>
|
|
66
|
+
row.cssVar.toLowerCase().includes(q) ||
|
|
67
|
+
row.token.toLowerCase().includes(q) ||
|
|
68
|
+
row.component.toLowerCase().includes(q),
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { DasarTableComponent, DasarTableColumn } from 'dasar-ui';
|
|
4
|
+
import { DocsLayoutComponent } from '../../layouts/doc.layout';
|
|
5
|
+
import { TOKEN_GROUPS } from './theming.data';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
imports: [CommonModule, DocsLayoutComponent, DasarTableComponent],
|
|
9
|
+
template: `<docs-layout
|
|
10
|
+
title="Theme Tokens"
|
|
11
|
+
description="Every token key, the CSS variable it writes, and the config path that sets it. Use tokens.light.<component> or tokens.dark.<component> in setGlobalTheme or [tokenConfig]."
|
|
12
|
+
>
|
|
13
|
+
@for (group of groups; track group.component) {
|
|
14
|
+
<h2 class="theming-group-title">{{ group.component }}</h2>
|
|
15
|
+
<p class="theming-group-path">{{ group.path }}</p>
|
|
16
|
+
<dasar-table
|
|
17
|
+
[columns]="columns"
|
|
18
|
+
[hoverable]="true"
|
|
19
|
+
[striped]="true"
|
|
20
|
+
[data]="group.rows"
|
|
21
|
+
appearance="outline"
|
|
22
|
+
spacing="normal"
|
|
23
|
+
/>
|
|
24
|
+
}
|
|
25
|
+
</docs-layout>`,
|
|
26
|
+
styles: [
|
|
27
|
+
`
|
|
28
|
+
.theming-group-title {
|
|
29
|
+
text-transform: capitalize;
|
|
30
|
+
margin: var(--space-6) 0 0;
|
|
31
|
+
}
|
|
32
|
+
.theming-group-path {
|
|
33
|
+
font-size: var(--font-size-sm);
|
|
34
|
+
color: var(--theme-text-secondary-color);
|
|
35
|
+
}
|
|
36
|
+
dasar-table {
|
|
37
|
+
display: block;
|
|
38
|
+
margin-bottom: var(--space-6);
|
|
39
|
+
}
|
|
40
|
+
`,
|
|
41
|
+
],
|
|
42
|
+
selector: 'app-theming-tokens-page',
|
|
43
|
+
standalone: true,
|
|
44
|
+
})
|
|
45
|
+
export class ThemingTokensDocPage {
|
|
46
|
+
protected columns: DasarTableColumn[] = [
|
|
47
|
+
{ key: 'token', label: 'Token key' },
|
|
48
|
+
{ key: 'cssVar', label: 'CSS variable' },
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
protected groups = TOKEN_GROUPS.map((group) => ({
|
|
52
|
+
component: group.component,
|
|
53
|
+
path: group.path,
|
|
54
|
+
rows: Object.entries(group.map).map(([token, cssVar]) => ({ token, cssVar })),
|
|
55
|
+
}));
|
|
56
|
+
}
|