feat: добавить серверную генерацию спрайтов

This commit is contained in:
2026-07-16 09:14:11 +03:00
parent e9ae91815a
commit 57342fae4e
379 changed files with 3108 additions and 655 deletions

View File

@@ -1,17 +1,19 @@
<script setup>
import '@gromlab/svg-sprites/viewer/element'
import { IconsIcon } from './sprite'
import { AppIcon } from './app-icons/index.js'
import { RemoteAppIcon } from './remote-app-icons/index.js'
const viewerSources = [
() => import('./sprite/.svg-sprite/svg-sprite.manifest.js'),
() => import('./app-icons/.svg-sprite/svg-sprite.manifest.js'),
() => import('./remote-app-icons/.svg-sprite/svg-sprite.manifest.js'),
]
</script>
<template>
<main>
<h1>Vue + Vite</h1>
<IconsIcon
<AppIcon
data-testid="icon"
data-app="vue-vite"
icon="check"
@@ -20,6 +22,15 @@ const viewerSources = [
height="64"
style="--icon-color-1: #16a34a"
/>
<RemoteAppIcon
data-testid="remote-icon"
data-app="vue-vite-remote"
icon="check"
aria-label="Remote check icon"
width="64"
height="64"
style="--icon-color-1: #16a34a"
/>
<gromlab-sprite-viewer
:sources="viewerSources"
viewer-title="Vue Vite Viewer"

View File

@@ -2,7 +2,7 @@ import { defineSpriteConfig } from '@gromlab/svg-sprites'
export default defineSpriteConfig({
mode: 'vue@vite',
name: 'icons',
name: 'app',
input: '../../../../fixtures/icons/check.svg',
generatedNotice: false,
})

View File

@@ -1,9 +1,26 @@
import type { IconsIconName, IconsIconProps } from './sprite/.svg-sprite/index.js'
import { AppIcon } from './app-icons/.svg-sprite/index.js'
import type { AppIconName, AppIconProps } from './app-icons/.svg-sprite/index.js'
import { RemoteAppIcon } from './remote-app-icons/.svg-sprite/index.js'
import type {
RemoteAppIconName,
RemoteAppIconProps,
} from './remote-app-icons/.svg-sprite/index.js'
const icon: IconsIconName = 'check'
const props: IconsIconProps = { icon, width: 24, height: 24 }
void props
const iconName: AppIconName = 'check'
const iconProps: AppIconProps = { icon: iconName, width: 24, height: 24 }
const remoteIconName: RemoteAppIconName = 'check'
const remoteIconProps: RemoteAppIconProps = {
icon: remoteIconName,
width: 24,
height: 24,
}
void [AppIcon, RemoteAppIcon, iconProps, remoteIconProps]
// @ts-expect-error generated icon names are a closed union
const invalidIcon: IconsIconName = 'missing'
const invalidIcon: AppIconName = 'missing'
void invalidIcon
// @ts-expect-error generated remote icon names are a closed union
const invalidRemoteIcon: RemoteAppIconName = 'missing'
void invalidRemoteIcon

View File

@@ -0,0 +1,2 @@
# @generated by @gromlab/svg-sprites. Do not edit.
/.svg-sprite/

View File

@@ -0,0 +1 @@
export * from './.svg-sprite/index.js'

View File

@@ -0,0 +1 @@
export * from './.svg-sprite'

View File

@@ -0,0 +1,6 @@
export default {
mode: 'vue@vite',
source: 'remote',
input: process.env.SVG_SPRITE_REMOTE_MANIFEST_URL
?? '../../../standalone-server/cases/mixed-input/.svg-sprite/svg-sprite.manifest.json',
}