@vezham/icons-svelte 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # @vezham/icons-svelte
2
+
3
+ ## 1.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4bc7ae2`](https://github.com/vezham/reicon/commit/4bc7ae21342fe26c90359bc0d5cbb74258b32fe7) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - ver bump
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`345a93a`](https://github.com/vezham/reicon/commit/345a93aa6f5a5b7f0d4598a0708eb24dd704046a) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - ver bump
14
+
15
+ ## 1.0.0
16
+
17
+ ### Patch Changes
18
+
19
+ - [`ccfadd2`](https://github.com/vezham/reicon/commit/ccfadd29b3031f81cc6986d9e2ff084eca798c81) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - init test
package/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ SPDX-License-Identifier: MIT
2
+
3
+ Attribution:
4
+ Creator / Maintainer : Vezham Technologies Private Limited
5
+ Original Author : REICON
6
+ Licensor : Vezham Technologies Private Limited
7
+
8
+ Copyright (c) 2025 REICON.
9
+ Copyright (c) 2025–present Vezham Technologies Private Limited. All rights reserved.
10
+
11
+ ---
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2025 REICON
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ of this software and associated documentation files (the "Software"), to deal
18
+ in the Software without restriction, including without limitation the rights
19
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is
21
+ furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all
24
+ copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,222 @@
1
+ <p align="center">
2
+ <a href="https://reicon.dev">
3
+ <img src="https://reicon.dev/readme-banner.png" alt="Reicon Svelte — SVG Icon Library for Svelte" width="100%" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://npmjs.com/package/reicon-svelte"><img src="https://img.shields.io/npm/v/reicon-svelte?color=black&label=npm" alt="npm version" /></a>
9
+ <a href="https://npmjs.com/package/reicon-svelte"><img src="https://img.shields.io/npm/dm/reicon-svelte?color=black&label=downloads" alt="npm downloads" /></a>
10
+ <a href="https://github.com/dqev/reicon/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-black" alt="MIT License" /></a>
11
+ <a href="https://reicon.dev"><img src="https://img.shields.io/badge/docs-reicon.dev-black" alt="Documentation" /></a>
12
+ <a href="https://github.com/dqev/reicon"><img src="https://img.shields.io/badge/github-dqev/reicon-black" alt="GitHub" /></a>
13
+ </p>
14
+
15
+ <h1 align="center">Reicon Svelte</h1>
16
+
17
+ <p align="center">
18
+ <b>2674+ pixel-perfect SVG icons</b> • Outline & Filled weights • Svelte component wrapper • Zero dependencies • MIT Licensed
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="#install">Install</a> •
23
+ <a href="#usage">Usage</a> •
24
+ <a href="#props">Props</a> •
25
+ <a href="#tree-shaking">Tree-shaking</a> •
26
+ <a href="#icon-names">Icon Names</a> •
27
+ <a href="#typescript">TypeScript</a>
28
+ </p>
29
+
30
+ **Reicon Svelte** is the official Svelte package for <a href="https://reicon.dev">Reicon</a> — a free, open-source SVG icon library featuring 2674+ handcrafted, grid-aligned icons. Every component is tree-shakeable, fully TypeScript-ready, and ships with zero dependencies.
31
+
32
+ | 🔗 &nbsp; Resource | Link |
33
+ |---|---|
34
+ | 🌐 &nbsp; Website & icon browser | [reicon.dev](https://reicon.dev) |
35
+ | 📖 &nbsp; Documentation | [reicon.dev/docs](https://reicon.dev/docs) |
36
+ | 📦 &nbsp; Core package (vanilla JS) | [reicon](https://npmjs.com/package/reicon) |
37
+ | 🎨 &nbsp; Figma plugin | [reicon.dev/docs/figma](https://reicon.dev/docs/figma) |
38
+
39
+ ---
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ npm i reicon-svelte
45
+ # or
46
+ bun add reicon-svelte
47
+ # or
48
+ yarn add reicon-svelte
49
+ ```
50
+
51
+ <details>
52
+ <summary><b>Requirements</b></summary>
53
+
54
+ - **Svelte** ≥ 4.0 or **Svelte 5** (runes mode)
55
+ - No other dependencies required.
56
+
57
+ </details>
58
+
59
+ ---
60
+
61
+ ## Usage
62
+
63
+ ### Basic
64
+
65
+ ```svelte
66
+ <script>
67
+ import { Home, ShieldCheck, AltArrowDown } from 'reicon-svelte';
68
+ </script>
69
+
70
+ <Home />
71
+ <ShieldCheck size={32} color="#d97757" />
72
+ <AltArrowDown weight="Filled" />
73
+ ```
74
+
75
+ ### Weights
76
+
77
+ Every icon ships in two weights — **Outline** (default) and **Filled**:
78
+
79
+ ```svelte
80
+ <Home /> <!-- Outline (default) -->
81
+ <Home weight="Filled" /> <!-- Filled -->
82
+ ```
83
+
84
+ ### Sizing & coloring
85
+
86
+ ```svelte
87
+ <Home size={32} /> <!-- 32×32px -->
88
+ <Home size={48} color="#d97757" /> <!-- Custom size and color -->
89
+ <Home color="currentColor" /> <!-- Inherits parent text color -->
90
+ ```
91
+
92
+ ### Direct icon import (smallest bundle)
93
+
94
+ For the absolute minimum bundle size, import icons directly from the sub-path:
95
+
96
+ ```js
97
+ import Home from 'reicon-svelte/icons/Home.svelte';
98
+ import ShieldCheck from 'reicon-svelte/icons/ShieldCheck.svelte';
99
+ ```
100
+
101
+ ### All SVG attributes are supported
102
+
103
+ Pass any standard SVG attribute — `class`, `style`, `on:click`, `aria-*`, etc.:
104
+
105
+ ```svelte
106
+ <Home
107
+ size={48}
108
+ color="red"
109
+ class="my-icon"
110
+ style="margin-right: 8px"
111
+ on:click={() => console.log('clicked')}
112
+ aria-label="Home"
113
+ />
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Props
119
+
120
+ | Prop | Type | Default | Description |
121
+ |------|------|---------|-------------|
122
+ | `size` | `number | string` | `24` | Icon width & height (number = px) |
123
+ | `color` | `string` | — | Primary icon stroke/fill color. Leave unset to use CSS class. |
124
+ | `weight` | `'Outline' | 'Filled'` | `'Outline'` | Icon style variant |
125
+ | `strokeWidth` | `number | string` | — | Override the default stroke width |
126
+ | `class` | `string` | — | Additional CSS class on the `<svg>` element |
127
+ | `style` | `string` | — | Additional inline styles |
128
+
129
+ Any valid SVG attribute (e.g. `id`, `aria-*`) is forwarded to the underlying `<svg>` element.
130
+
131
+ ---
132
+
133
+ ## Tree-shaking
134
+
135
+ Every icon is a standalone ES module. Modern bundlers — **Vite**, **Webpack**, **Rollup**, **esbuild** — automatically tree-shake unused icons, keeping only what you import.
136
+
137
+ ```js
138
+ // ✅ Only Home is included in your production bundle
139
+ import { Home } from 'reicon-svelte';
140
+
141
+ // ✅ Even smaller — direct path import skips the barrel file entirely
142
+ import Home from 'reicon-svelte/icons/Home.svelte';
143
+ ```
144
+
145
+ The package is marked `"sideEffects": false` for optimal dead-code elimination.
146
+
147
+ ---
148
+
149
+ ## Icon Names
150
+
151
+ Icons use **PascalCase**, derived from their original kebab-case file names:
152
+
153
+ | Original name | PascalCase import |
154
+ |---------------|-------------------|
155
+ | `home` | `Home` |
156
+ | `shield-check` | `ShieldCheck` |
157
+ | `alt-arrow-down` | `AltArrowDown` |
158
+ | `shopping-cart` | `ShoppingCart` |
159
+ | `user-circle` | `UserCircle` |
160
+
161
+ Browse and search all 2674+ icons at <a href="https://reicon.dev">reicon.dev</a>.
162
+
163
+ ---
164
+
165
+ ## TypeScript
166
+
167
+ Full type declarations ship with the package — no separate `@types/` installation needed.
168
+
169
+ ```ts
170
+ import { Home, type IconProps, type IconWeight } from 'reicon-svelte';
171
+
172
+ const weight: IconWeight = 'Filled';
173
+ const props: IconProps = { size: 32, color: '#d97757', weight };
174
+ ```
175
+
176
+ ### Exported types
177
+
178
+ | Type | Description |
179
+ |------|-------------|
180
+ | `IconProps` | Combined icon props + Svelte SVG attributes |
181
+ | `IconWeight` | `'Outline' | 'Filled'` |
182
+
183
+ ---
184
+
185
+ ## Features
186
+
187
+ - **2674+ icons** — Handcrafted, pixel-perfect SVGs across a wide range of categories
188
+ - **Two weights** — Outline and Filled, with consistent 24×24 grid alignment
189
+ - **Tree-shakeable** — Import only what you use; every icon is a standalone ES module
190
+ - **Zero dependencies** — No runtime overhead beyond Svelte itself
191
+ - **TypeScript-ready** — Full type declarations included, no extra packages needed
192
+ - **SVG attribute passthrough** — All standard SVG props (`class`, `style`, `aria-*`, etc.) are forwarded
193
+ - **MIT licensed** — Free for personal and commercial use
194
+
195
+ ---
196
+
197
+ ## Related packages
198
+
199
+ | Package | Description |
200
+ |---------|-------------|
201
+ | [`reicon`](https://npmjs.com/package/reicon) | Core vanilla JS + CDN runtime. No framework required. |
202
+ | [`reicon-react`](https://npmjs.com/package/reicon-react) | React components for 2674+ icons. |
203
+ | [`reicon-vue`](https://npmjs.com/package/reicon-vue) | Vue 3 components for 2674+ icons. |
204
+ | [`reicon-svelte`](https://npmjs.com/package/reicon-svelte) | **You are here.** Svelte components for 2674+ icons. |
205
+
206
+ ---
207
+
208
+ ## Links
209
+
210
+ - 🌐 &nbsp; Website: [reicon.dev](https://reicon.dev)
211
+ - 📖 &nbsp; Documentation: [reicon.dev/docs](https://reicon.dev/docs)
212
+ - 📦 &nbsp; npm: [npmjs.com/package/reicon-svelte](https://npmjs.com/package/reicon-svelte)
213
+ - 🐙 &nbsp; GitHub: [github.com/dqev/reicon](https://github.com/dqev/reicon)
214
+ - 🐛 &nbsp; Issues: [github.com/dqev/reicon/issues](https://github.com/dqev/reicon/issues)
215
+
216
+ ---
217
+
218
+ ## License
219
+
220
+ MIT © [Dev Chauhan](https://devchauhan.in)
221
+
222
+ Free to use in personal and commercial projects. Attribution is appreciated but not required.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@vezham/icons-svelte",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Svelte icon components for Reicon.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/vezham/reicon",
9
+ "directory": "packages/icons-svelte"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/vezham/reicon/issues"
13
+ },
14
+ "homepage": "https://vezham.com",
15
+ "peerDependencies": {
16
+ "svelte": ">=3.0.0"
17
+ },
18
+ "scripts": {
19
+ "build": "node scripts/build.cjs"
20
+ }
21
+ }
@@ -0,0 +1,531 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * build.cjs — Generates the `reicon-svelte` Svelte package from icondata.json
4
+ *
5
+ * Usage: node packages/icons-svelte/scripts/build.cjs (or: npm run build:svelte)
6
+ *
7
+ * Output:
8
+ * src/icons/ Individual Svelte components and Svelte type declarations (git-ignored)
9
+ * src/index.js Barrel ESM exports (git-ignored)
10
+ * src/index.d.ts Barrel TypeScript declarations (git-ignored)
11
+ * dist/ Standard NPM package ready to publish (git-ignored)
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+
17
+ // ── paths ──────────────────────────────────────────────────────────────────
18
+ const DATA_PATH = path.join(__dirname, '..', '..', '..', 'data', 'icon-data.json');
19
+ const TAGS_PATH = path.join(__dirname, '..', '..', '..', 'data', 'icon-tags.json');
20
+ const SRC = path.join(__dirname, '..', 'src');
21
+ const DIST = path.join(__dirname, '..', 'dist');
22
+
23
+ // ── weight short keys ──────────────────────────────────────────────────────
24
+ const W_KEY = { Filled: 'F', Outline: 'O' };
25
+
26
+ // ── helpers ────────────────────────────────────────────────────────────────
27
+ function toPascalCase(str) {
28
+ return str
29
+ .split('-')
30
+ .map(s => s.charAt(0).toUpperCase() + s.slice(1))
31
+ .join('');
32
+ }
33
+
34
+ function stripSvgWrapper(code) {
35
+ if (!code) return '';
36
+ return code.replace(/^<svg[^>]*>/, '').replace(/<\/svg>\s*$/, '').trim();
37
+ }
38
+
39
+ // Fix hardcoded fill="white" → currentColor so user color prop works correctly.
40
+ function rewriteColors(svg) {
41
+ return svg.replace(/fill="white"/g, 'fill="currentColor"');
42
+ }
43
+
44
+ function escapeForJS(s) {
45
+ return s.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\n/g, ' ').replace(/\s+/g, ' ').replace(/\$\{/g, '\\${');
46
+ }
47
+
48
+ /**
49
+ * Build a base64 data URI for an inline SVG preview (shown in IDE hover).
50
+ */
51
+ function buildPreviewDataUri(weights) {
52
+ const inner = weights['O'] || weights['F'] || '';
53
+ if (!inner) return '';
54
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">${inner}</svg>`
55
+ .replace(/currentColor/g, '#e4e4e7');
56
+ return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;
57
+ }
58
+
59
+ // ── read data ──────────────────────────────────────────────────────────────
60
+ console.log('Reading icondata.json …');
61
+ const data = JSON.parse(fs.readFileSync(DATA_PATH, 'utf-8'));
62
+
63
+ let TAGS = {};
64
+ if (fs.existsSync(TAGS_PATH)) {
65
+ TAGS = JSON.parse(fs.readFileSync(TAGS_PATH, 'utf-8'));
66
+ console.log(`Read ${Object.keys(TAGS).length} tag entries`);
67
+ }
68
+
69
+ // ── collect icons ──────────────────────────────────────────────────────────
70
+ const RESERVED_EXPORT_NAMES = ['icon', 'createicon', 'iconprops', 'iconweight', 'iconcomponent', 'iconoptions', 'iconfunction'];
71
+ const icons = [];
72
+ const pascalLowerSet = new Set(RESERVED_EXPORT_NAMES);
73
+
74
+ for (const [catKey, catData] of Object.entries(data.categories || {})) {
75
+ for (const [iconKey, icon] of Object.entries(catData.icons || {})) {
76
+ let pascal = toPascalCase(iconKey);
77
+
78
+ if (pascalLowerSet.has(pascal.toLowerCase())) {
79
+ pascal += toPascalCase(catKey);
80
+ }
81
+ pascalLowerSet.add(pascal.toLowerCase());
82
+
83
+ const weights = {};
84
+ for (const [wName, wData] of Object.entries(icon.weights || {})) {
85
+ const short = W_KEY[wName];
86
+ if (short && wData.code) {
87
+ weights[short] = rewriteColors(stripSvgWrapper(wData.code));
88
+ }
89
+ }
90
+
91
+ if (Object.keys(weights).length > 0) {
92
+ icons.push({
93
+ kebab: iconKey,
94
+ pascal,
95
+ category: catKey,
96
+ weights,
97
+ tags: TAGS[iconKey] || icon.description || [],
98
+ });
99
+ }
100
+ }
101
+ }
102
+
103
+ icons.sort((a, b) => a.pascal.localeCompare(b.pascal));
104
+ console.log(`Found ${icons.length} icons`);
105
+
106
+ // ── clean & prepare src ────────────────────────────────────────────────────
107
+ fs.rmSync(path.join(SRC, 'icons'), { recursive: true, force: true });
108
+ fs.mkdirSync(path.join(SRC, 'icons'), { recursive: true });
109
+
110
+ // ── individual icon files ──────────────────────────────────────────────────
111
+ console.log('Generating Svelte components in src/icons/ …');
112
+
113
+ const barrelExports = [];
114
+ const dtsExports = [];
115
+
116
+ for (const icon of icons) {
117
+ const wEntries = Object.entries(icon.weights)
118
+ .map(([k, v]) => ` ${k}: \`${escapeForJS(v)}\``)
119
+ .join(',\n');
120
+
121
+ const previewUri = buildPreviewDataUri(icon.weights);
122
+ const kebab = icon.kebab;
123
+
124
+ // ── icon .svelte file ──
125
+ const iconSvelte = `<script>
126
+ import Icon from '../Icon.svelte';
127
+ export let size = 24;
128
+ export let color = undefined;
129
+ export let weight = 'Outline';
130
+ export let strokeWidth = undefined;
131
+
132
+ const iconData = {
133
+ ${wEntries}
134
+ };
135
+ </script>
136
+
137
+ <!--
138
+ @component
139
+ @name ${icon.pascal}
140
+ @description Reicon Svelte icon component, renders an SVG Element.
141
+ @preview ![${icon.pascal}](${previewUri}) - https://reicon.dev/icons/${kebab}
142
+ @see https://reicon.dev/docs — Documentation
143
+ -->
144
+ <Icon {size} {color} {weight} {strokeWidth} {iconData} {...$$restProps} />
145
+ `;
146
+
147
+ fs.writeFileSync(path.join(SRC, 'icons', `${icon.pascal}.svelte`), iconSvelte);
148
+
149
+ // ── icon .svelte.d.ts file ──
150
+ const iconDTS = `import { SvelteComponent } from 'svelte';
151
+ import { IconProps } from '../index';
152
+
153
+ /**
154
+ * @component
155
+ * @name ${icon.pascal}
156
+ * @description Reicon Svelte icon component, renders an SVG Element.
157
+ * @preview ![${icon.pascal}](${previewUri}) - https://reicon.dev/icons/${kebab}
158
+ * @see https://reicon.dev/docs — Documentation
159
+ */
160
+ export default class ${icon.pascal} extends SvelteComponent<IconProps, any, any> {}
161
+ `;
162
+
163
+ fs.writeFileSync(path.join(SRC, 'icons', `${icon.pascal}.svelte.d.ts`), iconDTS);
164
+
165
+ barrelExports.push(`export { default as ${icon.pascal} } from './icons/${icon.pascal}.svelte';`);
166
+ dtsExports.push(`export { default as ${icon.pascal} } from './icons/${icon.pascal}.svelte';`);
167
+ }
168
+
169
+ // ── index.js (ESM barrel in src/) ──────────────────────────────────────────
170
+ const indexJS = `// Auto-generated barrel — do not edit
171
+ export { default as Icon } from './Icon.svelte';
172
+
173
+ ${barrelExports.join('\n')}
174
+ `;
175
+
176
+ fs.writeFileSync(path.join(SRC, 'index.js'), indexJS);
177
+
178
+ // ── index.d.ts (types in src/) ─────────────────────────────────────────────
179
+ const indexDTS = `// Auto-generated — do not edit
180
+ import { SvelteComponent } from 'svelte';
181
+
182
+ export interface IconProps {
183
+ /** Primary icon color. Default: inherits from CSS */
184
+ color?: string;
185
+ /** Icon size (px when number, or any CSS unit). Default: \`24\` */
186
+ size?: number | string;
187
+ /** Icon weight / style: \`'Outline'\` | \`'Filled'\`. Default: \`'Outline'\` */
188
+ weight?: 'Outline' | 'Filled';
189
+ /** Override stroke-width on stroked weights */
190
+ strokeWidth?: number | string;
191
+ // allow other standard SVG/HTML attributes
192
+ [key: string]: any;
193
+ }
194
+
195
+ export declare class Icon extends SvelteComponent<IconProps, any, any> {}
196
+
197
+ ${dtsExports.join('\n')}
198
+ `;
199
+
200
+ fs.writeFileSync(path.join(SRC, 'index.d.ts'), indexDTS);
201
+
202
+ // ── recreate src/icons/.gitkeep ────────────────────────────────────────────
203
+ fs.writeFileSync(path.join(SRC, 'icons', '.gitkeep'), '# Keep directory in Git\n');
204
+
205
+ // ── clean & prepare dist ───────────────────────────────────────────────────
206
+ console.log('Preparing production build in dist/ …');
207
+ fs.rmSync(DIST, { recursive: true, force: true });
208
+ fs.mkdirSync(path.join(DIST, 'icons'), { recursive: true });
209
+
210
+ // ── copy src files to dist ─────────────────────────────────────────────────
211
+ fs.copyFileSync(path.join(SRC, 'Icon.svelte'), path.join(DIST, 'Icon.svelte'));
212
+ fs.copyFileSync(path.join(SRC, 'Icon.svelte.d.ts'), path.join(DIST, 'Icon.svelte.d.ts'));
213
+ fs.copyFileSync(path.join(SRC, 'index.js'), path.join(DIST, 'index.js'));
214
+ fs.copyFileSync(path.join(SRC, 'index.d.ts'), path.join(DIST, 'index.d.ts'));
215
+
216
+ for (const icon of icons) {
217
+ fs.copyFileSync(path.join(SRC, 'icons', `${icon.pascal}.svelte`), path.join(DIST, 'icons', `${icon.pascal}.svelte`));
218
+ fs.copyFileSync(path.join(SRC, 'icons', `${icon.pascal}.svelte.d.ts`), path.join(DIST, 'icons', `${icon.pascal}.svelte.d.ts`));
219
+ }
220
+
221
+ // ── package.json ───────────────────────────────────────────────────────────
222
+ const srcPkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
223
+ const pkg = {
224
+ name: srcPkg.name,
225
+ version: srcPkg.version,
226
+ type: 'module',
227
+ description:
228
+ `Svelte icon components for ${icons.length}+ icons in 2 weights (Outline & Filled). Tree-shakeable, TypeScript-ready.`,
229
+ main: './index.js',
230
+ module: './index.js',
231
+ svelte: './index.js',
232
+ types: './index.d.ts',
233
+ exports: {
234
+ '.': {
235
+ types: './index.d.ts',
236
+ svelte: './index.js',
237
+ default: './index.js'
238
+ },
239
+ './icons/*.svelte': {
240
+ types: './icons/*.svelte.d.ts',
241
+ svelte: './icons/*.svelte',
242
+ default: './icons/*.svelte'
243
+ },
244
+ './icons/*': {
245
+ types: './icons/*.svelte.d.ts',
246
+ svelte: './icons/*.svelte',
247
+ default: './icons/*.svelte'
248
+ },
249
+ './Icon.svelte': {
250
+ types: './Icon.svelte.d.ts',
251
+ svelte: './Icon.svelte',
252
+ default: './Icon.svelte'
253
+ }
254
+ },
255
+ sideEffects: false,
256
+ files: ['index.js', 'index.d.ts', 'Icon.svelte', 'Icon.svelte.d.ts', 'icons/', 'README.md'],
257
+ peerDependencies: {
258
+ svelte: '>=3.0.0',
259
+ },
260
+ keywords: [
261
+ 'icons',
262
+ 'svelte',
263
+ 'svelte3',
264
+ 'svelte4',
265
+ 'svelte5',
266
+ 'svelte-icons',
267
+ 'svg-icons',
268
+ 'icon-library',
269
+ 'reicon',
270
+ 'outline',
271
+ 'filled',
272
+ 'tree-shakeable',
273
+ 'typescript',
274
+ ],
275
+ author: {
276
+ name: 'devchauhan',
277
+ email: 'dev@devchauhan.in',
278
+ url: 'https://devchauhan.in',
279
+ },
280
+ license: 'MIT',
281
+ repository: { type: 'git', url: 'https://github.com/vezham/reicon', directory: 'packages/icons-svelte' },
282
+ bugs: { url: 'https://github.com/vezham/reicon/issues' },
283
+ homepage: 'https://vezham.com',
284
+ };
285
+
286
+ fs.writeFileSync(path.join(DIST, 'package.json'), JSON.stringify(pkg, null, 2) + '\n');
287
+
288
+ // ── README.md ──────────────────────────────────────────────────────────────
289
+ const readme = `<p align="center">
290
+ <a href="https://reicon.dev">
291
+ <img src="https://reicon.dev/readme-banner.png" alt="Reicon Svelte — SVG Icon Library for Svelte" width="100%" />
292
+ </a>
293
+ </p>
294
+
295
+ <p align="center">
296
+ <a href="https://npmjs.com/package/reicon-svelte"><img src="https://img.shields.io/npm/v/reicon-svelte?color=black&label=npm" alt="npm version" /></a>
297
+ <a href="https://npmjs.com/package/reicon-svelte"><img src="https://img.shields.io/npm/dm/reicon-svelte?color=black&label=downloads" alt="npm downloads" /></a>
298
+ <a href="https://github.com/dqev/reicon/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-black" alt="MIT License" /></a>
299
+ <a href="https://reicon.dev"><img src="https://img.shields.io/badge/docs-reicon.dev-black" alt="Documentation" /></a>
300
+ <a href="https://github.com/dqev/reicon"><img src="https://img.shields.io/badge/github-dqev/reicon-black" alt="GitHub" /></a>
301
+ </p>
302
+
303
+ <h1 align="center">Reicon Svelte</h1>
304
+
305
+ <p align="center">
306
+ <b>${icons.length}+ pixel-perfect SVG icons</b> • Outline & Filled weights • Svelte component wrapper • Zero dependencies • MIT Licensed
307
+ </p>
308
+
309
+ <p align="center">
310
+ <a href="#install">Install</a> •
311
+ <a href="#usage">Usage</a> •
312
+ <a href="#props">Props</a> •
313
+ <a href="#tree-shaking">Tree-shaking</a> •
314
+ <a href="#icon-names">Icon Names</a> •
315
+ <a href="#typescript">TypeScript</a>
316
+ </p>
317
+
318
+ **Reicon Svelte** is the official Svelte package for <a href="https://reicon.dev">Reicon</a> — a free, open-source SVG icon library featuring ${icons.length}+ handcrafted, grid-aligned icons. Every component is tree-shakeable, fully TypeScript-ready, and ships with zero dependencies.
319
+
320
+ | 🔗 &nbsp; Resource | Link |
321
+ |---|---|
322
+ | 🌐 &nbsp; Website & icon browser | [reicon.dev](https://reicon.dev) |
323
+ | 📖 &nbsp; Documentation | [reicon.dev/docs](https://reicon.dev/docs) |
324
+ | 📦 &nbsp; Core package (vanilla JS) | [reicon](https://npmjs.com/package/reicon) |
325
+ | 🎨 &nbsp; Figma plugin | [reicon.dev/docs/figma](https://reicon.dev/docs/figma) |
326
+
327
+ ---
328
+
329
+ ## Install
330
+
331
+ \`\`\`bash
332
+ npm i reicon-svelte
333
+ # or
334
+ bun add reicon-svelte
335
+ # or
336
+ yarn add reicon-svelte
337
+ \`\`\`
338
+
339
+ <details>
340
+ <summary><b>Requirements</b></summary>
341
+
342
+ - **Svelte** ≥ 4.0 or **Svelte 5** (runes mode)
343
+ - No other dependencies required.
344
+
345
+ </details>
346
+
347
+ ---
348
+
349
+ ## Usage
350
+
351
+ ### Basic
352
+
353
+ \`\`\`svelte
354
+ <script>
355
+ import { Home, ShieldCheck, AltArrowDown } from 'reicon-svelte';
356
+ </script>
357
+
358
+ <Home />
359
+ <ShieldCheck size={32} color="#d97757" />
360
+ <AltArrowDown weight="Filled" />
361
+ \`\`\`
362
+
363
+ ### Weights
364
+
365
+ Every icon ships in two weights — **Outline** (default) and **Filled**:
366
+
367
+ \`\`\`svelte
368
+ <Home /> <!-- Outline (default) -->
369
+ <Home weight="Filled" /> <!-- Filled -->
370
+ \`\`\`
371
+
372
+ ### Sizing & coloring
373
+
374
+ \`\`\`svelte
375
+ <Home size={32} /> <!-- 32×32px -->
376
+ <Home size={48} color="#d97757" /> <!-- Custom size and color -->
377
+ <Home color="currentColor" /> <!-- Inherits parent text color -->
378
+ \`\`\`
379
+
380
+ ### Direct icon import (smallest bundle)
381
+
382
+ For the absolute minimum bundle size, import icons directly from the sub-path:
383
+
384
+ \`\`\`js
385
+ import Home from 'reicon-svelte/icons/Home.svelte';
386
+ import ShieldCheck from 'reicon-svelte/icons/ShieldCheck.svelte';
387
+ \`\`\`
388
+
389
+ ### All SVG attributes are supported
390
+
391
+ Pass any standard SVG attribute — \`class\`, \`style\`, \`on:click\`, \`aria-*\`, etc.:
392
+
393
+ \`\`\`svelte
394
+ <Home
395
+ size={48}
396
+ color="red"
397
+ class="my-icon"
398
+ style="margin-right: 8px"
399
+ on:click={() => console.log('clicked')}
400
+ aria-label="Home"
401
+ />
402
+ \`\`\`
403
+
404
+ ---
405
+
406
+ ## Props
407
+
408
+ | Prop | Type | Default | Description |
409
+ |------|------|---------|-------------|
410
+ | \`size\` | \`number | string\` | \`24\` | Icon width & height (number = px) |
411
+ | \`color\` | \`string\` | — | Primary icon stroke/fill color. Leave unset to use CSS class. |
412
+ | \`weight\` | \`'Outline' | 'Filled'\` | \`'Outline'\` | Icon style variant |
413
+ | \`strokeWidth\` | \`number | string\` | — | Override the default stroke width |
414
+ | \`class\` | \`string\` | — | Additional CSS class on the \`<svg>\` element |
415
+ | \`style\` | \`string\` | — | Additional inline styles |
416
+
417
+ Any valid SVG attribute (e.g. \`id\`, \`aria-*\`) is forwarded to the underlying \`<svg>\` element.
418
+
419
+ ---
420
+
421
+ ## Tree-shaking
422
+
423
+ Every icon is a standalone ES module. Modern bundlers — **Vite**, **Webpack**, **Rollup**, **esbuild** — automatically tree-shake unused icons, keeping only what you import.
424
+
425
+ \`\`\`js
426
+ // ✅ Only Home is included in your production bundle
427
+ import { Home } from 'reicon-svelte';
428
+
429
+ // ✅ Even smaller — direct path import skips the barrel file entirely
430
+ import Home from 'reicon-svelte/icons/Home.svelte';
431
+ \`\`\`
432
+
433
+ The package is marked \`"sideEffects": false\` for optimal dead-code elimination.
434
+
435
+ ---
436
+
437
+ ## Icon Names
438
+
439
+ Icons use **PascalCase**, derived from their original kebab-case file names:
440
+
441
+ | Original name | PascalCase import |
442
+ |---------------|-------------------|
443
+ | \`home\` | \`Home\` |
444
+ | \`shield-check\` | \`ShieldCheck\` |
445
+ | \`alt-arrow-down\` | \`AltArrowDown\` |
446
+ | \`shopping-cart\` | \`ShoppingCart\` |
447
+ | \`user-circle\` | \`UserCircle\` |
448
+
449
+ Browse and search all ${icons.length}+ icons at <a href="https://reicon.dev">reicon.dev</a>.
450
+
451
+ ---
452
+
453
+ ## TypeScript
454
+
455
+ Full type declarations ship with the package — no separate \`@types/\` installation needed.
456
+
457
+ \`\`\`ts
458
+ import { Home, type IconProps, type IconWeight } from 'reicon-svelte';
459
+
460
+ const weight: IconWeight = 'Filled';
461
+ const props: IconProps = { size: 32, color: '#d97757', weight };
462
+ \`\`\`
463
+
464
+ ### Exported types
465
+
466
+ | Type | Description |
467
+ |------|-------------|
468
+ | \`IconProps\` | Combined icon props + Svelte SVG attributes |
469
+ | \`IconWeight\` | \`'Outline' | 'Filled'\` |
470
+
471
+ ---
472
+
473
+ ## Features
474
+
475
+ - **${icons.length}+ icons** — Handcrafted, pixel-perfect SVGs across a wide range of categories
476
+ - **Two weights** — Outline and Filled, with consistent 24×24 grid alignment
477
+ - **Tree-shakeable** — Import only what you use; every icon is a standalone ES module
478
+ - **Zero dependencies** — No runtime overhead beyond Svelte itself
479
+ - **TypeScript-ready** — Full type declarations included, no extra packages needed
480
+ - **SVG attribute passthrough** — All standard SVG props (\`class\`, \`style\`, \`aria-*\`, etc.) are forwarded
481
+ - **MIT licensed** — Free for personal and commercial use
482
+
483
+ ---
484
+
485
+ ## Related packages
486
+
487
+ | Package | Description |
488
+ |---------|-------------|
489
+ | [\`reicon\`](https://npmjs.com/package/reicon) | Core vanilla JS + CDN runtime. No framework required. |
490
+ | [\`reicon-react\`](https://npmjs.com/package/reicon-react) | React components for ${icons.length}+ icons. |
491
+ | [\`reicon-vue\`](https://npmjs.com/package/reicon-vue) | Vue 3 components for ${icons.length}+ icons. |
492
+ | [\`reicon-svelte\`](https://npmjs.com/package/reicon-svelte) | **You are here.** Svelte components for ${icons.length}+ icons. |
493
+
494
+ ---
495
+
496
+ ## Links
497
+
498
+ - 🌐 &nbsp; Website: [reicon.dev](https://reicon.dev)
499
+ - 📖 &nbsp; Documentation: [reicon.dev/docs](https://reicon.dev/docs)
500
+ - 📦 &nbsp; npm: [npmjs.com/package/reicon-svelte](https://npmjs.com/package/reicon-svelte)
501
+ - 🐙 &nbsp; GitHub: [github.com/dqev/reicon](https://github.com/dqev/reicon)
502
+ - 🐛 &nbsp; Issues: [github.com/dqev/reicon/issues](https://github.com/dqev/reicon/issues)
503
+
504
+ ---
505
+
506
+ ## License
507
+
508
+ MIT © [Dev Chauhan](https://devchauhan.in)
509
+
510
+ Free to use in personal and commercial projects. Attribution is appreciated but not required.
511
+ `;
512
+
513
+ fs.writeFileSync(path.join(DIST, 'README.md'), readme);
514
+ fs.writeFileSync(path.join(__dirname, '..', 'README.md'), readme);
515
+
516
+ // ── icon name map ──────────────────────────────────────────────────────────
517
+ const nameMap = {};
518
+ for (const icon of icons) {
519
+ nameMap[icon.kebab] = icon.pascal;
520
+ }
521
+ fs.writeFileSync(path.join(DIST, 'icon-names.json'), JSON.stringify(nameMap, null, 2));
522
+
523
+ // ── summary ────────────────────────────────────────────────────────────────
524
+ const totalFiles = (icons.length * 2) + 5;
525
+ console.log(`\nDone!`);
526
+ console.log(` Icons: ${icons.length}`);
527
+ console.log(` Weights: Outline + Filled`);
528
+ console.log(` Files: ${totalFiles}`);
529
+ console.log(` Output: ${DIST}`);
530
+ console.log(`\nTo publish:`);
531
+ console.log(` cd dist && npm publish --access public`);
@@ -0,0 +1,45 @@
1
+ <script>
2
+ /** @type {string | number} */
3
+ export let size = 24;
4
+ /** @type {string | undefined} */
5
+ export let color = undefined;
6
+ /** @type {string} */
7
+ export let weight = 'Outline';
8
+ /** @type {string | number | undefined} */
9
+ export let strokeWidth = undefined;
10
+ /** @type {Record<string, string>} */
11
+ export let iconData = {};
12
+
13
+ let className = '';
14
+ export { className as class };
15
+
16
+ let customStyle = '';
17
+ export { customStyle as style };
18
+
19
+ /** @type {Record<string, string>} */
20
+ const W_MAP = { Filled: 'F', Outline: 'O' };
21
+
22
+ $: key = W_MAP[weight] || 'O';
23
+ $: rawHtml = (() => {
24
+ /** @type {Record<string, string>} */
25
+ const data = iconData;
26
+ let html = data[key] || data[Object.keys(data)[0]] || '';
27
+ if (strokeWidth != null) {
28
+ html = html.replace(/stroke-width="[^"]*"/g, 'stroke-width="' + strokeWidth + '"');
29
+ }
30
+ return html;
31
+ })();
32
+ </script>
33
+
34
+ <svg
35
+ xmlns="http://www.w3.org/2000/svg"
36
+ width={size}
37
+ height={size}
38
+ viewBox="0 0 24 24"
39
+ fill="none"
40
+ class="reicon {className}"
41
+ style={color != null ? `color: ${color}; ${customStyle}` : customStyle}
42
+ {...$$restProps}
43
+ >
44
+ {@html rawHtml}
45
+ </svg>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from 'svelte';
2
+
3
+ export interface IconComponentProps {
4
+ /** Primary icon color. Default: inherits from CSS */
5
+ color?: string;
6
+ /** Icon size (px when number, or any CSS unit). Default: `24` */
7
+ size?: number | string;
8
+ /** Icon weight / style: `'Outline'` | `'Filled'`. Default: `'Outline'` */
9
+ weight?: 'Outline' | 'Filled';
10
+ /** Override stroke-width on stroked weights */
11
+ strokeWidth?: number | string;
12
+ /** Icon svg path data for different weights */
13
+ iconData?: Record<string, string>;
14
+ // allow other standard SVG/HTML attributes
15
+ [key: string]: any;
16
+ }
17
+
18
+ export default class Icon extends SvelteComponent<IconComponentProps, any, any> {}
@@ -0,0 +1 @@
1
+ # Keep directory in Git
@@ -0,0 +1 @@
1
+ export default {};
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "moduleResolution": "bundler",
4
+ "target": "es2022",
5
+ "module": "es2022",
6
+ "lib": ["es2022", "dom"],
7
+ "noEmit": true,
8
+ "allowJs": true,
9
+ "checkJs": true,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src/**/*"]
13
+ }