shirkasoft-ui-components 2.0.1 → 2.1.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/README.md +201 -52
- package/fesm2022/shirkasoft-ui-components-config.mjs +610 -72
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +6 -6
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +11 -0
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +262 -165
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +2 -24
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shirkasoft-ui-components-config.d.ts +246 -20
- package/types/shirkasoft-ui-components-icons.d.ts +6 -6
- package/types/shirkasoft-ui-components-theme-picker.d.ts +40 -12
- package/types/shirkasoft-ui-components-theme.d.ts +17 -9
|
@@ -383,7 +383,7 @@ export declare const ICON_NODES: {
|
|
|
383
383
|
readonly cy: "12";
|
|
384
384
|
readonly r: "10";
|
|
385
385
|
}], readonly ["path", {
|
|
386
|
-
readonly d: "M9 9.5a3 2.5 0
|
|
386
|
+
readonly d: "M9 9.5a3 2.5 0 0 1 6 0c0 2-2 2-3 3.5";
|
|
387
387
|
}], readonly ["path", {
|
|
388
388
|
readonly d: "M12 17h.01";
|
|
389
389
|
}]];
|
|
@@ -471,7 +471,7 @@ export declare const ICON_NODES: {
|
|
|
471
471
|
readonly LucideDollarSign: readonly [readonly ["path", {
|
|
472
472
|
readonly d: "M12 3v18";
|
|
473
473
|
}], readonly ["path", {
|
|
474
|
-
readonly d: "M17 5H9.5a1 1 0
|
|
474
|
+
readonly d: "M17 5H9.5a1 1 0 0 0 0 7h5a1 1 0 0 1 0 7H6";
|
|
475
475
|
}]];
|
|
476
476
|
/** download */
|
|
477
477
|
readonly LucideDownload: readonly [readonly ["path", {
|
|
@@ -505,7 +505,7 @@ export declare const ICON_NODES: {
|
|
|
505
505
|
}]];
|
|
506
506
|
/** eye-off */
|
|
507
507
|
readonly LucideEyeOff: readonly [readonly ["path", {
|
|
508
|
-
readonly d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.
|
|
508
|
+
readonly d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.8 10.8 0 0 1-1.444 2.49";
|
|
509
509
|
}], readonly ["path", {
|
|
510
510
|
readonly d: "M14.084 14.158a3 3 0 0 1-4.242-4.242";
|
|
511
511
|
}], readonly ["path", {
|
|
@@ -980,9 +980,9 @@ export declare const ICON_NODES: {
|
|
|
980
980
|
}], readonly ["path", {
|
|
981
981
|
readonly d: "M12 9.189V13";
|
|
982
982
|
}], readonly ["path", {
|
|
983
|
-
readonly d: "M19 12V6a2 2 0
|
|
983
|
+
readonly d: "M19 12V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6";
|
|
984
984
|
}], readonly ["path", {
|
|
985
|
-
readonly d: "M19.38 19A11.6 11.6 0
|
|
985
|
+
readonly d: "M19.38 19A11.6 11.6 0 0 0 21 13l-8.188-3.639a2 2 0 0 0-1.624 0L3 13.001a11.6 11.6 0 0 0 2.81 7.76";
|
|
986
986
|
}], readonly ["path", {
|
|
987
987
|
readonly d: "M2 20c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1";
|
|
988
988
|
}]];
|
|
@@ -1032,7 +1032,7 @@ export declare const ICON_NODES: {
|
|
|
1032
1032
|
}]];
|
|
1033
1033
|
/** star */
|
|
1034
1034
|
readonly LucideStar: readonly [readonly ["path", {
|
|
1035
|
-
readonly d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.
|
|
1035
|
+
readonly d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z";
|
|
1036
1036
|
}]];
|
|
1037
1037
|
/** table */
|
|
1038
1038
|
readonly LucideTable: readonly [readonly ["path", {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
|
+
import { ShkThemePreset } from "shirkasoft-ui-components/config";
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Shirkasoft UI Components.
|
|
@@ -11,8 +12,10 @@ import * as i0 from "@angular/core";
|
|
|
11
12
|
interface ShkPickerColor {
|
|
12
13
|
/** Hex color; it becomes `--shk-primary-600` (`theme.primary`). */
|
|
13
14
|
color: string;
|
|
14
|
-
/** Accessible name / tooltip. */
|
|
15
|
+
/** Accessible name / tooltip (English fallback). */
|
|
15
16
|
label: string;
|
|
17
|
+
/** Translation key of the label. */
|
|
18
|
+
labelKey?: string;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* Default primary colors (Tailwind 600 shades). Red and rose are left out on
|
|
@@ -20,19 +23,27 @@ interface ShkPickerColor {
|
|
|
20
23
|
*/
|
|
21
24
|
export declare const DEFAULT_PRIMARY_COLORS: readonly ShkPickerColor[];
|
|
22
25
|
/**
|
|
23
|
-
* Theme customizer: a palette button that opens a panel to pick
|
|
24
|
-
* color
|
|
26
|
+
* Theme customizer: a palette button that opens a panel to pick a theme preset,
|
|
27
|
+
* the primary color and the surface (neutral) palette at runtime.
|
|
25
28
|
*
|
|
26
|
-
* It edits the `theme.
|
|
27
|
-
* needs `provideShk(withTheme(...))
|
|
28
|
-
* choice. Without `withTheme()` it renders nothing.
|
|
29
|
+
* It edits the `theme.name`, `theme.primary` and `theme.surface` options, so it
|
|
30
|
+
* needs `provideShk(withTheme(...))`. Without `withTheme()` it renders nothing.
|
|
29
31
|
*
|
|
30
32
|
* ```html
|
|
33
|
+
* <!-- User preference (device layer) -->
|
|
31
34
|
* <shk-theme-picker />
|
|
35
|
+
*
|
|
36
|
+
* <!-- Embedded in a settings screen (admin preview writes the draft) -->
|
|
37
|
+
* <shk-theme-picker [inline]="true" />
|
|
32
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* While `ShkConfigSync.preview()` is active every write goes to the draft, so
|
|
41
|
+
* the same component serves the user and the admin without knowing about
|
|
42
|
+
* layers.
|
|
33
43
|
*/
|
|
34
44
|
export declare class ThemePickerComponent {
|
|
35
45
|
private readonly config;
|
|
46
|
+
private readonly labels;
|
|
36
47
|
private readonly host;
|
|
37
48
|
private readonly trigger;
|
|
38
49
|
/** Primary colors offered. */
|
|
@@ -41,23 +52,29 @@ export declare class ThemePickerComponent {
|
|
|
41
52
|
readonly showSurface: import("@angular/core").InputSignal<boolean>;
|
|
42
53
|
/** Shows the theme presets section (needs more than one preset). */
|
|
43
54
|
readonly showPresets: import("@angular/core").InputSignal<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
55
|
+
/** Renders the panel inline (no button, no popover) to embed it in a page. */
|
|
56
|
+
readonly inline: import("@angular/core").InputSignal<boolean>;
|
|
57
|
+
/** Accessible name and tooltip of the button. Defaults to the translated label. */
|
|
58
|
+
readonly triggerLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
59
|
+
readonly primaryLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
60
|
+
readonly surfaceLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
61
|
+
readonly presetsLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
49
62
|
/** `theme.*` options exist only when the app uses `withTheme()`. */
|
|
50
63
|
protected readonly available: boolean;
|
|
51
64
|
protected readonly open: import("@angular/core").WritableSignal<boolean>;
|
|
52
65
|
protected readonly panelId: string;
|
|
53
66
|
protected readonly paletteIcon: import("shirkasoft-ui-components/icons").IconNode | null;
|
|
54
|
-
protected readonly presets: readonly
|
|
67
|
+
protected readonly presets: readonly ShkThemePreset[];
|
|
55
68
|
/** Surface palettes, each shown with its 500 shade. */
|
|
56
69
|
protected readonly surfaces: {
|
|
57
70
|
name: string;
|
|
58
71
|
label: string;
|
|
59
72
|
color: string;
|
|
60
73
|
}[];
|
|
74
|
+
protected readonly triggerText: import("@angular/core").Signal<string>;
|
|
75
|
+
protected readonly primaryText: import("@angular/core").Signal<string>;
|
|
76
|
+
protected readonly surfaceText: import("@angular/core").Signal<string>;
|
|
77
|
+
protected readonly presetsText: import("@angular/core").Signal<string>;
|
|
61
78
|
protected readonly themeName: import("@angular/core").Signal<string>;
|
|
62
79
|
private readonly currentPreset;
|
|
63
80
|
private readonly primaryOverride;
|
|
@@ -68,6 +85,12 @@ export declare class ThemePickerComponent {
|
|
|
68
85
|
protected readonly activeSurface: import("@angular/core").Signal<string>;
|
|
69
86
|
/** True while no primary/surface override is applied on top of the preset. */
|
|
70
87
|
protected readonly isPresetPure: import("@angular/core").Signal<boolean>;
|
|
88
|
+
/** Translated name of a preset. */
|
|
89
|
+
protected presetLabel(preset: ShkThemePreset): string;
|
|
90
|
+
/** Translated name of a primary color. */
|
|
91
|
+
protected colorLabel(item: ShkPickerColor): string;
|
|
92
|
+
/** Translated name of a surface palette. */
|
|
93
|
+
protected surfaceName(name: string): string;
|
|
71
94
|
protected toggle(): void;
|
|
72
95
|
protected setPrimary(color: string): void;
|
|
73
96
|
protected setSurface(name: string): void;
|
|
@@ -92,6 +115,11 @@ export declare class ThemePickerComponent {
|
|
|
92
115
|
"required": false;
|
|
93
116
|
"isSignal": true;
|
|
94
117
|
};
|
|
118
|
+
"inline": {
|
|
119
|
+
"alias": "inline";
|
|
120
|
+
"required": false;
|
|
121
|
+
"isSignal": true;
|
|
122
|
+
};
|
|
95
123
|
"triggerLabel": {
|
|
96
124
|
"alias": "triggerLabel";
|
|
97
125
|
"required": false;
|
|
@@ -12,10 +12,17 @@ interface ShkThemeConfig {
|
|
|
12
12
|
defaultTheme?: ShkThemeName;
|
|
13
13
|
/** Scheme applied when nothing is stored yet. Defaults to `system`. */
|
|
14
14
|
defaultScheme?: ShkColorScheme;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated The selection is stored by `ShkConfigService`
|
|
17
|
+
* (`provideShk(withTheme())`). Kept so `provideShkTheme()` keeps compiling.
|
|
18
|
+
*/
|
|
16
19
|
persist?: boolean;
|
|
17
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Only read once to migrate a pre-2.1 selection into the
|
|
22
|
+
* registry (`shk-config`).
|
|
23
|
+
*/
|
|
18
24
|
storageKey?: string;
|
|
25
|
+
/** @deprecated Only read once, like {@link storageKey}. */
|
|
19
26
|
schemeStorageKey?: string;
|
|
20
27
|
/** Attribute written on <html>. Defaults to `data-shk-theme`. */
|
|
21
28
|
attribute?: string;
|
|
@@ -38,10 +45,14 @@ export declare const SHK_THEME_CONFIG: InjectionToken<Required<ShkThemeConfig>>;
|
|
|
38
45
|
*/
|
|
39
46
|
export declare function provideShkTheme(config?: ShkThemeConfig): EnvironmentProviders;
|
|
40
47
|
/**
|
|
41
|
-
* Applies
|
|
48
|
+
* Applies the color theme.
|
|
42
49
|
*
|
|
43
50
|
* Themes are plain CSS custom properties, so switching a theme is just an
|
|
44
51
|
* attribute change on `<html>` — no component re-render involved.
|
|
52
|
+
*
|
|
53
|
+
* The service only *applies*: `theme.name` and `theme.scheme` are options of
|
|
54
|
+
* `ShkConfigService`, which owns the value and its persistence (device layer,
|
|
55
|
+
* shared layer or an admin preview). `withTheme()` connects both.
|
|
45
56
|
*/
|
|
46
57
|
export declare class ShkThemeService {
|
|
47
58
|
private readonly doc;
|
|
@@ -49,9 +60,9 @@ export declare class ShkThemeService {
|
|
|
49
60
|
private readonly win;
|
|
50
61
|
/** Every theme name the service knows about. */
|
|
51
62
|
readonly availableThemes: readonly ShkThemeName[];
|
|
52
|
-
/** Currently
|
|
63
|
+
/** Currently applied theme. */
|
|
53
64
|
readonly theme: import("@angular/core").WritableSignal<ShkThemeName>;
|
|
54
|
-
/** Currently
|
|
65
|
+
/** Currently applied scheme (`light`, `dark` or `system`). */
|
|
55
66
|
readonly scheme: import("@angular/core").WritableSignal<ShkColorScheme>;
|
|
56
67
|
/** `true` when dark colors are being applied. */
|
|
57
68
|
readonly isDark: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -65,15 +76,12 @@ export declare class ShkThemeService {
|
|
|
65
76
|
setScheme(scheme: ShkColorScheme): void;
|
|
66
77
|
/** Flips between light and dark (leaves `system` on the opposite value). */
|
|
67
78
|
toggleDark(): void;
|
|
68
|
-
/** Applies a theme without
|
|
79
|
+
/** Applies a theme without changing the stored value (useful for previews). */
|
|
69
80
|
previewTheme(theme: ShkThemeName): void;
|
|
70
|
-
private restore;
|
|
71
81
|
private applyTheme;
|
|
72
82
|
private applyScheme;
|
|
73
83
|
private watchSystem;
|
|
74
84
|
private prefersDark;
|
|
75
|
-
private read;
|
|
76
|
-
private persist;
|
|
77
85
|
static ɵfac: i0.ɵɵFactoryDeclaration<ShkThemeService, never>;
|
|
78
86
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
79
87
|
}
|