Compare commits

..

No commits in common. "main" and "@lucide/lab@0.15.0" have entirely different histories.

16 changed files with 25 additions and 144 deletions

View file

@ -13,7 +13,6 @@ ungroup
toc
sunlounger
monstera
floorball
# Search tags and terms used in icon and category metadata
checkmark

View file

@ -1,28 +0,0 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"Bulgymizi"
],
"use-cases": [
"Labeling floorball sessions in workout logs",
"Identifying floorball equipment in sporting goods catalogs",
"Labeling floorball practices and matches in club calendars"
],
"tags": [
"ball",
"innebandy",
"unihockey",
"salibandy",
"equipment",
"perforated",
"plastic",
"hollow",
"indoor",
"team",
"match",
"training"
],
"categories": [
"sports"
]
}

View file

@ -1,18 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M14.5 21.682a1 1 0 00-5 0" />
<path d="M2.318 14.5a1 1 0 000-5" />
<path d="M21.682 9.5a1 1 0 000 5" />
<path d="M9.5 2.318a1 1 0 005 0" />
<circle cx="12" cy="12" r="10" />
<circle cx="12" cy="12" r="2.5" />
</svg>

Before

Width:  |  Height:  |  Size: 438 B

View file

@ -1,20 +0,0 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"felipeajzanetti"
],
"use-cases": [],
"tags": [
"sport",
"badminton",
"racket",
"shuttlecock",
"game",
"sports",
"equipment"
],
"categories": [
"sports",
"gaming"
]
}

View file

@ -1,16 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m14 10 1-5" />
<path d="M3 5a3 3 0 016 0 3 3 0 016 0 3 3 0 016 0l-5 9H8z" />
<path d="M8 18a4 4 0 008 0z" />
<path d="m9 5 1 5" />
</svg>

Before

Width:  |  Height:  |  Size: 356 B

View file

