diff --git a/docs-src/package.json b/docs-src/package.json index 86593b6..ec24d68 100644 --- a/docs-src/package.json +++ b/docs-src/package.json @@ -10,12 +10,12 @@ "prod": "NODE_ENV=production webpack" }, "dependencies": { - "@devlop-ab/dialog": "^1.0.1", + "@devlop-ab/dialog": "^1.0.5", "copy-webpack-plugin": "^9.0.1", "css-loader": "^5.2.7", "fork-ts-checker-webpack-plugin": "^6.3.2", "mini-css-extract-plugin": "^1.6.2", - "sass": "^1.37.5", + "sass": "^1.38.1", "sass-loader": "^10.1.1", "ts-loader": "^8.3.0", "typescript": "^4.3.5", diff --git a/docs/assets/docs.css b/docs/assets/docs.css index b611ce8..687c143 100644 --- a/docs/assets/docs.css +++ b/docs/assets/docs.css @@ -101,6 +101,7 @@ } [data-dialog] section.message { padding: var(--dialog-padding); + line-height: 1.5; } [data-dialog] section.prompt { padding: var(--dialog-padding); @@ -209,913 +210,4 @@ background-color: var(--ok-button-active-background-color); } -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ -html { - font-family: sans-serif; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; -} - -body { - margin: 0; -} - -article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { - display: block; -} - -audio, canvas, progress, video { - display: inline-block; - vertical-align: baseline; -} - -audio:not([controls]) { - display: none; - height: 0; -} - -[hidden], template { - display: none; -} - -a { - background-color: transparent; -} - -a:active, a:hover { - outline: 0; -} - -abbr[title] { - border-bottom: 1px dotted; -} - -b, strong { - font-weight: bold; -} - -dfn { - font-style: italic; -} - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -mark { - background: #ff0; - color: #000; -} - -small { - font-size: 80%; -} - -sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -img { - border: 0; -} - -svg:not(:root) { - overflow: hidden; -} - -figure { - margin: 1em 40px; -} - -hr { - box-sizing: content-box; - height: 0; -} - -pre { - overflow: auto; -} - -code, kbd, pre, samp { - font-family: monospace, monospace; - font-size: 1em; -} - -button, input, optgroup, select, textarea { - color: inherit; - font: inherit; - margin: 0; -} - -button { - overflow: visible; -} - -button, select { - text-transform: none; -} - -button, html input[type=button], input[type=reset], input[type=submit] { - -webkit-appearance: button; - cursor: pointer; -} - -button[disabled], html input[disabled] { - cursor: default; -} - -button::-moz-focus-inner, input::-moz-focus-inner { - border: 0; - padding: 0; -} - -input { - line-height: normal; -} - -input[type=checkbox], input[type=radio] { - box-sizing: border-box; - padding: 0; -} - -input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { - height: auto; -} - -input[type=search] { - -webkit-appearance: textfield; - box-sizing: content-box; -} - -input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { - -webkit-appearance: none; -} - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -legend { - border: 0; - padding: 0; -} - -textarea { - overflow: auto; -} - -optgroup { - font-weight: bold; -} - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, th { - padding: 0; -} - -.highlight table td { - padding: 5px; -} - -.highlight table pre { - margin: 0; -} - -.highlight .cm { - color: #999988; - font-style: italic; -} - -.highlight .cp { - color: #999999; - font-weight: bold; -} - -.highlight .c1 { - color: #999988; - font-style: italic; -} - -.highlight .cs { - color: #999999; - font-weight: bold; - font-style: italic; -} - -.highlight .c, .highlight .cd { - color: #999988; - font-style: italic; -} - -.highlight .err { - color: #a61717; - background-color: #e3d2d2; -} - -.highlight .gd { - color: #000000; - background-color: #ffdddd; -} - -.highlight .ge { - color: #000000; - font-style: italic; -} - -.highlight .gr { - color: #aa0000; -} - -.highlight .gh { - color: #999999; -} - -.highlight .gi { - color: #000000; - background-color: #ddffdd; -} - -.highlight .go { - color: #888888; -} - -.highlight .gp { - color: #555555; -} - -.highlight .gs { - font-weight: bold; -} - -.highlight .gu { - color: #aaaaaa; -} - -.highlight .gt { - color: #aa0000; -} - -.highlight .kc { - color: #000000; - font-weight: bold; -} - -.highlight .kd { - color: #000000; - font-weight: bold; -} - -.highlight .kn { - color: #000000; - font-weight: bold; -} - -.highlight .kp { - color: #000000; - font-weight: bold; -} - -.highlight .kr { - color: #000000; - font-weight: bold; -} - -.highlight .kt { - color: #445588; - font-weight: bold; -} - -.highlight .k, .highlight .kv { - color: #000000; - font-weight: bold; -} - -.highlight .mf { - color: #009999; -} - -.highlight .mh { - color: #009999; -} - -.highlight .il { - color: #009999; -} - -.highlight .mi { - color: #009999; -} - -.highlight .mo { - color: #009999; -} - -.highlight .m, .highlight .mb, .highlight .mx { - color: #009999; -} - -.highlight .sb { - color: #d14; -} - -.highlight .sc { - color: #d14; -} - -.highlight .sd { - color: #d14; -} - -.highlight .s2 { - color: #d14; -} - -.highlight .se { - color: #d14; -} - -.highlight .sh { - color: #d14; -} - -.highlight .si { - color: #d14; -} - -.highlight .sx { - color: #d14; -} - -.highlight .sr { - color: #009926; -} - -.highlight .s1 { - color: #d14; -} - -.highlight .ss { - color: #990073; -} - -.highlight .s { - color: #d14; -} - -.highlight .na { - color: #008080; -} - -.highlight .bp { - color: #999999; -} - -.highlight .nb { - color: #0086B3; -} - -.highlight .nc { - color: #445588; - font-weight: bold; -} - -.highlight .no { - color: #008080; -} - -.highlight .nd { - color: #3c5d5d; - font-weight: bold; -} - -.highlight .ni { - color: #800080; -} - -.highlight .ne { - color: #990000; - font-weight: bold; -} - -.highlight .nf { - color: #990000; - font-weight: bold; -} - -.highlight .nl { - color: #990000; - font-weight: bold; -} - -.highlight .nn { - color: #555555; -} - -.highlight .nt { - color: #000080; -} - -.highlight .vc { - color: #008080; -} - -.highlight .vg { - color: #008080; -} - -.highlight .vi { - color: #008080; -} - -.highlight .nv { - color: #008080; -} - -.highlight .ow { - color: #000000; - font-weight: bold; -} - -.highlight .o { - color: #000000; - font-weight: bold; -} - -.highlight .w { - color: #bbbbbb; -} - -.highlight { - background-color: #f8f8f8; -} - -* { - box-sizing: border-box; -} - -body { - padding: 0; - margin: 0; - font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; - color: #606c71; -} - -#skip-to-content { - height: 1px; - width: 1px; - position: absolute; - overflow: hidden; - top: -10px; -} - -#skip-to-content:focus { - position: fixed; - top: 10px; - left: 10px; - height: auto; - width: auto; - background: #e19447; - outline: thick solid #e19447; -} - -a { - color: #1e6bb8; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -.btn { - display: inline-block; - margin-bottom: 1rem; - color: rgba(255, 255, 255, 0.7); - background-color: rgba(255, 255, 255, 0.08); - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px; - border-radius: 0.3rem; - transition: color 0.2s, background-color 0.2s, border-color 0.2s; -} - -.btn:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; - background-color: rgba(255, 255, 255, 0.2); - border-color: rgba(255, 255, 255, 0.3); -} - -.btn + .btn { - margin-left: 1rem; -} - -@media screen and (min-width: 64em) { - .btn { - padding: 0.75rem 1rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .btn { - padding: 0.6rem 0.9rem; - font-size: 0.9rem; - } -} -@media screen and (max-width: 42em) { - .btn { - display: block; - width: 100%; - padding: 0.75rem; - font-size: 0.9rem; - } - - .btn + .btn { - margin-top: 1rem; - margin-left: 0; - } -} -.page-header { - color: #fff; - text-align: center; - background-color: #159957; - background-image: linear-gradient(120deg, #155799, #159957); -} - -@media screen and (min-width: 64em) { - .page-header { - padding: 5rem 6rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .page-header { - padding: 3rem 4rem; - } -} -@media screen and (max-width: 42em) { - .page-header { - padding: 2rem 1rem; - } -} -.project-name { - margin-top: 0; - margin-bottom: 0.1rem; -} - -@media screen and (min-width: 64em) { - .project-name { - font-size: 3.25rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .project-name { - font-size: 2.25rem; - } -} -@media screen and (max-width: 42em) { - .project-name { - font-size: 1.75rem; - } -} -.project-tagline { - margin-bottom: 2rem; - font-weight: normal; - opacity: 0.7; -} - -@media screen and (min-width: 64em) { - .project-tagline { - font-size: 1.25rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .project-tagline { - font-size: 1.15rem; - } -} -@media screen and (max-width: 42em) { - .project-tagline { - font-size: 1rem; - } -} -.main-content { - word-wrap: break-word; -} - -.main-content :first-child { - margin-top: 0; -} - -@media screen and (min-width: 64em) { - .main-content { - max-width: 64rem; - padding: 2rem 6rem; - margin: 0 auto; - font-size: 1.1rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .main-content { - padding: 2rem 4rem; - font-size: 1.1rem; - } -} -@media screen and (max-width: 42em) { - .main-content { - padding: 2rem 1rem; - font-size: 1rem; - } -} -.main-content kbd { - background-color: #fafbfc; - border: 1px solid #c6cbd1; - border-bottom-color: #959da5; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #959da5; - color: #444d56; - display: inline-block; - font-size: 11px; - line-height: 10px; - padding: 3px 5px; - vertical-align: middle; -} - -.main-content img { - max-width: 100%; -} - -.main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 { - margin-top: 2rem; - margin-bottom: 1rem; - font-weight: normal; - color: #159957; -} - -.main-content p { - margin-bottom: 1em; -} - -.main-content code { - padding: 2px 4px; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - font-size: 0.9rem; - color: #567482; - background-color: #f3f6fa; - border-radius: 0.3rem; -} - -.main-content pre { - padding: 0.8rem; - margin-top: 0; - margin-bottom: 1rem; - font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; - color: #567482; - word-wrap: normal; - background-color: #f3f6fa; - border: solid 1px #dce6f0; - border-radius: 0.3rem; -} - -.main-content pre > code { - padding: 0; - margin: 0; - font-size: 0.9rem; - color: #567482; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; -} - -.main-content .highlight { - margin-bottom: 1rem; -} - -.main-content .highlight pre { - margin-bottom: 0; - word-break: normal; -} - -.main-content .highlight pre, .main-content pre { - padding: 0.8rem; - overflow: auto; - font-size: 0.9rem; - line-height: 1.45; - border-radius: 0.3rem; - -webkit-overflow-scrolling: touch; -} - -.main-content pre code, .main-content pre tt { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; -} - -.main-content pre code:before, .main-content pre code:after, .main-content pre tt:before, .main-content pre tt:after { - content: normal; -} - -.main-content ul, .main-content ol { - margin-top: 0; -} - -.main-content blockquote { - padding: 0 1rem; - margin-left: 0; - color: #819198; - border-left: 0.3rem solid #dce6f0; -} - -.main-content blockquote > :first-child { - margin-top: 0; -} - -.main-content blockquote > :last-child { - margin-bottom: 0; -} - -.main-content table { - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all; - -webkit-overflow-scrolling: touch; -} - -.main-content table th { - font-weight: bold; -} - -.main-content table th, .main-content table td { - padding: 0.5rem 1rem; - border: 1px solid #e9ebec; -} - -.main-content dl { - padding: 0; -} - -.main-content dl dt { - padding: 0; - margin-top: 1rem; - font-size: 1rem; - font-weight: bold; -} - -.main-content dl dd { - padding: 0; - margin-bottom: 1rem; -} - -.main-content hr { - height: 2px; - padding: 0; - margin: 1rem 0; - background-color: #eff0f1; - border: 0; -} - -.site-footer { - padding-top: 2rem; - margin-top: 2rem; - border-top: solid 1px #eff0f1; -} - -@media screen and (min-width: 64em) { - .site-footer { - font-size: 1rem; - } -} -@media screen and (min-width: 42em) and (max-width: 64em) { - .site-footer { - font-size: 1rem; - } -} -@media screen and (max-width: 42em) { - .site-footer { - font-size: 0.9rem; - } -} -.site-footer-owner { - display: block; - font-weight: bold; -} - -.site-footer-credits { - color: #819198; -} - -@media screen and (min-width: 64em) { - header.page-header { - padding: 50px; - } -} -header .btn { - display: inline-flex; - align-items: center; - justify-content: center; -} -header .btn > img { - max-height: 32px; - margin-right: 15px; -} -header .btn:focus-visible { - outline: 2px solid #fff; - outline-offset: 4px; -} - -details summary { - color: #3B82F6; - text-decoration: underline; - cursor: pointer; -} -details summary:hover { - color: #0a59da; -} -details summary:active { - color: #094fc2; - text-decoration: none; -} -details[open] summary { - margin-bottom: 20px; -} - -#content { - margin-bottom: 100px; -} -#content h1, #content h2, #content h3 { - color: #159957; -} -#content h2 { - border-bottom: 2px solid currentColor; -} -#content h3::before { - content: "#"; - margin-right: 5px; -} -#content code.p { - padding: 15px; -} -#content > section { - margin-bottom: 40px; -} -#content button { - padding: 10px 15px; - line-height: 1; - color: #fefefe; - background-color: #16a25c; - border-color: #107543; - border-style: solid; - border-width: 0 0 4px 0; - border-radius: 3px; - user-select: none; -} -#content button:hover { - color: #fefefe; - background-color: #159957; - border-color: #0f6c3e; -} -#content button:active { - background-color: #12834a; - border-color: #12834a; - padding-top: 11px; - padding-bottom: 9px; -} -#content button:focus-visible { - outline: 2px solid #159957; - outline-offset: 4px; -} -#content button + code { - border: 2px solid #e2e5e8; - margin-left: 20px; - padding: 10px 15px; -} -#content button + code:empty { - display: none; -} +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.highlight table td{padding:5px}.highlight table pre{margin:0}.highlight .cm{color:#998;font-style:italic}.highlight .cp{color:#999;font-weight:bold}.highlight .c1{color:#998;font-style:italic}.highlight .cs{color:#999;font-weight:bold;font-style:italic}.highlight .c,.highlight .cd{color:#998;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .gd{color:#000;background-color:#fdd}.highlight .ge{color:#000;font-style:italic}.highlight .gr{color:#a00}.highlight .gh{color:#999}.highlight .gi{color:#000;background-color:#dfd}.highlight .go{color:#888}.highlight .gp{color:#555}.highlight .gs{font-weight:bold}.highlight .gu{color:#aaa}.highlight .gt{color:#a00}.highlight .kc{color:#000;font-weight:bold}.highlight .kd{color:#000;font-weight:bold}.highlight .kn{color:#000;font-weight:bold}.highlight .kp{color:#000;font-weight:bold}.highlight .kr{color:#000;font-weight:bold}.highlight .kt{color:#458;font-weight:bold}.highlight .k,.highlight .kv{color:#000;font-weight:bold}.highlight .mf{color:#099}.highlight .mh{color:#099}.highlight .il{color:#099}.highlight .mi{color:#099}.highlight .mo{color:#099}.highlight .m,.highlight .mb,.highlight .mx{color:#099}.highlight .sb{color:#d14}.highlight .sc{color:#d14}.highlight .sd{color:#d14}.highlight .s2{color:#d14}.highlight .se{color:#d14}.highlight .sh{color:#d14}.highlight .si{color:#d14}.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .s{color:#d14}.highlight .na{color:teal}.highlight .bp{color:#999}.highlight .nb{color:#0086b3}.highlight .nc{color:#458;font-weight:bold}.highlight .no{color:teal}.highlight .nd{color:#3c5d5d;font-weight:bold}.highlight .ni{color:purple}.highlight .ne{color:#900;font-weight:bold}.highlight .nf{color:#900;font-weight:bold}.highlight .nl{color:#900;font-weight:bold}.highlight .nn{color:#555}.highlight .nt{color:navy}.highlight .vc{color:teal}.highlight .vg{color:teal}.highlight .vi{color:teal}.highlight .nv{color:teal}.highlight .ow{color:#000;font-weight:bold}.highlight .o{color:#000;font-weight:bold}.highlight .w{color:#bbb}.highlight{background-color:#f8f8f8}*{box-sizing:border-box}body{padding:0;margin:0;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;line-height:1.5;color:#606c71}#skip-to-content{height:1px;width:1px;position:absolute;overflow:hidden;top:-10px}#skip-to-content:focus{position:fixed;top:10px;left:10px;height:auto;width:auto;background:#e19447;outline:thick solid #e19447}a{color:#1e6bb8;text-decoration:none}a:hover{text-decoration:underline}.btn{display:inline-block;margin-bottom:1rem;color:rgba(255, 255, 255, 0.7);background-color:rgba(255, 255, 255, 0.08);border-color:rgba(255, 255, 255, 0.2);border-style:solid;border-width:1px;border-radius:.3rem;transition:color .2s,background-color .2s,border-color .2s}.btn:hover{color:rgba(255, 255, 255, 0.8);text-decoration:none;background-color:rgba(255, 255, 255, 0.2);border-color:rgba(255, 255, 255, 0.3)}.btn+.btn{margin-left:1rem}@media screen and (min-width: 64em){.btn{padding:.75rem 1rem}}@media screen and (min-width: 42em)and (max-width: 64em){.btn{padding:.6rem .9rem;font-size:.9rem}}@media screen and (max-width: 42em){.btn{display:block;width:100%;padding:.75rem;font-size:.9rem}.btn+.btn{margin-top:1rem;margin-left:0}}.page-header{color:#fff;text-align:center;background-color:#159957;background-image:linear-gradient(120deg, #155799, #159957)}@media screen and (min-width: 64em){.page-header{padding:5rem 6rem}}@media screen and (min-width: 42em)and (max-width: 64em){.page-header{padding:3rem 4rem}}@media screen and (max-width: 42em){.page-header{padding:2rem 1rem}}.project-name{margin-top:0;margin-bottom:.1rem}@media screen and (min-width: 64em){.project-name{font-size:3.25rem}}@media screen and (min-width: 42em)and (max-width: 64em){.project-name{font-size:2.25rem}}@media screen and (max-width: 42em){.project-name{font-size:1.75rem}}.project-tagline{margin-bottom:2rem;font-weight:normal;opacity:.7}@media screen and (min-width: 64em){.project-tagline{font-size:1.25rem}}@media screen and (min-width: 42em)and (max-width: 64em){.project-tagline{font-size:1.15rem}}@media screen and (max-width: 42em){.project-tagline{font-size:1rem}}.main-content{word-wrap:break-word}.main-content :first-child{margin-top:0}@media screen and (min-width: 64em){.main-content{max-width:64rem;padding:2rem 6rem;margin:0 auto;font-size:1.1rem}}@media screen and (min-width: 42em)and (max-width: 64em){.main-content{padding:2rem 4rem;font-size:1.1rem}}@media screen and (max-width: 42em){.main-content{padding:2rem 1rem;font-size:1rem}}.main-content kbd{background-color:#fafbfc;border:1px solid #c6cbd1;border-bottom-color:#959da5;border-radius:3px;box-shadow:inset 0 -1px 0 #959da5;color:#444d56;display:inline-block;font-size:11px;line-height:10px;padding:3px 5px;vertical-align:middle}.main-content img{max-width:100%}.main-content h1,.main-content h2,.main-content h3,.main-content h4,.main-content h5,.main-content h6{margin-top:2rem;margin-bottom:1rem;font-weight:normal;color:#159957}.main-content p{margin-bottom:1em}.main-content code{padding:2px 4px;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:.9rem;color:#567482;background-color:#f3f6fa;border-radius:.3rem}.main-content pre{padding:.8rem;margin-top:0;margin-bottom:1rem;font:1rem Consolas,"Liberation Mono",Menlo,Courier,monospace;color:#567482;word-wrap:normal;background-color:#f3f6fa;border:solid 1px #dce6f0;border-radius:.3rem}.main-content pre>code{padding:0;margin:0;font-size:.9rem;color:#567482;word-break:normal;white-space:pre;background:transparent;border:0}.main-content .highlight{margin-bottom:1rem}.main-content .highlight pre{margin-bottom:0;word-break:normal}.main-content .highlight pre,.main-content pre{padding:.8rem;overflow:auto;font-size:.9rem;line-height:1.45;border-radius:.3rem;-webkit-overflow-scrolling:touch}.main-content pre code,.main-content pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.main-content pre code:before,.main-content pre code:after,.main-content pre tt:before,.main-content pre tt:after{content:normal}.main-content ul,.main-content ol{margin-top:0}.main-content blockquote{padding:0 1rem;margin-left:0;color:#819198;border-left:.3rem solid #dce6f0}.main-content blockquote>:first-child{margin-top:0}.main-content blockquote>:last-child{margin-bottom:0}.main-content table{display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all;-webkit-overflow-scrolling:touch}.main-content table th{font-weight:bold}.main-content table th,.main-content table td{padding:.5rem 1rem;border:1px solid #e9ebec}.main-content dl{padding:0}.main-content dl dt{padding:0;margin-top:1rem;font-size:1rem;font-weight:bold}.main-content dl dd{padding:0;margin-bottom:1rem}.main-content hr{height:2px;padding:0;margin:1rem 0;background-color:#eff0f1;border:0}.site-footer{padding-top:2rem;margin-top:2rem;border-top:solid 1px #eff0f1}@media screen and (min-width: 64em){.site-footer{font-size:1rem}}@media screen and (min-width: 42em)and (max-width: 64em){.site-footer{font-size:1rem}}@media screen and (max-width: 42em){.site-footer{font-size:.9rem}}.site-footer-owner{display:block;font-weight:bold}.site-footer-credits{color:#819198}@media screen and (min-width: 64em){header.page-header{padding:50px}}header .btn{display:inline-flex;align-items:center;justify-content:center}header .btn>img{max-height:32px;margin-right:15px}header .btn:focus-visible{outline:2px solid #fff;outline-offset:4px}details summary{color:#3b82f6;text-decoration:underline;cursor:pointer}details summary:hover{color:#0a59da}details summary:active{color:#094fc2;text-decoration:none}details[open] summary{margin-bottom:20px}#content{margin-bottom:100px}#content h1,#content h2,#content h3{color:#159957}#content h2{border-bottom:2px solid currentColor}#content h3::before{content:"#";margin-right:5px}#content code.p{padding:15px}#content>section{margin-bottom:40px}#content button{padding:10px 15px;line-height:1;color:#fefefe;background-color:#16a25c;border-color:#107543;border-style:solid;border-width:0 0 4px 0;border-radius:3px;user-select:none}#content button:hover{color:#fefefe;background-color:#159957;border-color:#0f6c3e}#content button:active{background-color:#12834a;border-color:#12834a;padding-top:11px;padding-bottom:9px}#content button:focus-visible{outline:2px solid #159957;outline-offset:4px}#content button+code{border:2px solid #e2e5e8;margin-left:20px;padding:10px 15px}#content button+code:empty{display:none} diff --git a/docs/assets/docs.js b/docs/assets/docs.js index b213a66..122b69e 100644 --- a/docs/assets/docs.js +++ b/docs/assets/docs.js @@ -1,536 +1 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/@devlop-ab/dialog/dist/index.js": -/*!******************************************************!*\ - !*** ./node_modules/@devlop-ab/dialog/dist/index.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ dialog), -/* harmony export */ "dialog": () => (/* binding */ dialog) -/* harmony export */ }); - -var template = "\n \n \n"; -; -; -var makeDialog = function (type, message, options) { - var _a, _b, _c; - var dialogHTML = template; - var title = (_a = options.title) !== null && _a !== void 0 ? _a : null; - var cancelText = (_b = options.cancelText) !== null && _b !== void 0 ? _b : 'Cancel'; - var okText = (_c = options.okText) !== null && _c !== void 0 ? _c : 'Ok'; - var uniqueId = String(Date.now()); - var titleId = "dialog-" + uniqueId + "-title"; - var descriptionId = "dialog-" + uniqueId + "-description"; - dialogHTML = dialogHTML.replace(/\{titleId\}/g, titleId); - dialogHTML = dialogHTML.replace(/\{descriptionId\}/g, descriptionId); - dialogHTML = dialogHTML.replace('{type}', type); - dialogHTML = dialogHTML.replace('{message}', message); - dialogHTML = dialogHTML.replace('{title}', title !== null && title !== void 0 ? title : ''); - dialogHTML = dialogHTML.replace('{cancelText}', cancelText); - dialogHTML = dialogHTML.replace('{okText}', okText); - var div = document.createElement('div'); - div.insertAdjacentHTML('afterbegin', dialogHTML); - if (title === null) { - (div.querySelector('header')).remove(); - (div.querySelector('[aria-describedby]')).removeAttribute('aria-describedby'); - (div.querySelector('[aria-labelledby]')).setAttribute('aria-labelledby', descriptionId); - } - return div.firstElementChild; -}; -var makeAlertDialog = function (message, options) { - var dialog = makeDialog('alert', message, options); - removeDialogInputSection(dialog); - removeDialogCancelButton(dialog); - return dialog; -}; -var makeConfirmDialog = function (message, options) { - var dialog = makeDialog('confirm', message, options); - removeDialogInputSection(dialog); - return dialog; -}; -var makePromptDialog = function (message, _default, options) { - var _a; - var dialog = makeDialog('prompt', message, options); - var inputField = getInputField(dialog); - inputField.value = _default; - var inputAttributes = (_a = options.input) !== null && _a !== void 0 ? _a : null; - if (inputAttributes !== null) { - updateInputFieldAttributes(inputField, inputAttributes); - } - return dialog; -}; -var updateInputFieldAttributes = function (inputField, inputAttributes) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; - inputField.type = (_a = inputAttributes.type) !== null && _a !== void 0 ? _a : inputField.type; - if (((_b = inputAttributes.required) !== null && _b !== void 0 ? _b : null) !== null) { - inputField.required = inputAttributes.required; - } - if (((_c = inputAttributes.placeholder) !== null && _c !== void 0 ? _c : null) !== null) { - inputField.placeholder = inputAttributes.placeholder; - } - if (((_d = inputAttributes.multiple) !== null && _d !== void 0 ? _d : null) !== null) { - inputField.multiple = inputAttributes.multiple; - } - if (((_e = inputAttributes.minLength) !== null && _e !== void 0 ? _e : null) !== null) { - inputField.minLength = inputAttributes.minLength; - } - if (((_f = inputAttributes.maxLength) !== null && _f !== void 0 ? _f : null) !== null) { - inputField.maxLength = inputAttributes.maxLength; - } - if (((_g = inputAttributes.min) !== null && _g !== void 0 ? _g : null) !== null) { - inputField.min = String(inputAttributes.min); - } - if (((_h = inputAttributes.max) !== null && _h !== void 0 ? _h : null) !== null) { - inputField.max = String(inputAttributes.max); - } - if (((_j = inputAttributes.max) !== null && _j !== void 0 ? _j : null) !== null) { - inputField.max = String(inputAttributes.max); - } - if (((_k = inputAttributes.step) !== null && _k !== void 0 ? _k : null) !== null) { - inputField.step = String(inputAttributes.step); - } - if (((_l = inputAttributes.pattern) !== null && _l !== void 0 ? _l : null) !== null) { - inputField.pattern = inputAttributes.pattern; - } - if (((_m = inputAttributes.title) !== null && _m !== void 0 ? _m : null) !== null) { - inputField.title = inputAttributes.title; - } - if (((_o = inputAttributes.list) !== null && _o !== void 0 ? _o : null) !== null) { - inputField.setAttribute('list', inputAttributes.list); - } - if (((_p = inputAttributes.inputMode) !== null && _p !== void 0 ? _p : null) !== null) { - inputField.inputMode = inputAttributes.inputMode; - } - if (((_q = inputAttributes.spellcheck) !== null && _q !== void 0 ? _q : null) !== null) { - inputField.spellcheck = inputAttributes.spellcheck; - } -}; -var removeDialogInputSection = function (dialog) { - var _a; - (_a = dialog.querySelector('section[data-role="prompt-section"]')) === null || _a === void 0 ? void 0 : _a.remove(); -}; -var removeDialogCancelButton = function (dialog) { - var _a; - (_a = dialog.querySelector('footer > button[data-role="cancel"]')) === null || _a === void 0 ? void 0 : _a.remove(); -}; -var documentEventListeners = []; -var registerEventListeners = function (dialog, okCallback, cancelCallback) { - var backdrop = 'dialogBackdrop' in dialog.dataset - ? dialog - : dialog.querySelector('[data-dialog-backdrop]'); - backdrop === null || backdrop === void 0 ? void 0 : backdrop.addEventListener('click', function (event) { - event.stopPropagation(); - if (event.target !== backdrop) { - return; - } - cancelCallback.apply(null); - }); - registerDocumentEventListener('keydown', function (event) { - if (event.key !== 'Escape') { - return; - } - cancelCallback.apply(null); - }); - window.setTimeout(function () { - registerDocumentEventListener('click', function (event) { - cancelCallback.apply(null); - }); - }); - var form = dialog.querySelector('form'); - var cancelButton = dialog.querySelector('[data-role="cancel"]'); - var okButton = dialog.querySelector('[data-role="ok"]'); - var inputField = getInputField(dialog); - cancelButton === null || cancelButton === void 0 ? void 0 : cancelButton.addEventListener('click', function (event) { - cancelCallback.apply(null); - }); - form.addEventListener('submit', function (event) { - event.preventDefault(); - okCallback.apply(null); - }); - if (cancelButton !== null && okButton !== null) { - [cancelButton, okButton].forEach(function (button) { - button.addEventListener('keydown', function (event) { - var isLeftOrRightKey = event.key === 'ArrowLeft' || event.key === 'ArrowRight'; - if (!isLeftOrRightKey) { - return; - } - event.preventDefault(); - (event.target === okButton ? cancelButton : okButton).focus(); - }); - }); - } - registerTabTrap(dialog); -}; -var registerDocumentEventListener = function (type, listener) { - document.addEventListener(type, listener); - documentEventListeners.push({ - type: type, - listener: listener - }); -}; -var unregisterDocumentEventListeners = function () { - var eventListenerReference; - while (typeof (eventListenerReference = documentEventListeners.shift()) !== 'undefined') { - document.removeEventListener(eventListenerReference.type, eventListenerReference.listener); - } -}; -var registerTabTrap = function (dialog) { - var tabbableElements = Array.from(dialog.querySelectorAll('a, button, input')) - .filter(function (tabbableElement) { - var computedStyle = window.getComputedStyle(tabbableElement); - if (computedStyle.display === 'none') { - return false; - } - if (computedStyle.visibility === 'hidden') { - return false; - } - if (['button', 'input'].includes(tabbableElement.tagName) && tabbableElement.disabled === true) { - return false; - } - return true; - }); - if (tabbableElements.length === 0) { - return; - } - var firstTabbableElement = tabbableElements[0]; - var lastTabbableElement = tabbableElements[tabbableElements.length - 1]; - registerDocumentEventListener('focusin', function (event) { - if (!dialog.contains(event.target)) { - event.preventDefault(); - firstTabbableElement.focus(); - } - }); - firstTabbableElement.addEventListener('keydown', function (event) { - var shouldWrap = event.key === 'Tab' && event.shiftKey; - if (shouldWrap) { - event.preventDefault(); - lastTabbableElement.focus(); - } - }); - lastTabbableElement.addEventListener('keydown', function (event) { - var shouldWrap = event.key === 'Tab' && !event.shiftKey; - if (shouldWrap) { - event.preventDefault(); - firstTabbableElement.focus(); - } - }); -}; -var openDialog = function (dialog, callback) { - getDialogContainer().appendChild(dialog); - dialog.hidden = false; - dialog.firstElementChild.style.display = 'block'; - callback.apply(null); -}; -var dialogContainer = null; -var getDialogContainer = function () { - if (dialogContainer === null) { - dialogContainer = document.createElement('div'); - } - if (dialogContainer.parentElement === null) { - document.body.appendChild(dialogContainer); - } - return dialogContainer; -}; -var closeDialog = function (dialog) { - dialog.remove(); - unregisterDocumentEventListeners(); -}; -var focusOkButton = function (dialog) { - dialog.querySelector('button[data-role="ok"]').focus(); -}; -var focusCancelButton = function (dialog) { - dialog.querySelector('button[data-role="cancel"]').focus(); -}; -var getInputField = function (dialog) { - return dialog.querySelector('input'); -}; -var getInputFieldValue = function (dialog) { - var _a, _b; - return (_b = (_a = getInputField(dialog)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ''; -}; -var alertDialog = function (message, options) { - if (options === void 0) { options = {}; } - return new Promise(function (resolve, reject) { - var dialog = makeAlertDialog(message !== null && message !== void 0 ? message : '', options); - registerEventListeners(dialog, function () { - closeDialog(dialog); - resolve(); - }, function () { - closeDialog(dialog); - resolve(); - }); - openDialog(dialog, function () { - focusOkButton(dialog); - }); - }); -}; -var confirmDialog = function (message, options) { - if (options === void 0) { options = {}; } - return new Promise(function (resolve, reject) { - var dialog = makeConfirmDialog(message !== null && message !== void 0 ? message : '', options); - registerEventListeners(dialog, function () { - closeDialog(dialog); - resolve(true); - }, function () { - closeDialog(dialog); - resolve(false); - }); - openDialog(dialog, function () { - if (options.focus === 'cancel') { - focusCancelButton(dialog); - } - else { - focusOkButton(dialog); - } - }); - }); -}; -var promptDialog = function (message, _default, options) { - if (options === void 0) { options = {}; } - return new Promise(function (resolve, reject) { - var dialog = makePromptDialog(message !== null && message !== void 0 ? message : '', _default !== null && _default !== void 0 ? _default : '', options); - registerEventListeners(dialog, function () { - closeDialog(dialog); - var value = getInputFieldValue(dialog); - resolve(value); - }, function () { - closeDialog(dialog); - resolve(null); - }); - openDialog(dialog, function () { - var inputField = getInputField(dialog); - inputField.focus(); - inputField.select(); - }); - }); -}; -var dialog = { - 'alert': alertDialog, - 'confirm': confirmDialog, - 'prompt': promptDialog -}; - - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. -(() => { -var __webpack_exports__ = {}; -/*!*********************!*\ - !*** ./js/index.ts ***! - \*********************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _devlop_ab_dialog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @devlop-ab/dialog */ "./node_modules/@devlop-ab/dialog/dist/index.js"); -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; - -const alertExamples = { - '#alert-with-title': ['Your changes have been saved.', { - title: 'Saved', - }], - '#alert-with-custom-button-text': ['Your changes have been saved.', { - title: 'Saved', - okText: 'Alright!', - }], -}; -const confirmExamples = { - '#confirm-with-custom-buttons': [`Delete the file "passwords.txt"?`, { - title: 'Delete', - okText: 'Yes', - cancelText: 'No', - }], - '#confirm-with-prefocused-cancel-button': [`Delete the file "passwords.txt"?`, { - title: 'Delete', - focus: 'cancel', - }], -}; -const promptExamples = { - '#prompt-with-default-value': ['Glory?', 'Hammer!'], - '#prompt-with-placeholder': ['Enter your name', '', { - title: 'Your name', - input: { - placeholder: 'Your full name please', - }, - }], - '#prompt-with-required-input': ['Enter your name', '', { - title: 'Your name', - input: { - required: true, - }, - }], - '#prompt-with-custom-buttons': ['Please give us your name', '', { - title: 'Your name', - okText: 'Sure', - cancelText: 'No, it\'s a secret', - }], - '#prompt-with-email-input': ['Enter your email', '', { - title: 'Your Email', - input: { - type: 'email', - required: true, - }, - }], - '#prompt-with-date-input': ['Enter your birthday', '', { - title: 'Your Birthday', - input: { - type: 'date', - }, - }], - '#prompt-with-number-input-natural-between-50-99': ['Enter a natural number between 50 and 99', '', { - title: 'Natural numbers', - input: { - type: 'number', - required: true, - min: 50, - max: 99, - step: 1, - }, - }], - '#prompt-with-minimum-and-maximum-length-requirements': ['Enter a single word with a length between 4 and 9 letters.', '', { - title: 'A single word', - input: { - type: 'text', - placeholder: 'Letters only (a-z), no other characters.', - required: true, - minLength: 4, - maxLength: 9, - pattern: '[a-z]+', - }, - }], -}; -Object.keys(alertExamples).forEach((alertExampleId) => { - var _a; - (_a = document.querySelector(alertExampleId)) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (event) => __awaiter(void 0, void 0, void 0, function* () { - // @ts-ignore - yield _devlop_ab_dialog__WEBPACK_IMPORTED_MODULE_0__.dialog.alert.apply(null, alertExamples[alertExampleId]); - })); -}); -Object.keys(confirmExamples).forEach((confirmExampleId) => { - var _a; - (_a = document.querySelector(confirmExampleId)) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (event) => __awaiter(void 0, void 0, void 0, function* () { - // @ts-ignore - const result = yield _devlop_ab_dialog__WEBPACK_IMPORTED_MODULE_0__.dialog.confirm.apply(null, confirmExamples[confirmExampleId]); - const output = document.querySelector('#' + event.target.id + ' + code'); - if (output !== null) { - output.innerText = result === true - ? 'true' - : 'false'; - } - })); -}); -Object.keys(promptExamples).forEach((promptExampleId) => { - var _a; - (_a = document.querySelector(promptExampleId)) === null || _a === void 0 ? void 0 : _a.addEventListener('click', (event) => __awaiter(void 0, void 0, void 0, function* () { - // @ts-ignore - const result = yield _devlop_ab_dialog__WEBPACK_IMPORTED_MODULE_0__.dialog.prompt.apply(null, promptExamples[promptExampleId]); - const output = document.querySelector('#' + event.target.id + ' + code'); - if (output !== null) { - output.innerText = result !== null - ? `"${result}"` - : 'null'; - } - })); -}); -// @ts-ignore -hljs.highlightAll(); -window.setTimeout(() => { - Array.from(document.querySelectorAll('code.color-highlight')).forEach((element) => { - const colors = [ - 'blue', - 'yellow', - 'orange', - 'darkorange', - ]; - colors.forEach((color) => { - const pattern = new RegExp(`(?<=: )${color}`, 'g'); - const replacement = `${color}`; - element.innerHTML = element.innerHTML.replace(pattern, replacement); - }); - }); -}, 200); - -})(); - -// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. -(() => { -/*!************************!*\ - !*** ./css/index.scss ***! - \************************/ -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - -})(); - -/******/ })() -; -//# sourceMappingURL=docs.js.map \ No newline at end of file +(()=>{"use strict";(()=>{var e=function(e,t,n){var l,i,r,o='\n \n \n',u=null!==(l=n.title)&&void 0!==l?l:null,a=null!==(i=n.cancelText)&&void 0!==i?i:"Cancel",c=null!==(r=n.okText)&&void 0!==r?r:"Ok",d=String(Date.now()),p="dialog-"+d+"-title",s="dialog-"+d+"-description";o=(o=(o=(o=(o=(o=(o=o.replace(/\{titleId\}/g,p)).replace(/\{descriptionId\}/g,s)).replace("{type}",e)).replace("{message}",t)).replace("{title}",null!=u?u:"")).replace("{cancelText}",a)).replace("{okText}",c);var v=document.createElement("div");return v.insertAdjacentHTML("afterbegin",o),null===u&&(v.querySelector("header").remove(),v.querySelector("[aria-describedby]").removeAttribute("aria-describedby"),v.querySelector("[aria-labelledby]").setAttribute("aria-labelledby",s)),v.firstElementChild},t=function(e){var t;null===(t=e.querySelector('section[data-role="prompt-section"]'))||void 0===t||t.remove()},n=[],l=function(e,t,n){var l="dialogBackdrop"in e.dataset?e:e.querySelector("[data-dialog-backdrop]");null==l||l.addEventListener("click",(function(e){e.stopPropagation(),e.target===l&&n.apply(null)})),null==l||l.addEventListener("keydown",(function(e){"Escape"===e.key&&(e.preventDefault(),n.apply(null))})),i("keydown",(function(e){"Escape"===e.key&&n.apply(null)})),window.setTimeout((function(){i("click",(function(e){n.apply(null)}))}));var o=e.querySelector("form"),u=e.querySelector('[data-role="cancel"]'),a=e.querySelector('[data-role="ok"]');p(e),null==u||u.addEventListener("click",(function(e){n.apply(null)})),o.addEventListener("submit",(function(e){e.preventDefault(),t.apply(null)})),null!==u&&null!==a&&[u,a].forEach((function(e){e.addEventListener("keydown",(function(e){("ArrowLeft"===e.key||"ArrowRight"===e.key)&&(e.preventDefault(),(e.target===a?u:a).focus())}))})),r(e)},i=function(e,t){document.addEventListener(e,t),n.push({type:e,listener:t})},r=function(e){var t=Array.from(e.querySelectorAll("a, button, input")).filter((function(e){var t=window.getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility&&(!["button","input"].includes(e.tagName)||!0!==e.disabled)}));if(0!==t.length){var n=t[0],l=t[t.length-1];i("focusin",(function(t){e.contains(t.target)||(t.preventDefault(),n.focus())})),n.addEventListener("keydown",(function(e){"Tab"===e.key&&e.shiftKey&&(e.preventDefault(),l.focus())})),l.addEventListener("keydown",(function(e){"Tab"===e.key&&!e.shiftKey&&(e.preventDefault(),n.focus())}))}},o=function(e,t,n){var l;(null!==(l=t.container)&&void 0!==l?l:a()).appendChild(e),e.hidden=!1,e.firstElementChild.style.display="block",n.apply(null)},u=null,a=function(){return null===u&&(u=document.createElement("div")),null===u.parentElement&&document.body.appendChild(u),u},c=function(e){e.remove(),function(){for(var e;void 0!==(e=n.shift());)document.removeEventListener(e.type,e.listener)}()},d=function(e){e.querySelector('button[data-role="ok"]').focus()},p=function(e){return e.querySelector("input")},s={alert:function(n,i){return void 0===i&&(i={}),new Promise((function(r,u){var a=function(n,l){var i=e("alert",n,l);return t(i),function(e){var t;null===(t=e.querySelector('footer > button[data-role="cancel"]'))||void 0===t||t.remove()}(i),i}(null!=n?n:"",i);l(a,(function(){c(a),r()}),(function(){c(a),r()})),o(a,i,(function(){d(a)}))}))},confirm:function(n,i){return void 0===i&&(i={}),new Promise((function(r,u){var a=function(n,l){var i=e("confirm",n,l);return t(i),i}(null!=n?n:"",i);l(a,(function(){c(a),r(!0)}),(function(){c(a),r(!1)})),o(a,i,(function(){"cancel"===i.focus?function(e){e.querySelector('button[data-role="cancel"]').focus()}(a):d(a)}))}))},prompt:function(t,n,i){return void 0===i&&(i={}),new Promise((function(r,u){var a=function(t,n,l){var i,r=e("prompt",t,l),o=p(r);o.value=n;var u=null!==(i=l.input)&&void 0!==i?i:null;return null!==u&&function(e,t){var n,l,i,r,o,u,a,c,d,p,s,v,m,f,y;e.type=null!==(n=t.type)&&void 0!==n?n:e.type,null!==(null!==(l=t.required)&&void 0!==l?l:null)&&(e.required=t.required),null!==(null!==(i=t.placeholder)&&void 0!==i?i:null)&&(e.placeholder=t.placeholder),null!==(null!==(r=t.multiple)&&void 0!==r?r:null)&&(e.multiple=t.multiple),null!==(null!==(o=t.minLength)&&void 0!==o?o:null)&&(e.minLength=t.minLength),null!==(null!==(u=t.maxLength)&&void 0!==u?u:null)&&(e.maxLength=t.maxLength),null!==(null!==(a=t.min)&&void 0!==a?a:null)&&(e.min=String(t.min)),null!==(null!==(c=t.max)&&void 0!==c?c:null)&&(e.max=String(t.max)),null!==(null!==(d=t.max)&&void 0!==d?d:null)&&(e.max=String(t.max)),null!==(null!==(p=t.step)&&void 0!==p?p:null)&&(e.step=String(t.step)),null!==(null!==(s=t.pattern)&&void 0!==s?s:null)&&(e.pattern=t.pattern),null!==(null!==(v=t.title)&&void 0!==v?v:null)&&(e.title=t.title),null!==(null!==(m=t.list)&&void 0!==m?m:null)&&e.setAttribute("list",t.list),null!==(null!==(f=t.inputMode)&&void 0!==f?f:null)&&(e.inputMode=t.inputMode),null!==(null!==(y=t.spellcheck)&&void 0!==y?y:null)&&(e.spellcheck=t.spellcheck)}(o,u),r}(null!=t?t:"",null!=n?n:"",i);l(a,(function(){c(a);var e=function(e){var t,n;return null!==(n=null===(t=p(e))||void 0===t?void 0:t.value)&&void 0!==n?n:""}(a);r(e)}),(function(){c(a),r(null)})),o(a,i,(function(){var e=p(a);e.focus(),e.select()}))}))}},v=function(e,t,n,l){return new(n||(n=Promise))((function(i,r){function o(e){try{a(l.next(e))}catch(e){r(e)}}function u(e){try{a(l.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,u)}a((l=l.apply(e,t||[])).next())}))};const m={"#alert-with-title":["Your changes have been saved.",{title:"Saved"}],"#alert-with-custom-button-text":["Your changes have been saved.",{title:"Saved",okText:"Alright!"}]},f={"#confirm-with-custom-buttons":['Delete the file "passwords.txt"?',{title:"Delete",okText:"Yes",cancelText:"No"}],"#confirm-with-prefocused-cancel-button":['Delete the file "passwords.txt"?',{title:"Delete",focus:"cancel"}]},y={"#prompt-with-default-value":["Glory?","Hammer!"],"#prompt-with-placeholder":["Enter your name","",{title:"Your name",input:{placeholder:"Your full name please"}}],"#prompt-with-required-input":["Enter your name","",{title:"Your name",input:{required:!0}}],"#prompt-with-custom-buttons":["Please give us your name","",{title:"Your name",okText:"Sure",cancelText:"No, it's a secret"}],"#prompt-with-email-input":["Enter your email","",{title:"Your Email",input:{type:"email",required:!0}}],"#prompt-with-date-input":["Enter your birthday","",{title:"Your Birthday",input:{type:"date"}}],"#prompt-with-number-input-natural-between-50-99":["Enter a natural number between 50 and 99","",{title:"Natural numbers",input:{type:"number",required:!0,min:50,max:99,step:1}}],"#prompt-with-minimum-and-maximum-length-requirements":["Enter a single word with a length between 4 and 9 letters.","",{title:"A single word",input:{type:"text",placeholder:"Letters only (a-z), no other characters.",required:!0,minLength:4,maxLength:9,pattern:"[a-z]+"}}]};Object.keys(m).forEach((e=>{var t;null===(t=document.querySelector(e))||void 0===t||t.addEventListener("click",(t=>v(void 0,void 0,void 0,(function*(){yield s.alert.apply(null,m[e])}))))})),Object.keys(f).forEach((e=>{var t;null===(t=document.querySelector(e))||void 0===t||t.addEventListener("click",(t=>v(void 0,void 0,void 0,(function*(){const n=yield s.confirm.apply(null,f[e]),l=document.querySelector("#"+t.target.id+" + code");null!==l&&(l.innerText=!0===n?"true":"false")}))))})),Object.keys(y).forEach((e=>{var t;null===(t=document.querySelector(e))||void 0===t||t.addEventListener("click",(t=>v(void 0,void 0,void 0,(function*(){const n=yield s.prompt.apply(null,y[e]),l=document.querySelector("#"+t.target.id+" + code");null!==l&&(l.innerText=null!==n?`"${n}"`:"null")}))))})),hljs.highlightAll(),window.setTimeout((()=>{Array.from(document.querySelectorAll("code.color-highlight")).forEach((e=>{["blue","yellow","orange","darkorange"].forEach((t=>{const n=new RegExp(`(?<=: )${t}`,"g"),l=`${t}`;e.innerHTML=e.innerHTML.replace(n,l)}))}))}),200)})()})(); \ No newline at end of file