mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 13:07:44 +01:00
* Ignore linting for examples in docs * Formatting JSX single attribute per line * Separte `format` and `lint:format` in package.json * Bump prettier version * Run format
37 lines
775 B
TypeScript
37 lines
775 B
TypeScript
/* eslint-disable no-console */
|
|
|
|
import { ref, inject, Ref } from 'vue';
|
|
|
|
export const ICON_STYLE_CONTEXT = Symbol('size');
|
|
|
|
interface IconSizeContext {
|
|
size: Ref<number>;
|
|
strokeWidth: Ref<number>;
|
|
color: Ref<string>;
|
|
absoluteStrokeWidth: Ref<boolean>;
|
|
}
|
|
|
|
export const STYLE_DEFAULTS = {
|
|
size: 24,
|
|
strokeWidth: 2,
|
|
color: 'currentColor',
|
|
absoluteStrokeWidth: false,
|
|
};
|
|
|
|
export const iconStyleContext = {
|
|
size: ref(24),
|
|
strokeWidth: ref(2),
|
|
color: ref('currentColor'),
|
|
absoluteStrokeWidth: ref(false),
|
|
};
|
|
|
|
export function useIconStyleContext(): IconSizeContext {
|
|
const context = inject<IconSizeContext>(ICON_STYLE_CONTEXT);
|
|
|
|
if (!context) {
|
|
throw new Error('useIconStyleContext must be used with useIconStyleProvider');
|
|
}
|
|
|
|
return context;
|
|
}
|