iOS porting: Main screen and compositor

This commit is contained in:
James Babcock committed 2026-09-05 22:59:37 -07:00
1 parent 61b3bf8b7c
commit 99793a37a7
24 files changed
+1124 -70

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import { rasterizeSvg as render } from './ios-graphics'
export function rasterizeSvg(svg: string, size: number, strokeWidth: number) {
// Shared icon sources rely on the Android renderer's white, rounded
// stroke defaults. Supply those explicitly for a standards SVG renderer.
const source = svg.replace(/<svg\b([^>]*)>/, (_tag, attributes: string) => {
const defaults = { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24',
stroke: svg.includes('fill="none"') ? '#ffffff' : 'none', fill: '#ffffff', 'stroke-width': String(strokeWidth),
'stroke-linecap': 'round', 'stroke-linejoin': 'round' }
const missing = Object.entries(defaults).filter(([key]) => !new RegExp(`\\b${key}=`).test(attributes))
.map(([key, value]) => ` ${key}="${value}"`).join('')
return `<svg${attributes}${missing}>`
})
return render(source, size)
}