@microprofile/svg-render 0.0.1
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/README.md +23 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +59179 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 适用于Taro(React)微信小程序的svg渲染器
|
|
2
|
+
|
|
3
|
+
可以直接使用svg标签,对Agent开发更加友好
|
|
4
|
+
|
|
5
|
+
安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install @microprofile/svg-render
|
|
9
|
+
# 或者
|
|
10
|
+
# npm install @microprofile/svg-render
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
使用方式
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import SvgRenderer from '@microprofile/svg-render'
|
|
17
|
+
|
|
18
|
+
<SvgRender mode='aspectFit' className='w-10 h-10 border-2'>
|
|
19
|
+
<svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'>
|
|
20
|
+
<circle cx='50' cy='50' r='50' fill='red' />
|
|
21
|
+
</svg>
|
|
22
|
+
</SvgRender>
|
|
23
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { ImageProps } from '@tarojs/components';
|
|
4
|
+
|
|
5
|
+
declare function reactNodeToDomString(node: ReactNode): string;
|
|
6
|
+
interface SvgRenderProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
className?: string;
|
|
10
|
+
mode?: keyof ImageProps.Mode;
|
|
11
|
+
}
|
|
12
|
+
declare function SvgRender({ children, style, className, mode }: SvgRenderProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { type SvgRenderProps, SvgRender as default, reactNodeToDomString };
|