diff --git a/frontend/public/component-svgs/ssd1306.svg b/frontend/public/component-svgs/ssd1306.svg new file mode 100644 index 00000000..1ced6b70 --- /dev/null +++ b/frontend/public/component-svgs/ssd1306.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + Data + SA0 + CS + Vin + C1k + DC + Rst + 3v3 + Gnd + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/generate-component-svgs.cjs b/scripts/generate-component-svgs.cjs index b84c886c..15ae56ff 100644 --- a/scripts/generate-component-svgs.cjs +++ b/scripts/generate-component-svgs.cjs @@ -118,6 +118,26 @@ if (typeof globalThis.customElements === 'undefined') { globalThis.customElements = { define: () => {} }; } +// Stub `ImageData` — used by ssd1306-element's constructor to seed the +// off-screen canvas. We never invoke `putImageData` (the script only calls +// renderSVG()), so a minimal shape that doesn't throw is enough. +if (typeof globalThis.ImageData === 'undefined') { + globalThis.ImageData = class ImageData { + constructor(widthOrData, height, settings) { + if (typeof widthOrData === 'number') { + this.width = widthOrData; + this.height = height; + this.data = new Uint8ClampedArray(widthOrData * height * 4); + } else { + this.data = widthOrData; + this.width = height; + this.height = settings; + } + this.colorSpace = 'srgb'; + } + }; +} + // ── Elements to extract ─────────────────────────────────────────────────────── // [ tagName, elementFile, defaultProps, useRenderSVG ] const ELEMENTS = [ @@ -133,7 +153,8 @@ const ELEMENTS = [ ['wokwi-dht22', 'dht22-element', {}, false ], ['wokwi-hc-sr04', 'hc-sr04-element', {}, false ], ['wokwi-mpu6050', 'mpu6050-element', {}, false ], - ['velxio-bmp280', 'bmp280-element', {}, false ], + // velxio-bmp280 is a velxio-native component — its SVG ships hand-authored + // at frontend/public/component-svgs/bmp280.svg, so no extraction is needed. ['wokwi-lcd2004', 'lcd2004-element', {}, false ], ['wokwi-ssd1306', 'ssd1306-element', { width: 128, height: 64 }, false ], ['wokwi-ili9341', 'ili9341-element', {}, false ],