Skip to content

Commit

Permalink
Added utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
SamstyleGhost committed Oct 25, 2023
1 parent b762ab0 commit 55ea48b
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/lucide-figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@figma/plugin-typings": "^1.36.0",
"@lucide/utils": "workspace:*",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-figma/src/helpers/createIconComponent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, createElement, SVGProps } from 'react';
import { IconNode } from '../api/fetchIcons';
import { toKebabCase} from '../../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

const defaultAttributes = {
xmlns: 'http://www.w3.org/2000/svg',
Expand Down
1 change: 1 addition & 0 deletions packages/lucide-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"devDependencies": {
"@lucide/rollup-plugins": "workspace:*",
"@lucide/build-icons": "workspace:*",
"@lucide/utils": "workspace:*",
"@preact/preset-vite": "^2.4.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/preact": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-preact/src/createLucideIcon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentType, FunctionComponent, h, JSX, RefObject, toChildArray } from 'preact';
import defaultAttributes from './defaultAttributes';
import { toKebabCase} from '../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

type IconNode = [elementName: keyof JSX.IntrinsicElements, attrs: Record<string, string>][]

Expand Down
1 change: 1 addition & 0 deletions packages/lucide-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/rollup-plugins": "workspace:*",
"@lucide/utils": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^11.2.6",
"@types/prop-types": "^15.7.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-react/src/createLucideIcon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, createElement, ReactSVG, SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';
import defaultAttributes from './defaultAttributes';
import { toKebabCase} from '../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][]

Expand Down
1 change: 1 addition & 0 deletions packages/lucide-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
},
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/utils": "workspace:*",
"@atomico/rollup-plugin-sizes": "^1.1.4",
"@testing-library/jest-dom": "^5.16.5",
"rollup-plugin-license": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-solid/src/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { For, JSX, splitProps } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import defaultAttributes from './defaultAttributes';
import { IconNode, LucideProps } from './types';
import { toKebabCase} from '../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

interface IconProps {
name: string
Expand Down
1 change: 1 addition & 0 deletions packages/lucide-vue-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"devDependencies": {
"@lucide/rollup-plugins": "workspace:*",
"@lucide/build-icons": "workspace:*",
"@lucide/utils": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/vue": "^6.6.1",
"@vue/compiler-sfc": "3.2.45",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-vue-next/src/createLucideIcon.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { h } from 'vue';
import type { SVGAttributes, FunctionalComponent } from 'vue';
import defaultAttributes from './defaultAttributes';
import { toKebabCase} from '../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

// Create interface extending SVGAttributes
export interface SVGProps extends Partial<SVGAttributes> {
Expand Down
1 change: 1 addition & 0 deletions packages/lucide-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/rollup-plugins": "workspace:*",
"@lucide/utils": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/vue": "^5.9.0",
"@vitejs/plugin-vue2": "2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/lucide-vue/src/createVueComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from 'vue';
import { Vue, VueConfiguration } from 'vue/types/vue';
import defaultAttributes from './defaultAttributes';
import { toKebabCase} from '../../../scripts/helpers.mjs';
import { toKebabCase} from '@lucide/utils';

type IconNode = [elementName: string, attrs: Record<string, string>][]

Expand Down
9 changes: 9 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@lucide/utils",
"version": "1.0.0",
"private": true,
"description": "",
"main": "utils.js",
"author": "",
"license": "ISC"
}
8 changes: 8 additions & 0 deletions packages/utils/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Converts string to KebabCase
*
* @param {string} string
* @returns {string} A kebabized string
*/
export const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();

0 comments on commit 55ea48b

Please sign in to comment.