mirror of
https://github.com/gromlab-ru/svg-sprites.git
synced 2026-07-22 04:40:17 +03:00
feat: добавить серверную генерацию спрайтов
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
<script>
|
||||
import '@gromlab/svg-sprites/viewer/element'
|
||||
|
||||
import { IconsIcon } from './sprite/index.js'
|
||||
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'),
|
||||
]
|
||||
|
||||
/** @param {HTMLElement & { sources: unknown }} node */
|
||||
@@ -15,7 +17,7 @@
|
||||
|
||||
<main>
|
||||
<h1>Svelte + Webpack</h1>
|
||||
<IconsIcon
|
||||
<AppIcon
|
||||
data-testid="icon"
|
||||
data-app="svelte-webpack"
|
||||
icon="check"
|
||||
@@ -24,6 +26,15 @@
|
||||
height="64"
|
||||
style="--icon-color-1: #16a34a"
|
||||
/>
|
||||
<RemoteAppIcon
|
||||
data-testid="remote-icon"
|
||||
data-app="svelte-webpack-remote"
|
||||
icon="check"
|
||||
aria-label="Remote check icon"
|
||||
width="64"
|
||||
height="64"
|
||||
style="--icon-color-1: #16a34a"
|
||||
/>
|
||||
<gromlab-sprite-viewer
|
||||
use:connectViewer
|
||||
viewer-title="Svelte Webpack Viewer"
|
||||
|
||||
@@ -2,7 +2,7 @@ import { defineSpriteConfig } from '@gromlab/svg-sprites'
|
||||
|
||||
export default defineSpriteConfig({
|
||||
mode: 'svelte@webpack',
|
||||
name: 'icons',
|
||||
name: 'app',
|
||||
input: '../../../../fixtures/icons/check.svg',
|
||||
generatedNotice: false,
|
||||
})
|
||||
2
integration/apps/svelte-webpack/src/remote-app-icons/.gitignore
vendored
Normal file
2
integration/apps/svelte-webpack/src/remote-app-icons/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# @generated by @gromlab/svg-sprites. Do not edit.
|
||||
/.svg-sprite/
|
||||
1
integration/apps/svelte-webpack/src/remote-app-icons/index.d.ts
vendored
Normal file
1
integration/apps/svelte-webpack/src/remote-app-icons/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './.svg-sprite/index.js'
|
||||
@@ -0,0 +1 @@
|
||||
export * from './.svg-sprite/index.js'
|
||||
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
mode: 'svelte@webpack',
|
||||
source: 'remote',
|
||||
// @ts-ignore The config runs in Node, while the app typecheck only includes browser globals.
|
||||
input: process.env.SVG_SPRITE_REMOTE_MANIFEST_URL
|
||||
?? '../../../standalone-server/cases/mixed-input/.svg-sprite/svg-sprite.manifest.json',
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
import type { ComponentProps } from 'svelte'
|
||||
import { IconsIcon } from './sprite/index.js'
|
||||
import type { IconsIconName, IconsIconProps } from './sprite/index.js'
|
||||
import { AppIcon } from './app-icons/index.js'
|
||||
import type { AppIconName, AppIconProps } from './app-icons/index.js'
|
||||
import { RemoteAppIcon } from './remote-app-icons/index.js'
|
||||
import type { RemoteAppIconName, RemoteAppIconProps } from './remote-app-icons/index.js'
|
||||
|
||||
const icon: IconsIconName = 'check'
|
||||
const inferred: ComponentProps<typeof IconsIcon> = { icon, width: 64, height: 64 }
|
||||
const declared: IconsIconProps = inferred
|
||||
const iconName: AppIconName = 'check'
|
||||
const inferred: ComponentProps<typeof AppIcon> = { icon: iconName, width: 64, height: 64 }
|
||||
const declared: AppIconProps = inferred
|
||||
const remoteIconName: RemoteAppIconName = 'check'
|
||||
const remoteInferred: ComponentProps<typeof RemoteAppIcon> = {
|
||||
icon: remoteIconName,
|
||||
width: 64,
|
||||
height: 64,
|
||||
}
|
||||
const remoteDeclared: RemoteAppIconProps = remoteInferred
|
||||
|
||||
void declared
|
||||
void [declared, remoteDeclared]
|
||||
|
||||
Reference in New Issue
Block a user