719332d272
We currently serve icons in the form of 141 separate svg files. This is pretty inefficient: it results in 141 http requests each with its own overheads and costs. Each one is generally less than 1kb of data. This PR merges all of our icons into a single 44kb icon file. Each item in the svg has an ID, and we use the ID in the asset url to target the specific icon. This also fixes a lot of the icon preloading issues: because the icon file is already loaded, there's no extra request needed when panels open etc. I was messing with this whilst killing time before a late meeting so made a shitty overengineered code generator, dont at me ### Change type - [x] `improvement` ### Release notes - Serve icons more efficiently, and make sure they're still available if tldraw goes offline.
226 lines
12 KiB
JavaScript
226 lines
12 KiB
JavaScript
// This file is automatically generated by scripts/refresh-assets.ts.
|
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
|
|
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
/// <reference path="./modules.d.ts" />
|
|
import { formatAssetUrl } from './utils.js'
|
|
|
|
/**
|
|
* @param {AssetUrlOptions} [opts]
|
|
* @public
|
|
*/
|
|
export function getAssetUrls(opts) {
|
|
const iconsIcon0MergedSvg = formatAssetUrl('./icons/icon/0_merged.svg', opts)
|
|
return {
|
|
fonts: {
|
|
monospace: formatAssetUrl('./fonts/IBMPlexMono-Medium.woff2', opts),
|
|
sansSerif: formatAssetUrl('./fonts/IBMPlexSans-Medium.woff2', opts),
|
|
serif: formatAssetUrl('./fonts/IBMPlexSerif-Medium.woff2', opts),
|
|
draw: formatAssetUrl('./fonts/Shantell_Sans-Tldrawish.woff2', opts),
|
|
},
|
|
icons: {
|
|
'align-bottom': iconsIcon0MergedSvg + '#align-bottom',
|
|
'align-center-horizontal': iconsIcon0MergedSvg + '#align-center-horizontal',
|
|
'align-center-vertical': iconsIcon0MergedSvg + '#align-center-vertical',
|
|
'align-left': iconsIcon0MergedSvg + '#align-left',
|
|
'align-right': iconsIcon0MergedSvg + '#align-right',
|
|
'align-top': iconsIcon0MergedSvg + '#align-top',
|
|
'arrow-left': iconsIcon0MergedSvg + '#arrow-left',
|
|
'arrowhead-arrow': iconsIcon0MergedSvg + '#arrowhead-arrow',
|
|
'arrowhead-bar': iconsIcon0MergedSvg + '#arrowhead-bar',
|
|
'arrowhead-diamond': iconsIcon0MergedSvg + '#arrowhead-diamond',
|
|
'arrowhead-dot': iconsIcon0MergedSvg + '#arrowhead-dot',
|
|
'arrowhead-none': iconsIcon0MergedSvg + '#arrowhead-none',
|
|
'arrowhead-square': iconsIcon0MergedSvg + '#arrowhead-square',
|
|
'arrowhead-triangle-inverted': iconsIcon0MergedSvg + '#arrowhead-triangle-inverted',
|
|
'arrowhead-triangle': iconsIcon0MergedSvg + '#arrowhead-triangle',
|
|
blob: iconsIcon0MergedSvg + '#blob',
|
|
'bring-forward': iconsIcon0MergedSvg + '#bring-forward',
|
|
'bring-to-front': iconsIcon0MergedSvg + '#bring-to-front',
|
|
broken: iconsIcon0MergedSvg + '#broken',
|
|
'check-circle': iconsIcon0MergedSvg + '#check-circle',
|
|
check: iconsIcon0MergedSvg + '#check',
|
|
'chevron-down': iconsIcon0MergedSvg + '#chevron-down',
|
|
'chevron-left': iconsIcon0MergedSvg + '#chevron-left',
|
|
'chevron-right': iconsIcon0MergedSvg + '#chevron-right',
|
|
'chevron-up': iconsIcon0MergedSvg + '#chevron-up',
|
|
'chevrons-ne': iconsIcon0MergedSvg + '#chevrons-ne',
|
|
'chevrons-sw': iconsIcon0MergedSvg + '#chevrons-sw',
|
|
'clipboard-copied': iconsIcon0MergedSvg + '#clipboard-copied',
|
|
'clipboard-copy': iconsIcon0MergedSvg + '#clipboard-copy',
|
|
color: iconsIcon0MergedSvg + '#color',
|
|
'cross-2': iconsIcon0MergedSvg + '#cross-2',
|
|
'cross-circle': iconsIcon0MergedSvg + '#cross-circle',
|
|
'dash-dashed': iconsIcon0MergedSvg + '#dash-dashed',
|
|
'dash-dotted': iconsIcon0MergedSvg + '#dash-dotted',
|
|
'dash-draw': iconsIcon0MergedSvg + '#dash-draw',
|
|
'dash-solid': iconsIcon0MergedSvg + '#dash-solid',
|
|
disconnected: iconsIcon0MergedSvg + '#disconnected',
|
|
discord: iconsIcon0MergedSvg + '#discord',
|
|
'distribute-horizontal': iconsIcon0MergedSvg + '#distribute-horizontal',
|
|
'distribute-vertical': iconsIcon0MergedSvg + '#distribute-vertical',
|
|
dot: iconsIcon0MergedSvg + '#dot',
|
|
'dots-horizontal': iconsIcon0MergedSvg + '#dots-horizontal',
|
|
'dots-vertical': iconsIcon0MergedSvg + '#dots-vertical',
|
|
'drag-handle-dots': iconsIcon0MergedSvg + '#drag-handle-dots',
|
|
duplicate: iconsIcon0MergedSvg + '#duplicate',
|
|
edit: iconsIcon0MergedSvg + '#edit',
|
|
'external-link': iconsIcon0MergedSvg + '#external-link',
|
|
'fill-fill': iconsIcon0MergedSvg + '#fill-fill',
|
|
'fill-none': iconsIcon0MergedSvg + '#fill-none',
|
|
'fill-pattern': iconsIcon0MergedSvg + '#fill-pattern',
|
|
'fill-semi': iconsIcon0MergedSvg + '#fill-semi',
|
|
'fill-solid': iconsIcon0MergedSvg + '#fill-solid',
|
|
follow: iconsIcon0MergedSvg + '#follow',
|
|
following: iconsIcon0MergedSvg + '#following',
|
|
'font-draw': iconsIcon0MergedSvg + '#font-draw',
|
|
'font-mono': iconsIcon0MergedSvg + '#font-mono',
|
|
'font-sans': iconsIcon0MergedSvg + '#font-sans',
|
|
'font-serif': iconsIcon0MergedSvg + '#font-serif',
|
|
'geo-arrow-down': iconsIcon0MergedSvg + '#geo-arrow-down',
|
|
'geo-arrow-left': iconsIcon0MergedSvg + '#geo-arrow-left',
|
|
'geo-arrow-right': iconsIcon0MergedSvg + '#geo-arrow-right',
|
|
'geo-arrow-up': iconsIcon0MergedSvg + '#geo-arrow-up',
|
|
'geo-check-box': iconsIcon0MergedSvg + '#geo-check-box',
|
|
'geo-cloud': iconsIcon0MergedSvg + '#geo-cloud',
|
|
'geo-diamond': iconsIcon0MergedSvg + '#geo-diamond',
|
|
'geo-ellipse': iconsIcon0MergedSvg + '#geo-ellipse',
|
|
'geo-heart': iconsIcon0MergedSvg + '#geo-heart',
|
|
'geo-hexagon': iconsIcon0MergedSvg + '#geo-hexagon',
|
|
'geo-octagon': iconsIcon0MergedSvg + '#geo-octagon',
|
|
'geo-oval': iconsIcon0MergedSvg + '#geo-oval',
|
|
'geo-pentagon': iconsIcon0MergedSvg + '#geo-pentagon',
|
|
'geo-rectangle': iconsIcon0MergedSvg + '#geo-rectangle',
|
|
'geo-rhombus-2': iconsIcon0MergedSvg + '#geo-rhombus-2',
|
|
'geo-rhombus': iconsIcon0MergedSvg + '#geo-rhombus',
|
|
'geo-star': iconsIcon0MergedSvg + '#geo-star',
|
|
'geo-trapezoid': iconsIcon0MergedSvg + '#geo-trapezoid',
|
|
'geo-triangle': iconsIcon0MergedSvg + '#geo-triangle',
|
|
'geo-x-box': iconsIcon0MergedSvg + '#geo-x-box',
|
|
github: iconsIcon0MergedSvg + '#github',
|
|
group: iconsIcon0MergedSvg + '#group',
|
|
'horizontal-align-end': iconsIcon0MergedSvg + '#horizontal-align-end',
|
|
'horizontal-align-middle': iconsIcon0MergedSvg + '#horizontal-align-middle',
|
|
'horizontal-align-start': iconsIcon0MergedSvg + '#horizontal-align-start',
|
|
'info-circle': iconsIcon0MergedSvg + '#info-circle',
|
|
leading: iconsIcon0MergedSvg + '#leading',
|
|
link: iconsIcon0MergedSvg + '#link',
|
|
lock: iconsIcon0MergedSvg + '#lock',
|
|
menu: iconsIcon0MergedSvg + '#menu',
|
|
minus: iconsIcon0MergedSvg + '#minus',
|
|
mixed: iconsIcon0MergedSvg + '#mixed',
|
|
pack: iconsIcon0MergedSvg + '#pack',
|
|
plus: iconsIcon0MergedSvg + '#plus',
|
|
'question-mark-circle': iconsIcon0MergedSvg + '#question-mark-circle',
|
|
'question-mark': iconsIcon0MergedSvg + '#question-mark',
|
|
redo: iconsIcon0MergedSvg + '#redo',
|
|
'reset-zoom': iconsIcon0MergedSvg + '#reset-zoom',
|
|
'rotate-ccw': iconsIcon0MergedSvg + '#rotate-ccw',
|
|
'rotate-cw': iconsIcon0MergedSvg + '#rotate-cw',
|
|
'send-backward': iconsIcon0MergedSvg + '#send-backward',
|
|
'send-to-back': iconsIcon0MergedSvg + '#send-to-back',
|
|
'share-1': iconsIcon0MergedSvg + '#share-1',
|
|
'size-extra-large': iconsIcon0MergedSvg + '#size-extra-large',
|
|
'size-large': iconsIcon0MergedSvg + '#size-large',
|
|
'size-medium': iconsIcon0MergedSvg + '#size-medium',
|
|
'size-small': iconsIcon0MergedSvg + '#size-small',
|
|
'spline-cubic': iconsIcon0MergedSvg + '#spline-cubic',
|
|
'spline-line': iconsIcon0MergedSvg + '#spline-line',
|
|
'stack-horizontal': iconsIcon0MergedSvg + '#stack-horizontal',
|
|
'stack-vertical': iconsIcon0MergedSvg + '#stack-vertical',
|
|
'status-offline': iconsIcon0MergedSvg + '#status-offline',
|
|
'stretch-horizontal': iconsIcon0MergedSvg + '#stretch-horizontal',
|
|
'stretch-vertical': iconsIcon0MergedSvg + '#stretch-vertical',
|
|
'text-align-center': iconsIcon0MergedSvg + '#text-align-center',
|
|
'text-align-left': iconsIcon0MergedSvg + '#text-align-left',
|
|
'text-align-right': iconsIcon0MergedSvg + '#text-align-right',
|
|
'toggle-off': iconsIcon0MergedSvg + '#toggle-off',
|
|
'toggle-on': iconsIcon0MergedSvg + '#toggle-on',
|
|
'tool-arrow': iconsIcon0MergedSvg + '#tool-arrow',
|
|
'tool-eraser': iconsIcon0MergedSvg + '#tool-eraser',
|
|
'tool-frame': iconsIcon0MergedSvg + '#tool-frame',
|
|
'tool-hand': iconsIcon0MergedSvg + '#tool-hand',
|
|
'tool-highlight': iconsIcon0MergedSvg + '#tool-highlight',
|
|
'tool-laser': iconsIcon0MergedSvg + '#tool-laser',
|
|
'tool-line': iconsIcon0MergedSvg + '#tool-line',
|
|
'tool-media': iconsIcon0MergedSvg + '#tool-media',
|
|
'tool-note': iconsIcon0MergedSvg + '#tool-note',
|
|
'tool-pencil': iconsIcon0MergedSvg + '#tool-pencil',
|
|
'tool-pointer': iconsIcon0MergedSvg + '#tool-pointer',
|
|
'tool-screenshot': iconsIcon0MergedSvg + '#tool-screenshot',
|
|
'tool-text': iconsIcon0MergedSvg + '#tool-text',
|
|
trash: iconsIcon0MergedSvg + '#trash',
|
|
twitter: iconsIcon0MergedSvg + '#twitter',
|
|
undo: iconsIcon0MergedSvg + '#undo',
|
|
ungroup: iconsIcon0MergedSvg + '#ungroup',
|
|
unlock: iconsIcon0MergedSvg + '#unlock',
|
|
'vertical-align-end': iconsIcon0MergedSvg + '#vertical-align-end',
|
|
'vertical-align-middle': iconsIcon0MergedSvg + '#vertical-align-middle',
|
|
'vertical-align-start': iconsIcon0MergedSvg + '#vertical-align-start',
|
|
'warning-triangle': iconsIcon0MergedSvg + '#warning-triangle',
|
|
'zoom-in': iconsIcon0MergedSvg + '#zoom-in',
|
|
'zoom-out': iconsIcon0MergedSvg + '#zoom-out',
|
|
},
|
|
translations: {
|
|
ar: formatAssetUrl('./translations/ar.json', opts),
|
|
ca: formatAssetUrl('./translations/ca.json', opts),
|
|
cs: formatAssetUrl('./translations/cs.json', opts),
|
|
da: formatAssetUrl('./translations/da.json', opts),
|
|
de: formatAssetUrl('./translations/de.json', opts),
|
|
en: formatAssetUrl('./translations/en.json', opts),
|
|
es: formatAssetUrl('./translations/es.json', opts),
|
|
fa: formatAssetUrl('./translations/fa.json', opts),
|
|
fi: formatAssetUrl('./translations/fi.json', opts),
|
|
fr: formatAssetUrl('./translations/fr.json', opts),
|
|
gl: formatAssetUrl('./translations/gl.json', opts),
|
|
he: formatAssetUrl('./translations/he.json', opts),
|
|
'hi-in': formatAssetUrl('./translations/hi-in.json', opts),
|
|
hr: formatAssetUrl('./translations/hr.json', opts),
|
|
hu: formatAssetUrl('./translations/hu.json', opts),
|
|
id: formatAssetUrl('./translations/id.json', opts),
|
|
it: formatAssetUrl('./translations/it.json', opts),
|
|
ja: formatAssetUrl('./translations/ja.json', opts),
|
|
'ko-kr': formatAssetUrl('./translations/ko-kr.json', opts),
|
|
ku: formatAssetUrl('./translations/ku.json', opts),
|
|
languages: formatAssetUrl('./translations/languages.json', opts),
|
|
main: formatAssetUrl('./translations/main.json', opts),
|
|
my: formatAssetUrl('./translations/my.json', opts),
|
|
ne: formatAssetUrl('./translations/ne.json', opts),
|
|
no: formatAssetUrl('./translations/no.json', opts),
|
|
pl: formatAssetUrl('./translations/pl.json', opts),
|
|
'pt-br': formatAssetUrl('./translations/pt-br.json', opts),
|
|
'pt-pt': formatAssetUrl('./translations/pt-pt.json', opts),
|
|
ro: formatAssetUrl('./translations/ro.json', opts),
|
|
ru: formatAssetUrl('./translations/ru.json', opts),
|
|
sl: formatAssetUrl('./translations/sl.json', opts),
|
|
sv: formatAssetUrl('./translations/sv.json', opts),
|
|
te: formatAssetUrl('./translations/te.json', opts),
|
|
th: formatAssetUrl('./translations/th.json', opts),
|
|
tr: formatAssetUrl('./translations/tr.json', opts),
|
|
uk: formatAssetUrl('./translations/uk.json', opts),
|
|
vi: formatAssetUrl('./translations/vi.json', opts),
|
|
'zh-cn': formatAssetUrl('./translations/zh-cn.json', opts),
|
|
'zh-tw': formatAssetUrl('./translations/zh-tw.json', opts),
|
|
},
|
|
embedIcons: {
|
|
codepen: formatAssetUrl('./embed-icons/codepen.png', opts),
|
|
codesandbox: formatAssetUrl('./embed-icons/codesandbox.png', opts),
|
|
desmos: formatAssetUrl('./embed-icons/desmos.png', opts),
|
|
excalidraw: formatAssetUrl('./embed-icons/excalidraw.png', opts),
|
|
felt: formatAssetUrl('./embed-icons/felt.png', opts),
|
|
figma: formatAssetUrl('./embed-icons/figma.png', opts),
|
|
github_gist: formatAssetUrl('./embed-icons/github_gist.png', opts),
|
|
google_calendar: formatAssetUrl('./embed-icons/google_calendar.png', opts),
|
|
google_maps: formatAssetUrl('./embed-icons/google_maps.png', opts),
|
|
google_slides: formatAssetUrl('./embed-icons/google_slides.png', opts),
|
|
observable: formatAssetUrl('./embed-icons/observable.png', opts),
|
|
replit: formatAssetUrl('./embed-icons/replit.png', opts),
|
|
scratch: formatAssetUrl('./embed-icons/scratch.png', opts),
|
|
spotify: formatAssetUrl('./embed-icons/spotify.png', opts),
|
|
tldraw: formatAssetUrl('./embed-icons/tldraw.png', opts),
|
|
val_town: formatAssetUrl('./embed-icons/val_town.png', opts),
|
|
vimeo: formatAssetUrl('./embed-icons/vimeo.png', opts),
|
|
youtube: formatAssetUrl('./embed-icons/youtube.png', opts),
|
|
},
|
|
}
|
|
}
|