Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/components/Bag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ async function PackSvgs(type: PackType = 'svg') {
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('tsx')">
React<sup class="opacity-50 -mr-1">TS</sup>
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('svelte')">
Svelte
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('qwik')">
Qwik
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('solid')">
Solid
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('astro')">
Astro
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('react-native')">
React Native
</button>
<button class="btn small mr-1 mb-1 opacity-75" @click="PackSvgs('json')">
JSON
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/svg/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { HtmlToJSX } from './htmlToJsx'
import { getSvg } from './loader'
import { prettierCode } from './prettier'

export type PackType = 'svg' | 'tsx' | 'jsx' | 'vue' | 'json'
export type PackType = 'svg' | 'tsx' | 'jsx' | 'vue' | 'solid' | 'qwik' | 'svelte' | 'astro' | 'react-native' | 'json'

export function normalizeZipFleName(svgName: string): string {
return svgName.replace(':', '-')
Expand Down
29 changes: 19 additions & 10 deletions src/utils/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ import type { CollectionInfo } from '../../data'
import type { PackType } from '../svg'
import type { PackOperation, WorkerPackMessage } from './types'
import { downloadZip } from 'client-zip'
import {
getSvg,
LoadIconSvgs,
normalizeZipFleName,
SvgToJSX,
SvgToTSX,
SvgToVue,
toComponentName,
} from '../svg'
import { getSvg, LoadIconSvgs, normalizeZipFleName, SvgToAstro, SvgToJSX, SvgToQwik, SvgToReactNative, SvgToSolid, SvgToSvelte, SvgToTSX, SvgToVue, toComponentName } from '../svg'

globalThis.onmessage = async (event: MessageEvent<WorkerPackMessage<PackOperation>>) => {
const message = event.data
Expand Down Expand Up @@ -149,6 +141,8 @@ async function* PreparePackZip(
return
}

const ext = (type === 'solid' || type === 'qwik' || type === 'react-native') ? 'tsx' : type

for (const name of icons) {
if (!name)
continue
Expand All @@ -165,6 +159,21 @@ async function* PreparePackZip(
case 'jsx':
content = await SvgToJSX(svg, componentName, false)
break
case 'svelte':
content = SvgToSvelte(svg)
break
case 'astro':
content = SvgToAstro(svg)
break
case 'qwik':
content = await SvgToQwik(svg, componentName, false)
break
case 'react-native':
content = await SvgToReactNative(svg, componentName, false)
break
case 'solid':
content = await SvgToSolid(svg, componentName, false)
break
case 'tsx':
content = await SvgToTSX(svg, componentName, false)
break
Expand All @@ -173,7 +182,7 @@ async function* PreparePackZip(
}

yield {
name: `${componentName}.${type}`,
name: `${componentName}.${ext}`,
input: new Blob([content], { type: 'text/plain' }),
}
}
Expand Down