@getcortexlabs/mavis-core 0.1.0-alpha.1 → 0.1.0-alpha.3
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 +2 -2
- package/dist/icon.d.ts +15 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.js +28 -0
- package/dist/icon.js.map +1 -0
- package/dist/icons.d.ts +2002 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +2003 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/sheet.d.ts +5 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +14 -0
- package/dist/sheet.js.map +1 -0
- package/dist/vue/global-components.d.ts +8 -0
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +2 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +1 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/props.d.ts +195 -18
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +62 -17
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/theme.d.ts +25 -7
- package/dist/vue/theme.d.ts.map +1 -1
- package/dist/vue/theme.js +37 -2
- package/dist/vue/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/icon.ts +30 -0
- package/src/icons.ts +2002 -0
- package/src/index.ts +5 -0
- package/src/sheet.ts +17 -0
- package/src/vue/global-components.ts +8 -0
- package/src/vue/index.ts +10 -1
- package/src/vue/props.ts +62 -20
- package/src/vue/theme.ts +54 -3
package/dist/vue/props.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { iconSizes } from '../icon.js';
|
|
2
|
+
import { sheetCloseReasons } from '../sheet.js';
|
|
1
3
|
function choice(values, defaultValue) {
|
|
2
4
|
return {
|
|
3
5
|
type: String,
|
|
@@ -63,29 +65,32 @@ export const buttonProps = {
|
|
|
63
65
|
disabled: Boolean,
|
|
64
66
|
loading: Boolean,
|
|
65
67
|
loadingText: { type: String, default: 'Loading…' },
|
|
68
|
+
icon: { type: String, default: undefined },
|
|
69
|
+
trailingIcon: { type: String, default: undefined },
|
|
66
70
|
};
|
|
71
|
+
const tones = [
|
|
72
|
+
'background',
|
|
73
|
+
'surface',
|
|
74
|
+
'elevated',
|
|
75
|
+
'text',
|
|
76
|
+
'muted',
|
|
77
|
+
'primary',
|
|
78
|
+
'onPrimary',
|
|
79
|
+
'primarySoft',
|
|
80
|
+
'accent',
|
|
81
|
+
'onAccent',
|
|
82
|
+
'accentSoft',
|
|
83
|
+
'border',
|
|
84
|
+
'success',
|
|
85
|
+
'danger',
|
|
86
|
+
];
|
|
67
87
|
export const textProps = {
|
|
68
88
|
...viewProps,
|
|
69
89
|
...flexProps,
|
|
70
90
|
text: { type: String, default: undefined },
|
|
71
91
|
as: choice(['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], 'p'),
|
|
72
92
|
variant: choice(['display', 'title', 'heading', 'body', 'caption', 'overline'], 'body'),
|
|
73
|
-
tone: choice(
|
|
74
|
-
'background',
|
|
75
|
-
'surface',
|
|
76
|
-
'elevated',
|
|
77
|
-
'text',
|
|
78
|
-
'muted',
|
|
79
|
-
'primary',
|
|
80
|
-
'onPrimary',
|
|
81
|
-
'primarySoft',
|
|
82
|
-
'accent',
|
|
83
|
-
'onAccent',
|
|
84
|
-
'accentSoft',
|
|
85
|
-
'border',
|
|
86
|
-
'success',
|
|
87
|
-
'danger',
|
|
88
|
-
], 'text'),
|
|
93
|
+
tone: choice(tones, 'text'),
|
|
89
94
|
align: choice(['left', 'center', 'right'], 'left'),
|
|
90
95
|
wrap: { type: Boolean, default: true },
|
|
91
96
|
};
|
|
@@ -122,6 +127,8 @@ export const inputProps = {
|
|
|
122
127
|
},
|
|
123
128
|
autocorrect: { type: Boolean, default: undefined },
|
|
124
129
|
returnKey: choice(['done', 'next', 'go', 'search', 'send'], 'done'),
|
|
130
|
+
icon: { type: String, default: undefined },
|
|
131
|
+
trailingIcon: { type: String, default: undefined },
|
|
125
132
|
};
|
|
126
133
|
export const inputEmits = {
|
|
127
134
|
'update:modelValue': (value) => typeof value === 'string',
|
|
@@ -129,8 +136,44 @@ export const inputEmits = {
|
|
|
129
136
|
blur: () => true,
|
|
130
137
|
submit: (value) => typeof value === 'string',
|
|
131
138
|
};
|
|
132
|
-
export const
|
|
139
|
+
export const iconProps = {
|
|
140
|
+
id: viewProps.id,
|
|
141
|
+
name: { type: String, required: true },
|
|
142
|
+
size: {
|
|
143
|
+
type: [String, Number],
|
|
144
|
+
default: 'md',
|
|
145
|
+
validator: (value) => typeof value === 'number' || value in iconSizes,
|
|
146
|
+
},
|
|
147
|
+
tone: choice(tones, 'text'),
|
|
148
|
+
/** Accessible name. Without it the icon is decorative and hidden from assistive technology. */
|
|
149
|
+
label: { type: String, default: undefined },
|
|
150
|
+
};
|
|
151
|
+
export const screenProps = {
|
|
152
|
+
...viewProps,
|
|
153
|
+
scroll: Boolean,
|
|
154
|
+
/** Puts the software keyboard away on a tap outside the editor and, with `scroll`, on a drag towards it. */
|
|
155
|
+
dismissKeyboard: { type: Boolean, default: true },
|
|
156
|
+
};
|
|
133
157
|
export const revealProps = { ...columnProps, show: Boolean };
|
|
158
|
+
export const sheetProps = {
|
|
159
|
+
id: viewProps.id,
|
|
160
|
+
accessibilityLabel: viewProps.accessibilityLabel,
|
|
161
|
+
open: Boolean,
|
|
162
|
+
/** Rendered as the sheet heading and used as its accessible name. */
|
|
163
|
+
title: { type: String, default: undefined },
|
|
164
|
+
/** Allows the scrim, Escape, the back gesture, swiping down and the close button. */
|
|
165
|
+
dismissible: { type: Boolean, default: true },
|
|
166
|
+
fullscreen: Boolean,
|
|
167
|
+
closeLabel: { type: String, default: 'Close' },
|
|
168
|
+
padding: { ...spacingProp, default: 'lg' },
|
|
169
|
+
gap: spacingProp,
|
|
170
|
+
align: columnProps.align,
|
|
171
|
+
};
|
|
172
|
+
export const sheetEmits = {
|
|
173
|
+
'update:open': (value) => typeof value === 'boolean',
|
|
174
|
+
close: (reason) => sheetCloseReasons.includes(reason),
|
|
175
|
+
opened: () => true,
|
|
176
|
+
};
|
|
134
177
|
export const actionEmits = { click: () => true };
|
|
135
178
|
export const sliderEmits = { 'update:modelValue': (value) => Number.isFinite(value) };
|
|
136
179
|
export const componentProps = {
|
|
@@ -143,6 +186,8 @@ export const componentProps = {
|
|
|
143
186
|
MButton: buttonProps,
|
|
144
187
|
MSlider: sliderProps,
|
|
145
188
|
MInput: inputProps,
|
|
189
|
+
MIcon: iconProps,
|
|
146
190
|
MReveal: revealProps,
|
|
191
|
+
MSheet: sheetProps,
|
|
147
192
|
};
|
|
148
193
|
//# sourceMappingURL=props.js.map
|
package/dist/vue/props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/vue/props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/vue/props.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgC,MAAM,YAAY,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAA;AAEtE,SAAS,MAAM,CAAmB,MAAoB,EAAE,YAAe;IACrE,OAAO;QACL,IAAI,EAAE,MAAgC;QACtC,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,CAAC,KAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;KAChD,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AAC9F,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAA8B,EAAE,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AAI,EAAE,QAAQ;IACd,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,UAAU;CACnB,CAAA"}
|
package/dist/vue/theme.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type InjectionKey } from '@vue/runtime-core';
|
|
2
2
|
import type { MavisTheme } from '../theme/types.js';
|
|
3
|
-
export
|
|
3
|
+
export type Appearance = MavisTheme['appearance'];
|
|
4
|
+
export type AppearanceMode = Appearance | 'system';
|
|
5
|
+
/** Platform access to the device appearance; `current` is undefined while it is unknown, such as during SSR. */
|
|
6
|
+
export interface AppearanceSource {
|
|
7
|
+
current(): Appearance | undefined;
|
|
8
|
+
observe(listener: (appearance: Appearance) => void): () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ThemeContextOptions {
|
|
11
|
+
theme?: MavisTheme;
|
|
12
|
+
darkTheme?: MavisTheme;
|
|
13
|
+
appearance?: AppearanceMode;
|
|
14
|
+
source?: AppearanceSource;
|
|
15
|
+
}
|
|
16
|
+
export declare function createThemeContext(options?: MavisTheme | ThemeContextOptions): {
|
|
4
17
|
theme: Readonly<import("@vue/reactivity").Ref<{
|
|
5
18
|
readonly name: string;
|
|
6
19
|
readonly appearance: "light" | "dark";
|
|
@@ -21,19 +34,19 @@ export declare function createThemeContext(initial: MavisTheme): {
|
|
|
21
34
|
readonly danger: string;
|
|
22
35
|
};
|
|
23
36
|
readonly space: {
|
|
24
|
-
readonly none: number;
|
|
25
|
-
readonly xs: number;
|
|
26
37
|
readonly sm: number;
|
|
27
38
|
readonly md: number;
|
|
28
39
|
readonly lg: number;
|
|
40
|
+
readonly none: number;
|
|
41
|
+
readonly xs: number;
|
|
29
42
|
readonly xl: number;
|
|
30
43
|
readonly "2xl": number;
|
|
31
44
|
};
|
|
32
45
|
readonly radius: {
|
|
33
|
-
readonly none: number;
|
|
34
46
|
readonly sm: number;
|
|
35
47
|
readonly md: number;
|
|
36
48
|
readonly lg: number;
|
|
49
|
+
readonly none: number;
|
|
37
50
|
readonly full: number;
|
|
38
51
|
};
|
|
39
52
|
readonly typography: {
|
|
@@ -108,19 +121,19 @@ export declare function createThemeContext(initial: MavisTheme): {
|
|
|
108
121
|
readonly danger: string;
|
|
109
122
|
};
|
|
110
123
|
readonly space: {
|
|
111
|
-
readonly none: number;
|
|
112
|
-
readonly xs: number;
|
|
113
124
|
readonly sm: number;
|
|
114
125
|
readonly md: number;
|
|
115
126
|
readonly lg: number;
|
|
127
|
+
readonly none: number;
|
|
128
|
+
readonly xs: number;
|
|
116
129
|
readonly xl: number;
|
|
117
130
|
readonly "2xl": number;
|
|
118
131
|
};
|
|
119
132
|
readonly radius: {
|
|
120
|
-
readonly none: number;
|
|
121
133
|
readonly sm: number;
|
|
122
134
|
readonly md: number;
|
|
123
135
|
readonly lg: number;
|
|
136
|
+
readonly none: number;
|
|
124
137
|
readonly full: number;
|
|
125
138
|
};
|
|
126
139
|
readonly typography: {
|
|
@@ -176,7 +189,12 @@ export declare function createThemeContext(initial: MavisTheme): {
|
|
|
176
189
|
readonly pressScale: number;
|
|
177
190
|
};
|
|
178
191
|
}>>;
|
|
192
|
+
/** The selection: `system` follows the device; `light` and `dark` are explicit overrides. */
|
|
193
|
+
appearance: Readonly<import("@vue/reactivity").Ref<AppearanceMode, AppearanceMode>>;
|
|
194
|
+
setAppearance(mode: AppearanceMode): void;
|
|
195
|
+
/** Registers the theme for its own appearance and pins that appearance. */
|
|
179
196
|
setTheme(next: MavisTheme): void;
|
|
197
|
+
dispose(): void;
|
|
180
198
|
};
|
|
181
199
|
export type MavisThemeContext = ReturnType<typeof createThemeContext>;
|
|
182
200
|
export declare const themeKey: InjectionKey<MavisThemeContext>;
|
package/dist/vue/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,CAAA;AAElD,gHAAgH;AAChH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,UAAU,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AASD,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,UAAU,GAAG,mBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoB7E,6FAA6F;;wBAEzE,cAAc;IAIlC,2EAA2E;mBAC5D,UAAU;;EAS5B;AACD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAErE,eAAO,MAAM,QAAQ,EAAE,YAAY,CAAC,iBAAiB,CAAyB,CAAA;AAE9E,kFAAkF;AAClF,wBAAgB,aAAa,IAAI,iBAAiB,CAEjD"}
|
package/dist/vue/theme.js
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
1
|
import { inject, readonly, shallowRef } from '@vue/runtime-core';
|
|
2
2
|
import { mavis } from '../theme/themes.js';
|
|
3
|
-
|
|
3
|
+
const modes = ['system', 'light', 'dark'];
|
|
4
|
+
function checkMode(mode) {
|
|
5
|
+
if (!modes.includes(mode))
|
|
6
|
+
throw new RangeError(`Unknown appearance mode: ${String(mode)}`);
|
|
7
|
+
return mode;
|
|
8
|
+
}
|
|
9
|
+
export function createThemeContext(options = {}) {
|
|
10
|
+
const config = 'colors' in options ? { theme: options } : options;
|
|
11
|
+
const initial = config.theme ?? mavis;
|
|
12
|
+
const themes = { [initial.appearance]: initial };
|
|
13
|
+
if (config.darkTheme)
|
|
14
|
+
themes.dark = config.darkTheme;
|
|
15
|
+
const appearance = shallowRef(checkMode(config.appearance ?? 'system'));
|
|
4
16
|
const theme = shallowRef(initial);
|
|
17
|
+
const resolve = () => {
|
|
18
|
+
const wanted = appearance.value === 'system'
|
|
19
|
+
? (config.source?.current() ?? initial.appearance)
|
|
20
|
+
: appearance.value;
|
|
21
|
+
theme.value = themes[wanted] ?? themes[wanted === 'dark' ? 'light' : 'dark'] ?? initial;
|
|
22
|
+
};
|
|
23
|
+
resolve();
|
|
24
|
+
const stop = config.source?.observe(() => {
|
|
25
|
+
if (appearance.value === 'system')
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
5
28
|
return {
|
|
6
29
|
theme: readonly(theme),
|
|
30
|
+
/** The selection: `system` follows the device; `light` and `dark` are explicit overrides. */
|
|
31
|
+
appearance: readonly(appearance),
|
|
32
|
+
setAppearance(mode) {
|
|
33
|
+
appearance.value = checkMode(mode);
|
|
34
|
+
resolve();
|
|
35
|
+
},
|
|
36
|
+
/** Registers the theme for its own appearance and pins that appearance. */
|
|
7
37
|
setTheme(next) {
|
|
8
|
-
|
|
38
|
+
themes[next.appearance] = next;
|
|
39
|
+
appearance.value = next.appearance;
|
|
40
|
+
resolve();
|
|
41
|
+
},
|
|
42
|
+
dispose() {
|
|
43
|
+
stop?.();
|
|
9
44
|
},
|
|
10
45
|
};
|
|
11
46
|
}
|
package/dist/vue/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAmB1C,MAAM,KAAK,GAA8B,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAEpE,SAAS,SAAS,CAAC,IAAoB;IACrC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3F,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAA4C,EAAE;IAC/E,MAAM,MAAM,GAAwB,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAA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,CAAC,IAAgB;YACvB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;YAC9B,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAA;YAClC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO;YACL,IAAI,EAAE,EAAE,CAAA;QACV,CAAC;KACF,CAAA;AACH,CAAC;AAGD,MAAM,CAAC,MAAM,QAAQ,GAAoC,MAAM,CAAC,aAAa,CAAC,CAAA;AAE9E,kFAAkF;AAClF,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;AAChE,CAAC"}
|
package/package.json
CHANGED
package/src/icon.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { icons } from './icons.js'
|
|
2
|
+
|
|
3
|
+
export type IconName = keyof typeof icons
|
|
4
|
+
export const iconFontFamily = 'lucide'
|
|
5
|
+
export const iconSizes = { sm: 16, md: 20, lg: 24 } as const
|
|
6
|
+
export type IconSize = keyof typeof iconSizes | number
|
|
7
|
+
|
|
8
|
+
/** The private-use character of an icon in the bundled Lucide font. */
|
|
9
|
+
export function iconGlyph(name: IconName): string {
|
|
10
|
+
const code = icons[name]
|
|
11
|
+
if (!code) throw new RangeError(`Unknown icon: ${String(name)}`)
|
|
12
|
+
return String.fromCodePoint(code)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A control that shows only an icon still needs a name for assistive technology. */
|
|
16
|
+
export function checkIconOnly(text: string, hasIcon: boolean, label: string | undefined) {
|
|
17
|
+
if (hasIcon && !text && !label) {
|
|
18
|
+
throw new RangeError('An icon-only button needs accessibilityLabel')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function resolveIconSize(size: IconSize): number {
|
|
23
|
+
if (typeof size === 'number') {
|
|
24
|
+
if (!Number.isFinite(size) || size <= 0) throw new RangeError(`Invalid icon size: ${size}`)
|
|
25
|
+
return size
|
|
26
|
+
}
|
|
27
|
+
const value = iconSizes[size]
|
|
28
|
+
if (!value) throw new RangeError(`Invalid icon size: ${String(size)}`)
|
|
29
|
+
return value
|
|
30
|
+
}
|