@ -18,7 +18,7 @@ export interface LucideConfig {
* Stroke width
* @default 2
*/
strokeWidth: string | number;
strokeWidth: number;
/**
* Whether to use absolute stroke width.
* @deprecated Use `nonScalingStroke` instead.

View file

@ -2,9 +2,9 @@ import { createContext, h, type ComponentChildren } from 'preact';
import { useContext, useMemo } from 'preact/hooks';
const LucideContext = createContext<{
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/
@ -22,9 +22,9 @@ const LucideContext = createContext<{
interface LucideProviderProps {
children: ComponentChildren;
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -1,9 +1,9 @@
import { createContext, createElement, type ReactNode, useContext, useMemo } from 'react';
const LucideContext = createContext<{
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/
@ -21,9 +21,9 @@ const LucideContext = createContext<{
interface LucideProviderProps {
children: ReactNode;
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -4,9 +4,9 @@ import { createContext, createElement, type ReactNode, useContext, useMemo } fro
import { LucideProps } from './types';
type LucideConfig = {
size: number | string;
size: number;
color: string;
strokeWidth: number | string;
strokeWidth: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -1,9 +1,9 @@
import { createContext, splitProps, type JSXElement } from 'solid-js';
export const LucideContext = createContext<{
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/
@ -21,9 +21,9 @@ export const LucideContext = createContext<{
interface LucideProviderProps {
children: JSXElement;
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -41,7 +41,7 @@ This package include the following Lucide implementations:
This package is suitable for very specific use cases for example if you want to use icon fonts, svg sprites, normal svgs or Common.js Svg strings in your javascript project.
> [!WARNING]
> It is not recommended to use this package for SVG sprites or icon fonts for web pages/applications; for prototyping, it is ok. We recommend that bundlers for web applications make sure you only bundle the used icons from this icon library (tree-shaking). Otherwise, it will load all the icons, making your webpage load more slowly. Tree-shaking is available in our other [packages](https://lucide.dev/packages).
> It is not recommended to use this package for svg sprites or icon fonts for web pages/applications, for prototyping it is ok. We recommend to bundlers for web applications to make sure you only bundle the used icons from this icon library (Threeshaking). Otherwise it will load all the icons, making you webpage loading slower. Threeshaking is only available in the packages: [lucide](https://github.com/lucide-icons/lucide/tree/main/packages/lucide), [lucide-react](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-react), [lucide-vue](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-vue), [lucide-vue-next](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-vue-next), [lucide-angular](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-angular), [lucide-preact](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-preact)
## Installation

View file

@ -30,18 +30,11 @@ function buildLucideIconNode(icon: LucideIconData, params: LucideBuildParams = {
? mergeClasses(...classNamesFromClassName)
: mergeClasses('lucide', ...iconClassNames, ...classNamesFromClassName);
let calculatedStrokeWidth = params.strokeWidth ?? defaultAttributes['stroke-width'];
if (params.absoluteStrokeWidth) {
const scaled =
(Number(calculatedStrokeWidth) *
const calculatedStrokeWidth = params.absoluteStrokeWidth
? (Number(params.strokeWidth ?? defaultAttributes['stroke-width']) *
Number(icon.size ?? icon.width ?? defaultAttributes['width'])) /
Number(params.size ?? params.width ?? defaultAttributes['width']);
// Only numeric lengths can be scaled; a CSS unit such as `1em`, or a size of `0`, makes the
// conversion non-finite, so the unscaled width stands rather than emitting `NaN`.
if (Number.isFinite(scaled)) calculatedStrokeWidth = scaled;
}
Number(params.size ?? params.width ?? defaultAttributes['width'])
: (params.strokeWidth ?? defaultAttributes['stroke-width']);
const attributes = {
...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {

View file

@ -1,29 +0,0 @@
import { describe, it, expect } from 'vitest';
import buildLucideIconNode from '../src/build/buildLucideIconNode';
const icon = { name: 'circle', size: 24, node: [] };
const strokeWidthOf = (params: Parameters<typeof buildLucideIconNode>[1]) =>
buildLucideIconNode(icon, params)[1]['stroke-width'];
describe('buildLucideIconNode absoluteStrokeWidth', () => {
it('scales the stroke width for numeric sizes', () => {
expect(strokeWidthOf({ absoluteStrokeWidth: true, strokeWidth: 2, size: 48 })).toBe(1);
});
it('falls back to the unscaled width for a CSS unit size', () => {
expect(strokeWidthOf({ absoluteStrokeWidth: true, strokeWidth: 2, size: '1em' })).toBe(2);
});
it('falls back to the unscaled width for a non-numeric stroke width', () => {
expect(strokeWidthOf({ absoluteStrokeWidth: true, strokeWidth: '1em', size: 48 })).toBe('1em');
});
it('falls back to the unscaled width for a zero size', () => {
expect(strokeWidthOf({ absoluteStrokeWidth: true, strokeWidth: 2, size: 0 })).toBe(2);
});
it('leaves the stroke width alone when not absolute', () => {
expect(strokeWidthOf({ strokeWidth: 2, size: 48 })).toBe(2);
});
});

View file

@ -4,8 +4,8 @@ const LucideContext = Symbol('lucide-context');
export interface LucideGlobalContext {
color?: string;
size?: number | string;
strokeWidth?: number | string;
size?: number;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -3,9 +3,9 @@ import { provide, inject } from 'vue';
export const LUCIDE_CONTEXT = Symbol('lucide-icons');
interface LucideIconsContext {
size?: number | string;
size?: number;
color?: string;
strokeWidth?: number | string;
strokeWidth?: number;
/**
* @deprecated Use `nonScalingStroke` instead.
*/

View file

@ -5,7 +5,7 @@ import type {
} from '@lucide/shared/types';
export interface LucideProps extends Partial<SVGAttributes> {
size?: 24 | number | string;
size?: 24 | number;
strokeWidth?: number | string;
/**
* @deprecated Use `nonScalingStroke` instead.