Skip to content

Commit

Permalink
feat(browser-nativefs): update web_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
christianliebel committed Jul 31, 2020
1 parent fb11b2a commit 1922f72
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 58 deletions.
11 changes: 4 additions & 7 deletions web_modules/browser-nativefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
const e="chooseFileSystemEntries"in self?"chooseFileSystemEntries":"showOpenFilePicker"in self&&"showOpenFilePicker";

// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const t=e?"chooseFileSystemEntries"===e?import('./common/file-open-nativefs-a9b57b6b.js'):import('./common/file-open-nativefs-539a2c46.js'):import('./common/file-open-legacy-37886591.js');async function fileOpen(...e){return (await t).default(...e)}
const t=e?"chooseFileSystemEntries"===e?import('./common/file-open-fac3d0b1.js'):import('./common/file-open-6ce9eb2c.js'):import('./common/file-open-f9a5f1c4.js');async function fileOpen(...e){return (await t).default(...e)}

// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const t$1=e?"chooseFileSystemEntries"===e?import('./common/directory-open-nativefs-edd3f2a1.js'):import('./common/directory-open-nativefs-20e5d376.js'):import('./common/directory-open-legacy-aed60324.js');async function directoryOpen(...e){return (await t$1).default(...e)}
const t$1=e?"chooseFileSystemEntries"===e?import('./common/directory-open-7bae6a7f.js'):import('./common/directory-open-eb3669c5.js'):import('./common/directory-open-50706e94.js');async function directoryOpen(...e){return (await t$1).default(...e)}

// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const s=e?"chooseFileSystemEntries"===e?import('./common/file-save-nativefs-2c1b0849.js'):import('./common/file-save-nativefs-403dc0ac.js'):import('./common/file-save-legacy-df95654f.js');async function fileSave(...e){return (await s).default(...e)}
const s=e?"chooseFileSystemEntries"===e?import('./common/file-save-15adb038.js'):import('./common/file-save-3e74be39.js'):import('./common/file-save-70a78426.js');async function fileSave(...e){return (await s).default(...e)}

// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const t$2=async t=>new Promise(e=>{const a=document.createElement("canvas");a.width=t.naturalWidth,a.height=t.naturalHeight;a.getContext("2d").drawImage(t,0,0),a.toBlob(t=>{e(t);});});

export { directoryOpen, fileOpen, fileSave, t$2 as imageToBlob };
export { directoryOpen, fileOpen, fileSave };
19 changes: 0 additions & 19 deletions web_modules/common/_commonjsHelpers-51a1c497.js

This file was deleted.

4 changes: 4 additions & 0 deletions web_modules/common/directory-open-50706e94.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
var directoryOpen = async(e={})=>(e.recursive=e.recursive||!1,new Promise(t=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0,r.addEventListener("change",()=>{let i=Array.from(r.files);e.recursive||(i=i.filter(e=>2===e.webkitRelativePath.split("/").length)),t(i);}),r.click();}));

export default directoryOpen;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions web_modules/common/directory-open-legacy-aed60324.js

This file was deleted.

4 changes: 4 additions & 0 deletions web_modules/common/file-open-6ce9eb2c.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const e=async e=>{const t=await e.getFile();return t.handle=e,t};var fileOpen = async(t={})=>{const i={};t.mimeTypes?t.mimeTypes.map(e=>{i[e]=t.extensions||[];}):i["*.*"]=t.extensions||[];const n=await window.showOpenFilePicker({types:[{description:t.description||"",accept:i}],multiple:t.multiple||!1}),s=await Promise.all(n.map(e));return t.multiple?s:s[0]};

export default fileOpen;
4 changes: 4 additions & 0 deletions web_modules/common/file-open-f9a5f1c4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
var fileOpen = async(e={})=>new Promise(t=>{const i=document.createElement("input");i.type="file";const n=[...e.mimeTypes?e.mimeTypes:[],e.extensions?e.extensions.map(e=>"."+e):[]].join();i.multiple=e.multiple||!1,i.accept=n||"*/*",i.addEventListener("change",()=>{t(i.multiple?i.files:i.files[0]);}),i.click();});

export default fileOpen;
4 changes: 4 additions & 0 deletions web_modules/common/file-open-fac3d0b1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
const e=async e=>{const t=await e.getFile();return t.handle=e,t};var fileOpen = async(t={})=>{const i=await window.chooseFileSystemEntries({accepts:[{description:t.description||"",mimeTypes:t.mimeTypes||["*/*"],extensions:t.extensions||[""]}],multiple:t.multiple||!1});return t.multiple?Promise.all(i.map(e)):e(i)};

export default fileOpen;
4 changes: 0 additions & 4 deletions web_modules/common/file-open-legacy-37886591.js

This file was deleted.

4 changes: 0 additions & 4 deletions web_modules/common/file-open-nativefs-539a2c46.js

This file was deleted.

4 changes: 0 additions & 4 deletions web_modules/common/file-open-nativefs-a9b57b6b.js

This file was deleted.

4 changes: 4 additions & 0 deletions web_modules/common/file-save-15adb038.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
var fileSave = async(e,t={},i=null)=>{t.fileName=t.fileName||"Untitled",i=i||await window.chooseFileSystemEntries({type:"save-file",accepts:[{description:t.description||"",mimeTypes:[e.type],extensions:t.extensions||[""]}]});const a=await i.createWritable();return await a.write(e),await a.close(),i};

export default fileSave;
4 changes: 4 additions & 0 deletions web_modules/common/file-save-3e74be39.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
var fileSave = async(e,t={},i=null)=>{t.fileName=t.fileName||"Untitled",i=i||await window.showSaveFilePicker({types:[{description:t.description||"",accept:{[e.type]:t.extensions||[""]}}]});const a=await i.createWritable();return await a.write(e),await a.close(),i};

export default fileSave;
4 changes: 4 additions & 0 deletions web_modules/common/file-save-70a78426.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
var fileSave = async(e,t={})=>{const c=document.createElement("a");c.download=t.fileName||"Untitled",c.href=URL.createObjectURL(e),c.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(c.href),3e4);}),c.click();};

export default fileSave;
4 changes: 0 additions & 4 deletions web_modules/common/file-save-legacy-df95654f.js

This file was deleted.

4 changes: 0 additions & 4 deletions web_modules/common/file-save-nativefs-2c1b0849.js

This file was deleted.

4 changes: 0 additions & 4 deletions web_modules/common/file-save-nativefs-403dc0ac.js

This file was deleted.

0 comments on commit 1922f72

Please sign in to comment.