diff --git a/README.md b/README.md index 2663be3a..51c4edbc 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This project demonstrates the use of: - [Async Clipboard API](https://web.dev/image-support-for-async-clipboard/) for clipboard access - [Web Share API Level 2](https://web.dev/web-share/#sharing-files) for sharing images to other applications via _File > Send…_ - [StorageManager API](https://web.dev/storage-for-the-web/#check) for estimating storage usage in _Help > About Paint_ +- [prefers-color-scheme](https://web.dev/prefers-color-scheme/) for dark mode - [Snowpack](https://www.snowpack.dev/), a bundle-free, O(1) build system ## Goals diff --git a/assets/tools-dark.png b/assets/tools-dark.png new file mode 100644 index 00000000..4f201e1b Binary files /dev/null and b/assets/tools-dark.png differ diff --git a/assets/tools-light.png b/assets/tools-light.png new file mode 100644 index 00000000..6e42864e Binary files /dev/null and b/assets/tools-light.png differ diff --git a/elements/app.js b/elements/app.js index 844a986b..5332ab38 100644 --- a/elements/app.js +++ b/elements/app.js @@ -19,11 +19,18 @@ class App extends LitElement { return css` :host { --button-face: rgb(192 192 192); - --canvas: rgb(128 128 128); + --button-light: white; + --button-dark: rgb(128 128 128); + --button-darker: black; --button-text: black; + --canvas: rgb(128 128 128); + --disabled-text: rgb(128 128 128); --highlight: rgb(0 0 128); --highlight-text: white; + --highlight-disabled-text: rgb(128 128 128); + --disabled-text-backdrop: white; --selected-background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAAAAABX3VL4AAAADklEQVQIHWP4f4DhwH8ACoADf16N/DIAAAAASUVORK5CYII='); + --z-index-menu: 10; --z-index-dialog: 20; @@ -44,6 +51,22 @@ class App extends LitElement { -webkit-tap-highlight-color: transparent; } + @media (prefers-color-scheme: dark) { + :host { + --button-face: rgb(64 64 64); + --button-light: rgb(128 128 128); + --button-dark: rgb(32 32 32); + --button-text: white; + --canvas: rgb(32 32 32); + --disabled-text: rgb(64 64 64); + --highlight: rgb(0 0 128); + --highlight-text: white; + --highlight-disabled-text: rgb(128 128 128); + --disabled-text-backdrop: rgb(192 192 192); + --selected-background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAAAAABX3VL4AAAADklEQVQIHWNocGBwaAAABIYBga3c92oAAAAASUVORK5CYII='); + } + } + @media print { * { display: none; diff --git a/elements/canvas.js b/elements/canvas.js index 24128b37..bba6558d 100644 --- a/elements/canvas.js +++ b/elements/canvas.js @@ -19,9 +19,9 @@ class Canvas extends LitElement { height: 100%; box-sizing: border-box; - border: 1px solid var(--canvas); - border-bottom-color: var(--highlight-text); - border-right-color: var(--highlight-text); + border: 1px solid var(--button-dark); + border-bottom-color: var(--button-light); + border-right-color: var(--button-light); overflow: hidden; } @@ -30,7 +30,7 @@ class Canvas extends LitElement { height: 100%; box-sizing: border-box; - border: 1px solid var(--button-text); + border: 1px solid var(--button-darker); border-bottom-color: var(--button-face); border-right-color: var(--button-face); diff --git a/elements/color-picker.js b/elements/color-picker.js index 9fd0552f..3b320fc2 100644 --- a/elements/color-picker.js +++ b/elements/color-picker.js @@ -12,16 +12,16 @@ class ColorPicker extends LitElement { static get styles() { return css` :host { - border: 1px solid var(--highlight-text); - border-top-color: var(--canvas); - border-left-color: var(--canvas); + border: 1px solid var(--button-light); + border-top-color: var(--button-dark); + border-left-color: var(--button-dark); } div.frame { box-sizing: border-box; border: 1px solid var(--button-face); - border-top-color: var(--button-text); - border-left-color: var(--button-text); + border-top-color: var(--button-darker); + border-left-color: var(--button-darker); height: 100%; } `; diff --git a/elements/color-switcher.js b/elements/color-switcher.js index 8a110422..558d4328 100644 --- a/elements/color-switcher.js +++ b/elements/color-switcher.js @@ -11,9 +11,9 @@ class ColorSwitcher extends LitElement { static get styles() { return css` :host { - border: 1px solid var(--highlight-text); - border-top-color: var(--canvas); - border-left-color: var(--canvas); + border: 1px solid var(--button-light); + border-top-color: var(--button-dark); + border-left-color: var(--button-dark); background: var(--selected-background); image-rendering: pixelated; } @@ -21,8 +21,8 @@ class ColorSwitcher extends LitElement { div.frame { box-sizing: border-box; border: 1px solid var(--button-face); - border-top-color: var(--button-text); - border-left-color: var(--button-text); + border-top-color: var(--button-darker); + border-left-color: var(--button-darker); height: 100%; padding: 3px 2px; position: relative; @@ -32,9 +32,9 @@ class ColorSwitcher extends LitElement { box-sizing: border-box; width: 15px; height: 15px; - border: 1px solid var(--canvas); - border-top-color: var(--highlight-text); - border-left-color: var(--highlight-text); + border: 1px solid var(--button-dark); + border-top-color: var(--button-light); + border-left-color: var(--button-light); position: absolute; z-index: 2; } diff --git a/elements/dialogs/about.js b/elements/dialogs/about.js index 4fd6efbe..b9c81d26 100644 --- a/elements/dialogs/about.js +++ b/elements/dialogs/about.js @@ -40,6 +40,10 @@ export class About extends LitElement { margin-right: 1px; float: right; } + + a { + color: var(--button-text); + } `; } diff --git a/elements/inset-container.js b/elements/inset-container.js index 3f1825e1..fbbeee4b 100644 --- a/elements/inset-container.js +++ b/elements/inset-container.js @@ -7,9 +7,9 @@ class InsetContainer extends LitElement { return css` :host { box-sizing: border-box; - border: 1px solid var(--canvas); - border-bottom-color: var(--highlight-text); - border-right-color: var(--highlight-text); + border: 1px solid var(--button-dark); + border-bottom-color: var(--button-light); + border-right-color: var(--button-light); display: flex; align-items: flex-end; diff --git a/elements/menu.js b/elements/menu.js index a4c1fd44..7b24fee0 100644 --- a/elements/menu.js +++ b/elements/menu.js @@ -18,7 +18,7 @@ class Menu extends LitElement { z-index: var(--z-index-menu); display: inline-block; box-sizing: border-box; - border: 1px solid var(--button-text); + border: 1px solid var(--button-darker); border-top: 1px solid var(--button-face); border-left: 1px solid var(--button-face); background-color: var(--button-face); @@ -32,8 +32,8 @@ class Menu extends LitElement { div.frame { border: 1px solid var(--canvas); - border-top: 1px solid var(--highlight-text); - border-left: 1px solid var(--highlight-text); + border-top: 1px solid var(--button-light); + border-left: 1px solid var(--button-light); display: grid; grid-template-columns: 22px auto auto 19px; padding: 1px; @@ -79,30 +79,34 @@ class Menu extends LitElement { padding-left: 9px; } + .menu-entry span { + fill: var(--button-text); + } + .menu-entry:hover span { background-color: var(--highlight); color: var(--highlight-text); fill: var(--highlight-text); - text-shadow: none; } .menu-entry.disabled:hover span { - color: var(--canvas); - fill: var(--canvas); + color: var(--highlight-disabled-text); + fill: var(--highlight-disabled-text); + text-shadow: none; } .menu-entry.disabled:hover svg .shadow { fill: transparent; } - .disabled { - color: var(--canvas); - fill: var(--canvas); - text-shadow: 1px 1px 0 var(--highlight-text); + .menu-entry.disabled span { + color: var(--disabled-text); + fill: var(--disabled-text); + text-shadow: 1px 1px 0 var(--disabled-text-backdrop); } .disabled svg .shadow { - fill: var(--highlight-text); + fill: var(--disabled-text-backdrop); } `; } diff --git a/elements/ruler.js b/elements/ruler.js index 8c37eafb..c6984d84 100644 --- a/elements/ruler.js +++ b/elements/ruler.js @@ -5,8 +5,8 @@ class Ruler extends LitElement { return css` :host { display: block; - border-top: 1px solid var(--canvas); - border-bottom: 1px solid var(--highlight-text); + border-top: 1px solid var(--button-dark); + border-bottom: 1px solid var(--button-light); } `; } diff --git a/elements/status-bar.js b/elements/status-bar.js index ddfacb32..f9ec48a9 100644 --- a/elements/status-bar.js +++ b/elements/status-bar.js @@ -35,6 +35,12 @@ class StatusBar extends LitElement { margin-right: 3px; image-rendering: pixelated; } + + @media (prefers-color-scheme: dark) { + img { + filter: invert(1); + } + } `; } diff --git a/elements/tool-fill-style.js b/elements/tool-fill-style.js index 35b97e30..1b13c92b 100644 --- a/elements/tool-fill-style.js +++ b/elements/tool-fill-style.js @@ -44,7 +44,7 @@ export class ToolFillStyle extends LitElement { } li .item.fill { - background-color: var(--canvas); + background-color: var(--button-dark); } `; } diff --git a/elements/tool.js b/elements/tool.js index 2d822176..51d9fdd8 100644 --- a/elements/tool.js +++ b/elements/tool.js @@ -14,42 +14,60 @@ class Tool extends LitElement { box-sizing: border-box; width: 25px; height: 25px; - border: 1px solid var(--button-text); - border-top: 1px solid var(--highlight-text); - border-left: 1px solid var(--highlight-text); + border: 1px solid var(--button-darker); + border-top: 1px solid var(--button-light); + border-left: 1px solid var(--button-light); background-color: var(--button-face); - image-rendering: pixelated; } - div { - box-sizing: border-box; + div.wrapper { height: 100%; - border: 1px solid var(--canvas); + border: 1px solid var(--button-dark); border-top: 1px solid var(--button-face); border-left: 1px solid var(--button-face); - background-position: 2px 2px; + } + + div.tool { + display: inline-block; + width: 16px; + height: 16px; + image-rendering: pixelated; + background-image: url('assets/tools-light.png'); background-repeat: no-repeat; + margin: 2px; + } + + @media (prefers-color-scheme: dark) { + div.tool { + background-image: url('assets/tools-dark.png'); + } } :host(.active), :host(:active) { - border: 1px solid var(--highlight-text); - border-top: 1px solid var(--button-text); - border-left: 1px solid var(--button-text); - background: var(--selected-background); + border: 1px solid var(--button-light); + border-top: 1px solid var(--button-darker); + border-left: 1px solid var(--button-darker); + background-image: var(--selected-background); } - :host(.active) div, - :host(:active) div { + :host(.active) div.wrapper, + :host(:active) div.wrapper { border: 1px solid var(--button-face); - border-top: 1px solid var(--canvas); - border-left: 1px solid var(--canvas); - background-position: 3px 3px; + border-top: 1px solid var(--button-dark); + border-left: 1px solid var(--button-dark); } - :host(:active) div { + :host(:active) div.wrapper { background-color: var(--button-face); - background-position: 4px 4px; + } + + :host(.active) div.tool { + margin: 3px; + } + + :host(:active) div.tool { + margin: 4px; } `; } @@ -74,7 +92,12 @@ class Tool extends LitElement { render() { return html` -
+
+
+
`; } } diff --git a/elements/window/title-bar-button.js b/elements/window/title-bar-button.js index 7618c403..59d0fd86 100644 --- a/elements/window/title-bar-button.js +++ b/elements/window/title-bar-button.js @@ -14,9 +14,9 @@ export class TitleBarButton extends LitElement { box-sizing: border-box; width: 16px; height: 14px; - border: 1px solid var(--highlight-text); - border-bottom-color: var(--button-text); - border-right-color: var(--button-text); + border: 1px solid var(--button-light); + border-bottom-color: var(--button-darker); + border-right-color: var(--button-darker); background-color: var(--button-face); } @@ -24,16 +24,16 @@ export class TitleBarButton extends LitElement { box-sizing: border-box; height: 12px; border: 1px solid transparent; - border-bottom-color: var(--canvas); - border-right-color: var(--canvas); + border-bottom-color: var(--button-dark); + border-right-color: var(--button-dark); display: flex; justify-content: center; } :host(:active) { - border: 1px solid var(--button-text); - border-bottom-color: var(--highlight-text); - border-right-color: var(--highlight-text); + border: 1px solid var(--button-darker); + border-bottom-color: var(--button-light); + border-right-color: var(--button-light); } :host(:active) div.wrapper { diff --git a/elements/window/window.js b/elements/window/window.js index 3092a83e..8d131c3a 100644 --- a/elements/window/window.js +++ b/elements/window/window.js @@ -13,8 +13,8 @@ export class Window extends LitElement { return css` :host { border: 1px solid var(--button-face); - border-right-color: var(--button-text); - border-bottom-color: var(--button-text); + border-right-color: var(--button-darker); + border-bottom-color: var(--button-darker); background-color: var(--button-face); display: flex; position: absolute; @@ -22,9 +22,9 @@ export class Window extends LitElement { } .wrapper { - border: 1px solid var(--highlight-text); - border-right-color: var(--canvas); - border-bottom-color: var(--canvas); + border: 1px solid var(--button-light); + border-right-color: var(--button-dark); + border-bottom-color: var(--button-dark); padding: 1px; flex: 1; display: flex; diff --git a/sw.js b/sw.js index 8f3d6b72..736472ba 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return i[e]||(s=new Promise(async s=>{if("document"in self){const i=document.createElement("script");i.src=e,document.head.appendChild(i),i.onload=s}else importScripts(e),s()})),s.then(()=>{if(!i[e])throw new Error(`Module ${e} didn’t register its module`);return i[e]})},s=(s,i)=>{Promise.all(s.map(e)).then(e=>i(1===e.length?e[0]:e))},i={require:Promise.resolve(s)};self.define=(s,r,o)=>{i[s]||(i[s]=Promise.resolve().then(()=>{let i={};const a={uri:location.origin+s.slice(1)};return Promise.all(r.map(s=>{switch(s){case"exports":return i;case"module":return a;default:return e(s)}})).then(e=>{const s=o(...e);return i.default||(i.default=s),i})}))}}define("./sw.js",["./workbox-af7d0aae"],(function(e){"use strict";e.skipWaiting(),e.precacheAndRoute([{url:"styles.css",revision:"2349d151a833839647417e01e672129f"},{url:"index.html",revision:"e3927ac69f9f824f5f963c6755d17a6a"},{url:"actions/about.js",revision:"66eb5787d65a1d1f7c5f4cd398bc02d7"},{url:"actions/clear-image.js",revision:"9c2ec9f8694e3692b0801d978397b29c"},{url:"actions/clear-selection.js",revision:"35a126e153424728a89006c1347483be"},{url:"actions/color-box.js",revision:"c93f3e7b55713f517fa583332dde2eb4"},{url:"actions/copy-to.js",revision:"6400d2e8327c3dd46fb540e5cf3e9804"},{url:"actions/copy.js",revision:"889ed72fd88566cba466e964a7a0e2a5"},{url:"actions/cut.js",revision:"fa55dba23082941f95acb20156889544"},{url:"actions/draw-opaque.js",revision:"3d627555a891a3498344ffc5923d3fbd"},{url:"actions/flip-rotate.js",revision:"5b544501a7e83a933f5b0ab9a06a7966"},{url:"actions/get-colors.js",revision:"d24dce182c806b1045b0e5b5aeb8c3bb"},{url:"actions/invert-image.js",revision:"b401103ebf6e8936322581484b8522b9"},{url:"actions/new.js",revision:"8603fe9d0c5ab66d4a70a21e9e6427bd"},{url:"actions/open.js",revision:"6be525fe00c3dca2477b7bd493982e62"},{url:"actions/paste-from.js",revision:"08652a4b0fa870bf670108363b9f00a1"},{url:"actions/paste.js",revision:"171f4c35ebd3d7fd1ac00d22c0e1585c"},{url:"actions/print.js",revision:"6a4d63b555f546c8a03439474d2b85fc"},{url:"actions/save-as.js",revision:"6c7b88c613f389f5eecd2aca4e47923a"},{url:"actions/save-colors.js",revision:"7c9da177af6612cf74ec935f10fb1a2b"},{url:"actions/save.js",revision:"a1a966c25a3aa83617bb66541e7b188a"},{url:"actions/select-all.js",revision:"5567741c2e8bada7985a02f4859f616e"},{url:"actions/send.js",revision:"92b958899392d5bf7a8830a187fed00b"},{url:"actions/status-bar.js",revision:"bdd2215e191694174d243cf03389bc28"},{url:"actions/tool-box.js",revision:"4278c6a9d6a1d88727f11c67df5bc788"},{url:"actions/view-bitmap.js",revision:"401b94dd035337f400e94f127f89625d"},{url:"elements/app.js",revision:"c6d85ee932837702f09d77b75ea3f991"},{url:"elements/canvas.js",revision:"9b4a80bc046e1fbce57919ca74964d7f"},{url:"elements/color-box.js",revision:"e2f5a11623df90f012067d042d639668"},{url:"elements/color-picker.js",revision:"91e27f3ae5741b0bf14b920dc23be1e7"},{url:"elements/color-switcher.js",revision:"c0f5199f85dc385bea0dc6835c0674b5"},{url:"elements/dialogs/about.js",revision:"e0256dcf03bc88728daa08d3fde7d2c0"},{url:"elements/dialogs/flip-and-rotate.js",revision:"c4ae8753bf0c82b6f68c0b9faf93567e"},{url:"elements/handle.js",revision:"a962a8feedb9bcbfb2f0ac11cf7305ae"},{url:"elements/index.js",revision:"e90edd6eac023155b3bef817d817e9f7"},{url:"elements/inset-container.js",revision:"02d815a9f5a4ff72051bb01fbb15536d"},{url:"elements/menu-bar.js",revision:"bb408f728c53e9c252fcf69d414e91cd"},{url:"elements/menu.js",revision:"1e53e8e0c61880ba0b98f5df13539160"},{url:"elements/ruler.js",revision:"8807936ca45c67e038b80fbad8131d2c"},{url:"elements/status-bar.js",revision:"a10f268979aac0d7798997ede3dd0942"},{url:"elements/tool-bar.js",revision:"36eab9d062c2dccc12c080a31b66c0c2"},{url:"elements/tool-box.js",revision:"8c7a7cc627a9d6b85b9df2d1b699ea42"},{url:"elements/tool-color-preview.js",revision:"819c2b41e2c911e51d826facc32ace73"},{url:"elements/tool-draw-opaque.js",revision:"3582643703a01bdd9cfe28d9b99078a7"},{url:"elements/tool-eraser-size.js",revision:"a7a26f3791a36184163bac7191fb1b9f"},{url:"elements/tool-fill-style.js",revision:"d7bf47efac9806d7b3a0f5253fa7a604"},{url:"elements/tool-line-width.js",revision:"73521d1a22d8a42efed7409d63420f3e"},{url:"elements/tool.js",revision:"2327d0ec5e670371a05232abc37bdc21"},{url:"elements/window/title-bar-button.js",revision:"bd85fe224949bf59e41ec50981d0b0bb"},{url:"elements/window/window.js",revision:"1ea9119533a96d7875b14db94a45ead3"},{url:"helpers/get-blob-from-selection.js",revision:"16bec3017610e95845c3f6c2a7f11f16"},{url:"helpers/get-image-from-blob.js",revision:"b8c32ca578f81120741cb7f100422aaa"},{url:"helpers/register-sw.js",revision:"68c1f0821b9ceb5a2894660b917d6891"},{url:"helpers/render-mnemonic.js",revision:"983ea70eaa15dedbd4ffdf9497209e7b"},{url:"helpers/update-context.js",revision:"ac5488706f72864fbe0cdb95eda42ea0"},{url:"menus/all.js",revision:"1da72ab5b140d4368f492fee7a958fed"},{url:"menus/edit.js",revision:"5b295dafaf61aa72fe01bffdef96206f"},{url:"menus/file.js",revision:"82477218261e929a53f1267556bd913b"},{url:"menus/help.js",revision:"bea0523645dab5bfe4cc3c96d1d30164"},{url:"menus/image.js",revision:"1059caf6580d512e9a0f34fe02eceb9a"},{url:"menus/options.js",revision:"2d510b3695b3e33f9ed2ee79271242e2"},{url:"menus/view.js",revision:"537728c9698cbf477dbf894fdca2b1cc"},{url:"tools/all.js",revision:"03c423fadb7dca603dca616ef6e2c8f8"},{url:"tools/brush.js",revision:"7271410a9ca9f627d21d2bf8e22ea7fe"},{url:"tools/eraser.js",revision:"e850e4e4d5e2298e7f43317867457411"},{url:"tools/fill.js",revision:"405b75946f3e568482743eb8bda17bfc"},{url:"tools/line.js",revision:"a21dcfa25029b75b8f2b9edec029a596"},{url:"tools/pencil.js",revision:"3ab35c3e4e7431e7ecfefc7ff31a4ed1"},{url:"tools/pick.js",revision:"004c7578f6c2444529cd05f735e9e130"},{url:"tools/rectangle.js",revision:"33b48798f0e66978ada2ff7972016df9"},{url:"tools/select.js",revision:"367f6b2fa407446e2b46ba9ed7c76d19"},{url:"web_modules/bresenham-line.js",revision:"f3eee004b7acec6c5be1eeef3f7366fd"},{url:"web_modules/browser-nativefs.js",revision:"82225e04fcf3f9e00d99e1b4a9e97828"},{url:"web_modules/common/_commonjsHelpers-51a1c497.js",revision:"dae0f04e4dc8d08e5cd2d0b3699584f2"},{url:"web_modules/common/directory-open-legacy-8ad703f7.js",revision:"816372ee4795ffdb93af1842fc47b6f2"},{url:"web_modules/common/directory-open-nativefs-7ac98f26.js",revision:"91d96de461ab5395f2f9643c13306cda"},{url:"web_modules/common/file-open-legacy-37886591.js",revision:"436eea8d91464633a1f6e7196dbcbe35"},{url:"web_modules/common/file-open-nativefs-11792c03.js",revision:"7d0160f05bd6e354971122fdd0342723"},{url:"web_modules/common/file-save-legacy-df95654f.js",revision:"cfcf40db303e17225a904fbb685e301a"},{url:"web_modules/common/file-save-nativefs-b50a0318.js",revision:"fae89dfa12e73a38e168454c3b14aa2d"},{url:"web_modules/hotkeys-js.js",revision:"efe6753e1987c9331bda4737da130ede"},{url:"web_modules/lit-element.js",revision:"92a2d82ca6c36e317ec6dd9c2fd48730"},{url:"web_modules/q-floodfill.js",revision:"882fdf473348f7b206fe49e44de32779"},{url:"assets/icon.png",revision:"6401a7111b0b39f29448b74969487757"},{url:"manifest.webmanifest",revision:"ca8b0223e22674e208cc3c224d172f9c"},{url:"favicon.ico",revision:"0e809cc049c23b8d405a2886b8f1a23e"},{url:"3rdpartylicenses.txt",revision:"495048e8d0ba856e8589068964e8ca22"}],{})})); +if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return i[e]||(s=new Promise(async s=>{if("document"in self){const i=document.createElement("script");i.src=e,document.head.appendChild(i),i.onload=s}else importScripts(e),s()})),s.then(()=>{if(!i[e])throw new Error(`Module ${e} didn’t register its module`);return i[e]})},s=(s,i)=>{Promise.all(s.map(e)).then(e=>i(1===e.length?e[0]:e))},i={require:Promise.resolve(s)};self.define=(s,o,r)=>{i[s]||(i[s]=Promise.resolve().then(()=>{let i={};const a={uri:location.origin+s.slice(1)};return Promise.all(o.map(s=>{switch(s){case"exports":return i;case"module":return a;default:return e(s)}})).then(e=>{const s=r(...e);return i.default||(i.default=s),i})}))}}define("./sw.js",["./workbox-af7d0aae"],(function(e){"use strict";e.skipWaiting(),e.precacheAndRoute([{url:"styles.css",revision:"2349d151a833839647417e01e672129f"},{url:"index.html",revision:"e3927ac69f9f824f5f963c6755d17a6a"},{url:"actions/about.js",revision:"66eb5787d65a1d1f7c5f4cd398bc02d7"},{url:"actions/clear-image.js",revision:"9c2ec9f8694e3692b0801d978397b29c"},{url:"actions/clear-selection.js",revision:"35a126e153424728a89006c1347483be"},{url:"actions/color-box.js",revision:"c93f3e7b55713f517fa583332dde2eb4"},{url:"actions/copy-to.js",revision:"6400d2e8327c3dd46fb540e5cf3e9804"},{url:"actions/copy.js",revision:"889ed72fd88566cba466e964a7a0e2a5"},{url:"actions/cut.js",revision:"fa55dba23082941f95acb20156889544"},{url:"actions/draw-opaque.js",revision:"3d627555a891a3498344ffc5923d3fbd"},{url:"actions/flip-rotate.js",revision:"5b544501a7e83a933f5b0ab9a06a7966"},{url:"actions/get-colors.js",revision:"d24dce182c806b1045b0e5b5aeb8c3bb"},{url:"actions/invert-image.js",revision:"b401103ebf6e8936322581484b8522b9"},{url:"actions/new.js",revision:"8603fe9d0c5ab66d4a70a21e9e6427bd"},{url:"actions/open.js",revision:"6be525fe00c3dca2477b7bd493982e62"},{url:"actions/paste-from.js",revision:"08652a4b0fa870bf670108363b9f00a1"},{url:"actions/paste.js",revision:"171f4c35ebd3d7fd1ac00d22c0e1585c"},{url:"actions/print.js",revision:"6a4d63b555f546c8a03439474d2b85fc"},{url:"actions/save-as.js",revision:"6c7b88c613f389f5eecd2aca4e47923a"},{url:"actions/save-colors.js",revision:"7c9da177af6612cf74ec935f10fb1a2b"},{url:"actions/save.js",revision:"a1a966c25a3aa83617bb66541e7b188a"},{url:"actions/select-all.js",revision:"5567741c2e8bada7985a02f4859f616e"},{url:"actions/send.js",revision:"92b958899392d5bf7a8830a187fed00b"},{url:"actions/status-bar.js",revision:"bdd2215e191694174d243cf03389bc28"},{url:"actions/tool-box.js",revision:"4278c6a9d6a1d88727f11c67df5bc788"},{url:"actions/view-bitmap.js",revision:"401b94dd035337f400e94f127f89625d"},{url:"elements/app.js",revision:"11047a69ac8205bdf8896413835b0c6f"},{url:"elements/canvas.js",revision:"6b015022c79577d99341b4b12ee72430"},{url:"elements/color-box.js",revision:"e2f5a11623df90f012067d042d639668"},{url:"elements/color-picker.js",revision:"a802a77e20145c9b6c765d7ff600a288"},{url:"elements/color-switcher.js",revision:"bd866fe1dc4dbf499e4fa9c2b6be0083"},{url:"elements/dialogs/about.js",revision:"78fa841d6e708fa17407ba3e3453dbab"},{url:"elements/dialogs/flip-and-rotate.js",revision:"c4ae8753bf0c82b6f68c0b9faf93567e"},{url:"elements/handle.js",revision:"a962a8feedb9bcbfb2f0ac11cf7305ae"},{url:"elements/index.js",revision:"e90edd6eac023155b3bef817d817e9f7"},{url:"elements/inset-container.js",revision:"3d45328005f907f75175eeb395c70362"},{url:"elements/menu-bar.js",revision:"bb408f728c53e9c252fcf69d414e91cd"},{url:"elements/menu.js",revision:"32e10c3a0fb3266da7b60a7962283e99"},{url:"elements/ruler.js",revision:"b3511c85f37946b946166b4d7a6ad90a"},{url:"elements/status-bar.js",revision:"52e287ff3351495c42bf7a3f967bfa88"},{url:"elements/tool-bar.js",revision:"36eab9d062c2dccc12c080a31b66c0c2"},{url:"elements/tool-box.js",revision:"8c7a7cc627a9d6b85b9df2d1b699ea42"},{url:"elements/tool-color-preview.js",revision:"819c2b41e2c911e51d826facc32ace73"},{url:"elements/tool-draw-opaque.js",revision:"3582643703a01bdd9cfe28d9b99078a7"},{url:"elements/tool-eraser-size.js",revision:"a7a26f3791a36184163bac7191fb1b9f"},{url:"elements/tool-fill-style.js",revision:"50fcb700b98715e841042667e8c3a010"},{url:"elements/tool-line-width.js",revision:"73521d1a22d8a42efed7409d63420f3e"},{url:"elements/tool.js",revision:"098ae291a89af6f4329164989dd10321"},{url:"elements/window/title-bar-button.js",revision:"9544d3becf17f352fcb31c7578a4a81b"},{url:"elements/window/window.js",revision:"3cfdb895ff36c89c1a4c0060fbfdd287"},{url:"helpers/get-blob-from-selection.js",revision:"16bec3017610e95845c3f6c2a7f11f16"},{url:"helpers/get-image-from-blob.js",revision:"b8c32ca578f81120741cb7f100422aaa"},{url:"helpers/register-sw.js",revision:"68c1f0821b9ceb5a2894660b917d6891"},{url:"helpers/render-mnemonic.js",revision:"983ea70eaa15dedbd4ffdf9497209e7b"},{url:"helpers/update-context.js",revision:"ac5488706f72864fbe0cdb95eda42ea0"},{url:"menus/all.js",revision:"1da72ab5b140d4368f492fee7a958fed"},{url:"menus/edit.js",revision:"5b295dafaf61aa72fe01bffdef96206f"},{url:"menus/file.js",revision:"82477218261e929a53f1267556bd913b"},{url:"menus/help.js",revision:"bea0523645dab5bfe4cc3c96d1d30164"},{url:"menus/image.js",revision:"1059caf6580d512e9a0f34fe02eceb9a"},{url:"menus/options.js",revision:"2d510b3695b3e33f9ed2ee79271242e2"},{url:"menus/view.js",revision:"537728c9698cbf477dbf894fdca2b1cc"},{url:"tools/all.js",revision:"8a0187200d9cc0ae7a0e5f393bd8c068"},{url:"tools/brush.js",revision:"7271410a9ca9f627d21d2bf8e22ea7fe"},{url:"tools/eraser.js",revision:"e850e4e4d5e2298e7f43317867457411"},{url:"tools/fill.js",revision:"405b75946f3e568482743eb8bda17bfc"},{url:"tools/line.js",revision:"a21dcfa25029b75b8f2b9edec029a596"},{url:"tools/pencil.js",revision:"3ab35c3e4e7431e7ecfefc7ff31a4ed1"},{url:"tools/pick.js",revision:"004c7578f6c2444529cd05f735e9e130"},{url:"tools/rectangle.js",revision:"33b48798f0e66978ada2ff7972016df9"},{url:"tools/select.js",revision:"367f6b2fa407446e2b46ba9ed7c76d19"},{url:"web_modules/bresenham-line.js",revision:"f3eee004b7acec6c5be1eeef3f7366fd"},{url:"web_modules/browser-nativefs.js",revision:"51e4a981320d5b3e5a08c5592ba628a7"},{url:"web_modules/common/_commonjsHelpers-51a1c497.js",revision:"dae0f04e4dc8d08e5cd2d0b3699584f2"},{url:"web_modules/common/directory-open-legacy-aed60324.js",revision:"cc8f0084efbf6cfe02ba22f12824f282"},{url:"web_modules/common/directory-open-nativefs-20e5d376.js",revision:"1fdd7d8e263b3c2e4ac022a971900709"},{url:"web_modules/common/directory-open-nativefs-edd3f2a1.js",revision:"940ac7d8304c77a8e67b16c80ec0cf62"},{url:"web_modules/common/file-open-legacy-37886591.js",revision:"436eea8d91464633a1f6e7196dbcbe35"},{url:"web_modules/common/file-open-nativefs-539a2c46.js",revision:"c03d6267de2fe53458646ff356332e66"},{url:"web_modules/common/file-open-nativefs-a9b57b6b.js",revision:"de0be2bf453843797c78bd653ab10525"},{url:"web_modules/common/file-save-legacy-df95654f.js",revision:"cfcf40db303e17225a904fbb685e301a"},{url:"web_modules/common/file-save-nativefs-2c1b0849.js",revision:"1e5477203cbf75e2ffc92a5c5722815c"},{url:"web_modules/common/file-save-nativefs-403dc0ac.js",revision:"0eee31638bdc81230613761eeddfdb2a"},{url:"web_modules/hotkeys-js.js",revision:"efe6753e1987c9331bda4737da130ede"},{url:"web_modules/lit-element.js",revision:"92a2d82ca6c36e317ec6dd9c2fd48730"},{url:"web_modules/q-floodfill.js",revision:"882fdf473348f7b206fe49e44de32779"},{url:"assets/icon.png",revision:"6401a7111b0b39f29448b74969487757"},{url:"assets/tools-dark.png",revision:"cce885719ee12305612669b40d3be855"},{url:"assets/tools-light.png",revision:"db722feffdfe1b3869822b2c64aa15ff"},{url:"manifest.webmanifest",revision:"ca8b0223e22674e208cc3c224d172f9c"},{url:"favicon.ico",revision:"0e809cc049c23b8d405a2886b8f1a23e"},{url:"3rdpartylicenses.txt",revision:"495048e8d0ba856e8589068964e8ca22"}],{})})); diff --git a/tools/all.js b/tools/all.js index 96095e6a..44e6f835 100644 --- a/tools/all.js +++ b/tools/all.js @@ -10,23 +10,20 @@ import { EraserTool } from './eraser.js'; export const FREE_FORM_SELECT = { tooltip: 'Free-Form Select', helpText: 'Selects a free-form part of the picture to move, copy, or edit.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAATUlEQVQ4y71S2QoAIAxS6P9/2d6CYLF2lK9TdwnYEM7YasMhMmBsEpURe+soI0rdoGXcJ2J1dF58GmIGTMhEV95MrOpx1fXOUny/ZAITeuwb82N8y4sAAAAASUVORK5CYII=', + imagePosition: '0 0', }; export const SELECT = { tooltip: 'Select', helpText: 'Selects a rectangular part of the picture to move, copy, or edit.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAKElEQVQ4y2NgGBbgPxQTYuOU/0+h5dTxAtl6WQZNLAwDL1CUkIY4AABdMRvtVCCWxwAAAABJRU5ErkJggg==', + imagePosition: '-16px 0', instance: new SelectTool(), }; export const ERASER = { tooltip: 'Eraser/Color Eraser', helpText: 'Erases a portion of the picture, using the selected eraser shape.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAYElEQVQ4y2NgGGjASED+PyF9+Az4//H/egxBfsZAFL0sJGtuYIBgKGAhWTMaYKFEM3oYEKe5AXsg/scZlHg0o3jhChYjdBjxa8YXC9hcwYgvDP4TcAEjoZT4n4LUOtQBAKrjIRo4xtzPAAAAAElFTkSuQmCC', + imagePosition: '-32px 0', instance: new EraserTool(), cursor: 'none', }; @@ -34,61 +31,53 @@ export const ERASER = { export const FILL = { tooltip: 'Fill With Color', helpText: 'Fills an area with the current drawing color.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACVBMVEUAAAAAAAAArafQeB0vAAAAAXRSTlMAQObYZgAAAEJJREFUCB0FwaENgDAQAMAjKR4BottUoRH/JKCrmAbDCAi25A4ATNAxfCzr2+T5bPLKkDUPOWYXQ97C3oTKrFCg4AeVvwo78oeFFAAAAABJRU5ErkJggg==', + imagePosition: '-48px 0', instance: new FillTool(), }; export const PICK_COLOR = { tooltip: 'Pick Color', helpText: 'Picks up a color from the picture for drawing.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACVBMVEUAAAAAAAAArafQeB0vAAAAAXRSTlMAQObYZgAAAD5JREFUCB0FwTENgDAQAMD7BJgZ6IIEVLwEhr4I3CCiJASV3EFHFOZCK1Qn6kQl0TBtWBMXYmC5sSeeD8fLDwv/B/CGwemxAAAAAElFTkSuQmCC', + imagePosition: '-64px 0', instance: new PickTool(), }; export const MAGNIFIER = { tooltip: 'Magnifier', helpText: 'Changes the magnification.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADFBMVEUAAAAAAAAArad25P8qjoCKAAAAAXRSTlMAQObYZgAAADpJREFUCFtjYAhhYGBg/evAwCD//wKUqP//BZmASlwBqcsEqg7JAqpmkJoAJNiWAAnGlUCCASTDIAIA+9MVjTmiL1AAAAAASUVORK5CYII=', + imagePosition: '-80px 0', }; export const PENCIL = { tooltip: 'Pencil', helpText: 'Draws a free-form line one pixel wide.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAD1BMVEUAAAAAAACqAADU/wDx/68cBCymAAAAAXRSTlMAQObYZgAAADFJREFUCFtjYAACQQYIYFQSQGMIwqSEDXExGI0xGQJoDEFBKEPEEapbBCoAt5sBIgAAAuADhDcByHUAAAAASUVORK5CYII=', + imagePosition: '-96px 0', instance: new PencilTool(), }; export const BRUSH = { tooltip: 'Brush', helpText: 'Draws using a brush with the selected shape and size.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAV0lEQVQ4y+2SsQrAQAxC9ciH98NL7XQUSpQbr1CnDNFBHyXBiaQAQBLdT0Xz8dwuxAas6g/YIYAdSBOgtzoWqjM7OjugEom4dGKwkHCPHRDjayu49tMSNzsqKLNFMCGrAAAAAElFTkSuQmCC', + imagePosition: '-112px 0', instance: new BrushTool(), }; export const AIRBRUSH = { tooltip: 'Airbrush', helpText: 'Draws using an airbrush of the selected size.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAFVBMVEX///8AAAAAAIAAAP8AgIAA//8R/P87CDhcAAAAAXRSTlMAQObYZgAAAFNJREFUCB0FwbENwyAQAMCjSI+RF+AnIAXpLXmAl9Dvv0ruAAAAwN7fq+NTeb0P9l73OzpVeT8xOcc9IrpKLSKm32JEdJW0mJzE6FSiYS9AARzAHxQbCx2D+M74AAAAAElFTkSuQmCC', + imagePosition: '-128px 0', }; export const TEXT = { tooltip: 'Text', helpText: 'Inserts text into the picture.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAACxJREFUCB1jYACCAyDECEQPGJiAqICBBYIsGPh/MHDIMAjIMBjIMdTYA5UCANO8B/vh6q3yAAAAAElFTkSuQmCC', + imagePosition: '-144px 0', }; export const LINE = { tooltip: 'Line', helpText: 'Draws a straight line with the selected line width.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAFklEQVQ4y2NgoAz8H9U8qnlU87DRDABNiA/xUZW66AAAAABJRU5ErkJggg==', + imagePosition: '-160px 0', instance: new LineTool(), detailsSelector: 'paint-tool-line-width', }; @@ -96,38 +85,33 @@ export const LINE = { export const CURVE = { tooltip: 'Curve', helpText: 'Draws a curved line with the selected line width.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAACZJREFUCB0FwQENADAIACB0bq9hFKMZ1SgHD8vQNM2wgqQoiiRwH0MVAtphf7+PAAAAAElFTkSuQmCC', + imagePosition: '-176px 0', detailsSelector: 'paint-tool-line-width', }; export const RECTANGLE = { tooltip: 'Rectangle', helpText: 'Draws a rectangle with the selected fill style.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAJUlEQVQ4y2NgGPKAkYGB4T+lhlBiwH8WSm0fNWAwGECVhDTEAQBUugQbgUfDcwAAAABJRU5ErkJggg==', + imagePosition: '-192px 0', instance: new RectangleTool(), }; export const POLYGON = { tooltip: 'Polygon', helpText: 'Draws a polygon with the selected fill style.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAQklEQVQ4y2NkwAT/GXADRgYiwH8SxSnTzMJAIaDYAGKc+p8SzQQNGFxhQJb/GZEUMtIiAAnqGxyB+J8SvYwUGsAAACY2Egxkcb4+AAAAAElFTkSuQmCC', + imagePosition: '-208px 0', }; export const ELLIPSE = { tooltip: 'Ellipse', helpText: 'Draws an ellipse with the selected fill style.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAMklEQVQ4y2NgGPKAEY/cf2LUMpKgAa/8fzJc/58SzXC9LJQG4sAbQHEgUhyNFCekYQAATj8MC0rigyEAAAAASUVORK5CYII=', + imagePosition: '-224px 0', }; export const ROUNDED_RECTANGLE = { tooltip: 'Rounded Rectangle', helpText: 'Draws a rounded rectangle with the selected fill style.', - image: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAKklEQVQ4y2NgGPKAEYn9nwK9JGtG0fOfAh/8Z6E0DEYNoEI0Ui0hDWEAAMk0CBHA/VZLAAAAAElFTkSuQmCC', + imagePosition: '-240px 0', }; export const tools = [ diff --git a/web_modules/browser-nativefs.js b/web_modules/browser-nativefs.js index 3ad8033e..927a4025 100644 --- a/web_modules/browser-nativefs.js +++ b/web_modules/browser-nativefs.js @@ -1,13 +1,16 @@ // @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -const e="chooseFileSystemEntries"in self?import('./common/file-open-nativefs-11792c03.js'):import('./common/file-open-legacy-37886591.js');async function fileOpen(...i){return (await e).default(...i)} +const e="chooseFileSystemEntries"in self?"chooseFileSystemEntries":"showOpenFilePicker"in self&&"showOpenFilePicker"; // @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -const e$1="chooseFileSystemEntries"in self?import('./common/directory-open-nativefs-7ac98f26.js'):import('./common/directory-open-legacy-8ad703f7.js');async function directoryOpen(...t){return (await e$1).default(...t)} +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)} // @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -const e$2="chooseFileSystemEntries"in self?import('./common/file-save-nativefs-b50a0318.js'):import('./common/file-save-legacy-df95654f.js');async function fileSave(...i){return (await e$2).default(...i)} +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)} // @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -const t=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);});}); +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)} -export { directoryOpen, fileOpen, fileSave, t as imageToBlob }; +// @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 }; diff --git a/web_modules/common/directory-open-legacy-8ad703f7.js b/web_modules/common/directory-open-legacy-8ad703f7.js deleted file mode 100644 index c8ed563d..00000000 --- a/web_modules/common/directory-open-legacy-8ad703f7.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -var directoryOpenLegacy = async(e={})=>(e.recursive=e.recursive||!1,e.multiple=e.multiple||!1,new Promise(t=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0,i.multiple=e.multiple,i.addEventListener("change",()=>{let l=Array.from(i.files);if(e.recursive||(l=l.filter(e=>2===e.webkitRelativePath.split("/").length)),e.multiple){const e=new Set,t=[];l.forEach(t=>{e.add(t.webkitRelativePath.split("/")[0]);});for(const i of e)t.push(l.filter(e=>e.webkitRelativePath.startsWith(i)));l=t;}t(l);}),i.click();})); - -export default directoryOpenLegacy; diff --git a/web_modules/common/directory-open-legacy-aed60324.js b/web_modules/common/directory-open-legacy-aed60324.js new file mode 100644 index 00000000..69c01ecb --- /dev/null +++ b/web_modules/common/directory-open-legacy-aed60324.js @@ -0,0 +1,4 @@ +// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. +var directoryOpenLegacy = 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 directoryOpenLegacy; diff --git a/web_modules/common/directory-open-nativefs-20e5d376.js b/web_modules/common/directory-open-nativefs-20e5d376.js new file mode 100644 index 00000000..f8f16a35 --- /dev/null +++ b/web_modules/common/directory-open-nativefs-20e5d376.js @@ -0,0 +1,4 @@ +// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. +const e=async(t,r,a=t.name)=>{const i=[],n=[];for await(const o of t.values()){const t=`${a}/${o.name}`;"file"===o.kind?n.push(o.getFile().then(e=>Object.defineProperty(e,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>t}))):"directory"===o.kind&&r&&i.push(e(o,r,t));}return [...(await Promise.all(i)).flat(),...await Promise.all(n)]};var directoryOpenNativefs = async(t={})=>{t.recursive=t.recursive||!1;const r=await window.showDirectoryPicker();return e(r,t.recursive)}; + +export default directoryOpenNativefs; diff --git a/web_modules/common/directory-open-nativefs-7ac98f26.js b/web_modules/common/directory-open-nativefs-7ac98f26.js deleted file mode 100644 index 8cec8306..00000000 --- a/web_modules/common/directory-open-nativefs-7ac98f26.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -const t=async(e,i,r=[])=>{for await(const s of e)s.isFile?r.push(await s.getFile()):s.isDirectory&&i&&await t(await s.getEntries(),i,r);return r};var directoryOpenNativefs = async(e={})=>{e.recursive=e.recursive||!1,e.multiple=e.multiple||!1;try{const i=await window.chooseFileSystemEntries({type:"open-directory",multiple:e.multiple});if(e.multiple){const r=[];for(const s of i){const i=await s.getEntries();r.push(await t(i,e.recursive));}return r}const r=await i.getEntries();return await t(r,e.recursive)}catch(t){throw t}}; - -export default directoryOpenNativefs; diff --git a/web_modules/common/directory-open-nativefs-edd3f2a1.js b/web_modules/common/directory-open-nativefs-edd3f2a1.js new file mode 100644 index 00000000..a88e441c --- /dev/null +++ b/web_modules/common/directory-open-nativefs-edd3f2a1.js @@ -0,0 +1,4 @@ +// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. +const e=async(t,r,i=t.name)=>{const a=[],s=[];for await(const n of t.getEntries()){const t=`${i}/${n.name}`;n.isFile?s.push(n.getFile().then(e=>Object.defineProperty(e,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>t}))):n.isDirectory&&r&&a.push(e(n,r,t));}return [...(await Promise.all(a)).flat(),...await Promise.all(s)]};var directoryOpenNativefs = async(t={})=>{t.recursive=t.recursive||!1;const r=await window.chooseFileSystemEntries({type:"open-directory"});return e(r,t.recursive)}; + +export default directoryOpenNativefs; diff --git a/web_modules/common/file-open-nativefs-11792c03.js b/web_modules/common/file-open-nativefs-11792c03.js deleted file mode 100644 index 4fc01542..00000000 --- a/web_modules/common/file-open-nativefs-11792c03.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -var fileOpenNativefs = async(e={})=>{try{const t=await window.chooseFileSystemEntries({accepts:[{description:e.description||"",mimeTypes:e.mimeTypes||["*/*"],extensions:e.extensions||[""]}],multiple:e.multiple||!1});if(e.multiple){const e=[];for(const i of t){const t=await i.getFile();t.handle=i,e.push(t);}return e}const i=await t.getFile();return i.handle=t,i}catch(e){throw e}}; - -export default fileOpenNativefs; diff --git a/web_modules/common/file-open-nativefs-539a2c46.js b/web_modules/common/file-open-nativefs-539a2c46.js new file mode 100644 index 00000000..b2d80d05 --- /dev/null +++ b/web_modules/common/file-open-nativefs-539a2c46.js @@ -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 fileOpenNativefs = 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 fileOpenNativefs; diff --git a/web_modules/common/file-open-nativefs-a9b57b6b.js b/web_modules/common/file-open-nativefs-a9b57b6b.js new file mode 100644 index 00000000..dfb8961a --- /dev/null +++ b/web_modules/common/file-open-nativefs-a9b57b6b.js @@ -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 fileOpenNativefs = 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 fileOpenNativefs; diff --git a/web_modules/common/file-save-nativefs-2c1b0849.js b/web_modules/common/file-save-nativefs-2c1b0849.js new file mode 100644 index 00000000..a092dc08 --- /dev/null +++ b/web_modules/common/file-save-nativefs-2c1b0849.js @@ -0,0 +1,4 @@ +// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. +var fileSaveNativefs = 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 fileSaveNativefs; diff --git a/web_modules/common/file-save-nativefs-403dc0ac.js b/web_modules/common/file-save-nativefs-403dc0ac.js new file mode 100644 index 00000000..ec394597 --- /dev/null +++ b/web_modules/common/file-save-nativefs-403dc0ac.js @@ -0,0 +1,4 @@ +// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. +var fileSaveNativefs = 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 fileSaveNativefs; diff --git a/web_modules/common/file-save-nativefs-b50a0318.js b/web_modules/common/file-save-nativefs-b50a0318.js deleted file mode 100644 index ef570c0e..00000000 --- a/web_modules/common/file-save-nativefs-b50a0318.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0. -var fileSaveNativefs = async(e,t={},i=null)=>{try{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}catch(e){throw e}}; - -export default fileSaveNativefs;