@actview/lucide
v0.0.1
Published
A Lucide icon library package for ActView applications.
Readme
@actview/lucide
Lucide icon library adapter for ActView.
Installation
pnpm add @actview/lucide actview @actview/jsx
pnpm add -D @actview/plugin-vitenpm install @actview/lucide actview @actview/jsx
npm install -D @actview/plugin-viteConfigure jsxImportSource and the Vite plugin in your ActView app:
// tsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@actview/jsx"
}
}// vite.config.ts
import { actviewPlugin } from '@actview/plugin-vite';
export default {
plugins: [actviewPlugin()],
};Usage
With @actview/plugin-vite, write components as regular functions; the plugin
automatically converts them to defineComponent:
import { createApp } from 'actview';
import { Camera, LucideProvider } from '@actview/lucide';
function App() {
return (
<LucideProvider size={32} color="red">
<Camera class="my-icon" aria-label="Camera" />
</LucideProvider>
);
}
createApp(App).mount('#app');Imports
// Main entry
import { Camera, House } from '@actview/lucide';
// Namespace
import * as icons from '@actview/lucide/icons';
// Deep import
import Camera from '@actview/lucide/icons/camera';
// Custom icons
import { createLucideIcon } from '@actview/lucide';
import type { IconNode } from '@actview/lucide';Development
pnpm --filter @actview/lucide build # generate icons, JS and type declarations
pnpm --filter @actview/lucide test # generate icons and run testsComponents and hooks
| Export | Description |
| --- | --- |
| Icon | Core renderer. Pass iconNode manually. |
| createLucideIcon(name, iconNode) | Create an icon component. |
| LucideProvider | Provide default size, color, strokeWidth, absoluteStrokeWidth, and class. |
| useLucideContext() | Read the injected computed context. Only callable during setup. |
ActView-specific notes
- Every icon is already wrapped by
defineComponent. Consumers do not need@actview/plugin-babelto use these icons. refon an icon component points to the component instance, following ActView component semantics. ActView component refs are not forwarded to the underlyingsvgelement; use DOM queries or a wrapper element if you need the SVG node itself.- ActView writes SVG props with
setAttributeusing the exact prop key. This package translates common camelCase SVG props (strokeWidth,strokeLinecap, etc.) to their real SVG attribute names. useLucideContext()returns a computed ref because ActView component setups run once. Read.valueinside the render function to stay reactive.- ActView
provide/injectdoes not currently propagate throughrenderToString; SSR output falls back to Lucide defaults. - ActView's renderer maintains a fixed SVG tag list. SVG
titlechildren are not currently created in the SVG namespace; preferaria-label,aria-labelledby, or adescchild for accessible SVG text.
License
ISC
