svger-cli 1.0.5 → 1.0.7
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/.svgconfig.json +3 -0
- package/CODE_OF_CONDUCT.md +79 -0
- package/CONTRIBUTING.md +146 -0
- package/LICENSE +21 -0
- package/README.md +1862 -73
- package/TESTING.md +143 -0
- package/cli-framework.test.js +16 -0
- package/cli-test-angular/Arrowbenddownleft.component.ts +27 -0
- package/cli-test-angular/Vite.component.ts +27 -0
- package/cli-test-angular/index.ts +25 -0
- package/cli-test-output/Arrowbenddownleft.vue +33 -0
- package/cli-test-output/Vite.vue +33 -0
- package/cli-test-output/index.ts +25 -0
- package/cli-test-react/Arrowbenddownleft.tsx +39 -0
- package/cli-test-react/Vite.tsx +39 -0
- package/cli-test-react/index.ts +25 -0
- package/cli-test-svelte/Arrowbenddownleft.svelte +22 -0
- package/cli-test-svelte/Vite.svelte +22 -0
- package/cli-test-svelte/index.ts +25 -0
- package/dist/builder.js +12 -13
- package/dist/clean.js +3 -3
- package/dist/cli.js +139 -61
- package/dist/config.d.ts +1 -1
- package/dist/config.js +5 -7
- package/dist/lock.js +1 -1
- package/dist/templates/ComponentTemplate.d.ts +17 -4
- package/dist/templates/ComponentTemplate.js +35 -11
- package/dist/watch.d.ts +2 -1
- package/dist/watch.js +30 -33
- package/docs/ADR-SVG-INTRGRATION-METHODS-002.adr.md +550 -0
- package/docs/FRAMEWORK-GUIDE.md +768 -0
- package/docs/IMPLEMENTATION-SUMMARY.md +376 -0
- package/frameworks.test.js +170 -0
- package/my-svgs/ArrowBendDownLeft.svg +6 -0
- package/my-svgs/vite.svg +1 -0
- package/package.json +7 -10
- package/src/builder.ts +13 -14
- package/src/clean.ts +3 -3
- package/src/cli.ts +148 -59
- package/src/config.ts +5 -6
- package/src/core/error-handler.ts +303 -0
- package/src/core/framework-templates.ts +428 -0
- package/src/core/logger.ts +104 -0
- package/src/core/performance-engine.ts +327 -0
- package/src/core/plugin-manager.ts +228 -0
- package/src/core/style-compiler.ts +605 -0
- package/src/core/template-manager.ts +619 -0
- package/src/index.ts +235 -0
- package/src/lock.ts +1 -1
- package/src/processors/svg-processor.ts +288 -0
- package/src/services/config.ts +241 -0
- package/src/services/file-watcher.ts +218 -0
- package/src/services/svg-service.ts +468 -0
- package/src/templates/ComponentTemplate.ts +43 -26
- package/src/types/index.ts +169 -0
- package/src/utils/native.ts +352 -0
- package/src/watch.ts +36 -36
- package/test-output-mulit/TestIcon-angular-module.component.ts +26 -0
- package/test-output-mulit/TestIcon-angular-standalone.component.ts +27 -0
- package/test-output-mulit/TestIcon-lit.ts +35 -0
- package/test-output-mulit/TestIcon-preact.tsx +38 -0
- package/test-output-mulit/TestIcon-react.tsx +35 -0
- package/test-output-mulit/TestIcon-solid.tsx +27 -0
- package/test-output-mulit/TestIcon-svelte.svelte +22 -0
- package/test-output-mulit/TestIcon-vanilla.ts +37 -0
- package/test-output-mulit/TestIcon-vue-composition.vue +33 -0
- package/test-output-mulit/TestIcon-vue-options.vue +31 -0
- package/tsconfig.json +11 -9
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement, html, css, svg } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
@customElement('test-icon')
|
|
5
|
+
export class TestIcon extends LitElement {
|
|
6
|
+
@property({ type: String }) className = '';
|
|
7
|
+
@property({ type: String, reflect: true }) width = '24';
|
|
8
|
+
@property({ type: String, reflect: true }) height = '24';
|
|
9
|
+
@property({ type: String, reflect: true }) fill = 'currentColor';
|
|
10
|
+
@property({ type: String, reflect: true }) stroke = '';
|
|
11
|
+
|
|
12
|
+
static styles = css`:host { display: inline-block; }`;
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
return svg`
|
|
16
|
+
<svg
|
|
17
|
+
class="${this.className}"
|
|
18
|
+
width="${this.width}"
|
|
19
|
+
height="${this.height}"
|
|
20
|
+
fill="${this.fill}"
|
|
21
|
+
stroke="${this.stroke}"
|
|
22
|
+
viewBox="0 0 24 24"
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
>
|
|
25
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
26
|
+
</svg>
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
'test-icon': TestIcon;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { h, FunctionComponent } from 'preact';
|
|
2
|
+
import { JSX } from 'preact/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
export interface TestIconProps extends JSX.SVGAttributes<SVGSVGElement> {
|
|
5
|
+
className?: string;
|
|
6
|
+
width?: string | number;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
fill?: string;
|
|
9
|
+
stroke?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TestIcon: FunctionComponent<TestIconProps> = ({
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
fill,
|
|
18
|
+
stroke,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<svg
|
|
23
|
+
class={className}
|
|
24
|
+
style={style}
|
|
25
|
+
width={width || 24}
|
|
26
|
+
height={height || 24}
|
|
27
|
+
fill={fill || 'currentColor'}
|
|
28
|
+
stroke={stroke}
|
|
29
|
+
viewBox="0 0 24 24"
|
|
30
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default TestIcon;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SVGProps } from "react";
|
|
3
|
+
|
|
4
|
+
export interface TestIconProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
size?: number | string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const TestIcon = React.forwardRef<SVGSVGElement, TestIconProps>(
|
|
9
|
+
({ size, className, style, ...props }, ref) => {
|
|
10
|
+
const dimensions = size ? { width: size, height: size } : {
|
|
11
|
+
width: props.width || 24,
|
|
12
|
+
height: props.height || 24
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<svg
|
|
17
|
+
ref={ref}
|
|
18
|
+
viewBox="0 0 24 24"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
width={dimensions.width}
|
|
21
|
+
height={dimensions.height}
|
|
22
|
+
fill={props.fill || "currentColor"}
|
|
23
|
+
className={className}
|
|
24
|
+
style={style}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
TestIcon.displayName = "TestIcon";
|
|
34
|
+
|
|
35
|
+
export default TestIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, JSX } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
export interface TestIconProps extends JSX.SvgSVGAttributes<SVGSVGElement> {
|
|
4
|
+
className?: string;
|
|
5
|
+
width?: string | number;
|
|
6
|
+
height?: string | number;
|
|
7
|
+
fill?: string;
|
|
8
|
+
stroke?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TestIcon: Component<TestIconProps> = (props) => (
|
|
12
|
+
<svg
|
|
13
|
+
class={props.className}
|
|
14
|
+
style={props.style}
|
|
15
|
+
width={props.width || 24}
|
|
16
|
+
height={props.height || 24}
|
|
17
|
+
fill={props.fill || 'currentColor'}
|
|
18
|
+
stroke={props.stroke}
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default TestIcon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let className: string = '';
|
|
3
|
+
export let style: string = '';
|
|
4
|
+
export let width: string | number = 24;
|
|
5
|
+
export let height: string | number = 24;
|
|
6
|
+
export let fill: string = 'currentColor';
|
|
7
|
+
export let stroke: string = '';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<svg
|
|
11
|
+
class={className}
|
|
12
|
+
{style}
|
|
13
|
+
{width}
|
|
14
|
+
{height}
|
|
15
|
+
{fill}
|
|
16
|
+
{stroke}
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
{...$$restProps}
|
|
20
|
+
>
|
|
21
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface TestIconOptions {
|
|
2
|
+
className?: string;
|
|
3
|
+
width?: string | number;
|
|
4
|
+
height?: string | number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function TestIcon(options: TestIconOptions = {}): SVGSVGElement {
|
|
11
|
+
const {
|
|
12
|
+
className = '',
|
|
13
|
+
width = 24,
|
|
14
|
+
height = 24,
|
|
15
|
+
fill = 'currentColor',
|
|
16
|
+
stroke = '',
|
|
17
|
+
...attrs
|
|
18
|
+
} = options;
|
|
19
|
+
|
|
20
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
21
|
+
svg.setAttribute('viewBox', '0 0 24 24');
|
|
22
|
+
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
23
|
+
|
|
24
|
+
if (className) svg.setAttribute('class', className);
|
|
25
|
+
svg.setAttribute('width', String(width));
|
|
26
|
+
svg.setAttribute('height', String(height));
|
|
27
|
+
svg.setAttribute('fill', fill);
|
|
28
|
+
if (stroke) svg.setAttribute('stroke', stroke);
|
|
29
|
+
|
|
30
|
+
Object.entries(attrs).forEach(([key, value]) => {
|
|
31
|
+
svg.setAttribute(key, String(value));
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
svg.innerHTML = `<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>`;
|
|
35
|
+
|
|
36
|
+
return svg;
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
:class="className"
|
|
4
|
+
:style="style"
|
|
5
|
+
:width="width || 24"
|
|
6
|
+
:height="height || 24"
|
|
7
|
+
:fill="fill || 'currentColor'"
|
|
8
|
+
:stroke="stroke"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
14
|
+
</svg>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
interface Props {
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: string | Record<string, any>;
|
|
21
|
+
width?: string | number;
|
|
22
|
+
height?: string | number;
|
|
23
|
+
fill?: string;
|
|
24
|
+
stroke?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
withDefaults(defineProps<Props>(), {
|
|
28
|
+
className: '',
|
|
29
|
+
fill: 'currentColor',
|
|
30
|
+
width: 24,
|
|
31
|
+
height: 24
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
:class="className"
|
|
4
|
+
:style="style"
|
|
5
|
+
:width="width"
|
|
6
|
+
:height="height"
|
|
7
|
+
:fill="fill"
|
|
8
|
+
:stroke="stroke"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
14
|
+
</svg>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { defineComponent } from 'vue';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'TestIcon',
|
|
22
|
+
props: {
|
|
23
|
+
className: { type: String, default: '' },
|
|
24
|
+
style: { type: [String, Object], default: '' },
|
|
25
|
+
width: { type: [String, Number], default: 24 },
|
|
26
|
+
height: { type: [String, Number], default: 24 },
|
|
27
|
+
fill: { type: String, default: 'currentColor' },
|
|
28
|
+
stroke: { type: String, default: '' }
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
</script>
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
5
|
-
"moduleResolution": "
|
|
6
|
-
"declaration": true,
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
7
6
|
"outDir": "dist",
|
|
8
7
|
"rootDir": "src",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"emitDeclarationOnly": false,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
11
|
"strict": true,
|
|
12
|
-
"
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"types": ["node"]
|
|
13
16
|
},
|
|
14
17
|
"include": ["src"]
|
|
15
|
-
}
|
|
16
|
-
|
|
18
|
+
}
|