This commit is contained in:
Jorge Mario Arita Ramírez 2024-07-28 22:55:15 -06:00
parent 161399cf43
commit 31d816f12b
32 changed files with 301 additions and 178 deletions

View File

@ -1,4 +0,0 @@
import * as React from "react";
import { IconProps } from "@/types";
export declare const DocumentPlus: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
export default DocumentPlus;

View File

@ -1 +0,0 @@
import*as e from"react";const r=e.forwardRef((({color:r="currentColor",...t},o)=>e.createElement("svg",{...t,ref:o,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true","data-slot":"icon"},e.createElement("path",{fill:r,"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))));export{r as DocumentPlus,r as default};

View File

@ -1 +0,0 @@
export { DocumentPlus } from "./DocumentPlus";

View File

@ -1 +0,0 @@
export{DocumentPlus}from"./DocumentPlus.js";

View File

@ -1,4 +0,0 @@
import * as React from "react";
import { IconProps } from "@/types";
export declare const DocumentPlus: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
export default DocumentPlus;

View File

@ -1 +0,0 @@
import*as e from"react";const a=e.forwardRef((({color:a="currentColor",...t},l)=>e.createElement("svg",{...t,ref:l,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true","data-slot":"icon"},e.createElement("path",{fill:a,"fill-rule":"evenodd",d:"M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM12.75 12a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V18a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V12Z","clip-rule":"evenodd"}),e.createElement("path",{fill:a,d:"M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"}))));export{a as DocumentPlus,a as default};

View File

@ -1 +0,0 @@
export { DocumentPlus } from "./DocumentPlus";

View File

@ -1 +0,0 @@
export{DocumentPlus}from"./DocumentPlus.js";

2
dist/index.d.ts vendored
View File

@ -1,2 +0,0 @@
export * as OutlineIcons from "./icons/outline";
export * as SolidIcons from "./icons/solid";

5
dist/index.js vendored
View File

@ -1,4 +1 @@
import * as o from "./icons/outline/index.js"; module.exports=new Proxy({},{get:(o,e)=>{if("__esModule"===e)return{};throw new Error("Importing from 'via-icons' directly is not supported. Please import from either 'via-icons/solid' or 'via-icons/outline' instead.")}});
export { o as OutlineIcons };
import * as s from "./icons/solid/index.js";
export { s as SolidIcons };

13
dist/outline/DocumentPlusIcon.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import * as React from 'react';
interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}
/**
* The DocumentPlus icon is used to represent the action of adding a new document.
*
* @usage
* Use this icon in buttons, links, or other UI elements where the user can create a new document.
*/
export declare const DocumentPlusIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
export {};

1
dist/outline/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export { DocumentPlusIcon } from './DocumentPlusIcon';

1
dist/outline/index.js vendored Normal file
View File

@ -0,0 +1 @@
import*as e from"react";const o=e.forwardRef((({color:o="currentColor",...r},t)=>e.createElement("svg",{...r,ref:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},e.createElement("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))));o.displayName="DocumentPlusIcon";export{o as DocumentPlusIcon};

13
dist/solid/DocumentPlusIcon.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import * as React from 'react';
interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}
/**
* The DocumentPlus icon is used to represent the action of adding a new document.
*
* @usage
* Use this icon in buttons, links, or other UI elements where the user can create a new document.
*/
export declare const DocumentPlusIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
export {};

1
dist/solid/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export { DocumentPlusIcon } from './DocumentPlusIcon';

1
dist/solid/index.js vendored Normal file
View File

@ -0,0 +1 @@
import*as e from"react";const a=e.forwardRef((({color:a="currentColor",...r},t)=>e.createElement("svg",{...r,ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},e.createElement("path",{"fill-rule":"evenodd",d:"M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM12.75 12a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V18a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V12Z","clip-rule":"evenodd"}),e.createElement("path",{d:"M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"}))));a.displayName="DocumentPlusIcon";export{a as DocumentPlusIcon};

View File

@ -1,5 +0,0 @@
import * as React from "react";
export interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}

View File

@ -1,52 +1,40 @@
{ {
"name": "via-icons", "name": "via-icons",
"version": "1.0.0", "version": "1.0.1",
"description": "", "description": "",
"type": "module", "type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"sideEffects": false, "sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
"exports": { "exports": {
".": {
"require": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"import": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"./outline": { "./outline": {
"require": { "require": {
"import": "./dist/icons/outline/index.js", "import": "./dist/outline/index.js",
"types": "./dist/icons/outline/index.d.ts" "types": "./dist/outline/index.d.ts"
}, },
"import": { "import": {
"import": "./dist/icons/outline/index.js", "import": "./dist/outline/index.js",
"types": "./dist/icons/outline/index.d.ts" "types": "./dist/outline/index.d.ts"
} }
}, },
"./solid": { "./solid": {
"require": { "require": {
"import": "./dist/icons/solid/index.js", "import": "./dist/solid/index.js",
"types": "./dist/icons/solid/index.d.ts" "types": "./dist/solid/index.d.ts"
}, },
"import": { "import": {
"import": "./dist/icons/solid/index.js", "import": "./dist/solid/index.js",
"types": "./dist/icons/solid/index.d.ts" "types": "./dist/solid/index.d.ts"
} }
} }
}, },
"license": "ISC", "license": "ISC",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "generate-icons": "node scripts/generateIcons.js",
"rollupPrebuild": "rimraf dist", "rollupPrebuild": "rimraf dist",
"rollupBuildProd": "rollup -c --environment NODE_ENV:production", "rollupBuildProd": "rollup -c --environment NODE_ENV:production",
"deploy": "git pull origin main && yarn rollupPrebuild && yarn rollupBuildProd && git add . && yarn version --patch && git push origin main && git push origin main --tags" "deploy": "pnpm rollupPrebuild && pnpm rollupBuildProd && git add . && npm version --patch && git push origin main && git push origin main --tags"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@ -1,47 +1,75 @@
import fs from "fs";
import path from "path";
import typescript from "@rollup/plugin-typescript"; import typescript from "@rollup/plugin-typescript";
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve"; import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs"; import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser"; import { terser } from "rollup-plugin-terser";
import alias from "@rollup/plugin-alias";
import path from "path";
import { fileURLToPath } from "url";
const pkgPath = path.resolve("package.json"); const __filename = fileURLToPath(import.meta.url);
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8")); const __dirname = path.dirname(__filename);
const external = [ const projectRootDir = path.resolve(__dirname);
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
/@babel\/runtime/,
];
const rollupConfig = { export default [
{
input: "src/index.ts", input: "src/index.ts",
output: { output: [
dir: "dist", {
format: "esm", file: "dist/index.js",
format: "es",
sourcemap: false, sourcemap: false,
preserveModules: true,
preserveModulesRoot: "src",
}, },
external, ],
plugins: [ plugins: [
alias({
entries: [
{ find: "@", replacement: path.resolve(projectRootDir, "src") },
],
}),
resolve(), resolve(),
commonjs(), commonjs(),
typescript({ typescript({
tsconfig: "./tsconfig.json", tsconfig: "./tsconfig.json",
declaration: true, declaration: true,
noEmitOnError: true, declarationDir: "dist",
importHelpers: true, rootDir: "src",
}), outDir: "dist",
babel({
extensions: [".js", ".ts"],
babelHelpers: "runtime",
include: ["src/**/*"],
plugins: ["@babel/plugin-transform-runtime"],
}), }),
terser(), terser(),
], ],
}; external: ["react"],
},
export default rollupConfig; {
input: {
solid: "src/solid/index.ts",
outline: "src/outline/index.ts",
},
output: [
{
dir: "dist",
format: "es",
sourcemap: false,
entryFileNames: "[name]/index.js",
},
],
plugins: [
alias({
entries: [
{ find: "@", replacement: path.resolve(projectRootDir, "src") },
],
}),
resolve(),
commonjs(),
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
declarationDir: "dist",
rootDir: "src",
outDir: "dist",
}),
terser(),
],
external: ["react"],
},
];

104
scripts/generateIcons.js Normal file
View File

@ -0,0 +1,104 @@
import fs from "fs";
import path from "path";
import { optimize } from "svgo";
import { fileURLToPath } from "url";
import { dirname } from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const svgoConfig = {
plugins: [
{ name: "removeTitle", active: true },
{ name: "removeAttrs", params: { attrs: "(data-name)" } },
{ name: "removeDimensions", active: true },
{ name: "convertColors", params: { currentColor: true } },
],
};
const iconMetadataPath = path.resolve(__dirname, "./iconMetadata.json");
const iconMetadata = JSON.parse(fs.readFileSync(iconMetadataPath, "utf-8"));
const generateIconComponent = (name, svgContent, description, usage) => `
import * as React from 'react';
interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}
/**
* ${description}
*
* @usage
* ${usage}
*/
export const ${name}Icon = React.forwardRef<SVGSVGElement, IconProps>(
({ color = 'currentColor', ...props }, forwardedRef) => {
return (
${svgContent.replace("<svg", "<svg {...props} ref={forwardedRef}")}
);
}
);
${name}Icon.displayName = '${name}Icon';
`;
const generateIndexFile = (components, iconType) => {
const exports = components
.map((name) => `export { ${name}Icon } from './${name}Icon';`)
.join("\n");
const indexPath = path.resolve(__dirname, `../src/${iconType}/index.ts`);
fs.writeFileSync(indexPath, exports, "utf-8");
};
const processIcons = async (iconType) => {
const svgDir = path.resolve(__dirname, `../src/svgs/${iconType}`);
const componentDir = path.resolve(__dirname, `../src/${iconType}`);
if (!fs.existsSync(componentDir)) {
fs.mkdirSync(componentDir, { recursive: true });
}
const components = [];
const files = fs.readdirSync(svgDir);
for (const file of files) {
const filePath = path.resolve(svgDir, file);
const svgContent = fs.readFileSync(filePath, "utf-8");
const { data } = await optimize(svgContent, svgoConfig);
const componentName = file
.replace(".svg", "")
.replace(/(^\w|-\w)/g, clearAndUpper);
const metadata = iconMetadata[componentName];
if (!metadata) {
console.error(`Metadata for ${componentName} not found`);
continue;
}
components.push(componentName);
const componentContent = generateIconComponent(
componentName,
data,
metadata.description,
metadata.usage
);
const componentPath = path.resolve(
componentDir,
`${componentName}Icon.tsx`
);
fs.writeFileSync(componentPath, componentContent, "utf-8");
}
generateIndexFile(components, iconType);
};
const clearAndUpper = (text) => text.replace(/-/, "").toUpperCase();
(async () => {
await processIcons("solid");
await processIcons("outline");
})();

10
scripts/iconMetadata.json Normal file
View File

@ -0,0 +1,10 @@
{
"DocumentPlus": {
"description": "The DocumentPlus icon is used to represent the action of adding a new document.",
"usage": "Use this icon in buttons, links, or other UI elements where the user can create a new document."
},
"Icon2": {
"description": "The Icon2 icon represents a generic action or item.",
"usage": "Use this icon in scenarios where a general action needs to be indicated, such as settings or preferences."
}
}

View File

@ -1,29 +0,0 @@
import * as React from "react";
import { IconProps } from "@/types";
export const DocumentPlus = React.forwardRef<SVGSVGElement, IconProps>(
({ color = "currentColor", ...props }, forwardedRef) => {
return (
<svg
{...props}
ref={forwardedRef}
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
data-slot="icon"
>
<path
fill={color}
stroke-linecap="round"
stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"
/>
</svg>
);
}
);
export default DocumentPlus;

View File

@ -1 +0,0 @@
export { DocumentPlus } from "./DocumentPlus";

View File

@ -1,33 +0,0 @@
import * as React from "react";
import { IconProps } from "@/types";
export const DocumentPlus = React.forwardRef<SVGSVGElement, IconProps>(
({ color = "currentColor", ...props }, forwardedRef) => {
return (
<svg
{...props}
ref={forwardedRef}
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
data-slot="icon"
>
<path
fill={color}
fill-rule="evenodd"
d="M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM12.75 12a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V18a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V12Z"
clip-rule="evenodd"
/>
<path
fill={color}
d="M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"
/>
</svg>
);
}
);
export default DocumentPlus;

View File

@ -1 +0,0 @@
export { DocumentPlus } from "./DocumentPlus";

View File

@ -1,2 +1,14 @@
export * as OutlineIcons from "./icons/outline"; module.exports = new Proxy(
export * as SolidIcons from "./icons/solid"; {},
{
get: (_, property) => {
if (property === "__esModule") {
return {};
}
throw new Error(
`Importing from 'via-icons' directly is not supported. Please import from either 'via-icons/solid' or 'via-icons/outline' instead.`
);
},
}
);

View File

@ -0,0 +1,23 @@
import * as React from 'react';
interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}
/**
* The DocumentPlus icon is used to represent the action of adding a new document.
*
* @usage
* Use this icon in buttons, links, or other UI elements where the user can create a new document.
*/
export const DocumentPlusIcon = React.forwardRef<SVGSVGElement, IconProps>(
({ color = 'currentColor', ...props }, forwardedRef) => {
return (
<svg {...props} ref={forwardedRef} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true" data-slot="icon"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"/></svg>
);
}
);
DocumentPlusIcon.displayName = 'DocumentPlusIcon';

1
src/outline/index.ts Normal file
View File

@ -0,0 +1 @@
export { DocumentPlusIcon } from './DocumentPlusIcon';

View File

@ -0,0 +1,23 @@
import * as React from 'react';
interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}
/**
* The DocumentPlus icon is used to represent the action of adding a new document.
*
* @usage
* Use this icon in buttons, links, or other UI elements where the user can create a new document.
*/
export const DocumentPlusIcon = React.forwardRef<SVGSVGElement, IconProps>(
({ color = 'currentColor', ...props }, forwardedRef) => {
return (
<svg {...props} ref={forwardedRef} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" data-slot="icon"><path fill-rule="evenodd" d="M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM12.75 12a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V18a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V12Z" clip-rule="evenodd"/><path d="M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"/></svg>
);
}
);
DocumentPlusIcon.displayName = 'DocumentPlusIcon';

1
src/solid/index.ts Normal file
View File

@ -0,0 +1 @@
export { DocumentPlusIcon } from './DocumentPlusIcon';

View File

@ -1,6 +0,0 @@
import * as React from "react";
export interface IconProps extends React.SVGAttributes<SVGElement> {
children?: never;
color?: string;
}

View File

@ -1,25 +1,22 @@
{ {
"compilerOptions": { "compilerOptions": {
"allowSyntheticDefaultImports": true, "baseUrl": "./",
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"esModuleInterop": true,
"noUnusedLocals": true,
"declaration": true,
"outDir": "./dist",
"declarationDir": "./dist",
"target": "esnext",
"module": "esnext",
"jsx": "react",
"strict": false,
"noImplicitAny": false,
"baseUrl": ".",
"paths": { "paths": {
"@/*": ["src/*"] "@/*": ["src/*"]
}
}, },
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], "outDir": "./dist",
"exclude": ["node_modules", "dist"] "declaration": true,
"declarationDir": "./dist",
"emitDeclarationOnly": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"module": "ESNext",
"target": "ESNext",
"jsx": "react",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true
},
"include": ["src/**/*.tsx", "src/**/*.ts"]
} }