shirkasoft-ui-components 1.14.0 → 2.0.1
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 +12 -9
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1697 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +555 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +585 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1076 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +749 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +129 -133
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +561 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +210 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +232 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +335 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +263 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +47 -15
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { EnvironmentProviders, InjectionToken, Provider, Signal } from "@angular/core";
|
|
6
|
+
import { ShkThemeConfig } from "shirkasoft-ui-components/theme";
|
|
5
7
|
/**
|
|
6
8
|
* Shirkasoft UI Components.
|
|
7
9
|
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
@@ -11,8 +13,8 @@ import { ShkThemeConfig } from 'shirkasoft-ui-components/theme';
|
|
|
11
13
|
type ShkOptionType = 'string' | 'number' | 'boolean' | 'select' | 'color';
|
|
12
14
|
/** One allowed value of a `select` option. */
|
|
13
15
|
interface ShkOptionChoice<T = unknown> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
value: T;
|
|
17
|
+
label: string;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Definition of a configurable option (an entry of the options registry).
|
|
@@ -21,95 +23,94 @@ interface ShkOptionChoice<T = unknown> {
|
|
|
21
23
|
* theirs with `withOptions([...])` or `ShkConfigService.register()`.
|
|
22
24
|
*/
|
|
23
25
|
interface ShkOptionDef<T = unknown> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
/** Unique key, conventionally `module.name` (e.g. `dates.format`). */
|
|
27
|
+
key: string;
|
|
28
|
+
/** Group the option belongs to (e.g. `dates`); used to list options by module. */
|
|
29
|
+
module: string;
|
|
30
|
+
type: ShkOptionType;
|
|
31
|
+
/** Value used until the option is set (or after `reset`). */
|
|
32
|
+
default: T;
|
|
33
|
+
/** Human-readable name for a settings screen. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Longer help text for a settings screen. */
|
|
36
|
+
description?: string;
|
|
37
|
+
/** Allowed values for `select` options. */
|
|
38
|
+
choices?: readonly ShkOptionChoice<T>[];
|
|
39
|
+
/**
|
|
40
|
+
* `select` options only: also accept values outside `choices` (the choices
|
|
41
|
+
* are then suggestions, e.g. any BCP 47 locale or ISO currency code).
|
|
42
|
+
*/
|
|
43
|
+
allowCustom?: boolean;
|
|
44
|
+
/** Lower bound for `number` options. */
|
|
45
|
+
min?: number;
|
|
46
|
+
/** Upper bound for `number` options. */
|
|
47
|
+
max?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Whether `withPersistence()` stores this option. Defaults to `true`.
|
|
50
|
+
* Options persisted elsewhere (e.g. the theme service) set it to `false`.
|
|
51
|
+
*/
|
|
52
|
+
persist?: boolean;
|
|
51
53
|
}
|
|
52
54
|
/** An option as listed by `ShkConfigService.options()`: its definition plus its current value. */
|
|
53
55
|
interface ShkOptionEntry<T = unknown> extends ShkOptionDef<T> {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
value: T;
|
|
57
|
+
/** True when the current value equals the default. */
|
|
58
|
+
isDefault: boolean;
|
|
57
59
|
}
|
|
58
60
|
/** How the date picker shows the selected date when the field is not being edited. */
|
|
59
61
|
type ShkDateDisplayStyle = 'long' | 'medium' | 'short' | 'format';
|
|
60
62
|
/** Values of the options the library registers, by key (gives typed `get`/`set`). */
|
|
61
63
|
interface ShkConfigValues {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
/** BCP 47 locale for month/day names (e.g. `es`, `en-US`). */
|
|
65
|
+
'dates.locale': string;
|
|
66
|
+
/**
|
|
67
|
+
* Date pattern (`dd/MM/yyyy`, `yyyy-MM-dd`, `d MMM yyyy`…). Empty = automatic:
|
|
68
|
+
* `MM/dd/yyyy` for English locales, `dd/MM/yyyy` otherwise.
|
|
69
|
+
*/
|
|
70
|
+
'dates.format': string;
|
|
71
|
+
'dates.displayStyle': ShkDateDisplayStyle;
|
|
72
|
+
'dates.hourFormat': '12' | '24';
|
|
73
|
+
/** First day of the week (0 = Sunday … 6 = Saturday); `null` = from the locale. */
|
|
74
|
+
'dates.weekStart': number | null;
|
|
75
|
+
/** BCP 47 locale for number grouping/decimal separators. */
|
|
76
|
+
'numbers.locale': string;
|
|
77
|
+
/** ISO 4217 currency code (e.g. `USD`, `EUR`, `CUP`). */
|
|
78
|
+
'numbers.currency': string;
|
|
79
|
+
/** Symbol shown by money inputs. Empty = derived from the currency (`$`, `€`…). */
|
|
80
|
+
'numbers.currencySymbol': string;
|
|
81
|
+
/** Decimal places for money amounts; `null` = the currency's own (2 for USD, 0 for JPY). */
|
|
82
|
+
'numbers.decimals': number | null;
|
|
83
|
+
/** Active theme pack (built-in or registered with `withTheme({ themes })`). */
|
|
84
|
+
'theme.name': string;
|
|
85
|
+
'theme.scheme': 'light' | 'dark' | 'system';
|
|
86
|
+
/** Primary color override applied on top of the theme. Empty = the theme's own. */
|
|
87
|
+
'theme.primary': string;
|
|
88
|
+
/** Neutral palette override (`slate`, `gray`, `zinc`, `neutral`, `stone`). Empty = the theme's own. */
|
|
89
|
+
'theme.surface': string;
|
|
88
90
|
}
|
|
89
91
|
type ShkConfigKey = keyof ShkConfigValues;
|
|
90
|
-
|
|
91
92
|
/** What a `with*()` feature contributes to the registry. */
|
|
92
93
|
interface ShkConfigFeature {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
/** Extra option definitions to register. */
|
|
95
|
+
options?: readonly ShkOptionDef[];
|
|
96
|
+
/** App-level defaults for registered options (what `reset` returns to). */
|
|
97
|
+
defaults?: Readonly<Record<string, unknown>>;
|
|
97
98
|
}
|
|
98
99
|
/** Features collected from `provideShk(...)`. */
|
|
99
|
-
declare const SHK_CONFIG_FEATURES: InjectionToken<readonly ShkConfigFeature[]>;
|
|
100
|
+
export declare const SHK_CONFIG_FEATURES: InjectionToken<readonly ShkConfigFeature[]>;
|
|
100
101
|
/** Storage settings enabled by `withPersistence()`. */
|
|
101
102
|
interface ShkConfigPersistence {
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
/** localStorage key. Defaults to `shk-config`. */
|
|
104
|
+
storageKey: string;
|
|
104
105
|
}
|
|
105
|
-
declare const SHK_CONFIG_PERSISTENCE: InjectionToken<ShkConfigPersistence>;
|
|
106
|
+
export declare const SHK_CONFIG_PERSISTENCE: InjectionToken<ShkConfigPersistence>;
|
|
106
107
|
/**
|
|
107
108
|
* Value held outside the registry (e.g. by `ShkThemeService`). The registry
|
|
108
109
|
* reads and writes through it, so both stay in sync.
|
|
109
110
|
*/
|
|
110
111
|
interface ShkOptionSource<T = unknown> {
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
value: Signal<T>;
|
|
113
|
+
set(value: T): void;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Registry of the library's configurable options ("nomenclador" de opciones).
|
|
@@ -125,62 +126,61 @@ interface ShkOptionSource<T = unknown> {
|
|
|
125
126
|
* config.options(); // definitions + current values
|
|
126
127
|
* ```
|
|
127
128
|
*/
|
|
128
|
-
declare class ShkConfigService {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
129
|
+
export declare class ShkConfigService {
|
|
130
|
+
private readonly win;
|
|
131
|
+
private readonly persistence;
|
|
132
|
+
/** Registered definitions, by key. */
|
|
133
|
+
private readonly defs;
|
|
134
|
+
/** Values set explicitly (anything else falls back to the definition's default). */
|
|
135
|
+
private readonly values;
|
|
136
|
+
/** Options whose value lives elsewhere. */
|
|
137
|
+
private readonly sources;
|
|
138
|
+
/** Stored values whose option is not registered yet; applied on `register`. */
|
|
139
|
+
private pending;
|
|
140
|
+
/** Cached per-key signals returned by `get`. */
|
|
141
|
+
private readonly cache;
|
|
142
|
+
/** Every registered option with its current value, in registration order. */
|
|
143
|
+
readonly options: Signal<ShkOptionEntry[]>;
|
|
144
|
+
/** Module names in registration order (`dates`, `numbers`, `theme`, …). */
|
|
145
|
+
readonly modules: Signal<string[]>;
|
|
146
|
+
constructor();
|
|
147
|
+
/** Current value of an option as a signal. Throws for unknown keys. */
|
|
148
|
+
get<K extends ShkConfigKey>(key: K): Signal<ShkConfigValues[K]>;
|
|
149
|
+
get<T = unknown>(key: string): Signal<T>;
|
|
150
|
+
/** Whether an option is registered (e.g. `theme.*` only exists with `withTheme()`). */
|
|
151
|
+
has(key: string): boolean;
|
|
152
|
+
/** Current value of an option (non-reactive read). */
|
|
153
|
+
value<K extends ShkConfigKey>(key: K): ShkConfigValues[K];
|
|
154
|
+
value<T = unknown>(key: string): T;
|
|
155
|
+
/**
|
|
156
|
+
* Sets an option. The value is validated against the definition (type,
|
|
157
|
+
* choices, bounds); an invalid value throws and changes nothing.
|
|
158
|
+
*/
|
|
159
|
+
set<K extends ShkConfigKey>(key: K, value: ShkConfigValues[K]): void;
|
|
160
|
+
set(key: string, value: unknown): void;
|
|
161
|
+
/** Restores one option (or all of them) to its default. */
|
|
162
|
+
reset(key?: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* Adds option definitions (or replaces existing ones with the same key).
|
|
165
|
+
* Stored values for them are applied if they are still valid.
|
|
166
|
+
*/
|
|
167
|
+
register(defs: readonly ShkOptionDef[]): void;
|
|
168
|
+
/**
|
|
169
|
+
* Binds an option to a value held elsewhere (used by `withTheme()` to share
|
|
170
|
+
* `theme.name`/`theme.scheme` with `ShkThemeService`).
|
|
171
|
+
*/
|
|
172
|
+
bind<T>(key: string, source: ShkOptionSource<T>): void;
|
|
173
|
+
/** Changes the defaults of registered options (`reset` returns to these). */
|
|
174
|
+
private setDefaults;
|
|
175
|
+
private read;
|
|
176
|
+
private requireDef;
|
|
177
|
+
/** Returns the value coerced to the option's type, or throws if it is not acceptable. */
|
|
178
|
+
private validate;
|
|
179
|
+
private loadStored;
|
|
180
|
+
private save;
|
|
181
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ShkConfigService, never>;
|
|
182
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
182
183
|
}
|
|
183
|
-
|
|
184
184
|
/**
|
|
185
185
|
* Shirkasoft UI Components.
|
|
186
186
|
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
@@ -191,42 +191,41 @@ declare class ShkConfigService {
|
|
|
191
191
|
*/
|
|
192
192
|
/** A theme registered with `withTheme({ themes })`. */
|
|
193
193
|
interface ShkCustomTheme {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
/** Main brand color (hex). It becomes `--shk-primary-600`, the shade buttons use. */
|
|
195
|
+
primary: string;
|
|
196
|
+
/** Name shown in settings screens. Defaults to the theme key. */
|
|
197
|
+
label?: string;
|
|
198
|
+
/** Extra CSS custom properties for the theme, e.g. `{ '--shk-surface-50': '#f8fafc' }`. */
|
|
199
|
+
vars?: Readonly<Record<`--shk-${string}`, string>>;
|
|
200
200
|
}
|
|
201
201
|
/** `--shk-primary-50` … `--shk-primary-950` (and the accent vars) derived from one color. */
|
|
202
|
-
declare function primaryScale(color: string): Record<string, string>;
|
|
202
|
+
export declare function primaryScale(color: string): Record<string, string>;
|
|
203
203
|
/** Neutral palettes for `theme.surface` (Tailwind scales, 50 … 900). */
|
|
204
|
-
declare const SURFACE_PALETTES: Readonly<Record<string, {
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
export declare const SURFACE_PALETTES: Readonly<Record<string, {
|
|
205
|
+
label: string;
|
|
206
|
+
scale: readonly string[];
|
|
207
207
|
}>>;
|
|
208
208
|
/** A selectable combination shown as a preset: a theme pack and its colors. */
|
|
209
209
|
interface ShkThemePreset {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
/** Theme name (`theme.name`). */
|
|
211
|
+
name: string;
|
|
212
|
+
label: string;
|
|
213
|
+
/** Its primary color (`--shk-primary-600`). */
|
|
214
|
+
primary: string;
|
|
215
|
+
/** Its surface palette (a `SURFACE_PALETTES` key), or '' when it has its own. */
|
|
216
|
+
surface: string;
|
|
217
217
|
}
|
|
218
218
|
/** The built-in theme packs as presets. */
|
|
219
|
-
declare const BUILT_IN_PRESETS: readonly ShkThemePreset[];
|
|
220
|
-
|
|
219
|
+
export declare const BUILT_IN_PRESETS: readonly ShkThemePreset[];
|
|
221
220
|
/**
|
|
222
221
|
* Theme packs offered as presets (built-in + `withTheme({ themes })`), with the
|
|
223
222
|
* primary color and surface each one uses. Read by `shk-theme-picker`.
|
|
224
223
|
*/
|
|
225
|
-
declare const SHK_THEME_PRESETS: InjectionToken<readonly ShkThemePreset[]>;
|
|
224
|
+
export declare const SHK_THEME_PRESETS: InjectionToken<readonly ShkThemePreset[]>;
|
|
226
225
|
/** A configuration module passed to `provideShk()`. */
|
|
227
226
|
interface ShkFeature {
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
/** @internal */
|
|
228
|
+
readonly ɵproviders: (Provider | EnvironmentProviders)[];
|
|
230
229
|
}
|
|
231
230
|
/**
|
|
232
231
|
* Configures the library. Every module is optional; component inputs still
|
|
@@ -245,37 +244,37 @@ interface ShkFeature {
|
|
|
245
244
|
* });
|
|
246
245
|
* ```
|
|
247
246
|
*/
|
|
248
|
-
declare function provideShk(...features: ShkFeature[]): EnvironmentProviders;
|
|
247
|
+
export declare function provideShk(...features: ShkFeature[]): EnvironmentProviders;
|
|
249
248
|
/** App defaults for the date options (`dates.*`). */
|
|
250
249
|
interface ShkDatesConfig {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
250
|
+
locale?: ShkConfigValues['dates.locale'];
|
|
251
|
+
format?: ShkConfigValues['dates.format'];
|
|
252
|
+
displayStyle?: ShkConfigValues['dates.displayStyle'];
|
|
253
|
+
hourFormat?: ShkConfigValues['dates.hourFormat'];
|
|
254
|
+
weekStart?: ShkConfigValues['dates.weekStart'];
|
|
256
255
|
}
|
|
257
256
|
/** Date module: locale, pattern, display style, 12/24 h and first day of the week. */
|
|
258
|
-
declare function withDates(config: ShkDatesConfig): ShkFeature;
|
|
257
|
+
export declare function withDates(config: ShkDatesConfig): ShkFeature;
|
|
259
258
|
/** App defaults for the number and currency options (`numbers.*`). */
|
|
260
259
|
interface ShkNumbersConfig {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
locale?: ShkConfigValues['numbers.locale'];
|
|
261
|
+
currency?: ShkConfigValues['numbers.currency'];
|
|
262
|
+
currencySymbol?: ShkConfigValues['numbers.currencySymbol'];
|
|
263
|
+
decimals?: ShkConfigValues['numbers.decimals'];
|
|
265
264
|
}
|
|
266
265
|
/** Number module: separators locale, currency, currency symbol and decimals. */
|
|
267
|
-
declare function withNumbers(config: ShkNumbersConfig): ShkFeature;
|
|
266
|
+
export declare function withNumbers(config: ShkNumbersConfig): ShkFeature;
|
|
268
267
|
/** Theme module settings. */
|
|
269
268
|
interface ShkThemeModuleConfig extends ShkThemeConfig {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Extra themes generated from one color: `{ marca: '#2563eb' }` or
|
|
271
|
+
* `{ marca: { primary: '#2563eb', label: 'Marca', vars: { … } } }`.
|
|
272
|
+
*/
|
|
273
|
+
themes?: Readonly<Record<string, string | ShkCustomTheme>>;
|
|
274
|
+
/** Primary color applied on top of any theme (`theme.primary`). Empty = none. */
|
|
275
|
+
primary?: string;
|
|
276
|
+
/** Neutral palette applied on top of any theme (`theme.surface`). Empty = none. */
|
|
277
|
+
surface?: string;
|
|
279
278
|
}
|
|
280
279
|
/**
|
|
281
280
|
* Theme module: built-in and custom themes, light/dark/system scheme and a
|
|
@@ -284,28 +283,20 @@ interface ShkThemeModuleConfig extends ShkThemeConfig {
|
|
|
284
283
|
* `theme.name` and `theme.scheme` are shared with `ShkThemeService` (which
|
|
285
284
|
* persists them); `theme.primary` is stored by `withPersistence()`.
|
|
286
285
|
*/
|
|
287
|
-
declare function withTheme(config?: ShkThemeModuleConfig): ShkFeature;
|
|
286
|
+
export declare function withTheme(config?: ShkThemeModuleConfig): ShkFeature;
|
|
288
287
|
/** Registers app-defined options in the same registry (`app.pageSize`, …). */
|
|
289
|
-
declare function withOptions(options: readonly ShkOptionDef[]): ShkFeature;
|
|
288
|
+
export declare function withOptions(options: readonly ShkOptionDef[]): ShkFeature;
|
|
290
289
|
/**
|
|
291
290
|
* Persists changed options in localStorage so they survive reloads.
|
|
292
291
|
* Options with `persist: false` are skipped (the theme service stores its own).
|
|
293
292
|
*/
|
|
294
|
-
declare function withPersistence(config?: {
|
|
295
|
-
|
|
293
|
+
export declare function withPersistence(config?: {
|
|
294
|
+
storageKey?: string;
|
|
296
295
|
}): ShkFeature;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Shirkasoft UI Components.
|
|
300
|
-
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
301
|
-
* Belongs to Shirkasoft.
|
|
302
|
-
*/
|
|
303
|
-
|
|
304
296
|
/** Date options (`dates.*`), always registered. */
|
|
305
|
-
declare const DATE_OPTIONS: readonly ShkOptionDef[];
|
|
297
|
+
export declare const DATE_OPTIONS: readonly ShkOptionDef[];
|
|
306
298
|
/** Number and currency options (`numbers.*`), always registered. */
|
|
307
|
-
declare const NUMBER_OPTIONS: readonly ShkOptionDef[];
|
|
308
|
-
|
|
299
|
+
export declare const NUMBER_OPTIONS: readonly ShkOptionDef[];
|
|
309
300
|
/**
|
|
310
301
|
* Shirkasoft UI Components.
|
|
311
302
|
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
@@ -315,9 +306,9 @@ declare const NUMBER_OPTIONS: readonly ShkOptionDef[];
|
|
|
315
306
|
* Pure functions on top of `Intl`: no Angular locale data needs registering.
|
|
316
307
|
*/
|
|
317
308
|
/** Default numeric pattern for a locale: `MM/dd/yyyy` for English, `dd/MM/yyyy` otherwise. */
|
|
318
|
-
declare function resolveDateFormat(format: string | null | undefined, locale: string): string;
|
|
309
|
+
export declare function resolveDateFormat(format: string | null | undefined, locale: string): string;
|
|
319
310
|
/** Converts a value to a `Date`. ISO date-only strings (`2026-12-31`) are read as local dates. */
|
|
320
|
-
declare function toDate(value: Date | string | number | null | undefined): Date | null;
|
|
311
|
+
export declare function toDate(value: Date | string | number | null | undefined): Date | null;
|
|
321
312
|
/**
|
|
322
313
|
* Formats a date with a pattern (`dd/MM/yyyy`, `d MMM yyyy`, `yyyy-MM-dd HH:mm`…).
|
|
323
314
|
*
|
|
@@ -327,42 +318,40 @@ declare function toDate(value: Date | string | number | null | undefined): Date
|
|
|
327
318
|
* ("31 dic 2026" in Spanish, "Dec 31, 2026" in English).
|
|
328
319
|
* Returns an empty string for empty or invalid values.
|
|
329
320
|
*/
|
|
330
|
-
declare function formatDate(value: Date | string | number | null | undefined, pattern: string, locale: string): string;
|
|
321
|
+
export declare function formatDate(value: Date | string | number | null | undefined, pattern: string, locale: string): string;
|
|
331
322
|
/** An `Intl` date (and optional time) style. */
|
|
332
323
|
type ShkIntlStyle = 'full' | 'long' | 'medium' | 'short';
|
|
333
324
|
/**
|
|
334
325
|
* Date formatted with an `Intl` style (`long`: "31 de diciembre de 2026"),
|
|
335
326
|
* optionally followed by the time in `timeStyle`.
|
|
336
327
|
*/
|
|
337
|
-
declare function formatDateStyle(value: Date | string | number | null | undefined, style: ShkIntlStyle, locale: string, timeStyle?: ShkIntlStyle): string;
|
|
328
|
+
export declare function formatDateStyle(value: Date | string | number | null | undefined, style: ShkIntlStyle, locale: string, timeStyle?: ShkIntlStyle): string;
|
|
338
329
|
/** A pattern reduced to the parts a user types: field order and separator. */
|
|
339
330
|
interface TypedDateLayout {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
331
|
+
/** Order of day/month/year in the pattern. */
|
|
332
|
+
order: readonly ('d' | 'm' | 'y')[];
|
|
333
|
+
/** Separator between the parts (`/`, `-` or `.`). */
|
|
334
|
+
separator: string;
|
|
344
335
|
}
|
|
345
336
|
/**
|
|
346
337
|
* Field order and separator of a pattern, for typing dates in an input.
|
|
347
338
|
* Named months and weekdays are typed as numbers (`d MMM yyyy` → `dd/MM/yyyy`).
|
|
348
339
|
*/
|
|
349
|
-
declare function typedDateLayout(pattern: string): TypedDateLayout;
|
|
340
|
+
export declare function typedDateLayout(pattern: string): TypedDateLayout;
|
|
350
341
|
/** Narrow currency symbol (`USD` → `$`, `EUR` → `€`). Unknown codes are returned as-is. */
|
|
351
|
-
declare function currencySymbol(currency: string, locale: string): string;
|
|
342
|
+
export declare function currencySymbol(currency: string, locale: string): string;
|
|
352
343
|
/**
|
|
353
344
|
* Formats an amount as money (`$1,234.50`, `1.234,50 €`, `¥1,000`).
|
|
354
345
|
* `decimals` `null`/omitted = the currency's own digits (2 for USD, 0 for JPY).
|
|
355
346
|
*/
|
|
356
|
-
declare function formatCurrency(value: number | string | null | undefined, currency: string, locale: string, decimals?: number | null): string;
|
|
347
|
+
export declare function formatCurrency(value: number | string | null | undefined, currency: string, locale: string, decimals?: number | null): string;
|
|
357
348
|
/** Decimal digits a currency uses by default (USD → 2, JPY → 0, BHD → 3). Unknown codes → 2. */
|
|
358
|
-
declare function currencyDecimals(currency: string): number;
|
|
349
|
+
export declare function currencyDecimals(currency: string): number;
|
|
359
350
|
/** Formats a number with the locale's grouping and decimal separators. */
|
|
360
|
-
declare function formatNumber(value: number, locale: string, maxDecimals?: number, minDecimals?: number): string;
|
|
351
|
+
export declare function formatNumber(value: number, locale: string, maxDecimals?: number, minDecimals?: number): string;
|
|
361
352
|
/** Decimal and grouping separators of a locale (`es-ES` → `,` and `.`). */
|
|
362
|
-
declare function numberSeparators(locale: string): {
|
|
363
|
-
|
|
364
|
-
|
|
353
|
+
export declare function numberSeparators(locale: string): {
|
|
354
|
+
decimal: string;
|
|
355
|
+
group: string;
|
|
365
356
|
};
|
|
366
|
-
|
|
367
|
-
export { BUILT_IN_PRESETS, DATE_OPTIONS, NUMBER_OPTIONS, SHK_CONFIG_FEATURES, SHK_CONFIG_PERSISTENCE, SHK_THEME_PRESETS, SURFACE_PALETTES, ShkConfigService, currencyDecimals, currencySymbol, formatCurrency, formatDate, formatDateStyle, formatNumber, numberSeparators, primaryScale, provideShk, resolveDateFormat, toDate, typedDateLayout, withDates, withNumbers, withOptions, withPersistence, withTheme };
|
|
368
|
-
export type { ShkConfigFeature, ShkConfigKey, ShkConfigPersistence, ShkConfigValues, ShkCustomTheme, ShkDateDisplayStyle, ShkDatesConfig, ShkFeature, ShkIntlStyle, ShkNumbersConfig, ShkOptionChoice, ShkOptionDef, ShkOptionEntry, ShkOptionSource, ShkOptionType, ShkThemeModuleConfig, ShkThemePreset, TypedDateLayout };
|
|
357
|
+
export type { ShkConfigFeature, ShkConfigKey, ShkConfigPersistence, ShkConfigValues, ShkCustomTheme, ShkDateDisplayStyle, ShkDatesConfig, ShkFeature, ShkIntlStyle, ShkNumbersConfig, ShkOptionChoice, ShkOptionDef, ShkOptionEntry, ShkOptionSource, ShkOptionType, ShkThemeModuleConfig, ShkThemePreset, TypedDateLayout };
|