bertui-icons 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/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "bertui-icons",
3
+ "version": "1.0.0",
4
+ "description": "Blazing fast icon library powered by Zig + Bun FFI. Lucide-compatible with text overlays.",
5
+ "type": "module",
6
+ "main": "./generated/index.js",
7
+ "module": "./generated/index.js",
8
+ "types": "./generated/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./generated/index.js",
12
+ "default": "./generated/index.js"
13
+ },
14
+ "./server": {
15
+ "import": "./generated/server.js",
16
+ "default": "./generated/server.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "generated/",
21
+ "react-wrapper.jsx",
22
+ "zig-out/lib/"
23
+ ],
24
+ "scripts": {
25
+ "prebuild": "bun run build-icons.js",
26
+ "build": "zig build -Doptimize=ReleaseFast",
27
+ "build:icons": "bun run build-icons.js",
28
+ "build:zig": "zig build -Doptimize=ReleaseFast",
29
+ "dev": "bun run build-icons.js && zig build",
30
+ "test": "zig build test",
31
+ "prepublishOnly": "bun run prebuild && bun run build"
32
+ },
33
+ "keywords": [
34
+ "icons",
35
+ "svg",
36
+ "react",
37
+ "zig",
38
+ "bun",
39
+ "lucide",
40
+ "fast",
41
+ "bertui"
42
+ ],
43
+ "author": "BERTUI",
44
+ "license": "MIT",
45
+ "peerDependencies": {
46
+ "react": ">=16.8.0"
47
+ },
48
+ "devDependencies": {
49
+ "bun-types": "latest"
50
+ },
51
+ "engines": {
52
+ "bun": ">=1.0.0"
53
+ }
54
+ }
@@ -0,0 +1,99 @@
1
+ import React from 'react';
2
+
3
+ // Import generated icons
4
+ import { Icons, createIcon } from './generated/index.js';
5
+
6
+ /**
7
+ * Base Icon component for BERTUI Icons
8
+ * Lucide-react compatible API with text overlay support
9
+ */
10
+ export function Icon({
11
+ name,
12
+ children,
13
+ size = 24,
14
+ color = 'currentColor',
15
+ strokeWidth = 2,
16
+ className = '',
17
+ x,
18
+ y,
19
+ fontSize = 12,
20
+ ...props
21
+ }) {
22
+ const IconComponent = Icons[name] || createIcon(name);
23
+
24
+ const options = {
25
+ width: size,
26
+ height: size,
27
+ stroke: color,
28
+ strokeWidth,
29
+ className,
30
+ overlay: children ? {
31
+ text: String(children),
32
+ x: x ?? size + 4,
33
+ y: y ?? size / 2,
34
+ fontSize,
35
+ } : null,
36
+ ...props,
37
+ };
38
+
39
+ const svgHtml = IconComponent(options);
40
+
41
+ return (
42
+ <span
43
+ dangerouslySetInnerHTML={svgHtml}
44
+ className={className}
45
+ style={{ display: 'inline-block', lineHeight: 0 }}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ /**
52
+ * Generate individual icon components
53
+ * Usage: <ArrowRight>home</ArrowRight>
54
+ */
55
+ export function createIconComponent(iconName) {
56
+ const IconComp = ({ children, ...props }) => {
57
+ return <Icon name={iconName} {...props}>{children}</Icon>;
58
+ };
59
+
60
+ IconComp.displayName = iconName;
61
+ return IconComp;
62
+ }
63
+
64
+ // Auto-generate all icon exports
65
+ const iconComponents = {};
66
+ Object.keys(Icons).forEach(iconName => {
67
+ iconComponents[iconName] = createIconComponent(iconName);
68
+ });
69
+
70
+ // Export all icons for lucide-react compatibility
71
+ export const {
72
+ ZapOff,
73
+ ArrowRight,
74
+ Home,
75
+ // ... all other icons will be auto-generated
76
+ } = iconComponents;
77
+
78
+ // Default export for wildcard imports
79
+ export default iconComponents;
80
+
81
+ /**
82
+ * Usage examples:
83
+ *
84
+ * // Direct import (lucide-react style)
85
+ * import { ArrowRight, Home } from 'bertui-icons';
86
+ * <ArrowRight />
87
+ * <Home>5</Home>
88
+ *
89
+ * // With text overlay and positioning
90
+ * <ArrowRight x={30} y={15} fontSize={14}>Next</ArrowRight>
91
+ *
92
+ * // Wildcard import
93
+ * import * as Icons from 'bertui-icons';
94
+ * <Icons.ArrowRight />
95
+ *
96
+ * // Dynamic icon
97
+ * import { Icon } from 'bertui-icons';
98
+ * <Icon name="ArrowRight">text</Icon>
99
+ */
Binary file