@@ -38,6 +38,7 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
3838 @Part ( ) $saveSvg : HTMLInputElement ;
3939 @Part ( ) $savePng : HTMLInputElement ;
4040
41+ // MAKE A LIST COMPONENT!!!! [text | delete]
4142 @Part ( ) $colors : HTMLPreElement ;
4243 @Part ( ) $layers : HTMLPreElement ;
4344
@@ -89,6 +90,21 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
8990 } ) ;
9091 this . $file . addEventListener ( 'change' , this . handleFile . bind ( this ) ) ;
9192 this . $saveSvg . addEventListener ( 'click' , async ( ) => {
93+ // @ts -ignore
94+ const handle = await window . showSaveFilePicker ( {
95+ suggestedName : 'Canvas' ,
96+ types : [ {
97+ description : 'SVG Document' ,
98+ accept : { 'image/svg+xml' : [ '.svg' ] } ,
99+ } ] ,
100+ } ) ;
101+ const writable = await handle . createWritable ( ) ;
102+ await writable . write ( `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${ this . $width . value } ${ this . $height . value } ">` ) ;
103+ await writable . write ( `<path d="${ 'test' } " />` ) ;
104+ await writable . write ( '</svg>' ) ;
105+ await writable . close ( ) ;
106+ } ) ;
107+ this . $savePng . addEventListener ( 'click' , async ( ) => {
92108 // @ts -ignore
93109 const handle = await window . showSaveFilePicker ( {
94110 suggestedName : 'CanvasName' ,
@@ -99,11 +115,9 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
99115 } ) ;
100116 const writable = await handle . createWritable ( ) ;
101117 await writable . write ( 'something' ) ;
118+ await writable . write
102119 await writable . close ( ) ;
103120 } ) ;
104- this . $savePng . addEventListener ( 'click' , ( ) => {
105-
106- } ) ;
107121 }
108122
109123 handleFile ( e ) {
@@ -138,7 +152,7 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
138152
139153 handleChange ( e : CustomEvent ) {
140154 const { value } = e . detail ;
141- this . $value1 . innerText = value ;
155+ this . $value1 . innerText = value . join ( '--' ) ;
142156 }
143157
144158 handleInput ( e : CustomEvent ) {
0 commit comments