normal
\ No newline at end of file
diff --git a/docs/flems_soubory/commandline.html b/docs/flems_soubory/commandline.html
deleted file mode 100644
index 76930b3..0000000
--- a/docs/flems_soubory/commandline.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Tridactyl commandline
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/flems_soubory/commandline_data/cleanslate.css b/docs/flems_soubory/commandline_data/cleanslate.css
deleted file mode 100644
index 6ebefc6..0000000
--- a/docs/flems_soubory/commandline_data/cleanslate.css
+++ /dev/null
@@ -1,449 +0,0 @@
-/*!
-* CleanSlate
-* github.com/premasagar/cleanslate
-*
-*//*
- An extreme CSS reset stylesheet, for normalising the styling of a container element and its children.
-
- by Premasagar Rose
- dharmafly.com
-
- license
- opensource.org/licenses/mit-license.php
-
- **
-
- v0.9.3
-
-*/
-
-/* == BLANKET RESET RULES == */
-
-/* HTML 4.01 */
-.cleanslate, .cleanslate h1, .cleanslate h2, .cleanslate h3, .cleanslate h4, .cleanslate h5, .cleanslate h6, .cleanslate p, .cleanslate td, .cleanslate dl, .cleanslate tr, .cleanslate dt, .cleanslate ol, .cleanslate form, .cleanslate select, .cleanslate option, .cleanslate pre, .cleanslate div, .cleanslate table, .cleanslate th, .cleanslate tbody, .cleanslate tfoot, .cleanslate caption, .cleanslate thead, .cleanslate ul, .cleanslate li, .cleanslate address, .cleanslate blockquote, .cleanslate dd, .cleanslate fieldset, .cleanslate li, .cleanslate iframe, .cleanslate strong, .cleanslate legend, .cleanslate em, .cleanslate summary, .cleanslate cite, .cleanslate span, .cleanslate input, .cleanslate sup, .cleanslate label, .cleanslate dfn, .cleanslate object, .cleanslate big, .cleanslate q, .cleanslate samp, .cleanslate acronym, .cleanslate small, .cleanslate img, .cleanslate strike, .cleanslate code, .cleanslate sub, .cleanslate ins, .cleanslate textarea, .cleanslate button, .cleanslate var, .cleanslate a, .cleanslate abbr, .cleanslate applet, .cleanslate del, .cleanslate kbd, .cleanslate tt, .cleanslate b, .cleanslate i, .cleanslate hr,
-
-/* HTML5 - Sept 2013 taken from MDN https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/HTML5_element_list */
-.cleanslate article, .cleanslate aside, .cleanslate figure, .cleanslate figcaption, .cleanslate footer, .cleanslate header, .cleanslate menu, .cleanslate nav, .cleanslate section, .cleanslate time, .cleanslate mark, .cleanslate audio, .cleanslate video, .cleanslate abbr, .cleanslate address, .cleanslate area, .cleanslate blockquote, .cleanslate canvas, .cleanslate caption, .cleanslate cite, .cleanslate code, .cleanslate colgroup, .cleanslate col, .cleanslate datalist, .cleanslate fieldset, .cleanslate main, .cleanslate map, .cleanslate meta, .cleanslate optgroup, .cleanslate output, .cleanslate progress {
- background-attachment:scroll !important;
- background-color:transparent !important;
- background-image:none !important; /* This rule affects the use of pngfix JavaScript http://dillerdesign.com/experiment/DD_BelatedPNG for IE6, which is used to force the browser to recognise alpha-transparent PNGs files that replace the IE6 lack of PNG transparency. (The rule overrides the VML image that is used to replace the given CSS background-image). If you don't know what that means, then you probably haven't used the pngfix script, and this comment may be ignored :) */
- background-position:0 0 !important;
- background-repeat:repeat !important;
- border-color:black !important;
- border-color:currentColor !important; /* `border-color` should match font color. Modern browsers (incl. IE9) allow the use of "currentColor" to match the current font 'color' value . For older browsers, a default of 'black' is given before this rule. Guideline to support older browsers: if you haven't already declared a border-color for an element, be sure to do so, e.g. when you first declare the border-width. */
- border-radius:0 !important;
- border-style:none !important;
- border-width:medium !important;
- bottom:auto !important;
- clear:none !important;
- clip:auto !important;
- color:inherit !important;
- counter-increment:none !important;
- counter-reset:none !important;
- cursor:auto !important;
- direction:inherit !important;
- display:inline !important;
- float:none !important;
- font-family: inherit !important; /* As with other inherit values, this needs to be set on the root container element */
- font-size: inherit !important;
- font-style:inherit !important;
- font-variant:normal !important;
- font-weight:inherit !important;
- height:auto !important;
- left:auto !important;
- letter-spacing:normal !important;
- line-height:inherit !important;
- list-style-type: inherit !important; /* Could set list-style-type to none */
- list-style-position: outside !important;
- list-style-image: none !important;
- margin:0 !important;
- max-height:none !important;
- max-width:none !important;
- min-height:0 !important;
- min-width:0 !important;
- opacity:1;
- outline:invert none medium !important;
- overflow:visible !important;
- padding:0 !important;
- position:static !important;
- quotes: "" "" !important;
- right:auto !important;
- table-layout:auto !important;
- text-align:inherit !important;
- text-decoration:inherit !important;
- text-indent:0 !important;
- text-transform:none !important;
- top:auto !important;
- unicode-bidi:normal !important;
- vertical-align:baseline !important;
- visibility:inherit !important;
- white-space:normal !important;
- width:auto !important;
- word-spacing:normal !important;
- z-index:auto !important;
-
- /* CSS3 */
- /* Including all prefixes according to http://caniuse.com/ */
- /* CSS Animations don't cascade, so don't require resetting */
- -webkit-background-origin: padding-box !important;
- background-origin: padding-box !important;
- -webkit-background-clip: border-box !important;
- background-clip: border-box !important;
- -webkit-background-size: auto !important;
- -moz-background-size: auto !important;
- background-size: auto !important;
- -webkit-border-image: none !important;
- -moz-border-image: none !important;
- -o-border-image: none !important;
- border-image: none !important;
- -webkit-border-radius:0 !important;
- -moz-border-radius:0 !important;
- border-radius: 0 !important;
- -webkit-box-shadow: none !important;
- box-shadow: none !important;
- -webkit-box-sizing: content-box !important;
- -moz-box-sizing: content-box !important;
- box-sizing: content-box !important;
- -webkit-column-count: auto !important;
- -moz-column-count: auto !important;
- column-count: auto !important;
- -webkit-column-gap: normal !important;
- -moz-column-gap: normal !important;
- column-gap: normal !important;
- -webkit-column-rule: medium none black !important;
- -moz-column-rule: medium none black !important;
- column-rule: medium none black !important;
- -webkit-column-span: 1 !important;
- -moz-column-span: 1 !important; /* doesn't exist yet but probably will */
- column-span: 1 !important;
- -webkit-column-width: auto !important;
- -moz-column-width: auto !important;
- column-width: auto !important;
- font-feature-settings: normal !important;
- overflow-x: visible !important;
- overflow-y: visible !important;
- -webkit-hyphens: manual !important;
- -moz-hyphens: manual !important;
- hyphens: manual !important;
- -webkit-perspective: none !important;
- -moz-perspective: none !important;
- -ms-perspective: none !important;
- -o-perspective: none !important;
- perspective: none !important;
- -webkit-perspective-origin: 50% 50% !important;
- -moz-perspective-origin: 50% 50% !important;
- -ms-perspective-origin: 50% 50% !important;
- -o-perspective-origin: 50% 50% !important;
- perspective-origin: 50% 50% !important;
- -webkit-backface-visibility: visible !important;
- -moz-backface-visibility: visible !important;
- -ms-backface-visibility: visible !important;
- -o-backface-visibility: visible !important;
- backface-visibility: visible !important;
- text-shadow: none !important;
- -webkit-transition: all 0s ease 0s !important;
- transition: all 0s ease 0s !important;
- -webkit-transform: none !important;
- -moz-transform: none !important;
- -ms-transform: none !important;
- -o-transform: none !important;
- transform: none !important;
- -webkit-transform-origin: 50% 50% !important;
- -moz-transform-origin: 50% 50% !important;
- -ms-transform-origin: 50% 50% !important;
- -o-transform-origin: 50% 50% !important;
- transform-origin: 50% 50% !important;
- -webkit-transform-style: flat !important;
- -moz-transform-style: flat !important;
- -ms-transform-style: flat !important;
- -o-transform-style: flat !important;
- transform-style: flat !important;
- word-break: normal !important;
-}
-
-/* == BLOCK-LEVEL == */
-/* Actually, some of these should be inline-block and other values, but block works fine (TODO: rigorously verify this) */
-/* HTML 4.01 */
-.cleanslate, .cleanslate h3, .cleanslate h5, .cleanslate p, .cleanslate h1, .cleanslate dl, .cleanslate dt, .cleanslate h6, .cleanslate ol, .cleanslate form, .cleanslate option, .cleanslate pre, .cleanslate div, .cleanslate h2, .cleanslate caption, .cleanslate h4, .cleanslate ul, .cleanslate address, .cleanslate blockquote, .cleanslate dd, .cleanslate fieldset, .cleanslate hr,
-
-/* HTML5 new elements */
-.cleanslate article, .cleanslate dialog, .cleanslate figure, .cleanslate footer, .cleanslate header, .cleanslate hgroup, .cleanslate menu, .cleanslate nav, .cleanslate section, .cleanslate audio, .cleanslate video, .cleanslate address, .cleanslate blockquote, .cleanslate colgroup, .cleanslate main, .cleanslate progress, .cleanslate summary {
- display:block !important;
-}
-.cleanslate h1, .cleanslate h2, .cleanslate h3, .cleanslate h4, .cleanslate h5, .cleanslate h6 {
- font-weight: bold !important;
-}
-.cleanslate h1 {
- font-size: 2em !important;
- padding: .67em 0 !important;
-}
-.cleanslate h2 {
- font-size: 1.5em !important;
- padding: .83em 0 !important;
-}
-.cleanslate h3 {
- font-size: 1.17em !important;
- padding: .83em 0 !important;
-}
-.cleanslate h4 {
- font-size: 1em !important;
-}
-.cleanslate h5 {
- font-size: .83em !important;
-}
-.cleanslate p {
- margin: 1em 0 !important;
-}
-.cleanslate table {
- display: table !important;
-}
-.cleanslate thead {
- display: table-header-group !important;
-}
-.cleanslate tbody {
- display: table-row-group !important;
-}
-.cleanslate tfoot {
- display: table-footer-group !important;
-}
-.cleanslate tr {
- display: table-row !important;
-}
-.cleanslate th, .cleanslate td {
- display: table-cell !important;
- padding: 2px !important;
-}
-
-/* == SPECIFIC ELEMENTS == */
-/* Some of these are browser defaults; some are just useful resets */
-.cleanslate ol, .cleanslate ul {
- margin: 1em 0 !important;
-}
-.cleanslate ul li, .cleanslate ul ul li, .cleanslate ul ul ul li, .cleanslate ol li, .cleanslate ol ol li, .cleanslate ol ol ol li, .cleanslate ul ol ol li, .cleanslate ul ul ol li, .cleanslate ol ul ul li, .cleanslate ol ol ul li {
- list-style-position: inside !important;
- margin-top: .08em !important;
-}
-.cleanslate ol ol, .cleanslate ol ol ol, .cleanslate ul ul, .cleanslate ul ul ul, .cleanslate ol ul, .cleanslate ol ul ul, .cleanslate ol ol ul, .cleanslate ul ol, .cleanslate ul ol ol, .cleanslate ul ul ol {
- padding-left: 40px !important;
- margin: 0 !important;
-}
-/* helper for general navigation */
-.cleanslate nav ul, .cleanslate nav ol {
- list-style-type:none !important;
-
-}
-.cleanslate ul, .cleanslate menu {
- list-style-type:disc !important;
-}
-.cleanslate ol {
- list-style-type:decimal !important;
-}
-.cleanslate ol ul, .cleanslate ul ul, .cleanslate menu ul, .cleanslate ol menu, .cleanslate ul menu, .cleanslate menu menu {
- list-style-type:circle !important;
-}
-.cleanslate ol ol ul, .cleanslate ol ul ul, .cleanslate ol menu ul, .cleanslate ol ol menu, .cleanslate ol ul menu, .cleanslate ol menu menu, .cleanslate ul ol ul, .cleanslate ul ul ul, .cleanslate ul menu ul, .cleanslate ul ol menu, .cleanslate ul ul menu, .cleanslate ul menu menu, .cleanslate menu ol ul, .cleanslate menu ul ul, .cleanslate menu menu ul, .cleanslate menu ol menu, .cleanslate menu ul menu, .cleanslate menu menu menu {
- list-style-type:square !important;
-}
-.cleanslate li {
- display:list-item !important;
- /* Fixes IE7 issue with positioning of nested bullets */
- min-height:auto !important;
- min-width:auto !important;
- padding-left: 20px !important; /* replace -webkit-padding-start: 40px; */
-}
-.cleanslate strong {
- font-weight:bold !important;
-}
-.cleanslate em {
- font-style:italic !important;
-}
-.cleanslate kbd, .cleanslate samp, .cleanslate code {
- font-family:monospace !important;
-}
-.cleanslate a {
- color: blue !important;
- text-decoration: underline !important;s
-}
-.cleanslate a:visited {
- color: #529 !important;
-}
-.cleanslate a, .cleanslate a *, .cleanslate input[type=submit], .cleanslate input[type=radio], .cleanslate input[type=checkbox], .cleanslate select {
- cursor:pointer !important;
-}
-.cleanslate button, .cleanslate input[type=submit] {
- text-align: center !important;
- padding: 2px 6px 3px !important;
- border-radius: 4px !important;
- text-decoration: none !important;
- font-family: arial, helvetica, sans-serif !important;
- font-size: small !important;
- background: white !important;
- -webkit-appearance: push-button !important;
- color: buttontext !important;
- border: 1px #a6a6a6 solid !important;
- background: lightgrey !important; /* Old browsers */
- background: rgb(255,255,255); /* Old browsers */
- background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(221,221,221,1) 100%, rgba(209,209,209,1) 100%, rgba(221,221,221,1) 100%) !important; /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(221,221,221,1)), color-stop(100%,rgba(209,209,209,1)), color-stop(100%,rgba(221,221,221,1))) !important; /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(221,221,221,1) 100%,rgba(209,209,209,1) 100%,rgba(221,221,221,1) 100%) !important; /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(221,221,221,1) 100%,rgba(209,209,209,1) 100%,rgba(221,221,221,1) 100%) !important; /* Opera 11.10+ */
- background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(221,221,221,1) 100%,rgba(209,209,209,1) 100%,rgba(221,221,221,1) 100%) !important; /* IE10+ */
- background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(221,221,221,1) 100%,rgba(209,209,209,1) 100%,rgba(221,221,221,1) 100%) !important; /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#dddddd',GradientType=0 ) !important; /* IE6-9 */
- -webkit-box-shadow: 1px 1px 0px #eee !important;
- -moz-box-shadow: 1px 1px 0px #eee !important;
- -o-box-shadow: 1px 1px 0px #eee !important;
- box-shadow: 1px 1px 0px #eee !important;
- outline: initial !important;
-}
-.cleanslate button {
- padding: 1px 6px 2px 6px !important;
- margin-right: 5px !important;
-}
-.cleanslate input[type=hidden] {
- display:none !important;
-}
-/* restore form defaults */
-.cleanslate textarea {
- -webkit-appearance: textarea !important;
- background: white !important;
- padding: 2px !important;
- margin-left: 4px !important;
- word-wrap: break-word !important;
- white-space: pre-wrap !important;
- font-size: 11px !important;
- font-family: arial, helvetica, sans-serif !important;
- line-height: 13px !important;
- resize: both !important;
-}
-.cleanslate select, .cleanslate textarea, .cleanslate input {
- border:1px solid #ccc !important;
-}
-.cleanslate select {
- font-size: 11px !important;
- font-family: helvetica, arial, sans-serif !important;
- display: inline-block;
-}
-.cleanslate textarea:focus, .cleanslate input:focus {
- outline: auto 5px -webkit-focus-ring-color !important;
- outline: initial !important;
-}
-.cleanslate input[type=text] {
- background: white !important;
- padding: 1px !important;
- font-family: initial !important;
- font-size: small !important;
-}
-.cleanslate input[type=checkbox], .cleanslate input[type=radio] {
- border: 1px #2b2b2b solid !important;
- border-radius: 4px !important;
-}
-.cleanslate input[type=checkbox], .cleanslate input[type=radio] {
- outline: intial !important;
-}
-.cleanslate input[type=radio] {
- margin: 2px 2px 3px 2px !important;
-}
-.cleanslate input[type=submit]:active, .cleanslate button:active {
- background: rgb(59,103,158) !important; /* Old browsers */
- background: -moz-linear-gradient(top, rgba(59,103,158,1) 0%, rgba(43,136,217,1) 50%, rgba(32,124,202,1) 51%, rgba(125,185,232,1) 100%) !important; /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(59,103,158,1)), color-stop(50%,rgba(43,136,217,1)), color-stop(51%,rgba(32,124,202,1)), color-stop(100%,rgba(125,185,232,1))) !important; /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, rgba(59,103,158,1) 0%,rgba(43,136,217,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%) !important; /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, rgba(59,103,158,1) 0%,rgba(43,136,217,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%) !important; /* Opera 11.10+ */
- background: -ms-linear-gradient(top, rgba(59,103,158,1) 0%,rgba(43,136,217,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%) !important; /* IE10+ */
- background: linear-gradient(to bottom, rgba(59,103,158,1) 0%,rgba(43,136,217,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%) !important; /* W3C */
- border-color: #5259b0 !important;
-}
-.cleanslate abbr[title], .cleanslate acronym[title], .cleanslate dfn[title] {
- cursor:help !important;
- border-bottom-width:1px !important;
- border-bottom-style:dotted !important;
-}
-.cleanslate ins {
- background-color:#ff9 !important;
- color:black !important;
-}
-.cleanslate del {
- text-decoration: line-through !important;
-}
-.cleanslate blockquote, .cleanslate q {
- quotes:none !important; /* HTML5 */
-}
-.cleanslate blockquote:before, .cleanslate blockquote:after, .cleanslate q:before, .cleanslate q:after, .cleanslate li:before, .cleanslate li:after {
- content:"" !important;
-}
-.cleanslate input, .cleanslate select {
- vertical-align:middle !important;
-}
-
-.cleanslate table {
- border-collapse:collapse !important;
- border-spacing:0 !important;
-}
-.cleanslate hr {
- display:block !important;
- height:1px !important;
- border:0 !important;
- border-top:1px solid #ccc !important;
- margin:1em 0 !important;
-}
-.cleanslate *[dir=rtl] {
- direction: rtl !important;
-}
-.cleanslate mark {
- background-color:#ff9 !important;
- color:black !important;
- font-style:italic !important;
- font-weight:bold !important;
-}
-.cleanslate menu {
- padding-left: 40px !important;
- padding-top: 8px !important;
-}
-
-/* additional helpers */
-.cleanslate [hidden],
-.cleanslate template {
- display: none !important;
-}
-.cleanslate abbr[title] {
- border-bottom: 1px dotted !important;
-}
-.cleanslate sub, .cleanslate sup {
- font-size: 75% !important;
- line-height: 0 !important;
- position: relative !important;
- vertical-align: baseline !important;
-}
-.cleanslate sup {
- top: -0.5em !important;
-}
-.cleanslate sub {
- bottom: -0.25em !important;
-}
-.cleanslate img {
- border: 0 !important;
-}
-.cleanslate figure {
- margin: 0 !important;
-}
-.cleanslate textarea {
- overflow: auto !important;
- vertical-align: top !important;
-}
-
-/* == ROOT CONTAINER ELEMENT == */
-/* This contains default values for child elements to inherit */
-.cleanslate {
- font-size: medium !important;
- line-height: 1 !important;
- direction:ltr !important;
- text-align: left !important; /* for IE, Opera */
- text-align: start !important; /* recommended W3C Spec */
- font-family: "Times New Roman", Times, serif !important; /* Override this with whatever font-family is required */
- color: black !important;
- font-style:normal !important;
- font-weight:normal !important;
- text-decoration:none !important;
- list-style-type:disc !important;
-}
diff --git a/docs/flems_soubory/commandline_data/commandline.css b/docs/flems_soubory/commandline_data/commandline.css
deleted file mode 100644
index 2cc7146..0000000
--- a/docs/flems_soubory/commandline_data/commandline.css
+++ /dev/null
@@ -1,299 +0,0 @@
-@import url("../themes/auto/auto.css");
-
-body {
- overflow: hidden;
- margin: 0;
- position: absolute;
- /* CSS is pants. Move the bar down a tiny bit to cover up the gap. */
- top: 1px;
- width: 100%;
- display: flex;
- flex-direction: column;
-}
-
-#command-line-holder {
- background: var(--tridactyl-cmdl-bg);
- color: var(--tridactyl-cmdl-fg);
- font-family: var(--tridactyl-cmdl-font-family);
- font-size: 9pt;
- /* reduce the padding added by the colon so that the command line shows up roughly where it used to be */
- padding-left: 0.125ex;
-}
-
-input {
- width: 97%;
- font-family: var(--tridactyl-cmdl-font-family);
- font-size: var(--tridactyl-cmdl-font-size);
- line-height: var(--tridactyl-cmdl-line-height);
- color: var(--tridactyl-cmdl-fg);
- background: var(--tridactyl-cmdl-bg);
- border: unset;
- /* reduce the padding from the colon */
- /* margin-left: -0.25ex; */
- /* we currently have a border from the completions */
- /* border-top: solid 1px lightgray; */
-}
-
-input:focus {
- outline: none;
-}
-
-#tridactyl-colon::before {
- content: ":";
-}
-
-/* COMPLETIONS */
-
-#completions {
- --option-height: var(--tridactyl-cmplt-option-height);
- color: var(--tridactyl-cmplt-fg);
- background: var(--tridactyl-cmplt-bg);
- display: inline-block;
- font-size: var(--tridactyl-cmplt-font-size);
- font-family: var(--tridactyl-cmplt-font-family);
- overflow: hidden;
- width: 100%;
- border-top: var(--tridactyl-cmplt-border-top);
-}
-
-/* Olie doesn't know how CSS inheritance works */
-#completions > div {
- max-height: calc(20 * var(--option-height));
- min-height: calc(10 * var(--option-height));
-}
-
-#completions > div > table {
- width: 100%;
- font-size: 9pt;
- border-spacing: 0;
- table-layout: fixed;
-}
-
-#completions table tr td.prefix {
- width: 3.2em;
- padding-left: 0.5em;
- text-align: center;
-}
-#completions table tr td.container,
-#completions table tr td.icon,
-#completions table tr td.privatewindow {
- width: 1.5em;
-}
-#completions table tr td.tabcount {
- width: 6em;
-}
-#completions table tr td.tgroup {
- width: 10em;
- padding-left: 0.5em;
- text-align: right;
-}
-#completions table tr td.tgroup:empty {
- display: none;
-}
-/* #completions table tr td:nth-of-type(3) { width: 5em; } */
-#completions table tr td.content {
- width: 50%;
-}
-
-/* Accroding to src/completions/TabHistory.ts formatTimeSpan,
- * max-width should be 14 characters (14ex), 20ex for more tolorance. */
-#completions table tr td.time {
- width: 20ex;
- text-align: right;
- padding-right: 2ex;
-}
-
-#completions table tr {
- white-space: nowrap;
- overflow: hidden;
-}
-
-#completions table tr td {
- overflow: hidden;
-}
-
-#completions img {
- display: inline;
- vertical-align: middle;
- height: 1em;
- width: 1em;
-}
-
-#completions .sectionHeader {
- background: linear-gradient(
- var(--tridactyl-header-first-bg),
- var(--tridactyl-header-second-bg),
- var(--tridactyl-header-third-bg)
- );
- font-size: var(--tridactyl-header-font-size);
- font-weight: var(--tridactyl-header-font-weight);
- border-bottom: var(--tridactyl-header-border-bottom);
- padding-left: 0.5ex;
-}
-
-#completions .sectionHeader,
-#completions .option {
- height: var(--option-height);
- line-height: var(--option-height);
-}
-
-.url {
- text-decoration: var(--tridactyl-url-text-decoration);
-}
-
-.option:not(.focused) .url {
- color: var(--tridactyl-url-fg);
- background: var(--tridactyl-url-bg);
-}
-
-a.url:hover {
- cursor: var(--tridactyl-url-cursor);
- text-decoration: underline;
-}
-
-/* Hide the URLs if the screen is small */
-@media all and (max-width: 500px) {
- .url {
- display: none;
- }
-}
-
-.FindCompletionOption .match {
- font-weight: bold;
-}
-
-.hidden {
- display: none;
-}
-
-/* Pick the .url out especially because otherwise its link styles dominate. */
-.focused,
-.focused .url {
- color: var(--tridactyl-of-fg);
- background: var(--tridactyl-of-bg);
-}
-
-.option.incognito .privatewindow {
- background-image: var(--tridactyl-private-window-icon-url);
-}
-
-/* Still completions, but container-related stuff */
-.option .container {
- mask-size: 1em;
- mask-repeat: no-repeat;
- mask-position: center;
-}
-.option .privatewindow {
- background-size: 1em;
- background-repeat: no-repeat;
- background-position: center;
-}
-.option.container_blue .container {
- background-color: var(--tridactyl-container-color-blue);
-}
-.option.container_turquoise .container {
- background-color: var(--tridactyl-container-color-turquoise);
-}
-.option.container_green .container {
- background-color: var(--tridactyl-container-color-green);
-}
-.option.container_yellow .container {
- background-color: var(--tridactyl-container-color-yellow);
-}
-.option.container_orange .container {
- background-color: var(--tridactyl-container-color-orange);
-}
-.option.container_red .container {
- background-color: var(--tridactyl-container-color-red);
-}
-.option.container_pink .container {
- background-color: var(--tridactyl-container-color-pink);
-}
-.option.container_purple .container {
- background-color: var(--tridactyl-container-color-purple);
-}
-.option.container_fingerprint .container {
- mask-image: var(--tridactyl-container-fingerprint-url);
-}
-.option.container_briefcase .container {
- mask-image: var(--tridactyl-container-briefcase-url);
-}
-.option.container_dollar .container {
- mask-image: var(--tridactyl-container-dollar-url);
-}
-.option.container_cart .container {
- mask-image: var(--tridactyl-container-cart-url);
-}
-.option.container_circle .container {
- mask-image: var(--tridactyl-container-circle-url);
-}
-.option.container_gift .container {
- mask-image: var(--tridactyl-container-gift-url);
-}
-.option.container_vacation .container {
- mask-image: var(--tridactyl-container-vacation-url);
-}
-.option.container_food .container {
- mask-image: var(--tridactyl-container-food-url);
-}
-.option.container_fruit .container {
- mask-image: var(--tridactyl-container-fruit-url);
-}
-.option.container_pet .container {
- mask-image: var(--tridactyl-container-pet-url);
-}
-.option.container_tree .container {
- mask-image: var(--tridactyl-container-tree-url);
-}
-.option.container_chill .container {
- mask-image: var(--tridactyl-container-chill-url);
-}
-
-.ExcmdCompletionOption td.excmd {
- padding-left: 0.5em;
- width: 20%;
-}
-
-.ExcmdCompletionOption td.documentation {
- width: 100%;
-}
-
-.SettingsCompletionOption td.title {
- padding-left: 0.5em;
-}
-
-#completions .SettingsCompletionOption td.title,
-#completions .SettingsCompletionOption td.content,
-#completions .SettingsCompletionOption td.type {
- width: 15%;
- text-overflow: ellipsis;
-}
-
-#completions .TabGroupCompletionOption td.title {
- width: 15%;
-}
-
-#completions .TabGroupCompletionOption td.content {
- width: auto;
-}
-
-.HelpCompletionOption td.name {
- width: 25%;
-}
-
-#completions .SessionCompletionOption td.type {
- width: 1ch !important;
- padding: 0px 3pt;
-}
-
-#completions .SessionCompletionOption td.time {
- width: 5ch !important;
- padding: 0px 3pt;
- text-align: right;
-}
-
-#completions .WindowCompletionOption td.id {
- width: 6ch !important;
- text-align: right;
- padding: 0px 8pt;
-}
diff --git a/docs/flems_soubory/commandline_data/commandline_frame.js b/docs/flems_soubory/commandline_data/commandline_frame.js
deleted file mode 100644
index b0132c1..0000000
--- a/docs/flems_soubory/commandline_data/commandline_frame.js
+++ /dev/null
@@ -1,14035 +0,0 @@
-"use strict";
-(() => {
- var __create = Object.create;
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __getProtoOf = Object.getPrototypeOf;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __commonJS = (cb2, mod) => function __require() {
- return mod || (0, cb2[__getOwnPropNames(cb2)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
- };
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
- ));
- var __decorateClass = (decorators, target, key, kind) => {
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
- if (decorator = decorators[i])
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
- if (kind && result)
- __defProp(target, key, result);
- return result;
- };
-
- // node_modules/nearley/lib/nearley.js
- var require_nearley = __commonJS({
- "node_modules/nearley/lib/nearley.js"(exports, module) {
- (function(root, factory) {
- if (typeof module === "object" && module.exports) {
- module.exports = factory();
- } else {
- root.nearley = factory();
- }
- })(exports, function() {
- function Rule(name, symbols, postprocess) {
- this.id = ++Rule.highestId;
- this.name = name;
- this.symbols = symbols;
- this.postprocess = postprocess;
- return this;
- }
- Rule.highestId = 0;
- Rule.prototype.toString = function(withCursorAt) {
- var symbolSequence = typeof withCursorAt === "undefined" ? this.symbols.map(getSymbolShortDisplay).join(" ") : this.symbols.slice(0, withCursorAt).map(getSymbolShortDisplay).join(" ") + " \u25CF " + this.symbols.slice(withCursorAt).map(getSymbolShortDisplay).join(" ");
- return this.name + " \u2192 " + symbolSequence;
- };
- function State2(rule, dot, reference, wantedBy) {
- this.rule = rule;
- this.dot = dot;
- this.reference = reference;
- this.data = [];
- this.wantedBy = wantedBy;
- this.isComplete = this.dot === rule.symbols.length;
- }
- State2.prototype.toString = function() {
- return "{" + this.rule.toString(this.dot) + "}, from: " + (this.reference || 0);
- };
- State2.prototype.nextState = function(child) {
- var state2 = new State2(this.rule, this.dot + 1, this.reference, this.wantedBy);
- state2.left = this;
- state2.right = child;
- if (state2.isComplete) {
- state2.data = state2.build();
- state2.right = void 0;
- }
- return state2;
- };
- State2.prototype.build = function() {
- var children = [];
- var node = this;
- do {
- children.push(node.right.data);
- node = node.left;
- } while (node.left);
- children.reverse();
- return children;
- };
- State2.prototype.finish = function() {
- if (this.rule.postprocess) {
- this.data = this.rule.postprocess(this.data, this.reference, Parser3.fail);
- }
- };
- function Column(grammar2, index2) {
- this.grammar = grammar2;
- this.index = index2;
- this.states = [];
- this.wants = {};
- this.scannable = [];
- this.completed = {};
- }
- Column.prototype.process = function(nextColumn) {
- var states = this.states;
- var wants = this.wants;
- var completed = this.completed;
- for (var w = 0; w < states.length; w++) {
- var state2 = states[w];
- if (state2.isComplete) {
- state2.finish();
- if (state2.data !== Parser3.fail) {
- var wantedBy = state2.wantedBy;
- for (var i = wantedBy.length; i--; ) {
- var left = wantedBy[i];
- this.complete(left, state2);
- }
- if (state2.reference === this.index) {
- var exp = state2.rule.name;
- (this.completed[exp] = this.completed[exp] || []).push(state2);
- }
- }
- } else {
- var exp = state2.rule.symbols[state2.dot];
- if (typeof exp !== "string") {
- this.scannable.push(state2);
- continue;
- }
- if (wants[exp]) {
- wants[exp].push(state2);
- if (completed.hasOwnProperty(exp)) {
- var nulls = completed[exp];
- for (var i = 0; i < nulls.length; i++) {
- var right = nulls[i];
- this.complete(state2, right);
- }
- }
- } else {
- wants[exp] = [state2];
- this.predict(exp);
- }
- }
- }
- };
- Column.prototype.predict = function(exp) {
- var rules = this.grammar.byName[exp] || [];
- for (var i = 0; i < rules.length; i++) {
- var r = rules[i];
- var wantedBy = this.wants[exp];
- var s = new State2(r, 0, this.index, wantedBy);
- this.states.push(s);
- }
- };
- Column.prototype.complete = function(left, right) {
- var copy = left.nextState(right);
- this.states.push(copy);
- };
- function Grammar2(rules, start) {
- this.rules = rules;
- this.start = start || this.rules[0].name;
- var byName = this.byName = {};
- this.rules.forEach(function(rule) {
- if (!byName.hasOwnProperty(rule.name)) {
- byName[rule.name] = [];
- }
- byName[rule.name].push(rule);
- });
- }
- Grammar2.fromCompiled = function(rules, start) {
- var lexer = rules.Lexer;
- if (rules.ParserStart) {
- start = rules.ParserStart;
- rules = rules.ParserRules;
- }
- var rules = rules.map(function(r) {
- return new Rule(r.name, r.symbols, r.postprocess);
- });
- var g = new Grammar2(rules, start);
- g.lexer = lexer;
- return g;
- };
- function StreamLexer() {
- this.reset("");
- }
- StreamLexer.prototype.reset = function(data, state2) {
- this.buffer = data;
- this.index = 0;
- this.line = state2 ? state2.line : 1;
- this.lastLineBreak = state2 ? -state2.col : 0;
- };
- StreamLexer.prototype.next = function() {
- if (this.index < this.buffer.length) {
- var ch = this.buffer[this.index++];
- if (ch === "\n") {
- this.line += 1;
- this.lastLineBreak = this.index;
- }
- return { value: ch };
- }
- };
- StreamLexer.prototype.save = function() {
- return {
- line: this.line,
- col: this.index - this.lastLineBreak
- };
- };
- StreamLexer.prototype.formatError = function(token, message2) {
- var buffer = this.buffer;
- if (typeof buffer === "string") {
- var lines = buffer.split("\n").slice(
- Math.max(0, this.line - 5),
- this.line
- );
- var nextLineBreak = buffer.indexOf("\n", this.index);
- if (nextLineBreak === -1)
- nextLineBreak = buffer.length;
- var col = this.index - this.lastLineBreak;
- var lastLineDigits = String(this.line).length;
- message2 += " at line " + this.line + " col " + col + ":\n\n";
- message2 += lines.map(function(line, i) {
- return pad3(this.line - lines.length + i + 1, lastLineDigits) + " " + line;
- }, this).join("\n");
- message2 += "\n" + pad3("", lastLineDigits + col) + "^\n";
- return message2;
- } else {
- return message2 + " at index " + (this.index - 1);
- }
- function pad3(n, length) {
- var s = String(n);
- return Array(length - s.length + 1).join(" ") + s;
- }
- };
- function Parser3(rules, start, options) {
- if (rules instanceof Grammar2) {
- var grammar2 = rules;
- var options = start;
- } else {
- var grammar2 = Grammar2.fromCompiled(rules, start);
- }
- this.grammar = grammar2;
- this.options = {
- keepHistory: false,
- lexer: grammar2.lexer || new StreamLexer()
- };
- for (var key in options || {}) {
- this.options[key] = options[key];
- }
- this.lexer = this.options.lexer;
- this.lexerState = void 0;
- var column = new Column(grammar2, 0);
- var table = this.table = [column];
- column.wants[grammar2.start] = [];
- column.predict(grammar2.start);
- column.process();
- this.current = 0;
- }
- Parser3.fail = {};
- Parser3.prototype.feed = function(chunk) {
- var lexer = this.lexer;
- lexer.reset(chunk, this.lexerState);
- var token;
- while (true) {
- try {
- token = lexer.next();
- if (!token) {
- break;
- }
- } catch (e) {
- var nextColumn = new Column(this.grammar, this.current + 1);
- this.table.push(nextColumn);
- var err = new Error(this.reportLexerError(e));
- err.offset = this.current;
- err.token = e.token;
- throw err;
- }
- var column = this.table[this.current];
- if (!this.options.keepHistory) {
- delete this.table[this.current - 1];
- }
- var n = this.current + 1;
- var nextColumn = new Column(this.grammar, n);
- this.table.push(nextColumn);
- var literal = token.text !== void 0 ? token.text : token.value;
- var value = lexer.constructor === StreamLexer ? token.value : token;
- var scannable = column.scannable;
- for (var w = scannable.length; w--; ) {
- var state2 = scannable[w];
- var expect = state2.rule.symbols[state2.dot];
- if (expect.test ? expect.test(value) : expect.type ? expect.type === token.type : expect.literal === literal) {
- var next = state2.nextState({ data: value, token, isToken: true, reference: n - 1 });
- nextColumn.states.push(next);
- }
- }
- nextColumn.process();
- if (nextColumn.states.length === 0) {
- var err = new Error(this.reportError(token));
- err.offset = this.current;
- err.token = token;
- throw err;
- }
- if (this.options.keepHistory) {
- column.lexerState = lexer.save();
- }
- this.current++;
- }
- if (column) {
- this.lexerState = lexer.save();
- }
- this.results = this.finish();
- return this;
- };
- Parser3.prototype.reportLexerError = function(lexerError) {
- var tokenDisplay, lexerMessage;
- var token = lexerError.token;
- if (token) {
- tokenDisplay = "input " + JSON.stringify(token.text[0]) + " (lexer error)";
- lexerMessage = this.lexer.formatError(token, "Syntax error");
- } else {
- tokenDisplay = "input (lexer error)";
- lexerMessage = lexerError.message;
- }
- return this.reportErrorCommon(lexerMessage, tokenDisplay);
- };
- Parser3.prototype.reportError = function(token) {
- var tokenDisplay = (token.type ? token.type + " token: " : "") + JSON.stringify(token.value !== void 0 ? token.value : token);
- var lexerMessage = this.lexer.formatError(token, "Syntax error");
- return this.reportErrorCommon(lexerMessage, tokenDisplay);
- };
- Parser3.prototype.reportErrorCommon = function(lexerMessage, tokenDisplay) {
- var lines = [];
- lines.push(lexerMessage);
- var lastColumnIndex = this.table.length - 2;
- var lastColumn = this.table[lastColumnIndex];
- var expectantStates = lastColumn.states.filter(function(state2) {
- var nextSymbol = state2.rule.symbols[state2.dot];
- return nextSymbol && typeof nextSymbol !== "string";
- });
- if (expectantStates.length === 0) {
- lines.push("Unexpected " + tokenDisplay + ". I did not expect any more input. Here is the state of my parse table:\n");
- this.displayStateStack(lastColumn.states, lines);
- } else {
- lines.push("Unexpected " + tokenDisplay + ". Instead, I was expecting to see one of the following:\n");
- var stateStacks = expectantStates.map(function(state2) {
- return this.buildFirstStateStack(state2, []) || [state2];
- }, this);
- stateStacks.forEach(function(stateStack) {
- var state2 = stateStack[0];
- var nextSymbol = state2.rule.symbols[state2.dot];
- var symbolDisplay = this.getSymbolDisplay(nextSymbol);
- lines.push("A " + symbolDisplay + " based on:");
- this.displayStateStack(stateStack, lines);
- }, this);
- }
- lines.push("");
- return lines.join("\n");
- };
- Parser3.prototype.displayStateStack = function(stateStack, lines) {
- var lastDisplay;
- var sameDisplayCount = 0;
- for (var j = 0; j < stateStack.length; j++) {
- var state2 = stateStack[j];
- var display = state2.rule.toString(state2.dot);
- if (display === lastDisplay) {
- sameDisplayCount++;
- } else {
- if (sameDisplayCount > 0) {
- lines.push(" ^ " + sameDisplayCount + " more lines identical to this");
- }
- sameDisplayCount = 0;
- lines.push(" " + display);
- }
- lastDisplay = display;
- }
- };
- Parser3.prototype.getSymbolDisplay = function(symbol) {
- return getSymbolLongDisplay(symbol);
- };
- Parser3.prototype.buildFirstStateStack = function(state2, visited) {
- if (visited.indexOf(state2) !== -1) {
- return null;
- }
- if (state2.wantedBy.length === 0) {
- return [state2];
- }
- var prevState = state2.wantedBy[0];
- var childVisited = [state2].concat(visited);
- var childResult = this.buildFirstStateStack(prevState, childVisited);
- if (childResult === null) {
- return null;
- }
- return [state2].concat(childResult);
- };
- Parser3.prototype.save = function() {
- var column = this.table[this.current];
- column.lexerState = this.lexerState;
- return column;
- };
- Parser3.prototype.restore = function(column) {
- var index2 = column.index;
- this.current = index2;
- this.table[index2] = column;
- this.table.splice(index2 + 1);
- this.lexerState = column.lexerState;
- this.results = this.finish();
- };
- Parser3.prototype.rewind = function(index2) {
- if (!this.options.keepHistory) {
- throw new Error("set option `keepHistory` to enable rewinding");
- }
- this.restore(this.table[index2]);
- };
- Parser3.prototype.finish = function() {
- var considerations = [];
- var start = this.grammar.start;
- var column = this.table[this.table.length - 1];
- column.states.forEach(function(t) {
- if (t.rule.name === start && t.dot === t.rule.symbols.length && t.reference === 0 && t.data !== Parser3.fail) {
- considerations.push(t);
- }
- });
- return considerations.map(function(c) {
- return c.data;
- });
- };
- function getSymbolLongDisplay(symbol) {
- var type3 = typeof symbol;
- if (type3 === "string") {
- return symbol;
- } else if (type3 === "object") {
- if (symbol.literal) {
- return JSON.stringify(symbol.literal);
- } else if (symbol instanceof RegExp) {
- return "character matching " + symbol;
- } else if (symbol.type) {
- return symbol.type + " token";
- } else if (symbol.test) {
- return "token matching " + String(symbol.test);
- } else {
- throw new Error("Unknown symbol type: " + symbol);
- }
- }
- }
- function getSymbolShortDisplay(symbol) {
- var type3 = typeof symbol;
- if (type3 === "string") {
- return symbol;
- } else if (type3 === "object") {
- if (symbol.literal) {
- return JSON.stringify(symbol.literal);
- } else if (symbol instanceof RegExp) {
- return symbol.toString();
- } else if (symbol.type) {
- return "%" + symbol.type;
- } else if (symbol.test) {
- return "<" + String(symbol.test) + ">";
- } else {
- throw new Error("Unknown symbol type: " + symbol);
- }
- }
- }
- return {
- Parser: Parser3,
- Grammar: Grammar2,
- Rule
- };
- });
- }
- });
-
- // node_modules/semver-compare/index.js
- var require_semver_compare = __commonJS({
- "node_modules/semver-compare/index.js"(exports, module) {
- module.exports = function cmp(a, b) {
- var pa = a.split(".");
- var pb = b.split(".");
- for (var i = 0; i < 3; i++) {
- var na = Number(pa[i]);
- var nb = Number(pb[i]);
- if (na > nb)
- return 1;
- if (nb > na)
- return -1;
- if (!isNaN(na) && isNaN(nb))
- return 1;
- if (isNaN(na) && !isNaN(nb))
- return -1;
- }
- return 0;
- };
- }
- });
-
- // node_modules/css/lib/parse/index.js
- var require_parse = __commonJS({
- "node_modules/css/lib/parse/index.js"(exports, module) {
- var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
- module.exports = function(css, options) {
- options = options || {};
- var lineno = 1;
- var column = 1;
- function updatePosition(str) {
- var lines = str.match(/\n/g);
- if (lines)
- lineno += lines.length;
- var i = str.lastIndexOf("\n");
- column = ~i ? str.length - i : column + str.length;
- }
- function position() {
- var start = { line: lineno, column };
- return function(node) {
- node.position = new Position(start);
- whitespace();
- return node;
- };
- }
- function Position(start) {
- this.start = start;
- this.end = { line: lineno, column };
- this.source = options.source;
- }
- Position.prototype.content = css;
- var errorsList = [];
- function error(msg) {
- var err = new Error(options.source + ":" + lineno + ":" + column + ": " + msg);
- err.reason = msg;
- err.filename = options.source;
- err.line = lineno;
- err.column = column;
- err.source = css;
- if (options.silent) {
- errorsList.push(err);
- } else {
- throw err;
- }
- }
- function stylesheet() {
- var rulesList = rules();
- return {
- type: "stylesheet",
- stylesheet: {
- source: options.source,
- rules: rulesList,
- parsingErrors: errorsList
- }
- };
- }
- function open() {
- return match(/^{\s*/);
- }
- function close() {
- return match(/^}/);
- }
- function rules() {
- var node;
- var rules2 = [];
- whitespace();
- comments(rules2);
- while (css.length && css.charAt(0) != "}" && (node = atrule() || rule())) {
- if (node !== false) {
- rules2.push(node);
- comments(rules2);
- }
- }
- return rules2;
- }
- function match(re) {
- var m = re.exec(css);
- if (!m)
- return;
- var str = m[0];
- updatePosition(str);
- css = css.slice(str.length);
- return m;
- }
- function whitespace() {
- match(/^\s*/);
- }
- function comments(rules2) {
- var c;
- rules2 = rules2 || [];
- while (c = comment()) {
- if (c !== false) {
- rules2.push(c);
- }
- }
- return rules2;
- }
- function comment() {
- var pos = position();
- if ("/" != css.charAt(0) || "*" != css.charAt(1))
- return;
- var i = 2;
- while ("" != css.charAt(i) && ("*" != css.charAt(i) || "/" != css.charAt(i + 1)))
- ++i;
- i += 2;
- if ("" === css.charAt(i - 1)) {
- return error("End of comment missing");
- }
- var str = css.slice(2, i - 2);
- column += 2;
- updatePosition(str);
- css = css.slice(i);
- column += 2;
- return pos({
- type: "comment",
- comment: str
- });
- }
- function selector() {
- var m = match(/^([^{]+)/);
- if (!m)
- return;
- return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function(m2) {
- return m2.replace(/,/g, "\u200C");
- }).split(/\s*(?![^(]*\)),\s*/).map(function(s) {
- return s.replace(/\u200C/g, ",");
- });
- }
- function declaration() {
- var pos = position();
- var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
- if (!prop)
- return;
- prop = trim(prop[0]);
- if (!match(/^:\s*/))
- return error("property missing ':'");
- var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
- var ret = pos({
- type: "declaration",
- property: prop.replace(commentre, ""),
- value: val ? trim(val[0]).replace(commentre, "") : ""
- });
- match(/^[;\s]*/);
- return ret;
- }
- function declarations() {
- var decls = [];
- if (!open())
- return error("missing '{'");
- comments(decls);
- var decl;
- while (decl = declaration()) {
- if (decl !== false) {
- decls.push(decl);
- comments(decls);
- }
- }
- if (!close())
- return error("missing '}'");
- return decls;
- }
- function keyframe() {
- var m;
- var vals = [];
- var pos = position();
- while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
- vals.push(m[1]);
- match(/^,\s*/);
- }
- if (!vals.length)
- return;
- return pos({
- type: "keyframe",
- values: vals,
- declarations: declarations()
- });
- }
- function atkeyframes() {
- var pos = position();
- var m = match(/^@([-\w]+)?keyframes\s*/);
- if (!m)
- return;
- var vendor = m[1];
- var m = match(/^([-\w]+)\s*/);
- if (!m)
- return error("@keyframes missing name");
- var name = m[1];
- if (!open())
- return error("@keyframes missing '{'");
- var frame;
- var frames = comments();
- while (frame = keyframe()) {
- frames.push(frame);
- frames = frames.concat(comments());
- }
- if (!close())
- return error("@keyframes missing '}'");
- return pos({
- type: "keyframes",
- name,
- vendor,
- keyframes: frames
- });
- }
- function atsupports() {
- var pos = position();
- var m = match(/^@supports *([^{]+)/);
- if (!m)
- return;
- var supports = trim(m[1]);
- if (!open())
- return error("@supports missing '{'");
- var style = comments().concat(rules());
- if (!close())
- return error("@supports missing '}'");
- return pos({
- type: "supports",
- supports,
- rules: style
- });
- }
- function athost() {
- var pos = position();
- var m = match(/^@host\s*/);
- if (!m)
- return;
- if (!open())
- return error("@host missing '{'");
- var style = comments().concat(rules());
- if (!close())
- return error("@host missing '}'");
- return pos({
- type: "host",
- rules: style
- });
- }
- function atmedia() {
- var pos = position();
- var m = match(/^@media *([^{]+)/);
- if (!m)
- return;
- var media = trim(m[1]);
- if (!open())
- return error("@media missing '{'");
- var style = comments().concat(rules());
- if (!close())
- return error("@media missing '}'");
- return pos({
- type: "media",
- media,
- rules: style
- });
- }
- function atcustommedia() {
- var pos = position();
- var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
- if (!m)
- return;
- return pos({
- type: "custom-media",
- name: trim(m[1]),
- media: trim(m[2])
- });
- }
- function atpage() {
- var pos = position();
- var m = match(/^@page */);
- if (!m)
- return;
- var sel = selector() || [];
- if (!open())
- return error("@page missing '{'");
- var decls = comments();
- var decl;
- while (decl = declaration()) {
- decls.push(decl);
- decls = decls.concat(comments());
- }
- if (!close())
- return error("@page missing '}'");
- return pos({
- type: "page",
- selectors: sel,
- declarations: decls
- });
- }
- function atdocument() {
- var pos = position();
- var m = match(/^@([-\w]+)?document *([^{]+)/);
- if (!m)
- return;
- var vendor = trim(m[1]);
- var doc = trim(m[2]);
- if (!open())
- return error("@document missing '{'");
- var style = comments().concat(rules());
- if (!close())
- return error("@document missing '}'");
- return pos({
- type: "document",
- document: doc,
- vendor,
- rules: style
- });
- }
- function atfontface() {
- var pos = position();
- var m = match(/^@font-face\s*/);
- if (!m)
- return;
- if (!open())
- return error("@font-face missing '{'");
- var decls = comments();
- var decl;
- while (decl = declaration()) {
- decls.push(decl);
- decls = decls.concat(comments());
- }
- if (!close())
- return error("@font-face missing '}'");
- return pos({
- type: "font-face",
- declarations: decls
- });
- }
- var atimport = _compileAtrule("import");
- var atcharset = _compileAtrule("charset");
- var atnamespace = _compileAtrule("namespace");
- function _compileAtrule(name) {
- var re = new RegExp("^@" + name + "\\s*([^;]+);");
- return function() {
- var pos = position();
- var m = match(re);
- if (!m)
- return;
- var ret = { type: name };
- ret[name] = m[1].trim();
- return pos(ret);
- };
- }
- function atrule() {
- if (css[0] != "@")
- return;
- return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();
- }
- function rule() {
- var pos = position();
- var sel = selector();
- if (!sel)
- return error("selector missing");
- comments();
- return pos({
- type: "rule",
- selectors: sel,
- declarations: declarations()
- });
- }
- return addParent(stylesheet());
- };
- function trim(str) {
- return str ? str.replace(/^\s+|\s+$/g, "") : "";
- }
- function addParent(obj, parent) {
- var isNode = obj && typeof obj.type === "string";
- var childParent = isNode ? obj : parent;
- for (var k in obj) {
- var value = obj[k];
- if (Array.isArray(value)) {
- value.forEach(function(v) {
- addParent(v, childParent);
- });
- } else if (value && typeof value === "object") {
- addParent(value, childParent);
- }
- }
- if (isNode) {
- Object.defineProperty(obj, "parent", {
- configurable: true,
- writable: true,
- enumerable: false,
- value: parent || null
- });
- }
- return obj;
- }
- }
- });
-
- // node_modules/css/lib/stringify/compiler.js
- var require_compiler = __commonJS({
- "node_modules/css/lib/stringify/compiler.js"(exports, module) {
- module.exports = Compiler;
- function Compiler(opts) {
- this.options = opts || {};
- }
- Compiler.prototype.emit = function(str) {
- return str;
- };
- Compiler.prototype.visit = function(node) {
- return this[node.type](node);
- };
- Compiler.prototype.mapVisit = function(nodes, delim) {
- var buf = "";
- delim = delim || "";
- for (var i = 0, length = nodes.length; i < length; i++) {
- buf += this.visit(nodes[i]);
- if (delim && i < length - 1)
- buf += this.emit(delim);
- }
- return buf;
- };
- }
- });
-
- // node_modules/inherits/inherits_browser.js
- var require_inherits_browser = __commonJS({
- "node_modules/inherits/inherits_browser.js"(exports, module) {
- if (typeof Object.create === "function") {
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- }
- };
- } else {
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function() {
- };
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- }
- };
- }
- }
- });
-
- // node_modules/css/lib/stringify/compress.js
- var require_compress = __commonJS({
- "node_modules/css/lib/stringify/compress.js"(exports, module) {
- var Base = require_compiler();
- var inherits = require_inherits_browser();
- module.exports = Compiler;
- function Compiler(options) {
- Base.call(this, options);
- }
- inherits(Compiler, Base);
- Compiler.prototype.compile = function(node) {
- return node.stylesheet.rules.map(this.visit, this).join("");
- };
- Compiler.prototype.comment = function(node) {
- return this.emit("", node.position);
- };
- Compiler.prototype.import = function(node) {
- return this.emit("@import " + node.import + ";", node.position);
- };
- Compiler.prototype.media = function(node) {
- return this.emit("@media " + node.media, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}");
- };
- Compiler.prototype.document = function(node) {
- var doc = "@" + (node.vendor || "") + "document " + node.document;
- return this.emit(doc, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}");
- };
- Compiler.prototype.charset = function(node) {
- return this.emit("@charset " + node.charset + ";", node.position);
- };
- Compiler.prototype.namespace = function(node) {
- return this.emit("@namespace " + node.namespace + ";", node.position);
- };
- Compiler.prototype.supports = function(node) {
- return this.emit("@supports " + node.supports, node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}");
- };
- Compiler.prototype.keyframes = function(node) {
- return this.emit("@" + (node.vendor || "") + "keyframes " + node.name, node.position) + this.emit("{") + this.mapVisit(node.keyframes) + this.emit("}");
- };
- Compiler.prototype.keyframe = function(node) {
- var decls = node.declarations;
- return this.emit(node.values.join(","), node.position) + this.emit("{") + this.mapVisit(decls) + this.emit("}");
- };
- Compiler.prototype.page = function(node) {
- var sel = node.selectors.length ? node.selectors.join(", ") : "";
- return this.emit("@page " + sel, node.position) + this.emit("{") + this.mapVisit(node.declarations) + this.emit("}");
- };
- Compiler.prototype["font-face"] = function(node) {
- return this.emit("@font-face", node.position) + this.emit("{") + this.mapVisit(node.declarations) + this.emit("}");
- };
- Compiler.prototype.host = function(node) {
- return this.emit("@host", node.position) + this.emit("{") + this.mapVisit(node.rules) + this.emit("}");
- };
- Compiler.prototype["custom-media"] = function(node) {
- return this.emit("@custom-media " + node.name + " " + node.media + ";", node.position);
- };
- Compiler.prototype.rule = function(node) {
- var decls = node.declarations;
- if (!decls.length)
- return "";
- return this.emit(node.selectors.join(","), node.position) + this.emit("{") + this.mapVisit(decls) + this.emit("}");
- };
- Compiler.prototype.declaration = function(node) {
- return this.emit(node.property + ":" + node.value, node.position) + this.emit(";");
- };
- }
- });
-
- // node_modules/css/lib/stringify/identity.js
- var require_identity = __commonJS({
- "node_modules/css/lib/stringify/identity.js"(exports, module) {
- var Base = require_compiler();
- var inherits = require_inherits_browser();
- module.exports = Compiler;
- function Compiler(options) {
- options = options || {};
- Base.call(this, options);
- this.indentation = options.indent;
- }
- inherits(Compiler, Base);
- Compiler.prototype.compile = function(node) {
- return this.stylesheet(node);
- };
- Compiler.prototype.stylesheet = function(node) {
- return this.mapVisit(node.stylesheet.rules, "\n\n");
- };
- Compiler.prototype.comment = function(node) {
- return this.emit(this.indent() + "/*" + node.comment + "*/", node.position);
- };
- Compiler.prototype.import = function(node) {
- return this.emit("@import " + node.import + ";", node.position);
- };
- Compiler.prototype.media = function(node) {
- return this.emit("@media " + node.media, node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(node.rules, "\n\n") + this.emit(
- this.indent(-1) + "\n}"
- );
- };
- Compiler.prototype.document = function(node) {
- var doc = "@" + (node.vendor || "") + "document " + node.document;
- return this.emit(doc, node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(node.rules, "\n\n") + this.emit(
- this.indent(-1) + "\n}"
- );
- };
- Compiler.prototype.charset = function(node) {
- return this.emit("@charset " + node.charset + ";", node.position);
- };
- Compiler.prototype.namespace = function(node) {
- return this.emit("@namespace " + node.namespace + ";", node.position);
- };
- Compiler.prototype.supports = function(node) {
- return this.emit("@supports " + node.supports, node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(node.rules, "\n\n") + this.emit(
- this.indent(-1) + "\n}"
- );
- };
- Compiler.prototype.keyframes = function(node) {
- return this.emit("@" + (node.vendor || "") + "keyframes " + node.name, node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(node.keyframes, "\n") + this.emit(
- this.indent(-1) + "}"
- );
- };
- Compiler.prototype.keyframe = function(node) {
- var decls = node.declarations;
- return this.emit(this.indent()) + this.emit(node.values.join(", "), node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(decls, "\n") + this.emit(
- this.indent(-1) + "\n" + this.indent() + "}\n"
- );
- };
- Compiler.prototype.page = function(node) {
- var sel = node.selectors.length ? node.selectors.join(", ") + " " : "";
- return this.emit("@page " + sel, node.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(node.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
- };
- Compiler.prototype["font-face"] = function(node) {
- return this.emit("@font-face ", node.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(node.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
- };
- Compiler.prototype.host = function(node) {
- return this.emit("@host", node.position) + this.emit(
- " {\n" + this.indent(1)
- ) + this.mapVisit(node.rules, "\n\n") + this.emit(
- this.indent(-1) + "\n}"
- );
- };
- Compiler.prototype["custom-media"] = function(node) {
- return this.emit("@custom-media " + node.name + " " + node.media + ";", node.position);
- };
- Compiler.prototype.rule = function(node) {
- var indent = this.indent();
- var decls = node.declarations;
- if (!decls.length)
- return "";
- return this.emit(node.selectors.map(function(s) {
- return indent + s;
- }).join(",\n"), node.position) + this.emit(" {\n") + this.emit(this.indent(1)) + this.mapVisit(decls, "\n") + this.emit(this.indent(-1)) + this.emit("\n" + this.indent() + "}");
- };
- Compiler.prototype.declaration = function(node) {
- return this.emit(this.indent()) + this.emit(node.property + ": " + node.value, node.position) + this.emit(";");
- };
- Compiler.prototype.indent = function(level) {
- this.level = this.level || 1;
- if (null != level) {
- this.level += level;
- return "";
- }
- return Array(this.level).join(this.indentation || " ");
- };
- }
- });
-
- // node_modules/source-map/lib/base64.js
- var require_base64 = __commonJS({
- "node_modules/source-map/lib/base64.js"(exports) {
- var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
- exports.encode = function(number) {
- if (0 <= number && number < intToCharMap.length) {
- return intToCharMap[number];
- }
- throw new TypeError("Must be between 0 and 63: " + number);
- };
- exports.decode = function(charCode) {
- var bigA = 65;
- var bigZ = 90;
- var littleA = 97;
- var littleZ = 122;
- var zero = 48;
- var nine = 57;
- var plus = 43;
- var slash = 47;
- var littleOffset = 26;
- var numberOffset = 52;
- if (bigA <= charCode && charCode <= bigZ) {
- return charCode - bigA;
- }
- if (littleA <= charCode && charCode <= littleZ) {
- return charCode - littleA + littleOffset;
- }
- if (zero <= charCode && charCode <= nine) {
- return charCode - zero + numberOffset;
- }
- if (charCode == plus) {
- return 62;
- }
- if (charCode == slash) {
- return 63;
- }
- return -1;
- };
- }
- });
-
- // node_modules/source-map/lib/base64-vlq.js
- var require_base64_vlq = __commonJS({
- "node_modules/source-map/lib/base64-vlq.js"(exports) {
- var base64 = require_base64();
- var VLQ_BASE_SHIFT = 5;
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
- var VLQ_BASE_MASK = VLQ_BASE - 1;
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
- function toVLQSigned(aValue) {
- return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
- }
- function fromVLQSigned(aValue) {
- var isNegative = (aValue & 1) === 1;
- var shifted = aValue >> 1;
- return isNegative ? -shifted : shifted;
- }
- exports.encode = function base64VLQ_encode(aValue) {
- var encoded = "";
- var digit;
- var vlq = toVLQSigned(aValue);
- do {
- digit = vlq & VLQ_BASE_MASK;
- vlq >>>= VLQ_BASE_SHIFT;
- if (vlq > 0) {
- digit |= VLQ_CONTINUATION_BIT;
- }
- encoded += base64.encode(digit);
- } while (vlq > 0);
- return encoded;
- };
- exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
- var strLen = aStr.length;
- var result = 0;
- var shift = 0;
- var continuation, digit;
- do {
- if (aIndex >= strLen) {
- throw new Error("Expected more digits in base 64 VLQ value.");
- }
- digit = base64.decode(aStr.charCodeAt(aIndex++));
- if (digit === -1) {
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
- }
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
- digit &= VLQ_BASE_MASK;
- result = result + (digit << shift);
- shift += VLQ_BASE_SHIFT;
- } while (continuation);
- aOutParam.value = fromVLQSigned(result);
- aOutParam.rest = aIndex;
- };
- }
- });
-
- // node_modules/source-map/lib/util.js
- var require_util = __commonJS({
- "node_modules/source-map/lib/util.js"(exports) {
- function getArg(aArgs, aName, aDefaultValue) {
- if (aName in aArgs) {
- return aArgs[aName];
- } else if (arguments.length === 3) {
- return aDefaultValue;
- } else {
- throw new Error('"' + aName + '" is a required argument.');
- }
- }
- exports.getArg = getArg;
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
- var dataUrlRegexp = /^data:.+\,.+$/;
- function urlParse(aUrl) {
- var match = aUrl.match(urlRegexp);
- if (!match) {
- return null;
- }
- return {
- scheme: match[1],
- auth: match[2],
- host: match[3],
- port: match[4],
- path: match[5]
- };
- }
- exports.urlParse = urlParse;
- function urlGenerate(aParsedUrl) {
- var url = "";
- if (aParsedUrl.scheme) {
- url += aParsedUrl.scheme + ":";
- }
- url += "//";
- if (aParsedUrl.auth) {
- url += aParsedUrl.auth + "@";
- }
- if (aParsedUrl.host) {
- url += aParsedUrl.host;
- }
- if (aParsedUrl.port) {
- url += ":" + aParsedUrl.port;
- }
- if (aParsedUrl.path) {
- url += aParsedUrl.path;
- }
- return url;
- }
- exports.urlGenerate = urlGenerate;
- function normalize(aPath) {
- var path = aPath;
- var url = urlParse(aPath);
- if (url) {
- if (!url.path) {
- return aPath;
- }
- path = url.path;
- }
- var isAbsolute = exports.isAbsolute(path);
- var parts = path.split(/\/+/);
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
- part = parts[i];
- if (part === ".") {
- parts.splice(i, 1);
- } else if (part === "..") {
- up++;
- } else if (up > 0) {
- if (part === "") {
- parts.splice(i + 1, up);
- up = 0;
- } else {
- parts.splice(i, 2);
- up--;
- }
- }
- }
- path = parts.join("/");
- if (path === "") {
- path = isAbsolute ? "/" : ".";
- }
- if (url) {
- url.path = path;
- return urlGenerate(url);
- }
- return path;
- }
- exports.normalize = normalize;
- function join(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- if (aPath === "") {
- aPath = ".";
- }
- var aPathUrl = urlParse(aPath);
- var aRootUrl = urlParse(aRoot);
- if (aRootUrl) {
- aRoot = aRootUrl.path || "/";
- }
- if (aPathUrl && !aPathUrl.scheme) {
- if (aRootUrl) {
- aPathUrl.scheme = aRootUrl.scheme;
- }
- return urlGenerate(aPathUrl);
- }
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
- return aPath;
- }
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
- aRootUrl.host = aPath;
- return urlGenerate(aRootUrl);
- }
- var joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
- if (aRootUrl) {
- aRootUrl.path = joined;
- return urlGenerate(aRootUrl);
- }
- return joined;
- }
- exports.join = join;
- exports.isAbsolute = function(aPath) {
- return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
- };
- function relative(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- aRoot = aRoot.replace(/\/$/, "");
- var level = 0;
- while (aPath.indexOf(aRoot + "/") !== 0) {
- var index2 = aRoot.lastIndexOf("/");
- if (index2 < 0) {
- return aPath;
- }
- aRoot = aRoot.slice(0, index2);
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
- return aPath;
- }
- ++level;
- }
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
- }
- exports.relative = relative;
- var supportsNullProto = function() {
- var obj = /* @__PURE__ */ Object.create(null);
- return !("__proto__" in obj);
- }();
- function identity2(s) {
- return s;
- }
- function toSetString(aStr) {
- if (isProtoString(aStr)) {
- return "$" + aStr;
- }
- return aStr;
- }
- exports.toSetString = supportsNullProto ? identity2 : toSetString;
- function fromSetString(aStr) {
- if (isProtoString(aStr)) {
- return aStr.slice(1);
- }
- return aStr;
- }
- exports.fromSetString = supportsNullProto ? identity2 : fromSetString;
- function isProtoString(s) {
- if (!s) {
- return false;
- }
- var length = s.length;
- if (length < 9) {
- return false;
- }
- if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
- return false;
- }
- for (var i = length - 10; i >= 0; i--) {
- if (s.charCodeAt(i) !== 36) {
- return false;
- }
- }
- return true;
- }
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
- var cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0 || onlyCompareOriginal) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByOriginalPositions = compareByOriginalPositions;
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0 || onlyCompareGenerated) {
- return cmp;
- }
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
- function strcmp(aStr1, aStr2) {
- if (aStr1 === aStr2) {
- return 0;
- }
- if (aStr1 === null) {
- return 1;
- }
- if (aStr2 === null) {
- return -1;
- }
- if (aStr1 > aStr2) {
- return 1;
- }
- return -1;
- }
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
- function parseSourceMapInput(str) {
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
- }
- exports.parseSourceMapInput = parseSourceMapInput;
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
- sourceURL = sourceURL || "";
- if (sourceRoot) {
- if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
- sourceRoot += "/";
- }
- sourceURL = sourceRoot + sourceURL;
- }
- if (sourceMapURL) {
- var parsed = urlParse(sourceMapURL);
- if (!parsed) {
- throw new Error("sourceMapURL could not be parsed");
- }
- if (parsed.path) {
- var index2 = parsed.path.lastIndexOf("/");
- if (index2 >= 0) {
- parsed.path = parsed.path.substring(0, index2 + 1);
- }
- }
- sourceURL = join(urlGenerate(parsed), sourceURL);
- }
- return normalize(sourceURL);
- }
- exports.computeSourceURL = computeSourceURL;
- }
- });
-
- // node_modules/source-map/lib/array-set.js
- var require_array_set = __commonJS({
- "node_modules/source-map/lib/array-set.js"(exports) {
- var util = require_util();
- var has = Object.prototype.hasOwnProperty;
- var hasNativeMap = typeof Map !== "undefined";
- function ArraySet() {
- this._array = [];
- this._set = hasNativeMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
- }
- ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
- var set = new ArraySet();
- for (var i = 0, len = aArray.length; i < len; i++) {
- set.add(aArray[i], aAllowDuplicates);
- }
- return set;
- };
- ArraySet.prototype.size = function ArraySet_size() {
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
- };
- ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
- var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
- var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
- var idx = this._array.length;
- if (!isDuplicate || aAllowDuplicates) {
- this._array.push(aStr);
- }
- if (!isDuplicate) {
- if (hasNativeMap) {
- this._set.set(aStr, idx);
- } else {
- this._set[sStr] = idx;
- }
- }
- };
- ArraySet.prototype.has = function ArraySet_has(aStr) {
- if (hasNativeMap) {
- return this._set.has(aStr);
- } else {
- var sStr = util.toSetString(aStr);
- return has.call(this._set, sStr);
- }
- };
- ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
- if (hasNativeMap) {
- var idx = this._set.get(aStr);
- if (idx >= 0) {
- return idx;
- }
- } else {
- var sStr = util.toSetString(aStr);
- if (has.call(this._set, sStr)) {
- return this._set[sStr];
- }
- }
- throw new Error('"' + aStr + '" is not in the set.');
- };
- ArraySet.prototype.at = function ArraySet_at(aIdx) {
- if (aIdx >= 0 && aIdx < this._array.length) {
- return this._array[aIdx];
- }
- throw new Error("No element indexed by " + aIdx);
- };
- ArraySet.prototype.toArray = function ArraySet_toArray() {
- return this._array.slice();
- };
- exports.ArraySet = ArraySet;
- }
- });
-
- // node_modules/source-map/lib/mapping-list.js
- var require_mapping_list = __commonJS({
- "node_modules/source-map/lib/mapping-list.js"(exports) {
- var util = require_util();
- function generatedPositionAfter(mappingA, mappingB) {
- var lineA = mappingA.generatedLine;
- var lineB = mappingB.generatedLine;
- var columnA = mappingA.generatedColumn;
- var columnB = mappingB.generatedColumn;
- return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
- }
- function MappingList() {
- this._array = [];
- this._sorted = true;
- this._last = { generatedLine: -1, generatedColumn: 0 };
- }
- MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
- this._array.forEach(aCallback, aThisArg);
- };
- MappingList.prototype.add = function MappingList_add(aMapping) {
- if (generatedPositionAfter(this._last, aMapping)) {
- this._last = aMapping;
- this._array.push(aMapping);
- } else {
- this._sorted = false;
- this._array.push(aMapping);
- }
- };
- MappingList.prototype.toArray = function MappingList_toArray() {
- if (!this._sorted) {
- this._array.sort(util.compareByGeneratedPositionsInflated);
- this._sorted = true;
- }
- return this._array;
- };
- exports.MappingList = MappingList;
- }
- });
-
- // node_modules/source-map/lib/source-map-generator.js
- var require_source_map_generator = __commonJS({
- "node_modules/source-map/lib/source-map-generator.js"(exports) {
- var base64VLQ = require_base64_vlq();
- var util = require_util();
- var ArraySet = require_array_set().ArraySet;
- var MappingList = require_mapping_list().MappingList;
- function SourceMapGenerator(aArgs) {
- if (!aArgs) {
- aArgs = {};
- }
- this._file = util.getArg(aArgs, "file", null);
- this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
- this._skipValidation = util.getArg(aArgs, "skipValidation", false);
- this._sources = new ArraySet();
- this._names = new ArraySet();
- this._mappings = new MappingList();
- this._sourcesContents = null;
- }
- SourceMapGenerator.prototype._version = 3;
- SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
- var sourceRoot = aSourceMapConsumer.sourceRoot;
- var generator = new SourceMapGenerator({
- file: aSourceMapConsumer.file,
- sourceRoot
- });
- aSourceMapConsumer.eachMapping(function(mapping) {
- var newMapping = {
- generated: {
- line: mapping.generatedLine,
- column: mapping.generatedColumn
- }
- };
- if (mapping.source != null) {
- newMapping.source = mapping.source;
- if (sourceRoot != null) {
- newMapping.source = util.relative(sourceRoot, newMapping.source);
- }
- newMapping.original = {
- line: mapping.originalLine,
- column: mapping.originalColumn
- };
- if (mapping.name != null) {
- newMapping.name = mapping.name;
- }
- }
- generator.addMapping(newMapping);
- });
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
- var sourceRelative = sourceFile;
- if (sourceRoot !== null) {
- sourceRelative = util.relative(sourceRoot, sourceFile);
- }
- if (!generator._sources.has(sourceRelative)) {
- generator._sources.add(sourceRelative);
- }
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- generator.setSourceContent(sourceFile, content);
- }
- });
- return generator;
- };
- SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
- var generated = util.getArg(aArgs, "generated");
- var original = util.getArg(aArgs, "original", null);
- var source = util.getArg(aArgs, "source", null);
- var name = util.getArg(aArgs, "name", null);
- if (!this._skipValidation) {
- this._validateMapping(generated, original, source, name);
- }
- if (source != null) {
- source = String(source);
- if (!this._sources.has(source)) {
- this._sources.add(source);
- }
- }
- if (name != null) {
- name = String(name);
- if (!this._names.has(name)) {
- this._names.add(name);
- }
- }
- this._mappings.add({
- generatedLine: generated.line,
- generatedColumn: generated.column,
- originalLine: original != null && original.line,
- originalColumn: original != null && original.column,
- source,
- name
- });
- };
- SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
- var source = aSourceFile;
- if (this._sourceRoot != null) {
- source = util.relative(this._sourceRoot, source);
- }
- if (aSourceContent != null) {
- if (!this._sourcesContents) {
- this._sourcesContents = /* @__PURE__ */ Object.create(null);
- }
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
- } else if (this._sourcesContents) {
- delete this._sourcesContents[util.toSetString(source)];
- if (Object.keys(this._sourcesContents).length === 0) {
- this._sourcesContents = null;
- }
- }
- };
- SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
- var sourceFile = aSourceFile;
- if (aSourceFile == null) {
- if (aSourceMapConsumer.file == null) {
- throw new Error(
- `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
- );
- }
- sourceFile = aSourceMapConsumer.file;
- }
- var sourceRoot = this._sourceRoot;
- if (sourceRoot != null) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- }
- var newSources = new ArraySet();
- var newNames = new ArraySet();
- this._mappings.unsortedForEach(function(mapping) {
- if (mapping.source === sourceFile && mapping.originalLine != null) {
- var original = aSourceMapConsumer.originalPositionFor({
- line: mapping.originalLine,
- column: mapping.originalColumn
- });
- if (original.source != null) {
- mapping.source = original.source;
- if (aSourceMapPath != null) {
- mapping.source = util.join(aSourceMapPath, mapping.source);
- }
- if (sourceRoot != null) {
- mapping.source = util.relative(sourceRoot, mapping.source);
- }
- mapping.originalLine = original.line;
- mapping.originalColumn = original.column;
- if (original.name != null) {
- mapping.name = original.name;
- }
- }
- }
- var source = mapping.source;
- if (source != null && !newSources.has(source)) {
- newSources.add(source);
- }
- var name = mapping.name;
- if (name != null && !newNames.has(name)) {
- newNames.add(name);
- }
- }, this);
- this._sources = newSources;
- this._names = newNames;
- aSourceMapConsumer.sources.forEach(function(sourceFile2) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile2);
- if (content != null) {
- if (aSourceMapPath != null) {
- sourceFile2 = util.join(aSourceMapPath, sourceFile2);
- }
- if (sourceRoot != null) {
- sourceFile2 = util.relative(sourceRoot, sourceFile2);
- }
- this.setSourceContent(sourceFile2, content);
- }
- }, this);
- };
- SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
- if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
- throw new Error(
- "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
- );
- }
- if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
- return;
- } else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
- return;
- } else {
- throw new Error("Invalid mapping: " + JSON.stringify({
- generated: aGenerated,
- source: aSource,
- original: aOriginal,
- name: aName
- }));
- }
- };
- SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
- var previousGeneratedColumn = 0;
- var previousGeneratedLine = 1;
- var previousOriginalColumn = 0;
- var previousOriginalLine = 0;
- var previousName = 0;
- var previousSource = 0;
- var result = "";
- var next;
- var mapping;
- var nameIdx;
- var sourceIdx;
- var mappings = this._mappings.toArray();
- for (var i = 0, len = mappings.length; i < len; i++) {
- mapping = mappings[i];
- next = "";
- if (mapping.generatedLine !== previousGeneratedLine) {
- previousGeneratedColumn = 0;
- while (mapping.generatedLine !== previousGeneratedLine) {
- next += ";";
- previousGeneratedLine++;
- }
- } else {
- if (i > 0) {
- if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
- continue;
- }
- next += ",";
- }
- }
- next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
- previousGeneratedColumn = mapping.generatedColumn;
- if (mapping.source != null) {
- sourceIdx = this._sources.indexOf(mapping.source);
- next += base64VLQ.encode(sourceIdx - previousSource);
- previousSource = sourceIdx;
- next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
- previousOriginalLine = mapping.originalLine - 1;
- next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
- previousOriginalColumn = mapping.originalColumn;
- if (mapping.name != null) {
- nameIdx = this._names.indexOf(mapping.name);
- next += base64VLQ.encode(nameIdx - previousName);
- previousName = nameIdx;
- }
- }
- result += next;
- }
- return result;
- };
- SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
- return aSources.map(function(source) {
- if (!this._sourcesContents) {
- return null;
- }
- if (aSourceRoot != null) {
- source = util.relative(aSourceRoot, source);
- }
- var key = util.toSetString(source);
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
- }, this);
- };
- SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
- var map3 = {
- version: this._version,
- sources: this._sources.toArray(),
- names: this._names.toArray(),
- mappings: this._serializeMappings()
- };
- if (this._file != null) {
- map3.file = this._file;
- }
- if (this._sourceRoot != null) {
- map3.sourceRoot = this._sourceRoot;
- }
- if (this._sourcesContents) {
- map3.sourcesContent = this._generateSourcesContent(map3.sources, map3.sourceRoot);
- }
- return map3;
- };
- SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
- return JSON.stringify(this.toJSON());
- };
- exports.SourceMapGenerator = SourceMapGenerator;
- }
- });
-
- // node_modules/source-map/lib/binary-search.js
- var require_binary_search = __commonJS({
- "node_modules/source-map/lib/binary-search.js"(exports) {
- exports.GREATEST_LOWER_BOUND = 1;
- exports.LEAST_UPPER_BOUND = 2;
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
- if (cmp === 0) {
- return mid;
- } else if (cmp > 0) {
- if (aHigh - mid > 1) {
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
- }
- if (aBias == exports.LEAST_UPPER_BOUND) {
- return aHigh < aHaystack.length ? aHigh : -1;
- } else {
- return mid;
- }
- } else {
- if (mid - aLow > 1) {
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
- }
- if (aBias == exports.LEAST_UPPER_BOUND) {
- return mid;
- } else {
- return aLow < 0 ? -1 : aLow;
- }
- }
- }
- exports.search = function search2(aNeedle, aHaystack, aCompare, aBias) {
- if (aHaystack.length === 0) {
- return -1;
- }
- var index2 = recursiveSearch(
- -1,
- aHaystack.length,
- aNeedle,
- aHaystack,
- aCompare,
- aBias || exports.GREATEST_LOWER_BOUND
- );
- if (index2 < 0) {
- return -1;
- }
- while (index2 - 1 >= 0) {
- if (aCompare(aHaystack[index2], aHaystack[index2 - 1], true) !== 0) {
- break;
- }
- --index2;
- }
- return index2;
- };
- }
- });
-
- // node_modules/source-map/lib/quick-sort.js
- var require_quick_sort = __commonJS({
- "node_modules/source-map/lib/quick-sort.js"(exports) {
- function swap(ary, x, y) {
- var temp = ary[x];
- ary[x] = ary[y];
- ary[y] = temp;
- }
- function randomIntInRange(low, high) {
- return Math.round(low + Math.random() * (high - low));
- }
- function doQuickSort(ary, comparator, p, r) {
- if (p < r) {
- var pivotIndex = randomIntInRange(p, r);
- var i = p - 1;
- swap(ary, pivotIndex, r);
- var pivot = ary[r];
- for (var j = p; j < r; j++) {
- if (comparator(ary[j], pivot) <= 0) {
- i += 1;
- swap(ary, i, j);
- }
- }
- swap(ary, i + 1, j);
- var q = i + 1;
- doQuickSort(ary, comparator, p, q - 1);
- doQuickSort(ary, comparator, q + 1, r);
- }
- }
- exports.quickSort = function(ary, comparator) {
- doQuickSort(ary, comparator, 0, ary.length - 1);
- };
- }
- });
-
- // node_modules/source-map/lib/source-map-consumer.js
- var require_source_map_consumer = __commonJS({
- "node_modules/source-map/lib/source-map-consumer.js"(exports) {
- var util = require_util();
- var binarySearch = require_binary_search();
- var ArraySet = require_array_set().ArraySet;
- var base64VLQ = require_base64_vlq();
- var quickSort = require_quick_sort().quickSort;
- function SourceMapConsumer(aSourceMap, aSourceMapURL) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === "string") {
- sourceMap = util.parseSourceMapInput(aSourceMap);
- }
- return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
- }
- SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
- return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
- };
- SourceMapConsumer.prototype._version = 3;
- SourceMapConsumer.prototype.__generatedMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, "_generatedMappings", {
- configurable: true,
- enumerable: true,
- get: function() {
- if (!this.__generatedMappings) {
- this._parseMappings(this._mappings, this.sourceRoot);
- }
- return this.__generatedMappings;
- }
- });
- SourceMapConsumer.prototype.__originalMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, "_originalMappings", {
- configurable: true,
- enumerable: true,
- get: function() {
- if (!this.__originalMappings) {
- this._parseMappings(this._mappings, this.sourceRoot);
- }
- return this.__originalMappings;
- }
- });
- SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index2) {
- var c = aStr.charAt(index2);
- return c === ";" || c === ",";
- };
- SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- throw new Error("Subclasses must implement _parseMappings");
- };
- SourceMapConsumer.GENERATED_ORDER = 1;
- SourceMapConsumer.ORIGINAL_ORDER = 2;
- SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
- SourceMapConsumer.LEAST_UPPER_BOUND = 2;
- SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
- var context = aContext || null;
- var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
- var mappings;
- switch (order) {
- case SourceMapConsumer.GENERATED_ORDER:
- mappings = this._generatedMappings;
- break;
- case SourceMapConsumer.ORIGINAL_ORDER:
- mappings = this._originalMappings;
- break;
- default:
- throw new Error("Unknown order of iteration.");
- }
- var sourceRoot = this.sourceRoot;
- mappings.map(function(mapping) {
- var source = mapping.source === null ? null : this._sources.at(mapping.source);
- source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
- return {
- source,
- generatedLine: mapping.generatedLine,
- generatedColumn: mapping.generatedColumn,
- originalLine: mapping.originalLine,
- originalColumn: mapping.originalColumn,
- name: mapping.name === null ? null : this._names.at(mapping.name)
- };
- }, this).forEach(aCallback, context);
- };
- SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
- var line = util.getArg(aArgs, "line");
- var needle = {
- source: util.getArg(aArgs, "source"),
- originalLine: line,
- originalColumn: util.getArg(aArgs, "column", 0)
- };
- needle.source = this._findSourceIndex(needle.source);
- if (needle.source < 0) {
- return [];
- }
- var mappings = [];
- var index2 = this._findMapping(
- needle,
- this._originalMappings,
- "originalLine",
- "originalColumn",
- util.compareByOriginalPositions,
- binarySearch.LEAST_UPPER_BOUND
- );
- if (index2 >= 0) {
- var mapping = this._originalMappings[index2];
- if (aArgs.column === void 0) {
- var originalLine = mapping.originalLine;
- while (mapping && mapping.originalLine === originalLine) {
- mappings.push({
- line: util.getArg(mapping, "generatedLine", null),
- column: util.getArg(mapping, "generatedColumn", null),
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
- });
- mapping = this._originalMappings[++index2];
- }
- } else {
- var originalColumn = mapping.originalColumn;
- while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
- mappings.push({
- line: util.getArg(mapping, "generatedLine", null),
- column: util.getArg(mapping, "generatedColumn", null),
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
- });
- mapping = this._originalMappings[++index2];
- }
- }
- }
- return mappings;
- };
- exports.SourceMapConsumer = SourceMapConsumer;
- function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === "string") {
- sourceMap = util.parseSourceMapInput(aSourceMap);
- }
- var version = util.getArg(sourceMap, "version");
- var sources = util.getArg(sourceMap, "sources");
- var names = util.getArg(sourceMap, "names", []);
- var sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
- var sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
- var mappings = util.getArg(sourceMap, "mappings");
- var file = util.getArg(sourceMap, "file", null);
- if (version != this._version) {
- throw new Error("Unsupported version: " + version);
- }
- if (sourceRoot) {
- sourceRoot = util.normalize(sourceRoot);
- }
- sources = sources.map(String).map(util.normalize).map(function(source) {
- return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
- });
- this._names = ArraySet.fromArray(names.map(String), true);
- this._sources = ArraySet.fromArray(sources, true);
- this._absoluteSources = this._sources.toArray().map(function(s) {
- return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
- });
- this.sourceRoot = sourceRoot;
- this.sourcesContent = sourcesContent;
- this._mappings = mappings;
- this._sourceMapURL = aSourceMapURL;
- this.file = file;
- }
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
- BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
- var relativeSource = aSource;
- if (this.sourceRoot != null) {
- relativeSource = util.relative(this.sourceRoot, relativeSource);
- }
- if (this._sources.has(relativeSource)) {
- return this._sources.indexOf(relativeSource);
- }
- var i;
- for (i = 0; i < this._absoluteSources.length; ++i) {
- if (this._absoluteSources[i] == aSource) {
- return i;
- }
- }
- return -1;
- };
- BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
- var smc = Object.create(BasicSourceMapConsumer.prototype);
- var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
- var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
- smc.sourceRoot = aSourceMap._sourceRoot;
- smc.sourcesContent = aSourceMap._generateSourcesContent(
- smc._sources.toArray(),
- smc.sourceRoot
- );
- smc.file = aSourceMap._file;
- smc._sourceMapURL = aSourceMapURL;
- smc._absoluteSources = smc._sources.toArray().map(function(s) {
- return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
- });
- var generatedMappings = aSourceMap._mappings.toArray().slice();
- var destGeneratedMappings = smc.__generatedMappings = [];
- var destOriginalMappings = smc.__originalMappings = [];
- for (var i = 0, length = generatedMappings.length; i < length; i++) {
- var srcMapping = generatedMappings[i];
- var destMapping = new Mapping();
- destMapping.generatedLine = srcMapping.generatedLine;
- destMapping.generatedColumn = srcMapping.generatedColumn;
- if (srcMapping.source) {
- destMapping.source = sources.indexOf(srcMapping.source);
- destMapping.originalLine = srcMapping.originalLine;
- destMapping.originalColumn = srcMapping.originalColumn;
- if (srcMapping.name) {
- destMapping.name = names.indexOf(srcMapping.name);
- }
- destOriginalMappings.push(destMapping);
- }
- destGeneratedMappings.push(destMapping);
- }
- quickSort(smc.__originalMappings, util.compareByOriginalPositions);
- return smc;
- };
- BasicSourceMapConsumer.prototype._version = 3;
- Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", {
- get: function() {
- return this._absoluteSources.slice();
- }
- });
- function Mapping() {
- this.generatedLine = 0;
- this.generatedColumn = 0;
- this.source = null;
- this.originalLine = null;
- this.originalColumn = null;
- this.name = null;
- }
- BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- var generatedLine = 1;
- var previousGeneratedColumn = 0;
- var previousOriginalLine = 0;
- var previousOriginalColumn = 0;
- var previousSource = 0;
- var previousName = 0;
- var length = aStr.length;
- var index2 = 0;
- var cachedSegments = {};
- var temp = {};
- var originalMappings = [];
- var generatedMappings = [];
- var mapping, str, segment, end, value;
- while (index2 < length) {
- if (aStr.charAt(index2) === ";") {
- generatedLine++;
- index2++;
- previousGeneratedColumn = 0;
- } else if (aStr.charAt(index2) === ",") {
- index2++;
- } else {
- mapping = new Mapping();
- mapping.generatedLine = generatedLine;
- for (end = index2; end < length; end++) {
- if (this._charIsMappingSeparator(aStr, end)) {
- break;
- }
- }
- str = aStr.slice(index2, end);
- segment = cachedSegments[str];
- if (segment) {
- index2 += str.length;
- } else {
- segment = [];
- while (index2 < end) {
- base64VLQ.decode(aStr, index2, temp);
- value = temp.value;
- index2 = temp.rest;
- segment.push(value);
- }
- if (segment.length === 2) {
- throw new Error("Found a source, but no line and column");
- }
- if (segment.length === 3) {
- throw new Error("Found a source and line, but no column");
- }
- cachedSegments[str] = segment;
- }
- mapping.generatedColumn = previousGeneratedColumn + segment[0];
- previousGeneratedColumn = mapping.generatedColumn;
- if (segment.length > 1) {
- mapping.source = previousSource + segment[1];
- previousSource += segment[1];
- mapping.originalLine = previousOriginalLine + segment[2];
- previousOriginalLine = mapping.originalLine;
- mapping.originalLine += 1;
- mapping.originalColumn = previousOriginalColumn + segment[3];
- previousOriginalColumn = mapping.originalColumn;
- if (segment.length > 4) {
- mapping.name = previousName + segment[4];
- previousName += segment[4];
- }
- }
- generatedMappings.push(mapping);
- if (typeof mapping.originalLine === "number") {
- originalMappings.push(mapping);
- }
- }
- }
- quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
- this.__generatedMappings = generatedMappings;
- quickSort(originalMappings, util.compareByOriginalPositions);
- this.__originalMappings = originalMappings;
- };
- BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
- if (aNeedle[aLineName] <= 0) {
- throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
- }
- if (aNeedle[aColumnName] < 0) {
- throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
- }
- return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
- };
- BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
- for (var index2 = 0; index2 < this._generatedMappings.length; ++index2) {
- var mapping = this._generatedMappings[index2];
- if (index2 + 1 < this._generatedMappings.length) {
- var nextMapping = this._generatedMappings[index2 + 1];
- if (mapping.generatedLine === nextMapping.generatedLine) {
- mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
- continue;
- }
- }
- mapping.lastGeneratedColumn = Infinity;
- }
- };
- BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
- var needle = {
- generatedLine: util.getArg(aArgs, "line"),
- generatedColumn: util.getArg(aArgs, "column")
- };
- var index2 = this._findMapping(
- needle,
- this._generatedMappings,
- "generatedLine",
- "generatedColumn",
- util.compareByGeneratedPositionsDeflated,
- util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
- );
- if (index2 >= 0) {
- var mapping = this._generatedMappings[index2];
- if (mapping.generatedLine === needle.generatedLine) {
- var source = util.getArg(mapping, "source", null);
- if (source !== null) {
- source = this._sources.at(source);
- source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
- }
- var name = util.getArg(mapping, "name", null);
- if (name !== null) {
- name = this._names.at(name);
- }
- return {
- source,
- line: util.getArg(mapping, "originalLine", null),
- column: util.getArg(mapping, "originalColumn", null),
- name
- };
- }
- }
- return {
- source: null,
- line: null,
- column: null,
- name: null
- };
- };
- BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
- if (!this.sourcesContent) {
- return false;
- }
- return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
- return sc == null;
- });
- };
- BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
- if (!this.sourcesContent) {
- return null;
- }
- var index2 = this._findSourceIndex(aSource);
- if (index2 >= 0) {
- return this.sourcesContent[index2];
- }
- var relativeSource = aSource;
- if (this.sourceRoot != null) {
- relativeSource = util.relative(this.sourceRoot, relativeSource);
- }
- var url;
- if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
- var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
- if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
- return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
- }
- if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
- return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
- }
- }
- if (nullOnMissing) {
- return null;
- } else {
- throw new Error('"' + relativeSource + '" is not in the SourceMap.');
- }
- };
- BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
- var source = util.getArg(aArgs, "source");
- source = this._findSourceIndex(source);
- if (source < 0) {
- return {
- line: null,
- column: null,
- lastColumn: null
- };
- }
- var needle = {
- source,
- originalLine: util.getArg(aArgs, "line"),
- originalColumn: util.getArg(aArgs, "column")
- };
- var index2 = this._findMapping(
- needle,
- this._originalMappings,
- "originalLine",
- "originalColumn",
- util.compareByOriginalPositions,
- util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
- );
- if (index2 >= 0) {
- var mapping = this._originalMappings[index2];
- if (mapping.source === needle.source) {
- return {
- line: util.getArg(mapping, "generatedLine", null),
- column: util.getArg(mapping, "generatedColumn", null),
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
- };
- }
- }
- return {
- line: null,
- column: null,
- lastColumn: null
- };
- };
- exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
- function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === "string") {
- sourceMap = util.parseSourceMapInput(aSourceMap);
- }
- var version = util.getArg(sourceMap, "version");
- var sections = util.getArg(sourceMap, "sections");
- if (version != this._version) {
- throw new Error("Unsupported version: " + version);
- }
- this._sources = new ArraySet();
- this._names = new ArraySet();
- var lastOffset = {
- line: -1,
- column: 0
- };
- this._sections = sections.map(function(s) {
- if (s.url) {
- throw new Error("Support for url field in sections not implemented.");
- }
- var offset = util.getArg(s, "offset");
- var offsetLine = util.getArg(offset, "line");
- var offsetColumn = util.getArg(offset, "column");
- if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
- throw new Error("Section offsets must be ordered and non-overlapping.");
- }
- lastOffset = offset;
- return {
- generatedOffset: {
- // The offset fields are 0-based, but we use 1-based indices when
- // encoding/decoding from VLQ.
- generatedLine: offsetLine + 1,
- generatedColumn: offsetColumn + 1
- },
- consumer: new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL)
- };
- });
- }
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
- IndexedSourceMapConsumer.prototype._version = 3;
- Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", {
- get: function() {
- var sources = [];
- for (var i = 0; i < this._sections.length; i++) {
- for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
- sources.push(this._sections[i].consumer.sources[j]);
- }
- }
- return sources;
- }
- });
- IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
- var needle = {
- generatedLine: util.getArg(aArgs, "line"),
- generatedColumn: util.getArg(aArgs, "column")
- };
- var sectionIndex = binarySearch.search(
- needle,
- this._sections,
- function(needle2, section2) {
- var cmp = needle2.generatedLine - section2.generatedOffset.generatedLine;
- if (cmp) {
- return cmp;
- }
- return needle2.generatedColumn - section2.generatedOffset.generatedColumn;
- }
- );
- var section = this._sections[sectionIndex];
- if (!section) {
- return {
- source: null,
- line: null,
- column: null,
- name: null
- };
- }
- return section.consumer.originalPositionFor({
- line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
- column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
- bias: aArgs.bias
- });
- };
- IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
- return this._sections.every(function(s) {
- return s.consumer.hasContentsOfAllSources();
- });
- };
- IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i];
- var content = section.consumer.sourceContentFor(aSource, true);
- if (content) {
- return content;
- }
- }
- if (nullOnMissing) {
- return null;
- } else {
- throw new Error('"' + aSource + '" is not in the SourceMap.');
- }
- };
- IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i];
- if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
- continue;
- }
- var generatedPosition = section.consumer.generatedPositionFor(aArgs);
- if (generatedPosition) {
- var ret = {
- line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
- column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
- };
- return ret;
- }
- }
- return {
- line: null,
- column: null
- };
- };
- IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- this.__generatedMappings = [];
- this.__originalMappings = [];
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i];
- var sectionMappings = section.consumer._generatedMappings;
- for (var j = 0; j < sectionMappings.length; j++) {
- var mapping = sectionMappings[j];
- var source = section.consumer._sources.at(mapping.source);
- source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
- this._sources.add(source);
- source = this._sources.indexOf(source);
- var name = null;
- if (mapping.name) {
- name = section.consumer._names.at(mapping.name);
- this._names.add(name);
- name = this._names.indexOf(name);
- }
- var adjustedMapping = {
- source,
- generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
- generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
- originalLine: mapping.originalLine,
- originalColumn: mapping.originalColumn,
- name
- };
- this.__generatedMappings.push(adjustedMapping);
- if (typeof adjustedMapping.originalLine === "number") {
- this.__originalMappings.push(adjustedMapping);
- }
- }
- }
- quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
- quickSort(this.__originalMappings, util.compareByOriginalPositions);
- };
- exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
- }
- });
-
- // node_modules/source-map/lib/source-node.js
- var require_source_node = __commonJS({
- "node_modules/source-map/lib/source-node.js"(exports) {
- var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
- var util = require_util();
- var REGEX_NEWLINE = /(\r?\n)/;
- var NEWLINE_CODE = 10;
- var isSourceNode = "$$$isSourceNode$$$";
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
- this.children = [];
- this.sourceContents = {};
- this.line = aLine == null ? null : aLine;
- this.column = aColumn == null ? null : aColumn;
- this.source = aSource == null ? null : aSource;
- this.name = aName == null ? null : aName;
- this[isSourceNode] = true;
- if (aChunks != null)
- this.add(aChunks);
- }
- SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
- var node = new SourceNode();
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
- var remainingLinesIndex = 0;
- var shiftNextLine = function() {
- var lineContents = getNextLine();
- var newLine = getNextLine() || "";
- return lineContents + newLine;
- function getNextLine() {
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
- }
- };
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
- var lastMapping = null;
- aSourceMapConsumer.eachMapping(function(mapping) {
- if (lastMapping !== null) {
- if (lastGeneratedLine < mapping.generatedLine) {
- addMappingWithCode(lastMapping, shiftNextLine());
- lastGeneratedLine++;
- lastGeneratedColumn = 0;
- } else {
- var nextLine = remainingLines[remainingLinesIndex] || "";
- var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- addMappingWithCode(lastMapping, code);
- lastMapping = mapping;
- return;
- }
- }
- while (lastGeneratedLine < mapping.generatedLine) {
- node.add(shiftNextLine());
- lastGeneratedLine++;
- }
- if (lastGeneratedColumn < mapping.generatedColumn) {
- var nextLine = remainingLines[remainingLinesIndex] || "";
- node.add(nextLine.substr(0, mapping.generatedColumn));
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- }
- lastMapping = mapping;
- }, this);
- if (remainingLinesIndex < remainingLines.length) {
- if (lastMapping) {
- addMappingWithCode(lastMapping, shiftNextLine());
- }
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
- }
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- if (aRelativePath != null) {
- sourceFile = util.join(aRelativePath, sourceFile);
- }
- node.setSourceContent(sourceFile, content);
- }
- });
- return node;
- function addMappingWithCode(mapping, code) {
- if (mapping === null || mapping.source === void 0) {
- node.add(code);
- } else {
- var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
- node.add(new SourceNode(
- mapping.originalLine,
- mapping.originalColumn,
- source,
- code,
- mapping.name
- ));
- }
- }
- };
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
- if (Array.isArray(aChunk)) {
- aChunk.forEach(function(chunk) {
- this.add(chunk);
- }, this);
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
- if (aChunk) {
- this.children.push(aChunk);
- }
- } else {
- throw new TypeError(
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
- );
- }
- return this;
- };
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
- if (Array.isArray(aChunk)) {
- for (var i = aChunk.length - 1; i >= 0; i--) {
- this.prepend(aChunk[i]);
- }
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
- this.children.unshift(aChunk);
- } else {
- throw new TypeError(
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
- );
- }
- return this;
- };
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
- var chunk;
- for (var i = 0, len = this.children.length; i < len; i++) {
- chunk = this.children[i];
- if (chunk[isSourceNode]) {
- chunk.walk(aFn);
- } else {
- if (chunk !== "") {
- aFn(chunk, {
- source: this.source,
- line: this.line,
- column: this.column,
- name: this.name
- });
- }
- }
- }
- };
- SourceNode.prototype.join = function SourceNode_join(aSep) {
- var newChildren;
- var i;
- var len = this.children.length;
- if (len > 0) {
- newChildren = [];
- for (i = 0; i < len - 1; i++) {
- newChildren.push(this.children[i]);
- newChildren.push(aSep);
- }
- newChildren.push(this.children[i]);
- this.children = newChildren;
- }
- return this;
- };
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
- var lastChild = this.children[this.children.length - 1];
- if (lastChild[isSourceNode]) {
- lastChild.replaceRight(aPattern, aReplacement);
- } else if (typeof lastChild === "string") {
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
- } else {
- this.children.push("".replace(aPattern, aReplacement));
- }
- return this;
- };
- SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
- };
- SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
- for (var i = 0, len = this.children.length; i < len; i++) {
- if (this.children[i][isSourceNode]) {
- this.children[i].walkSourceContents(aFn);
- }
- }
- var sources = Object.keys(this.sourceContents);
- for (var i = 0, len = sources.length; i < len; i++) {
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
- }
- };
- SourceNode.prototype.toString = function SourceNode_toString() {
- var str = "";
- this.walk(function(chunk) {
- str += chunk;
- });
- return str;
- };
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
- var generated = {
- code: "",
- line: 1,
- column: 0
- };
- var map3 = new SourceMapGenerator(aArgs);
- var sourceMappingActive = false;
- var lastOriginalSource = null;
- var lastOriginalLine = null;
- var lastOriginalColumn = null;
- var lastOriginalName = null;
- this.walk(function(chunk, original) {
- generated.code += chunk;
- if (original.source !== null && original.line !== null && original.column !== null) {
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
- map3.addMapping({
- source: original.source,
- original: {
- line: original.line,
- column: original.column
- },
- generated: {
- line: generated.line,
- column: generated.column
- },
- name: original.name
- });
- }
- lastOriginalSource = original.source;
- lastOriginalLine = original.line;
- lastOriginalColumn = original.column;
- lastOriginalName = original.name;
- sourceMappingActive = true;
- } else if (sourceMappingActive) {
- map3.addMapping({
- generated: {
- line: generated.line,
- column: generated.column
- }
- });
- lastOriginalSource = null;
- sourceMappingActive = false;
- }
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
- generated.line++;
- generated.column = 0;
- if (idx + 1 === length) {
- lastOriginalSource = null;
- sourceMappingActive = false;
- } else if (sourceMappingActive) {
- map3.addMapping({
- source: original.source,
- original: {
- line: original.line,
- column: original.column
- },
- generated: {
- line: generated.line,
- column: generated.column
- },
- name: original.name
- });
- }
- } else {
- generated.column++;
- }
- }
- });
- this.walkSourceContents(function(sourceFile, sourceContent) {
- map3.setSourceContent(sourceFile, sourceContent);
- });
- return { code: generated.code, map: map3 };
- };
- exports.SourceNode = SourceNode;
- }
- });
-
- // node_modules/source-map/source-map.js
- var require_source_map = __commonJS({
- "node_modules/source-map/source-map.js"(exports) {
- exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
- exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
- exports.SourceNode = require_source_node().SourceNode;
- }
- });
-
- // node_modules/atob/browser-atob.js
- var require_browser_atob = __commonJS({
- "node_modules/atob/browser-atob.js"(exports, module) {
- (function(w) {
- "use strict";
- function findBest(atobNative) {
- if ("function" === typeof atobNative) {
- return atobNative;
- }
- if ("function" === typeof Buffer) {
- return function atobBrowserify(a) {
- return new Buffer(a, "base64").toString("binary");
- };
- }
- if ("object" === typeof w.base64js) {
- return function atobWebWorker_iOS(a) {
- var buf = w.base64js.b64ToByteArray(a);
- return Array.prototype.map.call(buf, function(ch) {
- return String.fromCharCode(ch);
- }).join("");
- };
- }
- return function() {
- throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.");
- };
- }
- var atobBest = findBest(w.atob);
- w.atob = atobBest;
- if (typeof module === "object" && module && module.exports) {
- module.exports = atobBest;
- }
- })(window);
- }
- });
-
- // (disabled):url
- var require_url = __commonJS({
- "(disabled):url"() {
- }
- });
-
- // (disabled):path
- var require_path = __commonJS({
- "(disabled):path"() {
- }
- });
-
- // node_modules/decode-uri-component/index.js
- var require_decode_uri_component = __commonJS({
- "node_modules/decode-uri-component/index.js"(exports, module) {
- "use strict";
- var token = "%[a-f0-9]{2}";
- var singleMatcher = new RegExp("(" + token + ")|([^%]+?)", "gi");
- var multiMatcher = new RegExp("(" + token + ")+", "gi");
- function decodeComponents(components, split) {
- try {
- return [decodeURIComponent(components.join(""))];
- } catch (err) {
- }
- if (components.length === 1) {
- return components;
- }
- split = split || 1;
- var left = components.slice(0, split);
- var right = components.slice(split);
- return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
- }
- function decode(input) {
- try {
- return decodeURIComponent(input);
- } catch (err) {
- var tokens = input.match(singleMatcher) || [];
- for (var i = 1; i < tokens.length; i++) {
- input = decodeComponents(tokens, i).join("");
- tokens = input.match(singleMatcher) || [];
- }
- return input;
- }
- }
- function customDecodeURIComponent(input) {
- var replaceMap = {
- "%FE%FF": "\uFFFD\uFFFD",
- "%FF%FE": "\uFFFD\uFFFD"
- };
- var match = multiMatcher.exec(input);
- while (match) {
- try {
- replaceMap[match[0]] = decodeURIComponent(match[0]);
- } catch (err) {
- var result = decode(match[0]);
- if (result !== match[0]) {
- replaceMap[match[0]] = result;
- }
- }
- match = multiMatcher.exec(input);
- }
- replaceMap["%C2"] = "\uFFFD";
- var entries = Object.keys(replaceMap);
- for (var i = 0; i < entries.length; i++) {
- var key = entries[i];
- input = input.replace(new RegExp(key, "g"), replaceMap[key]);
- }
- return input;
- }
- module.exports = function(encodedURI) {
- if (typeof encodedURI !== "string") {
- throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof encodedURI + "`");
- }
- try {
- encodedURI = encodedURI.replace(/\+/g, " ");
- return decodeURIComponent(encodedURI);
- } catch (err) {
- return customDecodeURIComponent(encodedURI);
- }
- };
- }
- });
-
- // node_modules/source-map-resolve/index.js
- var require_source_map_resolve = __commonJS({
- "node_modules/source-map-resolve/index.js"(exports, module) {
- var atob = require_browser_atob();
- var urlLib = require_url();
- var pathLib = require_path();
- var decodeUriComponentLib = require_decode_uri_component();
- function resolveUrl() {
- return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) {
- return urlLib.resolve(resolved, nextUrl);
- });
- }
- function convertWindowsPath(aPath) {
- return pathLib.sep === "\\" ? aPath.replace(/\\/g, "/").replace(/^[a-z]:\/?/i, "/") : aPath;
- }
- function customDecodeUriComponent(string) {
- return decodeUriComponentLib(string.replace(/\+/g, "%2B"));
- }
- function callbackAsync(callback, error, result) {
- setImmediate(function() {
- callback(error, result);
- });
- }
- function parseMapToJSON(string, data) {
- try {
- return JSON.parse(string.replace(/^\)\]\}'/, ""));
- } catch (error) {
- error.sourceMapData = data;
- throw error;
- }
- }
- function readSync(read2, url, data) {
- var readUrl = customDecodeUriComponent(url);
- try {
- return String(read2(readUrl));
- } catch (error) {
- error.sourceMapData = data;
- throw error;
- }
- }
- var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
- var sourceMappingURLRegex = RegExp(
- "(?:/\\*(?:\\s*\r?\n(?://)?)?(?:" + innerRegex.source + ")\\s*\\*/|//(?:" + innerRegex.source + "))\\s*"
- );
- function getSourceMappingUrl(code) {
- var match = code.match(sourceMappingURLRegex);
- return match ? match[1] || match[2] || "" : null;
- }
- function resolveSourceMap(code, codeUrl, read2, callback) {
- var mapData;
- try {
- mapData = resolveSourceMapHelper(code, codeUrl);
- } catch (error) {
- return callbackAsync(callback, error);
- }
- if (!mapData || mapData.map) {
- return callbackAsync(callback, null, mapData);
- }
- var readUrl = customDecodeUriComponent(mapData.url);
- read2(readUrl, function(error, result) {
- if (error) {
- error.sourceMapData = mapData;
- return callback(error);
- }
- mapData.map = String(result);
- try {
- mapData.map = parseMapToJSON(mapData.map, mapData);
- } catch (error2) {
- return callback(error2);
- }
- callback(null, mapData);
- });
- }
- function resolveSourceMapSync(code, codeUrl, read2) {
- var mapData = resolveSourceMapHelper(code, codeUrl);
- if (!mapData || mapData.map) {
- return mapData;
- }
- mapData.map = readSync(read2, mapData.url, mapData);
- mapData.map = parseMapToJSON(mapData.map, mapData);
- return mapData;
- }
- var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/;
- var jsonMimeTypeRegex = /^(?:application|text)\/json$/;
- var jsonCharacterEncoding = "utf-8";
- function base64ToBuf(b64) {
- var binStr = atob(b64);
- var len = binStr.length;
- var arr = new Uint8Array(len);
- for (var i = 0; i < len; i++) {
- arr[i] = binStr.charCodeAt(i);
- }
- return arr;
- }
- function decodeBase64String(b64) {
- if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") {
- return atob(b64);
- }
- var buf = base64ToBuf(b64);
- var decoder = new TextDecoder(jsonCharacterEncoding, { fatal: true });
- return decoder.decode(buf);
- }
- function resolveSourceMapHelper(code, codeUrl) {
- codeUrl = convertWindowsPath(codeUrl);
- var url = getSourceMappingUrl(code);
- if (!url) {
- return null;
- }
- var dataUri = url.match(dataUriRegex);
- if (dataUri) {
- var mimeType = dataUri[1] || "text/plain";
- var lastParameter = dataUri[2] || "";
- var encoded = dataUri[3] || "";
- var data = {
- sourceMappingURL: url,
- url: null,
- sourcesRelativeTo: codeUrl,
- map: encoded
- };
- if (!jsonMimeTypeRegex.test(mimeType)) {
- var error = new Error("Unuseful data uri mime type: " + mimeType);
- error.sourceMapData = data;
- throw error;
- }
- try {
- data.map = parseMapToJSON(
- lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded),
- data
- );
- } catch (error2) {
- error2.sourceMapData = data;
- throw error2;
- }
- return data;
- }
- var mapUrl = resolveUrl(codeUrl, url);
- return {
- sourceMappingURL: url,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- }
- function resolveSources(map3, mapUrl, read2, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- var pending = map3.sources ? map3.sources.length : 0;
- var result = {
- sourcesResolved: [],
- sourcesContent: []
- };
- if (pending === 0) {
- callbackAsync(callback, null, result);
- return;
- }
- var done = function() {
- pending--;
- if (pending === 0) {
- callback(null, result);
- }
- };
- resolveSourcesHelper(map3, mapUrl, options, function(fullUrl, sourceContent, index2) {
- result.sourcesResolved[index2] = fullUrl;
- if (typeof sourceContent === "string") {
- result.sourcesContent[index2] = sourceContent;
- callbackAsync(done, null);
- } else {
- var readUrl = customDecodeUriComponent(fullUrl);
- read2(readUrl, function(error, source) {
- result.sourcesContent[index2] = error ? error : String(source);
- done();
- });
- }
- });
- }
- function resolveSourcesSync(map3, mapUrl, read2, options) {
- var result = {
- sourcesResolved: [],
- sourcesContent: []
- };
- if (!map3.sources || map3.sources.length === 0) {
- return result;
- }
- resolveSourcesHelper(map3, mapUrl, options, function(fullUrl, sourceContent, index2) {
- result.sourcesResolved[index2] = fullUrl;
- if (read2 !== null) {
- if (typeof sourceContent === "string") {
- result.sourcesContent[index2] = sourceContent;
- } else {
- var readUrl = customDecodeUriComponent(fullUrl);
- try {
- result.sourcesContent[index2] = String(read2(readUrl));
- } catch (error) {
- result.sourcesContent[index2] = error;
- }
- }
- }
- });
- return result;
- }
- var endingSlash = /\/?$/;
- function resolveSourcesHelper(map3, mapUrl, options, fn) {
- options = options || {};
- mapUrl = convertWindowsPath(mapUrl);
- var fullUrl;
- var sourceContent;
- var sourceRoot;
- for (var index2 = 0, len = map3.sources.length; index2 < len; index2++) {
- sourceRoot = null;
- if (typeof options.sourceRoot === "string") {
- sourceRoot = options.sourceRoot;
- } else if (typeof map3.sourceRoot === "string" && options.sourceRoot !== false) {
- sourceRoot = map3.sourceRoot;
- }
- if (sourceRoot === null || sourceRoot === "") {
- fullUrl = resolveUrl(mapUrl, map3.sources[index2]);
- } else {
- fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map3.sources[index2]);
- }
- sourceContent = (map3.sourcesContent || [])[index2];
- fn(fullUrl, sourceContent, index2);
- }
- }
- function resolve(code, codeUrl, read2, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- if (code === null) {
- var mapUrl = codeUrl;
- var data = {
- sourceMappingURL: null,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- var readUrl = customDecodeUriComponent(mapUrl);
- read2(readUrl, function(error, result) {
- if (error) {
- error.sourceMapData = data;
- return callback(error);
- }
- data.map = String(result);
- try {
- data.map = parseMapToJSON(data.map, data);
- } catch (error2) {
- return callback(error2);
- }
- _resolveSources(data);
- });
- } else {
- resolveSourceMap(code, codeUrl, read2, function(error, mapData) {
- if (error) {
- return callback(error);
- }
- if (!mapData) {
- return callback(null, null);
- }
- _resolveSources(mapData);
- });
- }
- function _resolveSources(mapData) {
- resolveSources(mapData.map, mapData.sourcesRelativeTo, read2, options, function(error, result) {
- if (error) {
- return callback(error);
- }
- mapData.sourcesResolved = result.sourcesResolved;
- mapData.sourcesContent = result.sourcesContent;
- callback(null, mapData);
- });
- }
- }
- function resolveSync(code, codeUrl, read2, options) {
- var mapData;
- if (code === null) {
- var mapUrl = codeUrl;
- mapData = {
- sourceMappingURL: null,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- mapData.map = readSync(read2, mapUrl, mapData);
- mapData.map = parseMapToJSON(mapData.map, mapData);
- } else {
- mapData = resolveSourceMapSync(code, codeUrl, read2);
- if (!mapData) {
- return null;
- }
- }
- var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read2, options);
- mapData.sourcesResolved = result.sourcesResolved;
- mapData.sourcesContent = result.sourcesContent;
- return mapData;
- }
- module.exports = {
- resolveSourceMap,
- resolveSourceMapSync,
- resolveSources,
- resolveSourcesSync,
- resolve,
- resolveSync,
- parseMapToJSON
- };
- }
- });
-
- // (disabled):fs
- var require_fs = __commonJS({
- "(disabled):fs"() {
- }
- });
-
- // node_modules/css/lib/stringify/source-map-support.js
- var require_source_map_support = __commonJS({
- "node_modules/css/lib/stringify/source-map-support.js"(exports, module) {
- var SourceMap = require_source_map().SourceMapGenerator;
- var SourceMapConsumer = require_source_map().SourceMapConsumer;
- var sourceMapResolve = require_source_map_resolve();
- var fs = require_fs();
- var path = require_path();
- module.exports = mixin;
- var makeFriendlyPath = function(aPath) {
- return path.sep === "\\" ? aPath.replace(/\\/g, "/").replace(/^[a-z]:\/?/i, "/") : aPath;
- };
- function mixin(compiler) {
- compiler._comment = compiler.comment;
- compiler.map = new SourceMap();
- compiler.position = { line: 1, column: 1 };
- compiler.files = {};
- for (var k in exports)
- compiler[k] = exports[k];
- }
- exports.updatePosition = function(str) {
- var lines = str.match(/\n/g);
- if (lines)
- this.position.line += lines.length;
- var i = str.lastIndexOf("\n");
- this.position.column = ~i ? str.length - i : this.position.column + str.length;
- };
- exports.emit = function(str, pos) {
- if (pos) {
- var sourceFile = makeFriendlyPath(pos.source || "source.css");
- this.map.addMapping({
- source: sourceFile,
- generated: {
- line: this.position.line,
- column: Math.max(this.position.column - 1, 0)
- },
- original: {
- line: pos.start.line,
- column: pos.start.column - 1
- }
- });
- this.addFile(sourceFile, pos);
- }
- this.updatePosition(str);
- return str;
- };
- exports.addFile = function(file, pos) {
- if (typeof pos.content !== "string")
- return;
- if (Object.prototype.hasOwnProperty.call(this.files, file))
- return;
- this.files[file] = pos.content;
- };
- exports.applySourceMaps = function() {
- Object.keys(this.files).forEach(function(file) {
- var content = this.files[file];
- this.map.setSourceContent(file, content);
- if (this.options.inputSourcemaps !== false) {
- var originalMap = sourceMapResolve.resolveSync(
- content,
- file,
- fs.readFileSync
- );
- if (originalMap) {
- var map3 = new SourceMapConsumer(originalMap.map);
- var relativeTo = originalMap.sourcesRelativeTo;
- this.map.applySourceMap(map3, file, makeFriendlyPath(path.dirname(relativeTo)));
- }
- }
- }, this);
- };
- exports.comment = function(node) {
- if (/^# sourceMappingURL=/.test(node.comment))
- return this.emit("", node.position);
- else
- return this._comment(node);
- };
- }
- });
-
- // node_modules/css/lib/stringify/index.js
- var require_stringify = __commonJS({
- "node_modules/css/lib/stringify/index.js"(exports, module) {
- var Compressed = require_compress();
- var Identity = require_identity();
- module.exports = function(node, options) {
- options = options || {};
- var compiler = options.compress ? new Compressed(options) : new Identity(options);
- if (options.sourcemap) {
- var sourcemaps = require_source_map_support();
- sourcemaps(compiler);
- var code = compiler.compile(node);
- compiler.applySourceMaps();
- var map3 = options.sourcemap === "generator" ? compiler.map : compiler.map.toJSON();
- return { code, map: map3 };
- }
- var code = compiler.compile(node);
- return code;
- };
- }
- });
-
- // node_modules/css/index.js
- var require_css = __commonJS({
- "node_modules/css/index.js"(exports) {
- exports.parse = require_parse();
- exports.stringify = require_stringify();
- }
- });
-
- // src/commandline_frame.ts
- var commandline_frame_exports = {};
- __export(commandline_frame_exports, {
- clear: () => clear,
- editor_function: () => editor_function,
- enableCompletions: () => enableCompletions,
- fillcmdline: () => fillcmdline,
- focus: () => focus,
- getContent: () => getContent,
- refresh_completions: () => refresh_completions
- });
-
- // node_modules/fuse.js/dist/fuse.esm.js
- function isArray(value) {
- return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
- }
- var INFINITY = 1 / 0;
- function baseToString(value) {
- if (typeof value == "string") {
- return value;
- }
- let result = value + "";
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
- }
- function toString(value) {
- return value == null ? "" : baseToString(value);
- }
- function isString(value) {
- return typeof value === "string";
- }
- function isNumber(value) {
- return typeof value === "number";
- }
- function isBoolean(value) {
- return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]";
- }
- function isObject(value) {
- return typeof value === "object";
- }
- function isObjectLike(value) {
- return isObject(value) && value !== null;
- }
- function isDefined(value) {
- return value !== void 0 && value !== null;
- }
- function isBlank(value) {
- return !value.trim().length;
- }
- function getTag(value) {
- return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
- }
- var INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
- var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`;
- var PATTERN_LENGTH_TOO_LARGE = (max) => `Pattern length exceeds max of ${max}.`;
- var MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
- var INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`;
- var hasOwn = Object.prototype.hasOwnProperty;
- var KeyStore = class {
- constructor(keys4) {
- this._keys = [];
- this._keyMap = {};
- let totalWeight = 0;
- keys4.forEach((key) => {
- let obj = createKey(key);
- totalWeight += obj.weight;
- this._keys.push(obj);
- this._keyMap[obj.id] = obj;
- totalWeight += obj.weight;
- });
- this._keys.forEach((key) => {
- key.weight /= totalWeight;
- });
- }
- get(keyId) {
- return this._keyMap[keyId];
- }
- keys() {
- return this._keys;
- }
- toJSON() {
- return JSON.stringify(this._keys);
- }
- };
- function createKey(key) {
- let path = null;
- let id2 = null;
- let src = null;
- let weight = 1;
- let getFn = null;
- if (isString(key) || isArray(key)) {
- src = key;
- path = createKeyPath(key);
- id2 = createKeyId(key);
- } else {
- if (!hasOwn.call(key, "name")) {
- throw new Error(MISSING_KEY_PROPERTY("name"));
- }
- const name = key.name;
- src = name;
- if (hasOwn.call(key, "weight")) {
- weight = key.weight;
- if (weight <= 0) {
- throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
- }
- }
- path = createKeyPath(name);
- id2 = createKeyId(name);
- getFn = key.getFn;
- }
- return { path, id: id2, weight, src, getFn };
- }
- function createKeyPath(key) {
- return isArray(key) ? key : key.split(".");
- }
- function createKeyId(key) {
- return isArray(key) ? key.join(".") : key;
- }
- function get(obj, path) {
- let list = [];
- let arr = false;
- const deepGet = (obj2, path2, index2) => {
- if (!isDefined(obj2)) {
- return;
- }
- if (!path2[index2]) {
- list.push(obj2);
- } else {
- let key = path2[index2];
- const value = obj2[key];
- if (!isDefined(value)) {
- return;
- }
- if (index2 === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {
- list.push(toString(value));
- } else if (isArray(value)) {
- arr = true;
- for (let i = 0, len = value.length; i < len; i += 1) {
- deepGet(value[i], path2, index2 + 1);
- }
- } else if (path2.length) {
- deepGet(value, path2, index2 + 1);
- }
- }
- };
- deepGet(obj, isString(path) ? path.split(".") : path, 0);
- return arr ? list : list[0];
- }
- var MatchOptions = {
- // Whether the matches should be included in the result set. When `true`, each record in the result
- // set will include the indices of the matched characters.
- // These can consequently be used for highlighting purposes.
- includeMatches: false,
- // When `true`, the matching function will continue to the end of a search pattern even if
- // a perfect match has already been located in the string.
- findAllMatches: false,
- // Minimum number of characters that must be matched before a result is considered a match
- minMatchCharLength: 1
- };
- var BasicOptions = {
- // When `true`, the algorithm continues searching to the end of the input even if a perfect
- // match is found before the end of the same input.
- isCaseSensitive: false,
- // When true, the matching function will continue to the end of a search pattern even if
- includeScore: false,
- // List of properties that will be searched. This also supports nested properties.
- keys: [],
- // Whether to sort the result list, by score
- shouldSort: true,
- // Default sort function: sort by ascending score, ascending index
- sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1
- };
- var FuzzyOptions = {
- // Approximately where in the text is the pattern expected to be found?
- location: 0,
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
- // (of both letters and location), a threshold of '1.0' would match anything.
- threshold: 0.6,
- // Determines how close the match must be to the fuzzy location (specified above).
- // An exact letter match which is 'distance' characters away from the fuzzy location
- // would score as a complete mismatch. A distance of '0' requires the match be at
- // the exact location specified, a threshold of '1000' would require a perfect match
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
- distance: 100
- };
- var AdvancedOptions = {
- // When `true`, it enables the use of unix-like search commands
- useExtendedSearch: false,
- // The get function to use when fetching an object's properties.
- // The default will search nested paths *ie foo.bar.baz*
- getFn: get,
- // When `true`, search will ignore `location` and `distance`, so it won't matter
- // where in the string the pattern appears.
- // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
- ignoreLocation: false,
- // When `true`, the calculation for the relevance score (used for sorting) will
- // ignore the field-length norm.
- // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
- ignoreFieldNorm: false,
- // The weight to determine how much field length norm effects scoring.
- fieldNormWeight: 1
- };
- var Config = {
- ...BasicOptions,
- ...MatchOptions,
- ...FuzzyOptions,
- ...AdvancedOptions
- };
- var SPACE = /[^ ]+/g;
- function norm(weight = 1, mantissa = 3) {
- const cache = /* @__PURE__ */ new Map();
- const m = Math.pow(10, mantissa);
- return {
- get(value) {
- const numTokens = value.match(SPACE).length;
- if (cache.has(numTokens)) {
- return cache.get(numTokens);
- }
- const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
- const n = parseFloat(Math.round(norm2 * m) / m);
- cache.set(numTokens, n);
- return n;
- },
- clear() {
- cache.clear();
- }
- };
- }
- var FuseIndex = class {
- constructor({
- getFn = Config.getFn,
- fieldNormWeight = Config.fieldNormWeight
- } = {}) {
- this.norm = norm(fieldNormWeight, 3);
- this.getFn = getFn;
- this.isCreated = false;
- this.setIndexRecords();
- }
- setSources(docs = []) {
- this.docs = docs;
- }
- setIndexRecords(records = []) {
- this.records = records;
- }
- setKeys(keys4 = []) {
- this.keys = keys4;
- this._keysMap = {};
- keys4.forEach((key, idx) => {
- this._keysMap[key.id] = idx;
- });
- }
- create() {
- if (this.isCreated || !this.docs.length) {
- return;
- }
- this.isCreated = true;
- if (isString(this.docs[0])) {
- this.docs.forEach((doc, docIndex) => {
- this._addString(doc, docIndex);
- });
- } else {
- this.docs.forEach((doc, docIndex) => {
- this._addObject(doc, docIndex);
- });
- }
- this.norm.clear();
- }
- // Adds a doc to the end of the index
- add(doc) {
- const idx = this.size();
- if (isString(doc)) {
- this._addString(doc, idx);
- } else {
- this._addObject(doc, idx);
- }
- }
- // Removes the doc at the specified index of the index
- removeAt(idx) {
- this.records.splice(idx, 1);
- for (let i = idx, len = this.size(); i < len; i += 1) {
- this.records[i].i -= 1;
- }
- }
- getValueForItemAtKeyId(item, keyId) {
- return item[this._keysMap[keyId]];
- }
- size() {
- return this.records.length;
- }
- _addString(doc, docIndex) {
- if (!isDefined(doc) || isBlank(doc)) {
- return;
- }
- let record = {
- v: doc,
- i: docIndex,
- n: this.norm.get(doc)
- };
- this.records.push(record);
- }
- _addObject(doc, docIndex) {
- let record = { i: docIndex, $: {} };
- this.keys.forEach((key, keyIndex) => {
- let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
- if (!isDefined(value)) {
- return;
- }
- if (isArray(value)) {
- let subRecords = [];
- const stack = [{ nestedArrIndex: -1, value }];
- while (stack.length) {
- const { nestedArrIndex, value: value2 } = stack.pop();
- if (!isDefined(value2)) {
- continue;
- }
- if (isString(value2) && !isBlank(value2)) {
- let subRecord = {
- v: value2,
- i: nestedArrIndex,
- n: this.norm.get(value2)
- };
- subRecords.push(subRecord);
- } else if (isArray(value2)) {
- value2.forEach((item, k) => {
- stack.push({
- nestedArrIndex: k,
- value: item
- });
- });
- } else
- ;
- }
- record.$[keyIndex] = subRecords;
- } else if (isString(value) && !isBlank(value)) {
- let subRecord = {
- v: value,
- n: this.norm.get(value)
- };
- record.$[keyIndex] = subRecord;
- }
- });
- this.records.push(record);
- }
- toJSON() {
- return {
- keys: this.keys,
- records: this.records
- };
- }
- };
- function createIndex(keys4, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
- myIndex.setKeys(keys4.map(createKey));
- myIndex.setSources(docs);
- myIndex.create();
- return myIndex;
- }
- function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
- const { keys: keys4, records } = data;
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
- myIndex.setKeys(keys4);
- myIndex.setIndexRecords(records);
- return myIndex;
- }
- function computeScore$1(pattern, {
- errors = 0,
- currentLocation = 0,
- expectedLocation = 0,
- distance = Config.distance,
- ignoreLocation = Config.ignoreLocation
- } = {}) {
- const accuracy = errors / pattern.length;
- if (ignoreLocation) {
- return accuracy;
- }
- const proximity = Math.abs(expectedLocation - currentLocation);
- if (!distance) {
- return proximity ? 1 : accuracy;
- }
- return accuracy + proximity / distance;
- }
- function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
- let indices = [];
- let start = -1;
- let end = -1;
- let i = 0;
- for (let len = matchmask.length; i < len; i += 1) {
- let match = matchmask[i];
- if (match && start === -1) {
- start = i;
- } else if (!match && start !== -1) {
- end = i - 1;
- if (end - start + 1 >= minMatchCharLength) {
- indices.push([start, end]);
- }
- start = -1;
- }
- }
- if (matchmask[i - 1] && i - start >= minMatchCharLength) {
- indices.push([start, i - 1]);
- }
- return indices;
- }
- var MAX_BITS = 32;
- function search(text, pattern, patternAlphabet, {
- location = Config.location,
- distance = Config.distance,
- threshold = Config.threshold,
- findAllMatches = Config.findAllMatches,
- minMatchCharLength = Config.minMatchCharLength,
- includeMatches = Config.includeMatches,
- ignoreLocation = Config.ignoreLocation
- } = {}) {
- if (pattern.length > MAX_BITS) {
- throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
- }
- const patternLen = pattern.length;
- const textLen = text.length;
- const expectedLocation = Math.max(0, Math.min(location, textLen));
- let currentThreshold = threshold;
- let bestLocation = expectedLocation;
- const computeMatches = minMatchCharLength > 1 || includeMatches;
- const matchMask = computeMatches ? Array(textLen) : [];
- let index2;
- while ((index2 = text.indexOf(pattern, bestLocation)) > -1) {
- let score = computeScore$1(pattern, {
- currentLocation: index2,
- expectedLocation,
- distance,
- ignoreLocation
- });
- currentThreshold = Math.min(score, currentThreshold);
- bestLocation = index2 + patternLen;
- if (computeMatches) {
- let i = 0;
- while (i < patternLen) {
- matchMask[index2 + i] = 1;
- i += 1;
- }
- }
- }
- bestLocation = -1;
- let lastBitArr = [];
- let finalScore = 1;
- let binMax = patternLen + textLen;
- const mask = 1 << patternLen - 1;
- for (let i = 0; i < patternLen; i += 1) {
- let binMin = 0;
- let binMid = binMax;
- while (binMin < binMid) {
- const score2 = computeScore$1(pattern, {
- errors: i,
- currentLocation: expectedLocation + binMid,
- expectedLocation,
- distance,
- ignoreLocation
- });
- if (score2 <= currentThreshold) {
- binMin = binMid;
- } else {
- binMax = binMid;
- }
- binMid = Math.floor((binMax - binMin) / 2 + binMin);
- }
- binMax = binMid;
- let start = Math.max(1, expectedLocation - binMid + 1);
- let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
- let bitArr = Array(finish + 2);
- bitArr[finish + 1] = (1 << i) - 1;
- for (let j = finish; j >= start; j -= 1) {
- let currentLocation = j - 1;
- let charMatch = patternAlphabet[text.charAt(currentLocation)];
- if (computeMatches) {
- matchMask[currentLocation] = +!!charMatch;
- }
- bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
- if (i) {
- bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
- }
- if (bitArr[j] & mask) {
- finalScore = computeScore$1(pattern, {
- errors: i,
- currentLocation,
- expectedLocation,
- distance,
- ignoreLocation
- });
- if (finalScore <= currentThreshold) {
- currentThreshold = finalScore;
- bestLocation = currentLocation;
- if (bestLocation <= expectedLocation) {
- break;
- }
- start = Math.max(1, 2 * expectedLocation - bestLocation);
- }
- }
- }
- const score = computeScore$1(pattern, {
- errors: i + 1,
- currentLocation: expectedLocation,
- expectedLocation,
- distance,
- ignoreLocation
- });
- if (score > currentThreshold) {
- break;
- }
- lastBitArr = bitArr;
- }
- const result = {
- isMatch: bestLocation >= 0,
- // Count exact matches (those with a score of 0) to be "almost" exact
- score: Math.max(1e-3, finalScore)
- };
- if (computeMatches) {
- const indices = convertMaskToIndices(matchMask, minMatchCharLength);
- if (!indices.length) {
- result.isMatch = false;
- } else if (includeMatches) {
- result.indices = indices;
- }
- }
- return result;
- }
- function createPatternAlphabet(pattern) {
- let mask = {};
- for (let i = 0, len = pattern.length; i < len; i += 1) {
- const char = pattern.charAt(i);
- mask[char] = (mask[char] || 0) | 1 << len - i - 1;
- }
- return mask;
- }
- var BitapSearch = class {
- constructor(pattern, {
- location = Config.location,
- threshold = Config.threshold,
- distance = Config.distance,
- includeMatches = Config.includeMatches,
- findAllMatches = Config.findAllMatches,
- minMatchCharLength = Config.minMatchCharLength,
- isCaseSensitive = Config.isCaseSensitive,
- ignoreLocation = Config.ignoreLocation
- } = {}) {
- this.options = {
- location,
- threshold,
- distance,
- includeMatches,
- findAllMatches,
- minMatchCharLength,
- isCaseSensitive,
- ignoreLocation
- };
- this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
- this.chunks = [];
- if (!this.pattern.length) {
- return;
- }
- const addChunk = (pattern2, startIndex) => {
- this.chunks.push({
- pattern: pattern2,
- alphabet: createPatternAlphabet(pattern2),
- startIndex
- });
- };
- const len = this.pattern.length;
- if (len > MAX_BITS) {
- let i = 0;
- const remainder = len % MAX_BITS;
- const end = len - remainder;
- while (i < end) {
- addChunk(this.pattern.substr(i, MAX_BITS), i);
- i += MAX_BITS;
- }
- if (remainder) {
- const startIndex = len - MAX_BITS;
- addChunk(this.pattern.substr(startIndex), startIndex);
- }
- } else {
- addChunk(this.pattern, 0);
- }
- }
- searchIn(text) {
- const { isCaseSensitive, includeMatches } = this.options;
- if (!isCaseSensitive) {
- text = text.toLowerCase();
- }
- if (this.pattern === text) {
- let result2 = {
- isMatch: true,
- score: 0
- };
- if (includeMatches) {
- result2.indices = [[0, text.length - 1]];
- }
- return result2;
- }
- const {
- location,
- distance,
- threshold,
- findAllMatches,
- minMatchCharLength,
- ignoreLocation
- } = this.options;
- let allIndices = [];
- let totalScore = 0;
- let hasMatches = false;
- this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
- const { isMatch, score, indices } = search(text, pattern, alphabet, {
- location: location + startIndex,
- distance,
- threshold,
- findAllMatches,
- minMatchCharLength,
- includeMatches,
- ignoreLocation
- });
- if (isMatch) {
- hasMatches = true;
- }
- totalScore += score;
- if (isMatch && indices) {
- allIndices = [...allIndices, ...indices];
- }
- });
- let result = {
- isMatch: hasMatches,
- score: hasMatches ? totalScore / this.chunks.length : 1
- };
- if (hasMatches && includeMatches) {
- result.indices = allIndices;
- }
- return result;
- }
- };
- var BaseMatch = class {
- constructor(pattern) {
- this.pattern = pattern;
- }
- static isMultiMatch(pattern) {
- return getMatch(pattern, this.multiRegex);
- }
- static isSingleMatch(pattern) {
- return getMatch(pattern, this.singleRegex);
- }
- search() {
- }
- };
- function getMatch(pattern, exp) {
- const matches = pattern.match(exp);
- return matches ? matches[1] : null;
- }
- var ExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "exact";
- }
- static get multiRegex() {
- return /^="(.*)"$/;
- }
- static get singleRegex() {
- return /^=(.*)$/;
- }
- search(text) {
- const isMatch = text === this.pattern;
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [0, this.pattern.length - 1]
- };
- }
- };
- var InverseExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "inverse-exact";
- }
- static get multiRegex() {
- return /^!"(.*)"$/;
- }
- static get singleRegex() {
- return /^!(.*)$/;
- }
- search(text) {
- const index2 = text.indexOf(this.pattern);
- const isMatch = index2 === -1;
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [0, text.length - 1]
- };
- }
- };
- var PrefixExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "prefix-exact";
- }
- static get multiRegex() {
- return /^\^"(.*)"$/;
- }
- static get singleRegex() {
- return /^\^(.*)$/;
- }
- search(text) {
- const isMatch = text.startsWith(this.pattern);
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [0, this.pattern.length - 1]
- };
- }
- };
- var InversePrefixExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "inverse-prefix-exact";
- }
- static get multiRegex() {
- return /^!\^"(.*)"$/;
- }
- static get singleRegex() {
- return /^!\^(.*)$/;
- }
- search(text) {
- const isMatch = !text.startsWith(this.pattern);
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [0, text.length - 1]
- };
- }
- };
- var SuffixExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "suffix-exact";
- }
- static get multiRegex() {
- return /^"(.*)"\$$/;
- }
- static get singleRegex() {
- return /^(.*)\$$/;
- }
- search(text) {
- const isMatch = text.endsWith(this.pattern);
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [text.length - this.pattern.length, text.length - 1]
- };
- }
- };
- var InverseSuffixExactMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "inverse-suffix-exact";
- }
- static get multiRegex() {
- return /^!"(.*)"\$$/;
- }
- static get singleRegex() {
- return /^!(.*)\$$/;
- }
- search(text) {
- const isMatch = !text.endsWith(this.pattern);
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices: [0, text.length - 1]
- };
- }
- };
- var FuzzyMatch = class extends BaseMatch {
- constructor(pattern, {
- location = Config.location,
- threshold = Config.threshold,
- distance = Config.distance,
- includeMatches = Config.includeMatches,
- findAllMatches = Config.findAllMatches,
- minMatchCharLength = Config.minMatchCharLength,
- isCaseSensitive = Config.isCaseSensitive,
- ignoreLocation = Config.ignoreLocation
- } = {}) {
- super(pattern);
- this._bitapSearch = new BitapSearch(pattern, {
- location,
- threshold,
- distance,
- includeMatches,
- findAllMatches,
- minMatchCharLength,
- isCaseSensitive,
- ignoreLocation
- });
- }
- static get type() {
- return "fuzzy";
- }
- static get multiRegex() {
- return /^"(.*)"$/;
- }
- static get singleRegex() {
- return /^(.*)$/;
- }
- search(text) {
- return this._bitapSearch.searchIn(text);
- }
- };
- var IncludeMatch = class extends BaseMatch {
- constructor(pattern) {
- super(pattern);
- }
- static get type() {
- return "include";
- }
- static get multiRegex() {
- return /^'"(.*)"$/;
- }
- static get singleRegex() {
- return /^'(.*)$/;
- }
- search(text) {
- let location = 0;
- let index2;
- const indices = [];
- const patternLen = this.pattern.length;
- while ((index2 = text.indexOf(this.pattern, location)) > -1) {
- location = index2 + patternLen;
- indices.push([index2, location - 1]);
- }
- const isMatch = !!indices.length;
- return {
- isMatch,
- score: isMatch ? 0 : 1,
- indices
- };
- }
- };
- var searchers = [
- ExactMatch,
- IncludeMatch,
- PrefixExactMatch,
- InversePrefixExactMatch,
- InverseSuffixExactMatch,
- SuffixExactMatch,
- InverseExactMatch,
- FuzzyMatch
- ];
- var searchersLen = searchers.length;
- var SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
- var OR_TOKEN = "|";
- function parseQuery(pattern, options = {}) {
- return pattern.split(OR_TOKEN).map((item) => {
- let query2 = item.trim().split(SPACE_RE).filter((item2) => item2 && !!item2.trim());
- let results = [];
- for (let i = 0, len = query2.length; i < len; i += 1) {
- const queryItem = query2[i];
- let found = false;
- let idx = -1;
- while (!found && ++idx < searchersLen) {
- const searcher = searchers[idx];
- let token = searcher.isMultiMatch(queryItem);
- if (token) {
- results.push(new searcher(token, options));
- found = true;
- }
- }
- if (found) {
- continue;
- }
- idx = -1;
- while (++idx < searchersLen) {
- const searcher = searchers[idx];
- let token = searcher.isSingleMatch(queryItem);
- if (token) {
- results.push(new searcher(token, options));
- break;
- }
- }
- }
- return results;
- });
- }
- var MultiMatchSet = /* @__PURE__ */ new Set([FuzzyMatch.type, IncludeMatch.type]);
- var ExtendedSearch = class {
- constructor(pattern, {
- isCaseSensitive = Config.isCaseSensitive,
- includeMatches = Config.includeMatches,
- minMatchCharLength = Config.minMatchCharLength,
- ignoreLocation = Config.ignoreLocation,
- findAllMatches = Config.findAllMatches,
- location = Config.location,
- threshold = Config.threshold,
- distance = Config.distance
- } = {}) {
- this.query = null;
- this.options = {
- isCaseSensitive,
- includeMatches,
- minMatchCharLength,
- findAllMatches,
- ignoreLocation,
- location,
- threshold,
- distance
- };
- this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
- this.query = parseQuery(this.pattern, this.options);
- }
- static condition(_, options) {
- return options.useExtendedSearch;
- }
- searchIn(text) {
- const query2 = this.query;
- if (!query2) {
- return {
- isMatch: false,
- score: 1
- };
- }
- const { includeMatches, isCaseSensitive } = this.options;
- text = isCaseSensitive ? text : text.toLowerCase();
- let numMatches = 0;
- let allIndices = [];
- let totalScore = 0;
- for (let i = 0, qLen = query2.length; i < qLen; i += 1) {
- const searchers2 = query2[i];
- allIndices.length = 0;
- numMatches = 0;
- for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) {
- const searcher = searchers2[j];
- const { isMatch, indices, score } = searcher.search(text);
- if (isMatch) {
- numMatches += 1;
- totalScore += score;
- if (includeMatches) {
- const type3 = searcher.constructor.type;
- if (MultiMatchSet.has(type3)) {
- allIndices = [...allIndices, ...indices];
- } else {
- allIndices.push(indices);
- }
- }
- } else {
- totalScore = 0;
- numMatches = 0;
- allIndices.length = 0;
- break;
- }
- }
- if (numMatches) {
- let result = {
- isMatch: true,
- score: totalScore / numMatches
- };
- if (includeMatches) {
- result.indices = allIndices;
- }
- return result;
- }
- }
- return {
- isMatch: false,
- score: 1
- };
- }
- };
- var registeredSearchers = [];
- function register(...args) {
- registeredSearchers.push(...args);
- }
- function createSearcher(pattern, options) {
- for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {
- let searcherClass = registeredSearchers[i];
- if (searcherClass.condition(pattern, options)) {
- return new searcherClass(pattern, options);
- }
- }
- return new BitapSearch(pattern, options);
- }
- var LogicalOperator = {
- AND: "$and",
- OR: "$or"
- };
- var KeyType = {
- PATH: "$path",
- PATTERN: "$val"
- };
- var isExpression = (query2) => !!(query2[LogicalOperator.AND] || query2[LogicalOperator.OR]);
- var isPath = (query2) => !!query2[KeyType.PATH];
- var isLeaf = (query2) => !isArray(query2) && isObject(query2) && !isExpression(query2);
- var convertToExplicit = (query2) => ({
- [LogicalOperator.AND]: Object.keys(query2).map((key) => ({
- [key]: query2[key]
- }))
- });
- function parse(query2, options, { auto = true } = {}) {
- const next = (query3) => {
- let keys4 = Object.keys(query3);
- const isQueryPath = isPath(query3);
- if (!isQueryPath && keys4.length > 1 && !isExpression(query3)) {
- return next(convertToExplicit(query3));
- }
- if (isLeaf(query3)) {
- const key = isQueryPath ? query3[KeyType.PATH] : keys4[0];
- const pattern = isQueryPath ? query3[KeyType.PATTERN] : query3[key];
- if (!isString(pattern)) {
- throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
- }
- const obj = {
- keyId: createKeyId(key),
- pattern
- };
- if (auto) {
- obj.searcher = createSearcher(pattern, options);
- }
- return obj;
- }
- let node = {
- children: [],
- operator: keys4[0]
- };
- keys4.forEach((key) => {
- const value = query3[key];
- if (isArray(value)) {
- value.forEach((item) => {
- node.children.push(next(item));
- });
- }
- });
- return node;
- };
- if (!isExpression(query2)) {
- query2 = convertToExplicit(query2);
- }
- return next(query2);
- }
- function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
- results.forEach((result) => {
- let totalScore = 1;
- result.matches.forEach(({ key, norm: norm2, score }) => {
- const weight = key ? key.weight : null;
- totalScore *= Math.pow(
- score === 0 && weight ? Number.EPSILON : score,
- (weight || 1) * (ignoreFieldNorm ? 1 : norm2)
- );
- });
- result.score = totalScore;
- });
- }
- function transformMatches(result, data) {
- const matches = result.matches;
- data.matches = [];
- if (!isDefined(matches)) {
- return;
- }
- matches.forEach((match) => {
- if (!isDefined(match.indices) || !match.indices.length) {
- return;
- }
- const { indices, value } = match;
- let obj = {
- indices,
- value
- };
- if (match.key) {
- obj.key = match.key.src;
- }
- if (match.idx > -1) {
- obj.refIndex = match.idx;
- }
- data.matches.push(obj);
- });
- }
- function transformScore(result, data) {
- data.score = result.score;
- }
- function format(results, docs, {
- includeMatches = Config.includeMatches,
- includeScore = Config.includeScore
- } = {}) {
- const transformers = [];
- if (includeMatches)
- transformers.push(transformMatches);
- if (includeScore)
- transformers.push(transformScore);
- return results.map((result) => {
- const { idx } = result;
- const data = {
- item: docs[idx],
- refIndex: idx
- };
- if (transformers.length) {
- transformers.forEach((transformer) => {
- transformer(result, data);
- });
- }
- return data;
- });
- }
- var Fuse = class {
- constructor(docs, options = {}, index2) {
- this.options = { ...Config, ...options };
- if (this.options.useExtendedSearch && false) {
- throw new Error(EXTENDED_SEARCH_UNAVAILABLE);
- }
- this._keyStore = new KeyStore(this.options.keys);
- this.setCollection(docs, index2);
- }
- setCollection(docs, index2) {
- this._docs = docs;
- if (index2 && !(index2 instanceof FuseIndex)) {
- throw new Error(INCORRECT_INDEX_TYPE);
- }
- this._myIndex = index2 || createIndex(this.options.keys, this._docs, {
- getFn: this.options.getFn,
- fieldNormWeight: this.options.fieldNormWeight
- });
- }
- add(doc) {
- if (!isDefined(doc)) {
- return;
- }
- this._docs.push(doc);
- this._myIndex.add(doc);
- }
- remove(predicate = () => false) {
- const results = [];
- for (let i = 0, len = this._docs.length; i < len; i += 1) {
- const doc = this._docs[i];
- if (predicate(doc, i)) {
- this.removeAt(i);
- i -= 1;
- len -= 1;
- results.push(doc);
- }
- }
- return results;
- }
- removeAt(idx) {
- this._docs.splice(idx, 1);
- this._myIndex.removeAt(idx);
- }
- getIndex() {
- return this._myIndex;
- }
- search(query2, { limit = -1 } = {}) {
- const {
- includeMatches,
- includeScore,
- shouldSort,
- sortFn,
- ignoreFieldNorm
- } = this.options;
- let results = isString(query2) ? isString(this._docs[0]) ? this._searchStringList(query2) : this._searchObjectList(query2) : this._searchLogical(query2);
- computeScore(results, { ignoreFieldNorm });
- if (shouldSort) {
- results.sort(sortFn);
- }
- if (isNumber(limit) && limit > -1) {
- results = results.slice(0, limit);
- }
- return format(results, this._docs, {
- includeMatches,
- includeScore
- });
- }
- _searchStringList(query2) {
- const searcher = createSearcher(query2, this.options);
- const { records } = this._myIndex;
- const results = [];
- records.forEach(({ v: text, i: idx, n: norm2 }) => {
- if (!isDefined(text)) {
- return;
- }
- const { isMatch, score, indices } = searcher.searchIn(text);
- if (isMatch) {
- results.push({
- item: text,
- idx,
- matches: [{ score, value: text, norm: norm2, indices }]
- });
- }
- });
- return results;
- }
- _searchLogical(query2) {
- const expression = parse(query2, this.options);
- const evaluate = (node, item, idx) => {
- if (!node.children) {
- const { keyId, searcher } = node;
- const matches = this._findMatches({
- key: this._keyStore.get(keyId),
- value: this._myIndex.getValueForItemAtKeyId(item, keyId),
- searcher
- });
- if (matches && matches.length) {
- return [
- {
- idx,
- item,
- matches
- }
- ];
- }
- return [];
- }
- const res = [];
- for (let i = 0, len = node.children.length; i < len; i += 1) {
- const child = node.children[i];
- const result = evaluate(child, item, idx);
- if (result.length) {
- res.push(...result);
- } else if (node.operator === LogicalOperator.AND) {
- return [];
- }
- }
- return res;
- };
- const records = this._myIndex.records;
- const resultMap = {};
- const results = [];
- records.forEach(({ $: item, i: idx }) => {
- if (isDefined(item)) {
- let expResults = evaluate(expression, item, idx);
- if (expResults.length) {
- if (!resultMap[idx]) {
- resultMap[idx] = { idx, item, matches: [] };
- results.push(resultMap[idx]);
- }
- expResults.forEach(({ matches }) => {
- resultMap[idx].matches.push(...matches);
- });
- }
- }
- });
- return results;
- }
- _searchObjectList(query2) {
- const searcher = createSearcher(query2, this.options);
- const { keys: keys4, records } = this._myIndex;
- const results = [];
- records.forEach(({ $: item, i: idx }) => {
- if (!isDefined(item)) {
- return;
- }
- let matches = [];
- keys4.forEach((key, keyIndex) => {
- matches.push(
- ...this._findMatches({
- key,
- value: item[keyIndex],
- searcher
- })
- );
- });
- if (matches.length) {
- results.push({
- idx,
- item,
- matches
- });
- }
- });
- return results;
- }
- _findMatches({ key, value, searcher }) {
- if (!isDefined(value)) {
- return [];
- }
- let matches = [];
- if (isArray(value)) {
- value.forEach(({ v: text, i: idx, n: norm2 }) => {
- if (!isDefined(text)) {
- return;
- }
- const { isMatch, score, indices } = searcher.searchIn(text);
- if (isMatch) {
- matches.push({
- score,
- key,
- value: text,
- idx,
- norm: norm2,
- indices
- });
- }
- });
- } else {
- const { v: text, n: norm2 } = value;
- const { isMatch, score, indices } = searcher.searchIn(text);
- if (isMatch) {
- matches.push({ score, key, value: text, norm: norm2, indices });
- }
- }
- return matches;
- }
- };
- Fuse.version = "6.6.2";
- Fuse.createIndex = createIndex;
- Fuse.parseIndex = parseIndex;
- Fuse.config = Config;
- {
- Fuse.parseQuery = parse;
- }
- {
- register(ExtendedSearch);
- }
-
- // src/lib/number.mod.ts
- Number.prototype.mod = function(n) {
- return knuth_mod(this, n);
- };
- function knuth_mod(dividend, divisor) {
- return dividend - divisor * Math.floor(dividend / divisor);
- }
-
- // src/lib/itertools.ts
- function head(iterable) {
- const iterator = iterable[Symbol.iterator]();
- const result = iterator.next();
- if (result.done)
- throw RangeError("Empty iterator has no head/tail");
- else
- return result.value;
- }
- function* filter(iter, predicate) {
- for (const v of iter) {
- if (predicate(v))
- yield v;
- }
- }
- function find(iter, predicate) {
- return head(filter(iter, predicate));
- }
- function* enumerate(iterable) {
- let index2 = 0;
- for (const element of iterable) {
- yield [index2, element];
- index2++;
- }
- }
- function* izip(...arrays) {
- const iterators = arrays.map((e) => e[Symbol.iterator]());
- const box = Array(arrays.length);
- for (let v of iterators[0]) {
- box[0] = v;
- let i;
- try {
- for ([i, v] of enumerate(iterators.slice(1))) {
- box[i + 1] = head(v);
- }
- yield [...box];
- } catch (e) {
- return;
- }
- }
- }
-
- // src/lib/convert.ts
- function toNumber(s) {
- const n = Number(s);
- if (isNaN(n))
- throw new Error("Not a number! " + s);
- else
- return n;
- }
-
- // node_modules/ramda/es/internal/_isPlaceholder.js
- function _isPlaceholder(a) {
- return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
- }
-
- // node_modules/ramda/es/internal/_curry1.js
- function _curry1(fn) {
- return function f1(a) {
- if (arguments.length === 0 || _isPlaceholder(a)) {
- return f1;
- } else {
- return fn.apply(this, arguments);
- }
- };
- }
-
- // node_modules/ramda/es/internal/_curry2.js
- function _curry2(fn) {
- return function f2(a, b) {
- switch (arguments.length) {
- case 0:
- return f2;
- case 1:
- return _isPlaceholder(a) ? f2 : _curry1(function(_b) {
- return fn(a, _b);
- });
- default:
- return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function(_a) {
- return fn(_a, b);
- }) : _isPlaceholder(b) ? _curry1(function(_b) {
- return fn(a, _b);
- }) : fn(a, b);
- }
- };
- }
-
- // node_modules/ramda/es/internal/_arity.js
- function _arity(n, fn) {
- switch (n) {
- case 0:
- return function() {
- return fn.apply(this, arguments);
- };
- case 1:
- return function(a0) {
- return fn.apply(this, arguments);
- };
- case 2:
- return function(a0, a1) {
- return fn.apply(this, arguments);
- };
- case 3:
- return function(a0, a1, a2) {
- return fn.apply(this, arguments);
- };
- case 4:
- return function(a0, a1, a2, a3) {
- return fn.apply(this, arguments);
- };
- case 5:
- return function(a0, a1, a2, a3, a4) {
- return fn.apply(this, arguments);
- };
- case 6:
- return function(a0, a1, a2, a3, a4, a5) {
- return fn.apply(this, arguments);
- };
- case 7:
- return function(a0, a1, a2, a3, a4, a5, a6) {
- return fn.apply(this, arguments);
- };
- case 8:
- return function(a0, a1, a2, a3, a4, a5, a6, a7) {
- return fn.apply(this, arguments);
- };
- case 9:
- return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) {
- return fn.apply(this, arguments);
- };
- case 10:
- return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
- return fn.apply(this, arguments);
- };
- default:
- throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
- }
- }
-
- // node_modules/ramda/es/internal/_curryN.js
- function _curryN(length, received, fn) {
- return function() {
- var combined = [];
- var argsIdx = 0;
- var left = length;
- var combinedIdx = 0;
- while (combinedIdx < received.length || argsIdx < arguments.length) {
- var result;
- if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
- result = received[combinedIdx];
- } else {
- result = arguments[argsIdx];
- argsIdx += 1;
- }
- combined[combinedIdx] = result;
- if (!_isPlaceholder(result)) {
- left -= 1;
- }
- combinedIdx += 1;
- }
- return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
- };
- }
-
- // node_modules/ramda/es/curryN.js
- var curryN = /* @__PURE__ */ _curry2(function curryN2(length, fn) {
- if (length === 1) {
- return _curry1(fn);
- }
- return _arity(length, _curryN(length, [], fn));
- });
- var curryN_default = curryN;
-
- // node_modules/ramda/es/internal/_curry3.js
- function _curry3(fn) {
- return function f3(a, b, c) {
- switch (arguments.length) {
- case 0:
- return f3;
- case 1:
- return _isPlaceholder(a) ? f3 : _curry2(function(_b, _c) {
- return fn(a, _b, _c);
- });
- case 2:
- return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function(_a, _c) {
- return fn(_a, b, _c);
- }) : _isPlaceholder(b) ? _curry2(function(_b, _c) {
- return fn(a, _b, _c);
- }) : _curry1(function(_c) {
- return fn(a, b, _c);
- });
- default:
- return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function(_a, _b) {
- return fn(_a, _b, c);
- }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function(_a, _c) {
- return fn(_a, b, _c);
- }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function(_b, _c) {
- return fn(a, _b, _c);
- }) : _isPlaceholder(a) ? _curry1(function(_a) {
- return fn(_a, b, c);
- }) : _isPlaceholder(b) ? _curry1(function(_b) {
- return fn(a, _b, c);
- }) : _isPlaceholder(c) ? _curry1(function(_c) {
- return fn(a, b, _c);
- }) : fn(a, b, c);
- }
- };
- }
-
- // node_modules/ramda/es/internal/_isArray.js
- var isArray_default = Array.isArray || function _isArray(val) {
- return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
- };
-
- // node_modules/ramda/es/internal/_isTransformer.js
- function _isTransformer(obj) {
- return obj != null && typeof obj["@@transducer/step"] === "function";
- }
-
- // node_modules/ramda/es/internal/_dispatchable.js
- function _dispatchable(methodNames, transducerCreator, fn) {
- return function() {
- if (arguments.length === 0) {
- return fn();
- }
- var obj = arguments[arguments.length - 1];
- if (!isArray_default(obj)) {
- var idx = 0;
- while (idx < methodNames.length) {
- if (typeof obj[methodNames[idx]] === "function") {
- return obj[methodNames[idx]].apply(obj, Array.prototype.slice.call(arguments, 0, -1));
- }
- idx += 1;
- }
- if (_isTransformer(obj)) {
- var transducer = transducerCreator.apply(null, Array.prototype.slice.call(arguments, 0, -1));
- return transducer(obj);
- }
- }
- return fn.apply(this, arguments);
- };
- }
-
- // node_modules/ramda/es/internal/_xfBase.js
- var xfBase_default = {
- init: function() {
- return this.xf["@@transducer/init"]();
- },
- result: function(result) {
- return this.xf["@@transducer/result"](result);
- }
- };
-
- // node_modules/ramda/es/internal/_map.js
- function _map(fn, functor) {
- var idx = 0;
- var len = functor.length;
- var result = Array(len);
- while (idx < len) {
- result[idx] = fn(functor[idx]);
- idx += 1;
- }
- return result;
- }
-
- // node_modules/ramda/es/internal/_isString.js
- function _isString(x) {
- return Object.prototype.toString.call(x) === "[object String]";
- }
-
- // node_modules/ramda/es/internal/_isArrayLike.js
- var _isArrayLike = /* @__PURE__ */ _curry1(function isArrayLike(x) {
- if (isArray_default(x)) {
- return true;
- }
- if (!x) {
- return false;
- }
- if (typeof x !== "object") {
- return false;
- }
- if (_isString(x)) {
- return false;
- }
- if (x.length === 0) {
- return true;
- }
- if (x.length > 0) {
- return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
- }
- return false;
- });
- var isArrayLike_default = _isArrayLike;
-
- // node_modules/ramda/es/internal/_xwrap.js
- var XWrap = /* @__PURE__ */ function() {
- function XWrap2(fn) {
- this.f = fn;
- }
- XWrap2.prototype["@@transducer/init"] = function() {
- throw new Error("init not implemented on XWrap");
- };
- XWrap2.prototype["@@transducer/result"] = function(acc) {
- return acc;
- };
- XWrap2.prototype["@@transducer/step"] = function(acc, x) {
- return this.f(acc, x);
- };
- return XWrap2;
- }();
- function _xwrap(fn) {
- return new XWrap(fn);
- }
-
- // node_modules/ramda/es/bind.js
- var bind = /* @__PURE__ */ _curry2(function bind2(fn, thisObj) {
- return _arity(fn.length, function() {
- return fn.apply(thisObj, arguments);
- });
- });
- var bind_default = bind;
-
- // node_modules/ramda/es/internal/_reduce.js
- function _arrayReduce(xf, acc, list) {
- var idx = 0;
- var len = list.length;
- while (idx < len) {
- acc = xf["@@transducer/step"](acc, list[idx]);
- if (acc && acc["@@transducer/reduced"]) {
- acc = acc["@@transducer/value"];
- break;
- }
- idx += 1;
- }
- return xf["@@transducer/result"](acc);
- }
- function _iterableReduce(xf, acc, iter) {
- var step = iter.next();
- while (!step.done) {
- acc = xf["@@transducer/step"](acc, step.value);
- if (acc && acc["@@transducer/reduced"]) {
- acc = acc["@@transducer/value"];
- break;
- }
- step = iter.next();
- }
- return xf["@@transducer/result"](acc);
- }
- function _methodReduce(xf, acc, obj, methodName) {
- return xf["@@transducer/result"](obj[methodName](bind_default(xf["@@transducer/step"], xf), acc));
- }
- var symIterator = typeof Symbol !== "undefined" ? Symbol.iterator : "@@iterator";
- function _reduce(fn, acc, list) {
- if (typeof fn === "function") {
- fn = _xwrap(fn);
- }
- if (isArrayLike_default(list)) {
- return _arrayReduce(fn, acc, list);
- }
- if (typeof list["fantasy-land/reduce"] === "function") {
- return _methodReduce(fn, acc, list, "fantasy-land/reduce");
- }
- if (list[symIterator] != null) {
- return _iterableReduce(fn, acc, list[symIterator]());
- }
- if (typeof list.next === "function") {
- return _iterableReduce(fn, acc, list);
- }
- if (typeof list.reduce === "function") {
- return _methodReduce(fn, acc, list, "reduce");
- }
- throw new TypeError("reduce: list must be array or iterable");
- }
-
- // node_modules/ramda/es/internal/_xmap.js
- var XMap = /* @__PURE__ */ function() {
- function XMap2(f, xf) {
- this.xf = xf;
- this.f = f;
- }
- XMap2.prototype["@@transducer/init"] = xfBase_default.init;
- XMap2.prototype["@@transducer/result"] = xfBase_default.result;
- XMap2.prototype["@@transducer/step"] = function(result, input) {
- return this.xf["@@transducer/step"](result, this.f(input));
- };
- return XMap2;
- }();
- var _xmap = /* @__PURE__ */ _curry2(function _xmap2(f, xf) {
- return new XMap(f, xf);
- });
- var xmap_default = _xmap;
-
- // node_modules/ramda/es/internal/_has.js
- function _has(prop, obj) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
-
- // node_modules/ramda/es/internal/_isArguments.js
- var toString2 = Object.prototype.toString;
- var _isArguments = /* @__PURE__ */ function() {
- return toString2.call(arguments) === "[object Arguments]" ? function _isArguments2(x) {
- return toString2.call(x) === "[object Arguments]";
- } : function _isArguments2(x) {
- return _has("callee", x);
- };
- }();
- var isArguments_default = _isArguments;
-
- // node_modules/ramda/es/keys.js
- var hasEnumBug = !/* @__PURE__ */ {
- toString: null
- }.propertyIsEnumerable("toString");
- var nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
- var hasArgsEnumBug = /* @__PURE__ */ function() {
- "use strict";
- return arguments.propertyIsEnumerable("length");
- }();
- var contains = function contains2(list, item) {
- var idx = 0;
- while (idx < list.length) {
- if (list[idx] === item) {
- return true;
- }
- idx += 1;
- }
- return false;
- };
- var keys = typeof Object.keys === "function" && !hasArgsEnumBug ? /* @__PURE__ */ _curry1(function keys2(obj) {
- return Object(obj) !== obj ? [] : Object.keys(obj);
- }) : /* @__PURE__ */ _curry1(function keys3(obj) {
- if (Object(obj) !== obj) {
- return [];
- }
- var prop, nIdx;
- var ks = [];
- var checkArgsLength = hasArgsEnumBug && isArguments_default(obj);
- for (prop in obj) {
- if (_has(prop, obj) && (!checkArgsLength || prop !== "length")) {
- ks[ks.length] = prop;
- }
- }
- if (hasEnumBug) {
- nIdx = nonEnumerableProps.length - 1;
- while (nIdx >= 0) {
- prop = nonEnumerableProps[nIdx];
- if (_has(prop, obj) && !contains(ks, prop)) {
- ks[ks.length] = prop;
- }
- nIdx -= 1;
- }
- }
- return ks;
- });
- var keys_default = keys;
-
- // node_modules/ramda/es/map.js
- var map = /* @__PURE__ */ _curry2(
- /* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], xmap_default, function map2(fn, functor) {
- switch (Object.prototype.toString.call(functor)) {
- case "[object Function]":
- return curryN_default(functor.length, function() {
- return fn.call(this, functor.apply(this, arguments));
- });
- case "[object Object]":
- return _reduce(function(acc, key) {
- acc[key] = fn(functor[key]);
- return acc;
- }, {}, keys_default(functor));
- default:
- return _map(fn, functor);
- }
- })
- );
- var map_default = map;
-
- // node_modules/ramda/es/internal/_isInteger.js
- var isInteger_default = Number.isInteger || function _isInteger(n) {
- return n << 0 === n;
- };
-
- // node_modules/ramda/es/reduce.js
- var reduce = /* @__PURE__ */ _curry3(_reduce);
- var reduce_default = reduce;
-
- // node_modules/ramda/es/type.js
- var type = /* @__PURE__ */ _curry1(function type2(val) {
- return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
- });
- var type_default = type;
-
- // node_modules/ramda/es/internal/_pipe.js
- function _pipe(f, g) {
- return function() {
- return g.call(this, f.apply(this, arguments));
- };
- }
-
- // node_modules/ramda/es/internal/_checkForMethod.js
- function _checkForMethod(methodname, fn) {
- return function() {
- var length = arguments.length;
- if (length === 0) {
- return fn();
- }
- var obj = arguments[length - 1];
- return isArray_default(obj) || typeof obj[methodname] !== "function" ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
- };
- }
-
- // node_modules/ramda/es/slice.js
- var slice = /* @__PURE__ */ _curry3(
- /* @__PURE__ */ _checkForMethod("slice", function slice2(fromIndex, toIndex, list) {
- return Array.prototype.slice.call(list, fromIndex, toIndex);
- })
- );
- var slice_default = slice;
-
- // node_modules/ramda/es/tail.js
- var tail = /* @__PURE__ */ _curry1(
- /* @__PURE__ */ _checkForMethod(
- "tail",
- /* @__PURE__ */ slice_default(1, Infinity)
- )
- );
- var tail_default = tail;
-
- // node_modules/ramda/es/pipe.js
- function pipe() {
- if (arguments.length === 0) {
- throw new Error("pipe requires at least one argument");
- }
- return _arity(arguments[0].length, reduce_default(_pipe, arguments[0], tail_default(arguments)));
- }
-
- // node_modules/ramda/es/reverse.js
- var reverse = /* @__PURE__ */ _curry1(function reverse2(list) {
- return _isString(list) ? list.split("").reverse().join("") : Array.prototype.slice.call(list, 0).reverse();
- });
- var reverse_default = reverse;
-
- // node_modules/ramda/es/internal/_identity.js
- function _identity(x) {
- return x;
- }
-
- // node_modules/ramda/es/identity.js
- var identity = /* @__PURE__ */ _curry1(_identity);
- var identity_default = identity;
-
- // node_modules/ramda/es/internal/_arrayFromIterator.js
- function _arrayFromIterator(iter) {
- var list = [];
- var next;
- while (!(next = iter.next()).done) {
- list.push(next.value);
- }
- return list;
- }
-
- // node_modules/ramda/es/internal/_includesWith.js
- function _includesWith(pred, x, list) {
- var idx = 0;
- var len = list.length;
- while (idx < len) {
- if (pred(x, list[idx])) {
- return true;
- }
- idx += 1;
- }
- return false;
- }
-
- // node_modules/ramda/es/internal/_functionName.js
- function _functionName(f) {
- var match = String(f).match(/^function (\w*)/);
- return match == null ? "" : match[1];
- }
-
- // node_modules/ramda/es/internal/_objectIs.js
- function _objectIs(a, b) {
- if (a === b) {
- return a !== 0 || 1 / a === 1 / b;
- } else {
- return a !== a && b !== b;
- }
- }
- var objectIs_default = typeof Object.is === "function" ? Object.is : _objectIs;
-
- // node_modules/ramda/es/internal/_equals.js
- function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
- var a = _arrayFromIterator(aIterator);
- var b = _arrayFromIterator(bIterator);
- function eq(_a, _b) {
- return _equals(_a, _b, stackA.slice(), stackB.slice());
- }
- return !_includesWith(function(b2, aItem) {
- return !_includesWith(eq, aItem, b2);
- }, b, a);
- }
- function _equals(a, b, stackA, stackB) {
- if (objectIs_default(a, b)) {
- return true;
- }
- var typeA = type_default(a);
- if (typeA !== type_default(b)) {
- return false;
- }
- if (typeof a["fantasy-land/equals"] === "function" || typeof b["fantasy-land/equals"] === "function") {
- return typeof a["fantasy-land/equals"] === "function" && a["fantasy-land/equals"](b) && typeof b["fantasy-land/equals"] === "function" && b["fantasy-land/equals"](a);
- }
- if (typeof a.equals === "function" || typeof b.equals === "function") {
- return typeof a.equals === "function" && a.equals(b) && typeof b.equals === "function" && b.equals(a);
- }
- switch (typeA) {
- case "Arguments":
- case "Array":
- case "Object":
- if (typeof a.constructor === "function" && _functionName(a.constructor) === "Promise") {
- return a === b;
- }
- break;
- case "Boolean":
- case "Number":
- case "String":
- if (!(typeof a === typeof b && objectIs_default(a.valueOf(), b.valueOf()))) {
- return false;
- }
- break;
- case "Date":
- if (!objectIs_default(a.valueOf(), b.valueOf())) {
- return false;
- }
- break;
- case "Error":
- return a.name === b.name && a.message === b.message;
- case "RegExp":
- if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
- return false;
- }
- break;
- }
- var idx = stackA.length - 1;
- while (idx >= 0) {
- if (stackA[idx] === a) {
- return stackB[idx] === b;
- }
- idx -= 1;
- }
- switch (typeA) {
- case "Map":
- if (a.size !== b.size) {
- return false;
- }
- return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
- case "Set":
- if (a.size !== b.size) {
- return false;
- }
- return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
- case "Arguments":
- case "Array":
- case "Object":
- case "Boolean":
- case "Number":
- case "String":
- case "Date":
- case "Error":
- case "RegExp":
- case "Int8Array":
- case "Uint8Array":
- case "Uint8ClampedArray":
- case "Int16Array":
- case "Uint16Array":
- case "Int32Array":
- case "Uint32Array":
- case "Float32Array":
- case "Float64Array":
- case "ArrayBuffer":
- break;
- default:
- return false;
- }
- var keysA = keys_default(a);
- if (keysA.length !== keys_default(b).length) {
- return false;
- }
- var extendedStackA = stackA.concat([a]);
- var extendedStackB = stackB.concat([b]);
- idx = keysA.length - 1;
- while (idx >= 0) {
- var key = keysA[idx];
- if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
- return false;
- }
- idx -= 1;
- }
- return true;
- }
-
- // node_modules/ramda/es/equals.js
- var equals = /* @__PURE__ */ _curry2(function equals2(a, b) {
- return _equals(a, b, [], []);
- });
- var equals_default = equals;
-
- // node_modules/ramda/es/internal/_indexOf.js
- function _indexOf(list, a, idx) {
- var inf, item;
- if (typeof list.indexOf === "function") {
- switch (typeof a) {
- case "number":
- if (a === 0) {
- inf = 1 / a;
- while (idx < list.length) {
- item = list[idx];
- if (item === 0 && 1 / item === inf) {
- return idx;
- }
- idx += 1;
- }
- return -1;
- } else if (a !== a) {
- while (idx < list.length) {
- item = list[idx];
- if (typeof item === "number" && item !== item) {
- return idx;
- }
- idx += 1;
- }
- return -1;
- }
- return list.indexOf(a, idx);
- case "string":
- case "boolean":
- case "function":
- case "undefined":
- return list.indexOf(a, idx);
- case "object":
- if (a === null) {
- return list.indexOf(a, idx);
- }
- }
- }
- while (idx < list.length) {
- if (equals_default(list[idx], a)) {
- return idx;
- }
- idx += 1;
- }
- return -1;
- }
-
- // node_modules/ramda/es/internal/_includes.js
- function _includes(a, list) {
- return _indexOf(list, a, 0) >= 0;
- }
-
- // node_modules/ramda/es/internal/_toISOString.js
- var pad = function pad2(n) {
- return (n < 10 ? "0" : "") + n;
- };
- var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
- return d.toISOString();
- } : function _toISOString3(d) {
- return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
- };
-
- // node_modules/ramda/es/internal/_complement.js
- function _complement(f) {
- return function() {
- return !f.apply(this, arguments);
- };
- }
-
- // node_modules/ramda/es/internal/_filter.js
- function _filter(fn, list) {
- var idx = 0;
- var len = list.length;
- var result = [];
- while (idx < len) {
- if (fn(list[idx])) {
- result[result.length] = list[idx];
- }
- idx += 1;
- }
- return result;
- }
-
- // node_modules/ramda/es/internal/_isObject.js
- function _isObject(x) {
- return Object.prototype.toString.call(x) === "[object Object]";
- }
-
- // node_modules/ramda/es/internal/_xfilter.js
- var XFilter = /* @__PURE__ */ function() {
- function XFilter2(f, xf) {
- this.xf = xf;
- this.f = f;
- }
- XFilter2.prototype["@@transducer/init"] = xfBase_default.init;
- XFilter2.prototype["@@transducer/result"] = xfBase_default.result;
- XFilter2.prototype["@@transducer/step"] = function(result, input) {
- return this.f(input) ? this.xf["@@transducer/step"](result, input) : result;
- };
- return XFilter2;
- }();
- var _xfilter = /* @__PURE__ */ _curry2(function _xfilter2(f, xf) {
- return new XFilter(f, xf);
- });
- var xfilter_default = _xfilter;
-
- // node_modules/ramda/es/filter.js
- var filter2 = /* @__PURE__ */ _curry2(
- /* @__PURE__ */ _dispatchable(["fantasy-land/filter", "filter"], xfilter_default, function(pred, filterable) {
- return _isObject(filterable) ? _reduce(function(acc, key) {
- if (pred(filterable[key])) {
- acc[key] = filterable[key];
- }
- return acc;
- }, {}, keys_default(filterable)) : (
- // else
- _filter(pred, filterable)
- );
- })
- );
- var filter_default = filter2;
-
- // node_modules/ramda/es/reject.js
- var reject = /* @__PURE__ */ _curry2(function reject2(pred, filterable) {
- return filter_default(_complement(pred), filterable);
- });
- var reject_default = reject;
-
- // node_modules/ramda/es/internal/_Set.js
- var _Set = /* @__PURE__ */ function() {
- function _Set2() {
- this._nativeSet = typeof Set === "function" ? /* @__PURE__ */ new Set() : null;
- this._items = {};
- }
- _Set2.prototype.add = function(item) {
- return !hasOrAdd(item, true, this);
- };
- _Set2.prototype.has = function(item) {
- return hasOrAdd(item, false, this);
- };
- return _Set2;
- }();
- function hasOrAdd(item, shouldAdd, set) {
- var type3 = typeof item;
- var prevSize, newSize;
- switch (type3) {
- case "string":
- case "number":
- if (item === 0 && 1 / item === -Infinity) {
- if (set._items["-0"]) {
- return true;
- } else {
- if (shouldAdd) {
- set._items["-0"] = true;
- }
- return false;
- }
- }
- if (set._nativeSet !== null) {
- if (shouldAdd) {
- prevSize = set._nativeSet.size;
- set._nativeSet.add(item);
- newSize = set._nativeSet.size;
- return newSize === prevSize;
- } else {
- return set._nativeSet.has(item);
- }
- } else {
- if (!(type3 in set._items)) {
- if (shouldAdd) {
- set._items[type3] = {};
- set._items[type3][item] = true;
- }
- return false;
- } else if (item in set._items[type3]) {
- return true;
- } else {
- if (shouldAdd) {
- set._items[type3][item] = true;
- }
- return false;
- }
- }
- case "boolean":
- if (type3 in set._items) {
- var bIdx = item ? 1 : 0;
- if (set._items[type3][bIdx]) {
- return true;
- } else {
- if (shouldAdd) {
- set._items[type3][bIdx] = true;
- }
- return false;
- }
- } else {
- if (shouldAdd) {
- set._items[type3] = item ? [false, true] : [true, false];
- }
- return false;
- }
- case "function":
- if (set._nativeSet !== null) {
- if (shouldAdd) {
- prevSize = set._nativeSet.size;
- set._nativeSet.add(item);
- newSize = set._nativeSet.size;
- return newSize === prevSize;
- } else {
- return set._nativeSet.has(item);
- }
- } else {
- if (!(type3 in set._items)) {
- if (shouldAdd) {
- set._items[type3] = [item];
- }
- return false;
- }
- if (!_includes(item, set._items[type3])) {
- if (shouldAdd) {
- set._items[type3].push(item);
- }
- return false;
- }
- return true;
- }
- case "undefined":
- if (set._items[type3]) {
- return true;
- } else {
- if (shouldAdd) {
- set._items[type3] = true;
- }
- return false;
- }
- case "object":
- if (item === null) {
- if (!set._items["null"]) {
- if (shouldAdd) {
- set._items["null"] = true;
- }
- return false;
- }
- return true;
- }
- default:
- type3 = Object.prototype.toString.call(item);
- if (!(type3 in set._items)) {
- if (shouldAdd) {
- set._items[type3] = [item];
- }
- return false;
- }
- if (!_includes(item, set._items[type3])) {
- if (shouldAdd) {
- set._items[type3].push(item);
- }
- return false;
- }
- return true;
- }
- }
- var Set_default = _Set;
-
- // node_modules/ramda/es/internal/_xuniqBy.js
- var XUniqBy = /* @__PURE__ */ function() {
- function XUniqBy2(f, xf) {
- this.xf = xf;
- this.f = f;
- this.set = new Set_default();
- }
- XUniqBy2.prototype["@@transducer/init"] = xfBase_default.init;
- XUniqBy2.prototype["@@transducer/result"] = xfBase_default.result;
- XUniqBy2.prototype["@@transducer/step"] = function(result, input) {
- return this.set.add(this.f(input)) ? this.xf["@@transducer/step"](result, input) : result;
- };
- return XUniqBy2;
- }();
- var _xuniqBy = /* @__PURE__ */ _curry2(function _xuniqBy2(f, xf) {
- return new XUniqBy(f, xf);
- });
- var xuniqBy_default = _xuniqBy;
-
- // node_modules/ramda/es/uniqBy.js
- var uniqBy = /* @__PURE__ */ _curry2(
- /* @__PURE__ */ _dispatchable([], xuniqBy_default, function(fn, list) {
- var set = new Set_default();
- var result = [];
- var idx = 0;
- var appliedItem, item;
- while (idx < list.length) {
- item = list[idx];
- appliedItem = fn(item);
- if (set.add(appliedItem)) {
- result.push(item);
- }
- idx += 1;
- }
- return result;
- })
- );
- var uniqBy_default = uniqBy;
-
- // node_modules/ramda/es/uniq.js
- var uniq = /* @__PURE__ */ uniqBy_default(identity_default);
- var uniq_default = uniq;
-
- // node_modules/ramda/es/internal/_objectAssign.js
- function _objectAssign(target) {
- if (target == null) {
- throw new TypeError("Cannot convert undefined or null to object");
- }
- var output = Object(target);
- var idx = 1;
- var length = arguments.length;
- while (idx < length) {
- var source = arguments[idx];
- if (source != null) {
- for (var nextKey in source) {
- if (_has(nextKey, source)) {
- output[nextKey] = source[nextKey];
- }
- }
- }
- idx += 1;
- }
- return output;
- }
- var objectAssign_default = typeof Object.assign === "function" ? Object.assign : _objectAssign;
-
- // node_modules/ramda/es/is.js
- var is = /* @__PURE__ */ _curry2(function is2(Ctor, val) {
- return val instanceof Ctor || val != null && (val.constructor === Ctor || Ctor.name === "Object" && typeof val === "object");
- });
- var is_default = is;
-
- // node_modules/ramda/es/mergeLeft.js
- var mergeLeft = /* @__PURE__ */ _curry2(function mergeLeft2(l, r) {
- return objectAssign_default({}, r, l);
- });
- var mergeLeft_default = mergeLeft;
-
- // node_modules/ramda/es/mergeRight.js
- var mergeRight = /* @__PURE__ */ _curry2(function mergeRight2(l, r) {
- return objectAssign_default({}, l, r);
- });
- var mergeRight_default = mergeRight;
-
- // node_modules/ramda/es/pick.js
- var pick = /* @__PURE__ */ _curry2(function pick2(names, obj) {
- var result = {};
- var idx = 0;
- while (idx < names.length) {
- if (names[idx] in obj) {
- result[names[idx]] = obj[names[idx]];
- }
- idx += 1;
- }
- return result;
- });
- var pick_default = pick;
-
- // node_modules/ramda/es/trim.js
- var hasProtoTrim = typeof String.prototype.trim === "function";
-
- // node_modules/ramda/es/when.js
- var when = /* @__PURE__ */ _curry3(function when2(pred, whenTrueFn, x) {
- return pred(x) ? whenTrueFn(x) : x;
- });
- var when_default = when;
-
- // src/lib/nearley_utils.ts
- var nearley = __toESM(require_nearley());
- var Parser2 = class {
- /* public results */
- constructor(grammar2) {
- this.parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar2));
- this.initial_state = this.parser.save();
- }
- feedUntilError(input) {
- let lastResult;
- let consumedIndex = 0;
- try {
- for (const val of input) {
- this.parser.feed(val);
- lastResult = this.parser.results[0];
- consumedIndex++;
- }
- } finally {
- this.reset();
- if (lastResult === void 0) {
- throw new Error("Error: no result!");
- } else {
- return [lastResult, input.slice(consumedIndex)];
- }
- }
- }
- reset() {
- this.parser.restore(this.initial_state);
- }
- /* feed(input) { */
- /* return this.parser.feed(input) */
- /* } */
- };
-
- // src/grammars/.bracketexpr.generated.ts
- function id(d) {
- return d[0];
- }
- var grammar = {
- Lexer: void 0,
- ParserRules: [
- { "name": "BracketExpr", "symbols": [{ "literal": "<" }, "Modifier", "ModKey", { "literal": ">" }], "postprocess": (bexpr) => bexpr.slice(1, -1) },
- { "name": "BracketExpr", "symbols": [{ "literal": "<" }, "Key", { "literal": ">" }], "postprocess": (bexpr) => [{}].concat(bexpr.slice(1, -1)) },
- { "name": "Modifier$ebnf$1", "symbols": [/[acmsACMS]/], "postprocess": id },
- { "name": "Modifier$ebnf$1", "symbols": [], "postprocess": () => null },
- { "name": "Modifier$ebnf$2", "symbols": [/[acmsACMS]/], "postprocess": id },
- { "name": "Modifier$ebnf$2", "symbols": [], "postprocess": () => null },
- { "name": "Modifier$ebnf$3", "symbols": [/[acmsACMS]/], "postprocess": id },
- { "name": "Modifier$ebnf$3", "symbols": [], "postprocess": () => null },
- { "name": "Modifier$ebnf$4", "symbols": [/[acmsACMS]/], "postprocess": id },
- { "name": "Modifier$ebnf$4", "symbols": [], "postprocess": () => null },
- {
- "name": "Modifier",
- "symbols": ["Modifier$ebnf$1", "Modifier$ebnf$2", "Modifier$ebnf$3", "Modifier$ebnf$4", { "literal": "-" }],
- "postprocess": (
- /** For each modifier present,
- add its long name as an attribute set to true to an object */
- (mods, _, reject3) => {
- const longNames = /* @__PURE__ */ new Map([
- ["A", "altKey"],
- ["C", "ctrlKey"],
- ["M", "metaKey"],
- ["S", "shiftKey"]
- ]);
- let modifiersObj = {};
- for (let mod of mods) {
- if (mod === null || mod === "-")
- continue;
- let longName = longNames.get(mod.toUpperCase());
- if (longName) {
- if (longName in modifiersObj)
- return reject3;
- else
- modifiersObj[longName] = true;
- }
- }
- return modifiersObj;
- }
- )
- },
- { "name": "ModKey", "symbols": [{ "literal": "<" }], "postprocess": id },
- { "name": "ModKey", "symbols": [{ "literal": ">" }], "postprocess": id },
- { "name": "ModKey", "symbols": [{ "literal": "-" }], "postprocess": id },
- { "name": "ModKey", "symbols": ["Key"], "postprocess": id },
- { "name": "Key$ebnf$1", "symbols": [/[^\s<>-]/] },
- { "name": "Key$ebnf$1", "symbols": ["Key$ebnf$1", /[^\s<>-]/], "postprocess": (d) => d[0].concat([d[1]]) },
- { "name": "Key", "symbols": ["Key$ebnf$1"], "postprocess": (key) => key[0].join("") }
- ],
- ParserStart: "BracketExpr"
- };
- var bracketexpr_generated_default = grammar;
-
- // src/lib/keyseq.ts
- var bracketexpr_grammar = bracketexpr_generated_default;
- var bracketexpr_parser = new Parser2(bracketexpr_grammar);
- var KEYCODETRANSLATEMAP = {};
- var modifiers = /* @__PURE__ */ new Map([
- ["A", "altKey"],
- ["C", "ctrlKey"],
- ["M", "metaKey"],
- ["S", "shiftKey"]
- ]);
- var MinimalKey = class {
- constructor(key, modifiers2) {
- this.key = key;
- this.altKey = false;
- this.ctrlKey = false;
- this.metaKey = false;
- this.shiftKey = false;
- this.translated = false;
- if (modifiers2 !== void 0) {
- for (const mod of Object.keys(modifiers2)) {
- if (this.key.length === 1 && this.key !== " " && mod === "shiftKey")
- continue;
- this[mod] = modifiers2[mod];
- }
- }
- }
- /** Does this key match another MinimalKey */
- match(keyevent) {
- if (this.key !== keyevent.key)
- return false;
- for (const [_, attr] of modifiers.entries()) {
- if (this[attr] !== keyevent[attr])
- return false;
- }
- return true;
- }
- translate(keytranslatemap) {
- let newkey = keytranslatemap[this.key];
- if (newkey === void 0 || this.translated)
- newkey = this.key;
- const result = new MinimalKey(newkey, {
- altKey: this.altKey,
- ctrlKey: this.ctrlKey,
- metaKey: this.metaKey,
- shiftKey: this.shiftKey
- });
- result.translated = true;
- return result;
- }
- toMapstr() {
- let str = "";
- let needsBrackets = this.key.length > 1;
- for (const [letter, attr] of modifiers.entries()) {
- if (this[attr]) {
- str += letter;
- needsBrackets = true;
- }
- }
- if (str) {
- str += "-";
- }
- let key = this.key;
- if (key === " ") {
- key = "Space";
- needsBrackets = true;
- }
- str += key;
- if (needsBrackets) {
- str = "<" + str + ">";
- }
- return str;
- }
- isPrintable() {
- return this.key.length === 1;
- }
- };
- function splitNumericPrefix(keyseq) {
- if (!hasModifiers(keyseq[0]) && [1, 2, 3, 4, 5, 6, 7, 8, 9].includes(Number(keyseq[0].key))) {
- const prefix = [keyseq[0]];
- for (const ke of keyseq.slice(1)) {
- if (!hasModifiers(ke) && [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].includes(Number(ke.key)))
- prefix.push(ke);
- else
- break;
- }
- const rest2 = keyseq.slice(prefix.length);
- return [prefix, rest2];
- } else {
- return [[], keyseq];
- }
- }
- function stripOnlyModifiers(keyseq) {
- return keyseq.filter(
- (key) => !["Control", "Shift", "Alt", "AltGraph", "Meta"].includes(key.key)
- );
- }
- function parse2(keyseq, map3) {
- keyseq = stripOnlyModifiers(keyseq);
- if (keyseq.length === 0)
- return { keys: [], isMatch: false };
- let numericPrefix;
- [numericPrefix, keyseq] = splitNumericPrefix(keyseq);
- let possibleMappings = completions(keyseq, map3);
- while (possibleMappings.size === 0 && keyseq.length > 0) {
- keyseq.shift();
- numericPrefix = [];
- possibleMappings = completions(keyseq, map3);
- }
- if (possibleMappings.size > 0) {
- try {
- const perfect = find(
- possibleMappings,
- ([k, _v]) => k.length === keyseq.length
- );
- return {
- value: perfect[1],
- exstr: perfect[1] + numericPrefixToExstrSuffix(numericPrefix),
- isMatch: true,
- numericPrefix: numericPrefix.length ? Number(numericPrefix.map((ke) => ke.key).join("")) : void 0,
- keys: []
- };
- } catch (e) {
- if (!(e instanceof RangeError))
- throw e;
- }
- }
- return { keys: numericPrefix.concat(keyseq), isMatch: keyseq.length > 0 };
- }
- function prefixes(seq1, seq2) {
- if (seq1.length > seq2.length) {
- return false;
- } else {
- for (const [key1, key2] of izip(seq1, seq2)) {
- if (!key2.match(key1))
- return false;
- }
- return true;
- }
- }
- function completions(keyseq, map3) {
- return new Map(
- filter(map3.entries(), ([ks, _maptarget]) => prefixes(keyseq, ks))
- );
- }
- function expandAliases(key) {
- const aliases = {
- cr: "Enter",
- esc: "Escape",
- return: "Enter",
- enter: "Enter",
- space: " ",
- bar: "|",
- del: "Delete",
- bs: "Backspace",
- lt: "<"
- };
- if (key.toLowerCase() in aliases)
- return aliases[key.toLowerCase()];
- else
- return key;
- }
- function bracketexprToKey(inputStr) {
- if (inputStr.indexOf(">") > 0) {
- try {
- const [[modifiers2, key], remainder] = bracketexpr_parser.feedUntilError(inputStr);
- return [new MinimalKey(expandAliases(key), modifiers2), remainder];
- } catch (e) {
- return [new MinimalKey("<"), inputStr.slice(1)];
- }
- } else {
- return [new MinimalKey("<"), inputStr.slice(1)];
- }
- }
- function mapstrToKeyseq(mapstr) {
- const keyseq = [];
- let key;
- while (mapstr.length) {
- if (mapstr[0] === "<") {
- ;
- [key, mapstr] = bracketexprToKey(mapstr);
- keyseq.push(key);
- } else {
- keyseq.push(new MinimalKey(mapstr[0]));
- mapstr = mapstr.slice(1);
- }
- }
- return keyseq;
- }
- function mapstrMapToKeyMap(mapstrMap) {
- const newKeyMap = /* @__PURE__ */ new Map();
- for (const [mapstr, target] of mapstrMap.entries()) {
- newKeyMap.set(mapstrToKeyseq(mapstr), target);
- }
- return newKeyMap;
- }
- var KEYMAP_CACHE = {};
- function keyMap(conf) {
- if (KEYMAP_CACHE[conf])
- return KEYMAP_CACHE[conf];
- if (!INITIALISED)
- return /* @__PURE__ */ new Map();
- const mapobj = get2(conf);
- if (mapobj === void 0)
- throw new Error(
- "No binds defined for this mode. Reload page with and add binds, e.g. :bind --mode=[mode] mode normal"
- );
- const maps = new Map(Object.entries(mapobj));
- KEYMAP_CACHE[conf] = mapstrMapToKeyMap(maps);
- return KEYMAP_CACHE[conf];
- }
- function hasModifiers(keyEvent) {
- return keyEvent.ctrlKey || keyEvent.altKey || keyEvent.metaKey || keyEvent.shiftKey;
- }
- function numericPrefixToExstrSuffix(numericPrefix) {
- if (numericPrefix.length > 0) {
- return " " + numericPrefix.map((k) => k.key).join("");
- } else {
- return "";
- }
- }
- function minimalKeyFromKeyboardEvent(keyEvent) {
- const modifiers2 = {
- altKey: keyEvent.altKey,
- ctrlKey: keyEvent.ctrlKey,
- metaKey: keyEvent.metaKey,
- shiftKey: keyEvent.shiftKey
- };
- if (get2("keyboardlayoutforce") === "true") {
- Object.keys(KEYCODETRANSLATEMAP).length === 0 && updateBaseLayout();
- let newkey = keyEvent.key;
- const translation = KEYCODETRANSLATEMAP[keyEvent.code];
- if (translation)
- newkey = translation[+keyEvent.shiftKey];
- return new MinimalKey(newkey, modifiers2);
- }
- const result = new MinimalKey(keyEvent.key, modifiers2);
- if (get2("usekeytranslatemap") === "true") {
- const translationmap = get2("keytranslatemap");
- return result.translate(translationmap);
- }
- return result;
- }
- browser.storage.onChanged.addListener((changes) => {
- if ("userconfig" in changes) {
- KEYMAP_CACHE = {};
- }
- });
- function updateBaseLayout() {
- KEYCODETRANSLATEMAP = mergeRight_default(
- keyboardlayouts[get2("keyboardlayoutbase")],
- get2("keyboardlayoutoverrides")
- );
- }
-
- // src/lib/binding.ts
- var mode2maps = /* @__PURE__ */ new Map([
- ["normal", "nmaps"],
- ["ignore", "ignoremaps"],
- ["insert", "imaps"],
- ["input", "inputmaps"],
- ["ex", "exmaps"],
- ["hint", "hintmaps"],
- ["visual", "vmaps"],
- ["browser", "browsermaps"]
- ]);
- var maps2mode = new Map(
- Array.from(mode2maps.keys()).map((k) => [mode2maps.get(k), k])
- );
- var modes = Array.from(mode2maps.keys());
- var modeMaps = Array.from(maps2mode.keys());
-
- // src/lib/platform.ts
- function getPlatformOs() {
- const platform = navigator.platform;
- const mapping = {
- win: "Win",
- openbsd: "BSD",
- mac: "Mac",
- linux: "Linux"
- };
- return keys_default(
- filter_default((x) => platform.includes(x), mapping)
- )[0];
- }
-
- // src/lib/config.ts
- var removeNull = when_default(
- is_default(Object),
- pipe(
- // Ramda gives an error here without the any
- reject_default((val) => val === null),
- map_default((a) => removeNull(a))
- )
- );
- var CONFIGNAME = "userconfig";
- var WAITERS = [];
- var INITIALISED = false;
- function o(object) {
- return Object.assign(/* @__PURE__ */ Object.create(null), object);
- }
- function schlepp(settings) {
- Object.assign(USERCONFIG, settings);
- }
- var USERCONFIG = o({});
- var default_config = class {
- constructor() {
- /**
- * Internal version number Tridactyl uses to know whether it needs to update from old versions of the configuration.
- *
- * Changing this might do weird stuff.
- */
- this.configversion = "0.0";
- /**
- * Internal field to handle site-specific configs. Use :seturl/:unseturl to change these values.
- */
- this.subconfigs = {
- "www.google.com": {
- followpagepatterns: {
- next: "Next",
- prev: "Previous"
- }
- },
- "^https://web.whatsapp.com": {
- nmaps: {
- f: "hint -c [tabindex]:not(.two)>div,a",
- F: "hint -bc [tabindex]:not(.two)>div,a"
- }
- }
- };
- /**
- * Internal field to handle mode-specific configs. Use :setmode/:unsetmode to change these values.
- *
- * Changing this might do weird stuff.
- */
- this.modesubconfigs = {
- normal: {},
- insert: {},
- input: {},
- ignore: {},
- ex: {},
- hint: {},
- visual: {}
- };
- /**
- * Internal field to handle site-specific config priorities. Use :seturl/:unseturl to change this value.
- */
- this.priority = 0;
- // Note to developers: When creating new maps, make sure to make the modifier uppercase (e.g. instead of ) otherwise some commands might not be able to find them (e.g. `bind `)
- /**
- * exmaps contains all of the bindings for the command line.
- * You can of course bind regular ex commands but also [editor functions](/static/docs/modules/_src_lib_editor_.html) and [commandline-specific functions](/static/docs/modules/_src_commandline_frame_.html).
- */
- this.exmaps = {
- "": "ex.accept_line",
- "": "ex.execute_ex_on_completion",
- "": "ex.accept_line",
- "": "ex.accept_line",
- "": "ex.hide_and_clear",
- "": "ex.hide_and_clear",
- "": "ex.prev_history",
- "": "ex.next_history",
- "": "ex.execute_ex_on_completion_args tabclose",
- "": "text.backward_word",
- "": "text.forward_word",
- "": "text.end_of_line",
- "": "text.kill_word",
- "": "text.backward_kill_word",
- "": "text.backward_kill_line",
- "": "text.kill_line",
- "": "ex.complete",
- "": "ex.next_completion",
- "": "ex.prev_completion",
- "": "ex.insert_space_or_completion",
- "": "ex.insert_space",
- "yy": "ex.execute_ex_on_completion_args clipboard yank",
- "t": "ex.execute_ex_on_completion_args tabopen -b",
- "w": "ex.execute_ex_on_completion_args winopen"
- };
- /**
- * ignoremaps contain all of the bindings for "ignore mode".
- *
- * They consist of key sequences mapped to ex commands.
- */
- this.ignoremaps = {
- "": "mode normal",
- "": "mode normal",
- "": "mode normal",
- "": "mode normal",
- "": "nmode normal 1 mode ignore"
- };
- /**
- * imaps contain all of the bindings for "insert mode".
- *
- * On top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in insert mode.
- *
- * They consist of key sequences mapped to ex commands.
- */
- this.imaps = {
- "": "composite unfocus | mode normal",
- "": "composite unfocus | mode normal",
- "": "editor",
- "": "mode normal",
- "": "mode normal",
- "": "mode ignore"
- };
- /**
- * inputmaps contain all of the bindings for "input mode".
- *
- * On top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in input mode.
- *
- * They consist of key sequences mapped to ex commands.
- */
- this.inputmaps = {
- "": "focusinput -n",
- "": "focusinput -N",
- /**
- * Config objects with this key inherit their keys from the object specified.
- *
- * Only supports "root" objects. Subconfigs (`seturl`) work as expected.
- *
- * Here, this means that input mode is the same as insert mode except it has added binds for tab and shift-tab.
- */
- "\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}": "imaps"
- };
- /**
- * Disable Tridactyl almost completely within a page, e.g. `seturl ^https?://mail.google.com disable true`. Only takes affect on page reload.
- *
- * You are usually better off using `blacklistadd` and `seturl [url] noiframe true` as you can then still use some Tridactyl binds, e.g. `shift-insert` for exiting ignore mode.
- *
- * NB: you should only use this with `seturl`. If you get trapped with Tridactyl disabled everywhere just run `tri unset superignore` in the Firefox address bar. If that still doesn't fix things, you can totally reset Tridactyl by running `tri help superignore` in the Firefox address bar, scrolling to the bottom of that page and then clicking "Reset Tridactyl config".
- */
- this.superignore = "false";
- /**
- * nmaps contain all of the bindings for "normal mode".
- *
- * They consist of key sequences mapped to ex commands.
- */
- this.nmaps = {
- "": "pin",
- "": "mute toggle",
- "": "help",
- o: "fillcmdline open",
- O: "current_url open",
- w: "fillcmdline winopen",
- W: "current_url winopen",
- t: "fillcmdline tabopen",
- "]]": "followpage next",
- "[[": "followpage prev",
- "[c": "urlincrement -1",
- "]c": "urlincrement 1",
- "": "urlincrement -1",
- "": "urlincrement 1",
- T: "current_url tabopen",
- yy: "clipboard yank",
- ys: "clipboard yankshort",
- yq: "text2qr --timeout 5",
- yc: "clipboard yankcanon",
- ym: "clipboard yankmd",
- yo: "clipboard yankorg",
- yt: "clipboard yanktitle",
- gh: "home",
- gH: "home true",
- p: "clipboard open",
- P: "clipboard tabopen",
- j: "scrollline 10",
- "": "scrollline 10",
- k: "scrollline -10",
- "": "scrollline -10",
- h: "scrollpx -50",
- l: "scrollpx 50",
- G: "scrollto 100",
- gg: "scrollto 0",
- "": "scrollpage -0.5",
- "": "scrollpage 0.5",
- "": "scrollpage 1",
- "": "scrollpage -1",
- "": "nmode ignore 1 mode normal",
- // Is this a terrible idea? Pentadactyl did it http://bug.5digits.org/help/pentadactyl/browsing.xhtml#send-key
- $: "scrollto 100 x",
- // "0": "scrollto 0 x", // will get interpreted as a count
- "^": "scrollto 0 x",
- H: "back",
- L: "forward",
- "": "jumpprev",
- "": "jumpnext",
- d: "tabclose",
- D: "composite tabprev; tabclose #",
- gx0: "tabclosealltoleft",
- gx$: "tabclosealltoright",
- "<<": "tabmove -1",
- ">>": "tabmove +1",
- u: "undo",
- U: "undo window",
- r: "reload",
- R: "reloadhard",
- x: "stop",
- gi: "focusinput -l",
- "g?": "rot13",
- "g!": "jumble",
- "g;": "changelistjump -1",
- J: "tabprev",
- K: "tabnext",
- gt: "tabnext_gt",
- gT: "tabprev",
- // "": "tabnext_gt", // c-n is reserved for new window
- // "": "tabprev",
- "g^": "tabfirst",
- g0: "tabfirst",
- g$: "tablast",
- ga: "tabaudio",
- gr: "reader --old",
- gu: "urlparent",
- gU: "urlroot",
- gf: "viewsource",
- ":": "fillcmdline_notrail",
- s: "fillcmdline open search",
- S: "fillcmdline tabopen search",
- // find mode not suitable for general consumption yet.
- // "/": "fillcmdline find",
- // "?": "fillcmdline find -?",
- // n: "findnext 1",
- // N: "findnext -1",
- // ",": "nohlsearch",
- M: "gobble 1 quickmark",
- B: "fillcmdline taball",
- b: "fillcmdline tab",
- ZZ: "qall",
- f: "hint",
- F: "hint -b",
- gF: "hint -qb",
- ";i": "hint -i",
- ";b": "hint -b",
- ";o": "hint",
- ";I": "hint -I",
- ";k": "hint -k",
- ";K": "hint -K",
- ";y": "hint -y",
- ";Y": "hint -cF img i => tri.excmds.yankimage(tri.urlutils.getAbsoluteURL(i.src))",
- ";p": "hint -p",
- ";h": "hint -h",
- v: "hint -h",
- // Easiest way of entering visual mode for now. Expect this bind to change
- ";P": "hint -P",
- ";r": "hint -r",
- ";s": "hint -s",
- ";S": "hint -S",
- ";a": "hint -a",
- ";A": "hint -A",
- ";;": "hint -; *",
- ";#": "hint -#",
- ";v": "hint -W mpvsafe",
- ";V": "hint -V",
- ";w": "hint -w",
- ";t": "hint -W tabopen",
- ";O": "hint -W fillcmdline_notrail open ",
- ";W": "hint -W fillcmdline_notrail winopen ",
- ";T": "hint -W fillcmdline_notrail tabopen ",
- ";d": "hint -W tabopen --discard",
- ";gd": "hint -qW tabopen --discard",
- ";z": "hint -z",
- ";m": "hint -JFc img i => tri.excmds.open('https://lens.google.com/uploadbyurl?url='+i.src)",
- ";M": "hint -JFc img i => tri.excmds.tabopen('https://lens.google.com/uploadbyurl?url='+i.src)",
- ";gi": "hint -qi",
- ";gI": "hint -qI",
- ";gk": "hint -qk",
- ";gy": "hint -qy",
- ";gp": "hint -qp",
- ";gP": "hint -qP",
- ";gr": "hint -qr",
- ";gs": "hint -qs",
- ";gS": "hint -qS",
- ";ga": "hint -qa",
- ";gA": "hint -qA",
- ";g;": "hint -q;",
- ";g#": "hint -q#",
- ";gv": "hint -qW mpvsafe",
- ";gw": "hint -qw",
- ";gb": "hint -qb",
- // These two don't strictly follow the "bind is ;g[flag]" rule but they make sense
- ";gF": "hint -qb",
- ";gf": "hint -q",
- "": "mode ignore",
- "": "mode ignore",
- "": "mode ignore",
- "": "mode ignore",
- "": "composite mode normal ; hidecmdline",
- "": "composite mode normal ; hidecmdline",
- a: "current_url bmark",
- A: "bmark",
- zi: "zoom 0.1 true",
- zo: "zoom -0.1 true",
- zm: "zoom 0.5 true",
- zr: "zoom -0.5 true",
- zM: "zoom 0.5 true",
- zR: "zoom -0.5 true",
- zz: "zoom 1",
- zI: "zoom 3",
- zO: "zoom 0.3",
- ".": "repeat",
- "ba": "open https://www.youtube.com/watch?v=M3iOROuTuMA",
- m: "gobble 1 markadd",
- "`": "gobble 1 markjump"
- };
- this.vmaps = {
- "": "composite js document.getSelection().empty(); mode normal; hidecmdline",
- "": "composite js document.getSelection().empty(); mode normal ; hidecmdline",
- y: "composite js document.getSelection().toString() | clipboard yank",
- s: "composite js document.getSelection().toString() | fillcmdline open search",
- S: "composite js document.getSelection().toString() | fillcmdline tabopen search",
- l: 'js document.getSelection().modify("extend","forward","character")',
- h: 'js document.getSelection().modify("extend","backward","character")',
- e: 'js document.getSelection().modify("extend","forward","word")',
- w: 'js document.getSelection().modify("extend","forward","word"); document.getSelection().modify("extend","forward","word"); document.getSelection().modify("extend","backward","word"); document.getSelection().modify("extend","forward","character")',
- b: 'js document.getSelection().modify("extend","backward","character"); document.getSelection().modify("extend","backward","word"); document.getSelection().modify("extend","forward","character")',
- j: 'js document.getSelection().modify("extend","forward","line")',
- q: "composite js document.getSelection().toString() | text2qr --timeout 5",
- // "j": 'js document.getSelection().modify("extend","forward","paragraph")', // not implemented in Firefox
- k: 'js document.getSelection().modify("extend","backward","line")',
- $: 'js document.getSelection().modify("extend","forward","lineboundary")',
- "0": 'js document.getSelection().modify("extend","backward","lineboundary")',
- "=": "js let n = document.getSelection().anchorNode.parentNode; let s = window.getSelection(); let r = document.createRange(); s.removeAllRanges(); r.selectNodeContents(n); s.addRange(r)",
- o: "js tri.visual.reverseSelection(document.getSelection())",
- "\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}": "nmaps"
- };
- this.hintmaps = {
- "": "hint.popKey",
- "": "hint.reset",
- "": "hint.reset",
- "": "hint.focusNextHint",
- "": "hint.focusPreviousHint",
- "": "hint.focusTopHint",
- "": "hint.focusBottomHint",
- "": "hint.focusLeftHint",
- "": "hint.focusRightHint",
- "": "hint.selectFocusedHint",
- "": "hint.selectFocusedHint"
- };
- /**
- * Browser-wide binds accessible in all modes and on pages where Tridactyl "cannot run".
- *
- */
- this.browsermaps = {
- "": "escapehatch",
- "": "tab #"
- // "": "tab #", // banned by e2e tests
- };
- /**
- * Whether to allow pages (not necessarily github) to override `/`, which is a default Firefox binding.
- */
- this.leavegithubalone = "false";
- /**
- * Which keys to protect from pages that try to override them. Requires [[leavegithubalone]] to be set to false.
- */
- this.blacklistkeys = ["/"];
- /**
- * Autocommands that run when certain events happen, and other conditions are met.
- *
- * Related ex command: `autocmd`.
- */
- this.autocmds = {
- /**
- * Commands that will be run as soon as Tridactyl loads into a page.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
- */
- DocStart: {
- // "addons.mozilla.org": "mode ignore",
- },
- /**
- * Commands that will be run when pages are loaded.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
- */
- DocLoad: {
- "^https://github.com/tridactyl/tridactyl/issues/new$": "issue"
- },
- /**
- * Commands that will be run when pages are unloaded.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
- */
- DocEnd: {
- // "emacs.org": "sanitise history",
- },
- /**
- * Commands that will be run when Tridactyl first runs each time you start your browser.
- *
- * Each key corresponds to a javascript regex that matches the hostname of the computer Firefox is running on. Note that fetching the hostname could be a little slow, if you want to execute something unconditionally, use ".*" as Tridactyl special-cases this pattern to avoid hostname lookups.
- */
- TriStart: {
- ".*": "source_quiet"
- },
- /**
- * Commands that will be run when you enter a tab.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
- */
- TabEnter: {
- // "gmail.com": "mode ignore",
- },
- /**
- * Commands that will be run when you leave a tab.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
- */
- TabLeft: {
- // Actually, this doesn't work because tabclose closes the current tab
- // Too bad :/
- // "emacs.org": "tabclose",
- },
- /**
- * Commands that will be run when fullscreen state changes.
- */
- FullscreenChange: {},
- /**
- * Commands that will be run when fullscreen state is entered.
- */
- FullscreenEnter: {},
- /**
- * Commands that will be run when fullscreen state is left.
- */
- FullscreenLeft: {}
- };
- /**
- * @deprecated Map for translating keys directly into other keys in normal-ish modes.
- * For example, if you have an entry in this config option mapping `п` to `g`,
- * then you could type `пп` instead of `gg` or `пi` instead of `gi` or `;п` instead
- * of `;g`.
- *
- * This was primarily useful for international users, but now you can `set
- * keyboardlayoutforce true`, which will make everything layout-independent(and work like qwerty by default),
- * and use [[keyboardlayoutoverrides]] setting to change the desired layout.
- *
- *
- * For example, you may want to map 'a' to 'q` on azerty
- * or 'r' to 'p' if you use dvorak.
- *
- * Note that the current implementation does not allow you to "chain" keys, for example, "a"=>"b" and "b"=>"c" for "a"=>"c". You can, however, swap or rotate keys, so "a"=>"b" and "b"=>"a" will work the way you'd expect, as will "a"=>"b" and "b"=>"c" and "c"=>"a".
- */
- this.keytranslatemap = {
- // Examples (I think >_>):
- // "д": "l", // Russian language
- // "é" : "w", // BÉPO
- // "h": "j", // Dvorak
- // "n": "j", // Colemak
- // etc
- };
- /**
- * @deprecated Whether to use the keytranslatemap.
- * Legacy option to map one keyboard character to another, was used to emulate
- * layout-independence. Now deprecated since you can set your layout once with [[keyboardlayoutforce]]
- * and [[keyboardlayoutoverrides]].
- */
- this.usekeytranslatemap = "true";
- /**
- * Instead of fetching actual character which depends on selected layout,
- * use machine code of a key and convert to character according to keyboardlayoutoverrides. The default layout mapping
- * is US `qwerty`, but can be changed with [[keyboardlayoutbase]].
- *
- * There is a much more detailed help page towards the end of `:tutor` under the title "Non-QWERTY layouts".
- *
- * Recommended for everyone with multiple or/and non-latin keyboard layouts. Make sure [[usekeytranslatemap]] is false
- * if you have previously used `keymap`.
- */
- this.keyboardlayoutforce = "false";
- /**
- * Base keyboard layout to use when [[keyboardlayoutforce]] is enabled. At the time of writing, the following layouts are supported: `qwerty, azerty, german, dvorak, uk, ca, bepo`. Requires page reload to take effect.
- *
- * If your layout is missing, you can contribute it with the help of https://gistpreview.github.io/?324119c773fac31651f6422087b36804 - please just open an `:issue` with your layout and we'll add it.
- *
- * You can manually override individual keys for a layout with [[keyboardlayoutoverrides]].
- */
- this.keyboardlayoutbase = "qwerty";
- /**
- * Override individual keys for a layout when [[keyboardlayoutforce]] is enabled. Changes take effect only after a page reload.
- *
- * Key codes for printable keys for [[keyboardlayoutforce]], lower and upper register. See https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values for the names of each key.
- *
- * NB: due to a Tridactyl bug, you cannot set this using array notation as you can for, e.g. [[homepage]].
- * You must instead set the lower and upper registers using a string with no spaces in it, for example
- * `:set keyboardlayoutoverrides Digit2: 2"` for the British English layout.
- */
- this.keyboardlayoutoverrides = {};
- /**
- * Automatically place these sites in the named container.
- *
- * Each key corresponds to a URL fragment which, if contained within the page URL, the site will be opened in a container tab instead.
- */
- this.autocontain = o({
- // "github.com": "microsoft",
- // "youtube.com": "google",
- });
- /**
- * Default proxy to use for all URLs. Has to be the name of a proxy. To add a proxy, see `:help proxyadd`. NB: usage with `:seturl` is buggy, use `:autocontain -s [regex to match URL] none [proxy]` instead
- */
- this.proxy = "";
- /**
- * Definitions of proxies.
- *
- * You can add a new proxy with `proxyadd proxyname proxyurl`
- */
- this.proxies = o({
- // "socksName": "socks://hostname:port",
- // "socks4": "socks4://hostname:port",
- // "https": "https://username:password@hostname:port"
- });
- /**
- * Whether to use proxy settings.
- *
- * If set to `true`, all proxy settings will be ignored.
- */
- this.noproxy = "false";
- /**
- * Strict mode will always ensure a domain is open in the correct container, replacing the current tab if necessary.
- *
- * Relaxed mode is less aggressive and instead treats container domains as a default when opening a new tab.
- */
- this.autocontainmode = "strict";
- /**
- * Aliases for the commandline.
- *
- * You can make a new one with `command alias ex-command`.
- */
- this.exaliases = {
- alias: "command",
- au: "autocmd",
- aucon: "autocontain",
- audel: "autocmddelete",
- audelete: "autocmddelete",
- blacklistremove: "autocmddelete DocStart",
- b: "tab",
- clsh: "clearsearchhighlight",
- nohlsearch: "clearsearchhighlight",
- noh: "clearsearchhighlight",
- o: "open",
- w: "winopen",
- t: "tabopen",
- tabgroupabort: "tgroupabort",
- tabgroupclose: "tgroupclose",
- tabgroupcreate: "tgroupcreate",
- tabgrouplast: "tgrouplast",
- tabgroupmove: "tgroupmove",
- tabgrouprename: "tgrouprename",
- tabgroupswitch: "tgroupswitch",
- tabnew: "tabopen",
- tabm: "tabmove",
- tabo: "tabonly",
- tn: "tabnext_gt",
- bn: "tabnext_gt",
- tnext: "tabnext_gt",
- bnext: "tabnext_gt",
- tp: "tabprev",
- tN: "tabprev",
- bp: "tabprev",
- bN: "tabprev",
- tprev: "tabprev",
- bprev: "tabprev",
- tabfirst: "tab 1",
- tablast: "tab 0",
- bfirst: "tabfirst",
- blast: "tablast",
- tfirst: "tabfirst",
- tlast: "tablast",
- buffer: "tab",
- bufferall: "taball",
- bd: "tabclose",
- bdelete: "tabclose",
- quit: "tabclose",
- q: "tabclose",
- qa: "qall",
- sanitize: "sanitise",
- "saveas!": "saveas --cleanup --overwrite",
- tutorial: "tutor",
- h: "help",
- unmute: "mute unmute",
- authors: "credits",
- openwith: "hint -W",
- "!": "exclaim",
- "!s": "exclaim_quiet",
- containerremove: "containerdelete",
- colours: "colourscheme",
- colorscheme: "colourscheme",
- colors: "colourscheme",
- man: "help",
- "!js": "fillcmdline_tmp 3000 !js is deprecated. Please use js instead",
- "!jsb": "fillcmdline_tmp 3000 !jsb is deprecated. Please use jsb instead",
- get_current_url: "js document.location.href",
- current_url: "composite get_current_url | fillcmdline_notrail ",
- stop: "js window.stop()",
- zo: "zoom",
- installnative: "nativeinstall",
- nativeupdate: "updatenative",
- mkt: "mktridactylrc",
- "mkt!": "mktridactylrc -f",
- "mktridactylrc!": "mktridactylrc -f",
- mpvsafe: "js -p tri.excmds.shellescape(JS_ARG).then(url => tri.excmds.exclaim_quiet('mpv --no-terminal ' + url))",
- drawingstop: "mouse_mode",
- exto: "extoptions",
- extpreferences: "extoptions",
- extp: "extpreferences",
- prefset: "setpref",
- prefremove: "removepref",
- tabclosealltoright: "tabcloseallto right",
- tabclosealltoleft: "tabcloseallto left",
- reibadailty: "jumble"
- };
- /**
- * Used by `]]` and `[[` to look for links containing these words.
- *
- * Edit these if you want to add, e.g. other language support.
- */
- this.followpagepatterns = {
- next: "^(next|newer)\\b|\xBB|>>|more",
- prev: "^(prev(ious)?|older)\\b|\xAB|<<"
- };
- /**
- * The default search engine used by `open search`. If empty string, your browser's default search engine will be used. If set to something, Tridactyl will first look at your [[searchurls]] and then at the search engines for which you have defined a keyword on `about:preferences#search`.
- */
- this.searchengine = "";
- /**
- * Definitions of search engines for use via `open [keyword]`.
- *
- * `%s` will be replaced with your whole query and `%s1`, `%s2`, ..., `%sn` will be replaced with the first, second and nth word of your query. Also supports array slicing, e.g. `%s[2:4]`, `%s[5:]`. If there are none of these patterns in your search urls, your query will simply be appended to the searchurl.
- *
- * Aliases are supported - for example, if you have a `google` searchurl, you can run `:set searchurls.g google` in which case `g` will act as if it was the `google` searchurl.
- *
- * Examples:
- * - When running `open gi cute puppies`, with a `gi` searchurl defined with `set searchurls.gi https://www.google.com/search?q=%s&tbm=isch`, tridactyl will navigate to `https://www.google.com/search?q=cute puppies&tbm=isch`.
- * - When running `tabopen translate en ja Tridactyl`, with a `translate` searchurl defined with `set searchurls.translate https://translate.google.com/#view=home&op=translate&sl=%s1&tl=%s2&text=%s3`, tridactyl will navigate to `https://translate.google.com/#view=home&op=translate&sl=en&tl=ja&text=Tridactyl`.
- *
- * [[setnull]] can be used to "delete" the default search engines. E.g. `setnull searchurls.google`.
- */
- this.searchurls = {
- google: "https://www.google.com/search?q=",
- googlelucky: "https://www.google.com/search?btnI=I'm+Feeling+Lucky&q=",
- scholar: "https://scholar.google.com/scholar?q=",
- googleuk: "https://www.google.co.uk/search?q=",
- bing: "https://www.bing.com/search?q=",
- duckduckgo: "https://duckduckgo.com/?q=",
- yahoo: "https://search.yahoo.com/search?p=",
- twitter: "https://twitter.com/search?q=",
- wikipedia: "https://en.wikipedia.org/wiki/Special:Search/",
- youtube: "https://www.youtube.com/results?search_query=",
- amazon: "https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=",
- amazonuk: "https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=",
- startpage: "https://startpage.com/do/search?language=english&cat=web&query=",
- github: "https://github.com/search?utf8=\u2713&q=",
- searx: "https://searx.me/?category_general=on&q=",
- cnrtl: "http://www.cnrtl.fr/lexicographie/",
- osm: "https://www.openstreetmap.org/search?query=",
- mdn: "https://developer.mozilla.org/en-US/search?q=",
- gentoo_wiki: "https://wiki.gentoo.org/index.php?title=Special%3ASearch&profile=default&fulltext=Search&search=",
- qwant: "https://www.qwant.com/?q="
- };
- /**
- * Like [[searchurls]] but must be a Javascript function that takes one argument (a single string with the remainder of the command line including spaces) and maps it to a valid href (or a promise that resolves to a valid href) that will be followed, e.g. `set jsurls.googleloud query => "https://google.com/search?q=" + query.toUpperCase()`
- *
- * NB: the href must be valid, i.e. it must include the protocol (e.g. "http://") and not just be e.g. "www.".
- */
- this.jsurls = {};
- /**
- * URL the newtab will redirect to.
- *
- * All usual rules about things you can open with `open` apply, with the caveat that you'll get interesting results if you try to use something that needs `nativeopen`: so don't try `about:newtab` or a `file:///` URI. You should instead use a data URI - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - or host a local webserver (e.g. Caddy).
- */
- this.newtab = "";
- /**
- * Whether `:viewsource` will use our own page that you can use Tridactyl binds on, or Firefox's default viewer, which you cannot use Tridactyl on.
- */
- this.viewsource = "tridactyl";
- /**
- * Pages opened with `gH`. In order to set this value, use `:set homepages ["example.org", "example.net", "example.com"]` and so on.
- */
- this.homepages = [];
- /**
- * Characters to use in hint mode.
- *
- * They are used preferentially from left to right.
- */
- this.hintchars = "hjklasdfgyuiopqwertnmzxcvb";
- /**
- * The type of hinting to use. `vimperator` will allow you to filter links based on their names by typing non-hint chars. It is recommended that you use this in conjuction with the [[hintchars]] setting, which you should probably set to e.g, `5432167890`. ´vimperator-reflow´ additionally updates the hint labels after filtering.
- */
- this.hintfiltermode = "simple";
- /**
- * Whether to optimise for the shortest possible names for each hint, or to use a simple numerical ordering. If set to `numeric`, overrides `hintchars` setting.
- */
- this.hintnames = "short";
- /**
- * Whether to display the names for hints in uppercase.
- */
- this.hintuppercase = "true";
- /**
- * The delay in milliseconds in `vimperator` style hint modes after selecting a hint before you are returned to normal mode.
- *
- * The point of this is to prevent accidental execution of normal mode binds due to people typing more than is necessary to choose a hint.
- */
- this.hintdelay = 300;
- /**
- * Controls whether hints should be shifted in quick-hints mode.
- *
- * Here's what it means: let's say you have hints from a to z but are only
- * interested in every second hint. You first press `a`, then `c`.
- * Tridactyl will realize that you skipped over `b`, and so that the next
- * hint you're going to trigger is probably `e`. Tridactyl will shift all
- * hint names so that `e` becomes `c`, `d` becomes `b`, `c` becomes `a` and
- * so on.
- * This means that once you pressed `c`, you can keep on pressing `c` to
- * trigger every second hint. Only makes sense with hintnames = short.
- */
- this.hintshift = "false";
- /**
- * Controls whether hints should be followed automatically.
- *
- * If set to `false`, hints will only be followed upon confirmation. This applies to cases when there is only a single match or only one link on the page.
- */
- this.hintautoselect = "true";
- /**
- * Controls whether the page can focus elements for you via js
- *
- * NB: will break fancy editors such as CodeMirror on Jupyter. Simply use `seturl` to whitelist pages you need it on.
- *
- * Best used in conjunction with browser.autofocus in `about:config`
- */
- this.allowautofocus = "true";
- /**
- * Uses a loop to prevent focus until you interact with a page. Only recommended for use via `seturl` for problematic sites as it can be a little heavy on CPU if running on all tabs. Should be used in conjuction with [[allowautofocus]]
- */
- this.preventautofocusjackhammer = "false";
- /**
- * Whether to use Tridactyl's (bad) smooth scrolling.
- */
- this.smoothscroll = "false";
- /**
- * How viscous you want smooth scrolling to feel.
- */
- this.scrollduration = 100;
- /**
- * Where to open tabs opened with `tabopen` - to the right of the current tab, or at the end of the tabs.
- */
- this.tabopenpos = "next";
- /**
- * When enabled (the default), running tabclose will close the tabs whether they are pinned or not. When disabled, tabclose will fail with an error if a tab is pinned.
- */
- this.tabclosepinned = "true";
- /**
- * Controls which tab order to use when numbering tabs. Either mru = sort by most recent tab or default = by tab index
- *
- * Applies to all places where Tridactyl numbers tabs including `:tab`, `:tabnext_gt` etc. (so, for example, with `:set tabsort mru` `2gt` would take you to the second most recently used tab, not the second tab in the tab bar).
- */
- this.tabsort = "default";
- /**
- * Where to open tabs opened with hinting - as if it had been middle clicked, to the right of the current tab, or at the end of the tabs.
- */
- this.relatedopenpos = "related";
- /**
- * The name of the voice to use for text-to-speech. You can get the list of installed voices by running the following snippet: `js alert(window.speechSynthesis.getVoices().reduce((a, b) => a + " " + b.name))`
- */
- this.ttsvoice = "default";
- // chosen from the listvoices list or "default"
- /**
- * Controls text-to-speech volume. Has to be a number between 0 and 1.
- */
- this.ttsvolume = 1;
- /**
- * Controls text-to-speech speed. Has to be a number between 0.1 and 10.
- */
- this.ttsrate = 1;
- /**
- * Controls text-to-speech pitch. Has to be between 0 and 2.
- */
- this.ttspitch = 1;
- /**
- * When set to "nextinput", pressing `` after gi selects the next input.
- *
- * When set to "firefox", `` behaves like normal, focusing the next tab-indexed element regardless of type.
- */
- this.gimode = "nextinput";
- /**
- * Decides where to place the cursor when selecting non-empty input fields
- */
- this.cursorpos = "end";
- /**
- * The theme to use.
- *
- * Permitted values: run `:composite js tri.styling.THEMES | fillcmdline` to find out.
- */
- this.theme = "default";
- /**
- * Storage for custom themes
- *
- * Maps theme names to CSS. Predominantly used automatically by [[colourscheme]] to store themes read from disk, as documented by [[colourscheme]]. Setting this manually is untested but might work provided that [[colourscheme]] is then used to change the theme to the right theme name.
- */
- this.customthemes = {};
- /**
- * Whether to display the mode indicator or not.
- */
- this.modeindicator = "true";
- /**
- * Whether to display the mode indicator in various modes. Ignored if modeindicator set to false.
- */
- this.modeindicatormodes = {
- normal: "true",
- insert: "true",
- input: "true",
- ignore: "true",
- ex: "true",
- hint: "true",
- visual: "true"
- };
- /**
- * Milliseconds before registering a scroll in the jumplist
- */
- this.jumpdelay = 3e3;
- /**
- * Logging levels. Unless you're debugging Tridactyl, it's unlikely you'll ever need to change these.
- */
- this.logging = {
- cmdline: "warning",
- containers: "warning",
- controller: "warning",
- excmd: "error",
- hinting: "warning",
- messaging: "warning",
- native: "warning",
- performance: "warning",
- state: "warning",
- styling: "warning",
- autocmds: "warning"
- };
- /**
- * Disables the commandline iframe. Dangerous setting, use [[seturl]] to set it. If you ever set this setting to "true" globally and then want to set it to false again, you can do this by opening Tridactyl's preferences page from about:addons.
- */
- this.noiframe = "false";
- /**
- * @deprecated A list of URLs on which to not load the iframe. Use `seturl [URL] noiframe true` instead, as shown in [[noiframe]].
- */
- this.noiframeon = [];
- /**
- * Insert / input mode edit-in-$EDITOR command to run
- * This has to be a command that stays in the foreground for the whole editing session
- * "auto" will attempt to find a sane editor in your path.
- * Please send your requests to have your favourite terminal moved further up the list to /dev/null.
- * (but we are probably happy to add your terminal to the list if it isn't already there.)
- *
- * Example values:
- * - linux: `xterm -e vim`
- * - windows: `start cmd.exe /c \"vim\"`.
- *
- * Also see [:editor](/static/docs/modules/_src_excmds_.html#editor).
- */
- this.editorcmd = "auto";
- /**
- * Command that should be run by the [[rssexec]] ex command. Has the
- * following format:
- * - %u: url
- * - %t: title
- * - %y: type (rss, atom, xml...)
- * Warning: This is a very large footgun. %u will be inserted without any
- * kind of escaping, hence you must obey the following rules if you care
- * about security:
- * - Do not use a composite command. If you need a composite command,
- * create an alias.
- * - Do not use `js` or `jsb`. If you need to use them, create an alias.
- * - Do not insert any %u, %t or %y in shell commands run by the native
- * messenger. Use pipes instead.
- *
- * Here's an example of how to save an rss url in a file on your disk
- * safely:
- * `alias save_rss jsb -p tri.native.run("cat >> ~/.config.newsboat/urls", JS_ARG)`
- * `set rsscmd save_rss %u`
- * This is safe because the url is passed to jsb as an argument rather than
- * being expanded inside of the string it will execute and because it is
- * piped to the shell command rather than being expanded inside of it.
- */
- this.rsscmd = "yank %u";
- /**
- * The browser executable to look for in commands such as `restart`. Not as mad as it seems if you have multiple versions of Firefox...
- */
- this.browser = "firefox";
- /**
- * Which clipboard to store items in. Requires the native messenger to be installed.
- */
- this.yankto = "clipboard";
- /**
- * Which clipboard to retrieve items from. Requires the native messenger to be installed.
- *
- * Permitted values: `clipboard`, or `selection`.
- */
- this.putfrom = "clipboard";
- /**
- * Clipboard command to try to get the selection from (e.g. `xsel` or `xclip`)
- */
- this.externalclipboardcmd = "auto";
- /**
- * Whether downloads (e.g. via ;s hint modes) appear in your download history.
- *
- * NB: will cause downloads to fail silently if Tridactyl is not allowed to run in private windows (regardless of whether you are trying to call it in a private window).
- */
- this.downloadsskiphistory = "false";
- /**
- * Set of characters that are to be considered illegal as download filenames.
- */
- this.downloadforbiddenchars = "/\0";
- /**
- * Value that will be used to replace the illegal character(s), if found, in the download filename.
- */
- this.downloadforbiddenreplacement = "_";
- /**
- * Comma-separated list of whole filenames which, if match
- * with the download filename, will be suffixed with the
- * "downloadforbiddenreplacement" value.
- */
- this.downloadforbiddennames = "";
- /**
- * Set this to something weird if you want to have fun every time Tridactyl tries to update its native messenger.
- *
- * %TAG will be replaced with your version of Tridactyl for stable builds, or "master" for beta builds
- *
- * NB: Windows has its own platform-specific default.
- */
- this.nativeinstallcmd = "curl -fsSl https://raw.githubusercontent.com/tridactyl/native_messenger/master/installers/install.sh -o /tmp/trinativeinstall.sh && sh /tmp/trinativeinstall.sh %TAG";
- /**
- * Used by :updatecheck and related built-in functionality to automatically check for updates and prompt users to upgrade.
- */
- this.update = {
- /**
- * Whether Tridactyl should check for available updates at startup.
- */
- nag: true,
- /**
- * How many days to wait after an update is first available until telling people.
- */
- nagwait: 7,
- /**
- * The version we last nagged you about. We only nag you once per version.
- */
- lastnaggedversion: "1.14.0",
- /**
- * Time we last checked for an update, milliseconds since unix epoch.
- */
- lastchecktime: 0,
- /**
- * Minimum interval between automatic update checks, in seconds.
- */
- checkintervalsecs: 60 * 60 * 24
- };
- /**
- * Profile directory to use with native messenger with e.g, `guiset`.
- */
- this.profiledir = "auto";
- // Container settings
- /**
- * If enabled, tabopen opens a new tab in the currently active tab's container.
- */
- this.tabopencontaineraware = "false";
- /**
- * If moodeindicator is enabled, containerindicator will color the border of the mode indicator with the container color.
- */
- this.containerindicator = "true";
- /**
- * Autocontain directives create a container if it doesn't exist already.
- */
- this.auconcreatecontainer = "true";
- /**
- * Initial urls to navigate to when creating a new tab for a new tab group.
- */
- this.tabgroupnewtaburls = {};
- /**
- * Whether :tab shows completions for hidden tabs (e.g. tabs in other tab groups).
- */
- this.tabshowhidden = "false";
- /**
- * Number of most recent results to ask Firefox for. We display the top 20 or so most frequently visited ones.
- */
- this.historyresults = 50;
- /**
- * When displaying bookmarks in history completions, how many page views to pretend they have.
- */
- this.bmarkweight = 100;
- /**
- * When displaying searchurls in history completions, how many page views to pretend they have.
- */
- this.searchurlweight = 150;
- /**
- * Default selector for :goto command.
- */
- this.gotoselector = "h1, h2, h3, h4, h5, h6";
- /**
- * General completions options - NB: options are set according to our internal completion source name - see - `src/completions/[name].ts` in the Tridactyl source.
- */
- this.completions = {
- Goto: {
- autoselect: "true"
- },
- Tab: {
- /**
- * Whether to automatically select the closest matching completion
- */
- autoselect: "true",
- /**
- * Whether to use unicode symbols to display tab statuses
- */
- statusstylepretty: "false"
- },
- TabAll: {
- autoselect: "true"
- },
- Rss: {
- autoselect: "true"
- },
- Bmark: {
- autoselect: "true"
- },
- Sessions: {
- autoselect: "true"
- }
- };
- /**
- * Number of results that should be shown in completions. -1 for unlimited
- */
- this.findresults = -1;
- /**
- * Number of characters to use as context for the matches shown in completions
- */
- this.findcontextlen = 100;
- /**
- * Whether find should be case-sensitive
- */
- this.findcase = "smart";
- /**
- * How long find highlights should persist in milliseconds. `<= 0` means they persist until cleared
- */
- this.findhighlighttimeout = 0;
- /**
- * Whether Tridactyl should jump to the first match when using `:find`
- */
- this.incsearch = "false";
- /**
- * How many characters should be typed before triggering incsearch/completions
- */
- this.minincsearchlen = 3;
- /**
- * Deprecated.
- * Change this to "clobber" to ruin the "Content Security Policy" of all sites a bit and make Tridactyl run a bit better on some of them, e.g. raw.github*
- */
- this.csp = "untouched";
- /**
- * JavaScript RegExp used to recognize words in text.* functions (e.g. text.transpose_words). Should match any character belonging to a word.
- */
- this.wordpattern = "[^\\s]+";
- /**
- * Activate tridactyl's performance counters. These have a
- * measurable performance impact, since every sample is a few
- * hundred bytes and we sample tridactyl densely, but they're good
- * when you're trying to optimize things.
- */
- this.perfcounters = "false";
- /**
- * How many samples to store from the perf counters.
- *
- * Each performance entry is two numbers (16 bytes), an entryType
- * of either "mark" or "measure" (js strings are utf-16 ad we have
- * two marks for each measure, so amortize to about 10 bytes per
- * entry), and a string name that for Tridactyl object will be
- * about 40 (utf-16) characters (80 bytes), plus object overhead
- * roughly proportional to the string-length of the name of the
- * constructor (in this case something like 30 bytes), for a total
- * of what we'll call 128 bytes for ease of math.
- *
- * We want to store, by default, about 1MB of performance
- * statistics, so somewhere around 10k samples.
- *
- */
- this.perfsamples = "10000";
- /**
- * Show (partial) command in the mode indicator.
- * Corresponds to 'showcmd' option of vi.
- */
- this.modeindicatorshowkeys = "false";
- /**
- * Whether a trailing slash is appended when we get the parent of a url with
- * gu (or other means).
- */
- this.urlparenttrailingslash = "true";
- /**
- * Whether to enter visual mode when text is selected. Visual mode can always be entered with `:mode visual`.
- */
- this.visualenterauto = "true";
- /**
- * Whether to return to normal mode when text is deselected.
- */
- this.visualexitauto = "true";
- /**
- * Whether to open and close the sidebar quickly to get focus back to the page when is pressed.
- *
- * Disable if the fact that it closes TreeStyleTabs gets on your nerves too much : )
- *
- * NB: when disabled, can't get focus back from the address bar, but it can still get it back from lots of other places (e.g. Flash-style video players)
- */
- this.escapehatchsidebarhack = "true";
- /**
- * Threshold for fuzzy matching on completions. Lower => stricter matching. Range between 0 and 1: 0 corresponds to perfect matches only. 1 will match anything.
- *
- * https://fusejs.io/api/options.html#threshold
- */
- this.completionfuzziness = 0.3;
- /**
- * Whether to show article url in the document.title of Reader View.
- */
- this.readerurlintitle = "false";
- }
- };
- var platform_defaults = {
- win: {
- browsermaps: {
- "": null,
- "": "buffer #"
- },
- // typescript doesn't like me adding new binds like this
- nmaps: {
- "": "buffer #"
- },
- imaps: {
- "": "buffer #"
- },
- inputmaps: {
- "": "buffer #"
- },
- ignoremaps: {
- "": "buffer #"
- },
- nativeinstallcmd: `powershell -ExecutionPolicy Bypass -NoProfile -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12;(New-Object System.Net.WebClient).DownloadFile('https://raw.githubusercontent.com/tridactyl/native_messenger/master/installers/windows.ps1', '%TEMP%/tridactyl_installnative.ps1');& '%TEMP%/tridactyl_installnative.ps1' -Tag %TAG;Remove-Item '%TEMP%/tridactyl_installnative.ps1'"`,
- downloadforbiddenchars: "#%&{}\\<>*?/$!'\":@+`|=",
- downloadforbiddennames: "CON, PRN, AUX, NUL, COM1, COM2,COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1,LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9,"
- },
- linux: {
- nmaps: {
- ";x": 'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + window.devicePixelRatio * pos.x + " " + window.devicePixelRatio * pos.y + "; xdotool click 1")}',
- ";X": 'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + window.devicePixelRatio * pos.x + " " + window.devicePixelRatio * pos.y + "; xdotool keydown ctrl+shift; xdotool click 1; xdotool keyup ctrl+shift")}'
- }
- }
- };
- var keyboardlayouts = {
- qwerty: {
- KeyA: ["a", "A"],
- KeyB: ["b", "B"],
- KeyC: ["c", "C"],
- KeyD: ["d", "D"],
- KeyE: ["e", "E"],
- KeyF: ["f", "F"],
- KeyG: ["g", "G"],
- KeyH: ["h", "H"],
- KeyI: ["i", "I"],
- KeyJ: ["j", "J"],
- KeyK: ["k", "K"],
- KeyL: ["l", "L"],
- KeyM: ["m", "M"],
- KeyN: ["n", "N"],
- KeyO: ["o", "O"],
- KeyP: ["p", "P"],
- KeyQ: ["q", "Q"],
- KeyR: ["r", "R"],
- KeyS: ["s", "S"],
- KeyT: ["t", "T"],
- KeyU: ["u", "U"],
- KeyV: ["v", "V"],
- KeyW: ["w", "W"],
- KeyX: ["x", "X"],
- KeyY: ["y", "Y"],
- KeyZ: ["z", "Z"],
- Digit0: ["0", ")"],
- Digit1: ["1", "!"],
- Digit2: ["2", "@"],
- Digit3: ["3", "#"],
- Digit4: ["4", "$"],
- Digit5: ["5", "%"],
- Digit6: ["6", "^"],
- Digit7: ["7", "&"],
- Digit8: ["8", "*"],
- Digit9: ["9", "("],
- Equal: ["=", "+"],
- Backquote: ["`", "~"],
- Backslash: ["\\", "|"],
- Period: [".", ">"],
- Comma: [",", "<"],
- Semicolon: [";", ":"],
- Slash: ["/", "?"],
- BracketLeft: ["[", "{"],
- BracketRight: ["]", "}"],
- Quote: ["'", '"'],
- Minus: ["-", "_"]
- },
- azerty: {
- Backquote: ["\xB2", "\xB2"],
- Digit1: ["&", "1"],
- Digit2: ["\xE9", "2"],
- Digit3: ['"', "3"],
- Digit4: ["'", "4"],
- Digit5: ["(", "5"],
- Digit6: ["-", "6"],
- Digit7: ["\xE8", "7"],
- Digit8: ["_", "8"],
- Digit9: ["\xE7", "9"],
- Digit0: ["\xE0", "0"],
- Minus: [")", "\xB0"],
- Equal: ["=", "+"],
- KeyQ: ["a", "A"],
- KeyW: ["z", "Z"],
- KeyE: ["e", "E"],
- KeyR: ["r", "R"],
- KeyT: ["t", "T"],
- KeyY: ["y", "Y"],
- KeyU: ["u", "U"],
- KeyI: ["i", "I"],
- KeyO: ["o", "O"],
- KeyP: ["p", "P"],
- BracketRight: ["$", "\xA3"],
- Backslash: ["*", "\xB5"],
- KeyA: ["q", "Q"],
- KeyS: ["s", "S"],
- KeyD: ["d", "D"],
- KeyF: ["f", "F"],
- KeyG: ["g", "G"],
- KeyH: ["h", "H"],
- KeyJ: ["j", "J"],
- KeyK: ["k", "K"],
- KeyL: ["l", "L"],
- Semicolon: ["m", "M"],
- Quote: ["\xF9", "%"],
- KeyZ: ["w", "W"],
- KeyX: ["x", "X"],
- KeyC: ["c", "C"],
- KeyV: ["v", "V"],
- KeyB: ["b", "B"],
- KeyN: ["n", "N"],
- KeyM: [",", "?"],
- Comma: [";", "."],
- Period: [":", "/"],
- Slash: ["!", "\xA7"]
- },
- german: {
- Digit1: ["1", "!"],
- Digit2: ["2", '"'],
- Digit3: ["3", "\xA7"],
- Digit4: ["4", "$"],
- Digit5: ["5", "%"],
- Digit6: ["6", "&"],
- Digit7: ["7", "/"],
- Digit8: ["8", "("],
- Digit9: ["9", ")"],
- Digit0: ["0", "="],
- Minus: ["\xDF", "?"],
- KeyQ: ["q", "Q"],
- KeyW: ["w", "W"],
- KeyE: ["e", "E"],
- KeyR: ["r", "R"],
- KeyT: ["t", "T"],
- KeyY: ["z", "Z"],
- KeyU: ["u", "U"],
- KeyI: ["i", "I"],
- KeyO: ["o", "O"],
- KeyP: ["p", "P"],
- BracketLeft: ["\xFC", "\xDC"],
- BracketRight: ["+", "*"],
- Backslash: ["#", "'"],
- KeyA: ["a", "A"],
- KeyS: ["s", "S"],
- KeyD: ["d", "D"],
- KeyF: ["f", "F"],
- KeyG: ["g", "G"],
- KeyH: ["h", "H"],
- KeyJ: ["j", "J"],
- KeyK: ["k", "K"],
- KeyL: ["l", "L"],
- Semicolon: ["\xF6", "\xD6"],
- Quote: ["\xE4", "\xC4"],
- KeyZ: ["y", "Y"],
- KeyX: ["x", "X"],
- KeyC: ["c", "C"],
- KeyV: ["v", "V"],
- KeyB: ["b", "B"],
- KeyN: ["n", "N"],
- KeyM: ["m", "M"],
- Comma: [",", ";"],
- Period: [".", ":"],
- Slash: ["-", "_"],
- Backquote: ["", "\xB0"]
- },
- dvorak: {
- Backquote: ["`", "~"],
- Digit1: ["1", "!"],
- Digit2: ["2", "@"],
- Digit3: ["3", "#"],
- Digit4: ["4", "$"],
- Digit5: ["5", "%"],
- Digit6: ["6", "^"],
- Digit7: ["7", "&"],
- Digit8: ["8", "*"],
- Digit9: ["9", "("],
- Digit0: ["0", ")"],
- Minus: ["[", "{"],
- Equal: ["]", "}"],
- KeyQ: ["'", '"'],
- KeyW: [",", "<"],
- KeyE: [".", ">"],
- KeyR: ["p", "P"],
- KeyT: ["y", "Y"],
- KeyY: ["f", "F"],
- KeyU: ["g", "G"],
- KeyI: ["c", "C"],
- KeyO: ["r", "R"],
- KeyP: ["l", "L"],
- BracketLeft: ["/", "?"],
- BracketRight: ["=", "+"],
- Backslash: ["\\", "|"],
- KeyA: ["a", "A"],
- KeyS: ["o", "O"],
- KeyD: ["e", "E"],
- KeyF: ["u", "U"],
- KeyG: ["i", "I"],
- KeyH: ["d", "D"],
- KeyJ: ["h", "H"],
- KeyK: ["t", "T"],
- KeyL: ["n", "N"],
- Semicolon: ["s", "S"],
- Quote: ["-", "_"],
- KeyZ: [";", ":"],
- KeyX: ["q", "Q"],
- KeyC: ["j", "J"],
- KeyV: ["k", "K"],
- KeyB: ["x", "X"],
- KeyN: ["b", "B"],
- KeyM: ["m", "M"],
- Comma: ["w", "W"],
- Period: ["v", "V"],
- Slash: ["z", "Z"]
- },
- uk: {
- Digit1: ["1", "!"],
- Digit2: ["2", '"'],
- Digit3: ["3", "\xA3"],
- Digit4: ["4", "$"],
- Digit5: ["5", "%"],
- Digit6: ["6", "^"],
- Digit7: ["7", "&"],
- Digit8: ["8", "*"],
- Digit9: ["9", "("],
- Digit0: ["0", ")"],
- Minus: ["-", "_"],
- Equal: ["=", "+"],
- KeyQ: ["q", "Q"],
- KeyW: ["w", "W"],
- KeyE: ["e", "E"],
- KeyR: ["r", "R"],
- KeyT: ["t", "T"],
- KeyY: ["y", "Y"],
- KeyU: ["u", "U"],
- KeyI: ["i", "I"],
- KeyO: ["o", "O"],
- KeyP: ["p", "P"],
- BracketLeft: ["[", "{"],
- KeyK: ["k", "K"],
- BracketRight: ["]", "}"],
- KeyA: ["a", "A"],
- KeyS: ["s", "S"],
- KeyD: ["d", "D"],
- KeyF: ["f", "F"],
- KeyG: ["g", "G"],
- KeyH: ["h", "H"],
- KeyJ: ["j", "J"],
- Semicolon: [";", ":"],
- Quote: ["'", "@"],
- Backslash: ["#", "~"],
- IntlBackslash: ["\\", "|"],
- KeyZ: ["z", "Z"],
- KeyX: ["x", "X"],
- KeyC: ["c", "C"],
- KeyV: ["v", "V"],
- KeyB: ["b", "B"],
- KeyN: ["n", "N"],
- KeyM: ["m", "M"],
- Period: [".", ">"],
- Slash: ["/", "?"],
- Backquote: ["`", "\xAC"],
- KeyL: ["l", "L"],
- Comma: [",", "<"]
- },
- ca: {
- Backquote: ["#", "|"],
- Digit1: ["1", "!"],
- Digit2: ["2", '"'],
- Digit3: ["3", "/"],
- Digit4: ["4", "$"],
- Digit5: ["5", "%"],
- Digit6: ["6", "?"],
- Digit7: ["7", "&"],
- Digit8: ["8", "*"],
- Digit9: ["9", "("],
- Digit0: ["0", ")"],
- Minus: ["-", "_"],
- Equal: ["=", "+"],
- KeyQ: ["q", "Q"],
- KeyW: ["w", "W"],
- KeyE: ["e", "E"],
- KeyR: ["r", "R"],
- KeyT: ["t", "T"],
- KeyY: ["y", "Y"],
- KeyU: ["u", "U"],
- KeyI: ["i", "I"],
- KeyO: ["o", "O"],
- KeyP: ["p", "P"],
- KeyA: ["a", "A"],
- KeyS: ["s", "S"],
- KeyD: ["d", "D"],
- KeyF: ["f", "F"],
- KeyG: ["g", "G"],
- KeyH: ["h", "H"],
- KeyJ: ["j", "J"],
- KeyK: ["k", "K"],
- KeyL: ["l", "L"],
- Semicolon: [";", ":"],
- Backslash: ["<", ">"],
- IntlBackslash: ["\xAB", "\xBB"],
- KeyZ: ["z", "Z"],
- KeyX: ["x", "X"],
- KeyC: ["c", "C"],
- KeyV: ["v", "V"],
- KeyB: ["b", "B"],
- KeyN: ["n", "N"],
- KeyM: ["m", "M"],
- Comma: [",", "'"],
- Period: [".", "."],
- Slash: ["\xE9", "\xC9"]
- },
- bepo: {
- Backquote: ["$", "#"],
- Digit1: ['"', "1"],
- Digit2: ["\xAB", "2"],
- Digit3: ["\xBB", "3"],
- Digit4: ["(", "4"],
- Digit5: [")", "5"],
- Digit6: ["@", "6"],
- Digit7: ["+", "7"],
- Digit8: ["-", "8"],
- Digit9: ["/", "9"],
- Digit0: ["*", "0"],
- Minus: ["=", "\xB0"],
- Equal: ["%", "`"],
- KeyQ: ["b", "B"],
- KeyW: ["\xE9", "\xC9"],
- KeyE: ["p", "P"],
- KeyR: ["o", "O"],
- KeyT: ["\xE8", "\xC8"],
- KeyU: ["v", "V"],
- KeyI: ["d", "D"],
- KeyO: ["l", "L"],
- KeyP: ["j", "J"],
- BracketLeft: ["z", "Z"],
- BracketRight: ["w", "W"],
- KeyA: ["a", "A"],
- KeyS: ["u", "U"],
- KeyD: ["i", "I"],
- KeyF: ["e", "E"],
- KeyG: [",", ";"],
- KeyH: ["c", "C"],
- KeyJ: ["t", "T"],
- KeyK: ["s", "S"],
- KeyL: ["r", "R"],
- Semicolon: ["n", "N"],
- Quote: ["m", "M"],
- Backslash: ["\xE7", "\xC7"],
- IntlBackslash: ["\xEA", "\xCA"],
- KeyZ: ["\xE0", "\xC0"],
- KeyX: ["y", "Y"],
- KeyC: ["x", "X"],
- KeyV: [".", ":"],
- KeyB: ["k", "K"],
- KeyN: ["'", "?"],
- KeyM: ["q", "Q"],
- Comma: ["g", "G"],
- Period: ["h", "H"],
- Slash: ["f", "F"],
- KeyY: ["", "!"]
- }
- };
- var mergeDeepCull = pipe(mergeDeep, removeNull);
- var DEFAULTS = mergeDeepCull(
- o(new default_config()),
- platform_defaults[getPlatformOs()]
- );
- function getDeepProperty(obj, target) {
- if (obj !== void 0 && obj !== null && target.length) {
- if (obj["\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}"] === void 0) {
- return getDeepProperty(obj[target[0]], target.slice(1));
- } else {
- return getDeepProperty(
- mergeDeepCull(get2(obj["\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}"]), obj)[target[0]],
- target.slice(1)
- );
- }
- } else {
- if (obj === void 0 || obj === null)
- return obj;
- if (obj["\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}"] !== void 0) {
- return mergeDeepCull(get2(obj["\u{1F577}\u{1F577}INHERITS\u{1F577}\u{1F577}"]), obj);
- } else {
- return obj;
- }
- }
- }
- function mergeDeep(o1, o2) {
- if (o1 === null)
- return Object.assign({}, o2);
- const r = Array.isArray(o1) ? o1.slice() : Object.create(o1);
- Object.assign(r, o1, o2);
- if (o2 === void 0)
- return r;
- Object.keys(o1).filter(
- (key) => typeof o1[key] === "object" && typeof o2[key] === "object"
- ).forEach(
- (key) => r[key] == null ? null : Object.assign(r[key], mergeDeep(o1[key], o2[key]))
- );
- return r;
- }
- function getURL(url, target) {
- function _getURL(conf, url2, target2) {
- if (!conf.subconfigs)
- return void 0;
- return Object.keys(conf.subconfigs).filter(
- (k) => url2.match(k) && getDeepProperty(conf.subconfigs[k], target2) !== void 0
- ).sort(
- (k1, k2) => (conf.subconfigs[k1].priority || 10) - (conf.subconfigs[k2].priority || 10)
- ).reduce((acc, curKey) => {
- const curVal = getDeepProperty(
- conf.subconfigs[curKey],
- target2
- );
- if (acc instanceof Object && curVal instanceof Object)
- return mergeDeep(acc, curVal);
- return curVal;
- }, void 0);
- }
- const user = _getURL(USERCONFIG, url, target);
- const deflt = _getURL(DEFAULTS, url, target);
- if (user === void 0 || user === null)
- return deflt;
- if (typeof user !== "object" || typeof deflt !== "object")
- return user;
- return mergeDeepCull(deflt, user);
- }
- function get2(target_typed, ...target) {
- if (target_typed === void 0) {
- target = [];
- } else {
- target = [target_typed].concat(target);
- }
- let loc = window.location;
- if (window.tri && window.tri.contentLocation)
- loc = window.tri.contentLocation;
- const site = getURL(loc.href, target);
- const user = getDeepProperty(USERCONFIG, target);
- const defult = getDeepProperty(DEFAULTS, target);
- if (typeof defult === "object") {
- return mergeDeepCull(mergeDeepCull(defult, user), site);
- } else {
- if (site !== void 0) {
- return site;
- } else if (user !== void 0) {
- return user;
- } else {
- return defult;
- }
- }
- }
- async function getAsync(target_typed, ...target) {
- if (INITIALISED) {
- const browserconfig = await browser.storage.local.get(CONFIGNAME);
- USERCONFIG = browserconfig[CONFIGNAME] || o({});
- return get2(target_typed, ...target);
- } else {
- return new Promise(
- (resolve) => WAITERS.push(() => resolve(get2(target_typed, ...target)))
- );
- }
- }
- async function init() {
- const localConfig = await browser.storage.local.get(CONFIGNAME);
- schlepp(localConfig[CONFIGNAME]);
- INITIALISED = true;
- for (const waiter of WAITERS) {
- waiter();
- }
- }
- var changeListeners = /* @__PURE__ */ new Map();
- function addChangeListener(name, listener) {
- let arr = changeListeners.get(name);
- if (!arr) {
- arr = [];
- changeListeners.set(name, arr);
- }
- arr.push(listener);
- }
- browser.storage.onChanged.addListener((changes, areaname) => {
- if (CONFIGNAME in changes) {
- let triggerChangeListeners2 = function(key, value = newValue[key]) {
- const arr = changeListeners.get(key);
- if (arr) {
- const v = old[key] === void 0 ? DEFAULTS[key] : old[key];
- arr.forEach((f) => f(v, value));
- }
- };
- var triggerChangeListeners = triggerChangeListeners2;
- const { newValue, oldValue } = changes[CONFIGNAME];
- const old = oldValue || {};
- if (areaname === "sync") {
- } else if (newValue !== void 0) {
- const unsetKeys = Object.keys(old).filter(
- (k) => newValue[k] === void 0 && JSON.stringify(old[k]) !== JSON.stringify(DEFAULTS[k])
- );
- const changedKeys = Object.keys(newValue).filter(
- (k) => JSON.stringify(
- old[k] !== void 0 ? old[k] : DEFAULTS[k]
- ) !== JSON.stringify(newValue[k])
- );
- changedKeys.forEach((key) => USERCONFIG[key] = newValue[key]);
- unsetKeys.forEach((key) => delete USERCONFIG[key]);
- unsetKeys.forEach((key) => triggerChangeListeners2(key, DEFAULTS[key]));
- changedKeys.forEach((key) => triggerChangeListeners2(key));
- } else {
- USERCONFIG = o({});
- Object.keys(old).filter((key) => old[key] !== DEFAULTS[key]).forEach((key) => triggerChangeListeners2(key));
- }
- }
- });
- init();
-
- // src/lib/aliases.ts
- function expandExstr(exstr, aliases = get2("exaliases"), prevExpansions = []) {
- const [command] = exstr.trim().split(/\s+/);
- if (aliases[command] === void 0) {
- return exstr;
- }
- if (prevExpansions.includes(command)) {
- throw new Error(
- `Infinite loop detected while expanding aliases. Stack: ${prevExpansions}.`
- );
- }
- prevExpansions.push(command);
- return expandExstr(
- exstr.replace(command, aliases[command]),
- aliases,
- prevExpansions
- );
- }
- function getCmdAliasMapping(aliases = get2("exaliases")) {
- const commands = {};
- for (const alias of Object.keys(aliases)) {
- const cmd = expandExstr(alias, aliases).trim();
- if (!commands[cmd])
- commands[cmd] = [];
- commands[cmd].push(alias.trim());
- }
- return commands;
- }
-
- // src/lib/patience.ts
- var sleep = (duration) => new Promise((res) => setTimeout(res, duration));
- var backoff = (fn, retries = 5, delay = 50) => fn().catch((err) => {
- retries > 1 ? sleep(delay).then(() => backoff(fn, retries - 1, delay * 2)) : Promise.reject(err);
- });
-
- // src/completions.ts
- var DEFAULT_FAVICON = browser.runtime.getURL(
- "static/defaultFavicon.svg"
- );
- var CompletionOption = class {
- };
- var CompletionSource = class {
- constructor(prefixes2) {
- this.prefixes = [];
- const commands = getCmdAliasMapping();
- prefixes2.map((p) => p.trim()).forEach((p) => {
- this.prefixes.push(p);
- if (commands[p])
- this.prefixes = this.prefixes.concat(commands[p]);
- });
- this.prefixes = this.prefixes.map((p) => p + " ");
- }
- /** Control presentation of Source */
- set state(newstate) {
- switch (newstate) {
- case "normal":
- this.node.classList.remove("hidden");
- this.completion = void 0;
- break;
- case "hidden":
- this.node.classList.add("hidden");
- break;
- }
- this._prevState = this._state;
- this._state = newstate;
- }
- get state() {
- return this._state;
- }
- shouldRefresh() {
- return this._state !== "hidden" || this.state !== this._prevState;
- }
- prev(inc = 1) {
- return this.next(-1 * inc);
- }
- deselect() {
- this.completion = void 0;
- if (this.lastFocused !== void 0)
- this.lastFocused.state = "normal";
- }
- };
- var CompletionOptionHTML = class extends CompletionOption {
- constructor() {
- super(...arguments);
- this._state = "hidden";
- }
- /** Control presentation of element */
- set state(newstate) {
- switch (newstate) {
- case "focused":
- this.html.classList.add("focused");
- this.html.classList.remove("hidden");
- const myRect = this.html.getClientRects()[0];
- if (myRect) {
- const container = document.getElementById("completions");
- const boxRect = container.getClientRects()[0];
- if (myRect.bottom > boxRect.bottom)
- this.html.scrollIntoView();
- else if (myRect.top < boxRect.top)
- this.html.scrollIntoView(false);
- }
- break;
- case "normal":
- this.html.classList.remove("focused");
- this.html.classList.remove("hidden");
- break;
- case "hidden":
- this.html.classList.remove("focused");
- this.html.classList.add("hidden");
- break;
- }
- this._state = newstate;
- }
- get state() {
- return this._state;
- }
- };
- var CompletionSourceFuse = class extends CompletionSource {
- constructor(prefixes2, className, title) {
- super(prefixes2);
- this.fuseOptions = {
- keys: ["fuseKeys"],
- shouldSort: true,
- includeScore: true,
- findAllMatches: true,
- ignoreLocation: true,
- ignoreFieldNorm: true,
- threshold: get2("completionfuzziness"),
- minMatchCharLength: 1
- };
- // PERF: Could be expensive not to cache Fuse()
- // yeah, it was.
- this.fuse = void 0;
- this.sortScoredOptions = false;
- this.optionContainer = html`
`;
- this.node = html`
-
${title || className}
-
`;
- this.node.appendChild(this.optionContainer);
- this.state = "hidden";
- }
- // Helpful default implementations
- async filter(exstr) {
- this.lastExstr = exstr;
- await this.onInput(exstr);
- return this.updateChain();
- }
- updateChain(exstr = this.lastExstr, options = this.options) {
- if (options === void 0) {
- this.state = "hidden";
- return;
- }
- const [prefix, query2] = this.splitOnPrefix(exstr);
- if (prefix) {
- if (this.state === "hidden") {
- this.state = "normal";
- }
- } else {
- this.state = "hidden";
- return;
- }
- if (query2) {
- this.setStateFromScore(this.scoredOptions(query2));
- } else {
- options.forEach((option) => option.state = "normal");
- }
- this.updateDisplay();
- }
- select(option) {
- if (this.lastExstr !== void 0 && option !== void 0) {
- const [prefix] = this.splitOnPrefix(this.lastExstr);
- this.completion = [prefix, option.value].join(" ");
- this.args = option.value;
- option.state = "focused";
- this.lastFocused = option;
- } else {
- throw new Error("lastExstr and option must be defined!");
- }
- }
- splitOnPrefix(exstr) {
- for (const prefix of this.prefixes) {
- if (exstr.startsWith(prefix)) {
- const query2 = exstr.replace(prefix, "");
- return [prefix.trim(), query2];
- }
- }
- return [void 0, void 0];
- }
- /** Rtn sorted array of {option, score} */
- scoredOptions(query2) {
- const searchThis = this.options.map((elem, index2) => ({
- index: index2,
- fuseKeys: elem.fuseKeys
- }));
- this.fuse = new Fuse(searchThis, this.fuseOptions);
- return this.fuse.search(query2).map((result) => {
- const index2 = toNumber(result.item.index);
- return {
- index: index2,
- option: this.options[index2],
- score: result.score
- };
- });
- }
- /** Set option state by score
-
- For now just displays all scored elements (see threshold in fuse) and
- focus the best match.
- */
- setStateFromScore(scoredOpts, autoselect = false) {
- const matches = scoredOpts.map((res) => res.index);
- const hidden_options = [];
- for (const [index2, option] of enumerate(this.options)) {
- if (matches.includes(index2))
- option.state = "normal";
- else {
- option.state = "hidden";
- hidden_options.push(option);
- }
- }
- if (matches.length && autoselect) {
- this.select(this.options[matches[0]]);
- } else {
- this.deselect();
- }
- if (this.sortScoredOptions) {
- const sorted_options = matches.map((index2) => this.options[index2]);
- this.options = sorted_options.concat(hidden_options);
- }
- }
- /** Call to replace the current display */
- updateDisplay() {
- const newContainer = this.optionContainer.cloneNode(
- false
- );
- for (const option of this.options) {
- if (option.state !== "hidden")
- newContainer.appendChild(option.html);
- }
- this.optionContainer.replaceWith(newContainer);
- this.optionContainer = newContainer;
- this.next(0);
- }
- async next(inc = 1) {
- if (this.state !== "hidden") {
- return backoff(async () => {
- const visopts = this.options.filter((o2) => o2.state !== "hidden");
- const currind = visopts.findIndex((o2) => o2.state === "focused");
- this.deselect();
- const max = visopts.length + 1;
- const opt = visopts[(currind + inc + max) % max];
- if (opt)
- this.select(opt);
- return true;
- });
- } else
- return false;
- }
- /* abstract onUpdate(query: string, prefix: string, options: CompletionOptionFuse[]) */
- // Lots of methods don't need this but some do
- // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars-experimental
- async onInput(exstr) {
- }
- };
-
- // compiler/types/AnyType.ts
- var AnyType = class {
- constructor(isDotDotDot = false, isQuestion = false) {
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "any";
- }
- toConstructor() {
- return `new AnyType(${!this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convert(argument) {
- return argument;
- }
- };
-
- // compiler/types/BooleanType.ts
- var BooleanType = class {
- constructor(isDotDotDot = false, isQuestion = false) {
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "boolean";
- }
- toConstructor() {
- return `new BooleanType(${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convert(argument) {
- if (argument === "true") {
- return true;
- } else if (argument === "false") {
- return false;
- }
- throw new Error("Can't convert ${argument} to boolean");
- }
- };
-
- // compiler/types/FunctionType.ts
- var FunctionType = class {
- constructor(args, ret, isDotDotDot = false, isQuestion = false) {
- this.args = args;
- this.ret = ret;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "function";
- }
- toConstructor() {
- return `new FunctionType([` + // Convert every argument type to its string constructor representation
- this.args.map((cur) => cur.toConstructor()) + `], ${this.ret.toConstructor()}, ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return `(${this.args.map((a) => a.toString()).join(", ")}) => ${this.ret.toString()}`;
- }
- convert(argument) {
- throw new Error(`Conversion to function not implemented: ${argument}`);
- }
- };
-
- // compiler/types/NumberType.ts
- var NumberType = class {
- constructor(isDotDotDot = false, isQuestion = false) {
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "number";
- }
- toConstructor() {
- return `new NumberType(${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convert(argument) {
- const n = parseFloat(argument);
- if (!Number.isNaN(n)) {
- return n;
- }
- throw new Error(`Can't convert to number: ${argument}`);
- }
- };
-
- // compiler/types/ObjectType.ts
- var ObjectType = class {
- // Note: a map that has an empty key ("") uses the corresponding type as default type
- constructor(members = /* @__PURE__ */ new Map(), isDotDotDot = false, isQuestion = false) {
- this.members = members;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "object";
- }
- toConstructor() {
- return `new ObjectType(new Map([` + Array.from(this.members.entries()).map(([n, m]) => `[${JSON.stringify(n)}, ${m.toConstructor()}]`).join(", ") + `]), ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convertMember(memberName, memberValue) {
- let type3 = this.members.get(memberName[0]);
- if (!type3) {
- type3 = this.members.get("");
- if (!type3) {
- return memberValue;
- }
- }
- if (type3.kind === "object") {
- return type3.convertMember(memberName.slice(1), memberValue);
- }
- return type3.convert(memberValue);
- }
- convert(argument) {
- try {
- return JSON.parse(argument);
- } catch (e) {
- throw new Error(`Can't convert to object: ${argument}`);
- }
- }
- };
-
- // compiler/types/StringType.ts
- var StringType = class {
- constructor(isDotDotDot = false, isQuestion = false) {
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "string";
- }
- toConstructor() {
- return `new StringType(${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convert(argument) {
- if (typeof argument === "string") {
- return argument;
- }
- throw new Error(`Can't convert to string: ${argument}`);
- }
- };
-
- // compiler/types/TypeReferenceType.ts
- var TypeReferenceType = class {
- constructor(kind, args, isDotDotDot = false, isQuestion = false) {
- this.kind = kind;
- this.args = args;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- }
- toConstructor() {
- return `new TypeReferenceType(${JSON.stringify(this.kind)}, [` + // Turn every type argument into its constructor representation
- this.args.map((cur) => cur.toConstructor()).join(",\n") + `], ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return `${this.kind}<${this.args.map((a) => a.toString()).join(", ")}>`;
- }
- convert(argument) {
- throw new Error("Conversion of simple type references not implemented.");
- }
- };
-
- // compiler/types/VoidType.ts
- var VoidType = class {
- constructor(isDotDotDot = false, isQuestion = false) {
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "void";
- }
- toConstructor() {
- return `new VoidType(${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.kind;
- }
- convert(argument) {
- return null;
- }
- };
-
- // compiler/types/ArrayType.ts
- var ArrayType = class {
- constructor(elemType, isDotDotDot = false, isQuestion = false) {
- this.elemType = elemType;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "array";
- }
- toConstructor() {
- return `new ArrayType(${this.elemType.toConstructor()}, ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return `${this.elemType.toString()}[]`;
- }
- convert(argument) {
- if (!Array.isArray(argument)) {
- try {
- argument = JSON.parse(argument);
- } catch (e) {
- throw new Error(`Can't convert ${argument} to array:`);
- }
- if (!Array.isArray(argument)) {
- throw new Error(`Can't convert ${argument} to array:`);
- }
- }
- return argument.map((v) => this.elemType.convert(v));
- }
- };
-
- // compiler/types/LiteralTypeType.ts
- var LiteralTypeType = class {
- constructor(value, isDotDotDot = false, isQuestion = false) {
- this.value = value;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "LiteralType";
- }
- toConstructor() {
- return `new LiteralTypeType(${JSON.stringify(this.value)}, ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return JSON.stringify(this.value);
- }
- convert(argument) {
- if (argument === this.value) {
- return argument;
- }
- throw new Error(
- `Argument does not match expected value (${this.value}): ${argument}`
- );
- }
- };
-
- // compiler/types/TupleType.ts
- var TupleType = class {
- constructor(elemTypes, isDotDotDot = false, isQuestion = false) {
- this.elemTypes = elemTypes;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "tuple";
- }
- toConstructor() {
- return `new TupleType([` + // Convert every element type to its constructor representation
- this.elemTypes.map((cur) => cur.toConstructor()).join(",\n") + `], ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return `[${this.elemTypes.map((e) => e.toString()).join(", ")}]`;
- }
- convert(argument) {
- if (!Array.isArray(argument)) {
- try {
- argument = JSON.parse(argument);
- } catch (e) {
- throw new Error(`Can't convert to tuple: ${argument}`);
- }
- if (!Array.isArray(argument)) {
- throw new Error(`Can't convert to tuple: ${argument}`);
- }
- }
- if (argument.length !== this.elemTypes.length) {
- throw new Error(
- `Error converting tuple: number of elements and type mismatch ${argument}`
- );
- }
- return argument.map((v, i) => this.elemTypes[i].convert(v));
- }
- };
-
- // compiler/types/UnionType.ts
- var UnionType = class {
- constructor(types, isDotDotDot = false, isQuestion = false) {
- this.types = types;
- this.isDotDotDot = isDotDotDot;
- this.isQuestion = isQuestion;
- this.kind = "union";
- }
- toConstructor() {
- return `new UnionType([` + // Convert every type to its string constructor representation
- this.types.map((cur) => cur.toConstructor()).join(",\n") + `], ${this.isDotDotDot}, ${this.isQuestion})`;
- }
- toString() {
- return this.types.map((t) => t.toString()).join(" | ");
- }
- convert(argument) {
- for (const t of this.types) {
- try {
- return t.convert(argument);
- } catch (e) {
- }
- }
- throw new Error(`Can't convert "${argument}" to any of: ${this.types}`);
- }
- };
-
- // compiler/metadata/SymbolMetadata.ts
- var SymbolMetadata = class {
- constructor(doc, type3, hidden = false) {
- this.doc = doc;
- this.type = type3;
- this.hidden = hidden;
- }
- toConstructor() {
- return `new SymbolMetadata(${JSON.stringify(
- this.doc
- )}, ${this.type.toConstructor()}, ${this.hidden})`;
- }
- };
-
- // compiler/metadata/ClassMetadata.ts
- var ClassMetadata = class {
- constructor(members = /* @__PURE__ */ new Map()) {
- this.members = members;
- }
- setMember(name, s) {
- this.members.set(name, s);
- }
- getMember(name) {
- return this.members.get(name);
- }
- getMembers() {
- return this.members.keys();
- }
- toConstructor() {
- return `new ClassMetadata(new Map([` + Array.from(this.members.entries()).map(([n, m]) => `[${JSON.stringify(n)}, ${m.toConstructor()}]`).join(",\n") + `]))`;
- }
- };
-
- // compiler/metadata/FileMetadata.ts
- var FileMetadata = class {
- constructor(classes = /* @__PURE__ */ new Map(), functions = /* @__PURE__ */ new Map()) {
- this.classes = classes;
- this.functions = functions;
- }
- setClass(name, c) {
- this.classes.set(name, c);
- }
- getClass(name) {
- return this.classes.get(name);
- }
- getClasses() {
- return Array.from(this.classes.keys());
- }
- setFunction(name, f) {
- this.functions.set(name, f);
- }
- getFunction(name) {
- return this.functions.get(name);
- }
- getFunctions() {
- return Array.from(this.functions.entries());
- }
- getFunctionNames() {
- return Array.from(this.functions.keys());
- }
- toConstructor() {
- return `new FileMetadata(new Map([` + Array.from(this.classes.entries()).map(([n, c]) => `[${JSON.stringify(n)}, ${c.toConstructor()}]`).join(",\n") + `]), new Map([` + Array.from(this.functions.entries()).map(([n, f]) => `[${JSON.stringify(n)}, ${f.toConstructor()}]`).join(",\n") + `]))`;
- }
- };
-
- // compiler/metadata/ProgramMetadata.ts
- var ProgramMetadata = class {
- constructor(files = /* @__PURE__ */ new Map()) {
- this.files = files;
- }
- setFile(name, file) {
- this.files.set(name, file);
- }
- getFile(name) {
- return this.files.get(name);
- }
- toConstructor() {
- return `new ProgramMetadata(new Map([` + Array.from(this.files.entries()).map(([n, f]) => `[${JSON.stringify(n)}, ${f.toConstructor()}]`).join(",\n") + `]))`;
- }
- };
-
- // src/.metadata.generated.ts
- var everything = new ProgramMetadata(/* @__PURE__ */ new Map([
- ["src/excmds.ts", new FileMetadata(/* @__PURE__ */ new Map([]), /* @__PURE__ */ new Map([
- ["getNativeVersion", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), true)],
- ["getRssLinks", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new ArrayType(new ObjectType(/* @__PURE__ */ new Map([]), false, false), false, false)], false, false), false, false), true)],
- ["rssexec", new SymbolMetadata("Execute [[rsscmd]] for an rss link.\n\nIf `url` is undefined, Tridactyl will look for rss links in the current\npage. If it doesn't find any, it will display an error message. If it finds\nmultiple urls, it will offer completions in order for you to select the link\nyou're interested in. If a single rss feed is found, it will automatically\nbe selected.", new FunctionType([new StringType(false, false), new StringType(false, true), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["fillinput", new SymbolMetadata("Fills the element matched by `selector` with content and falls back to the last used input if the element can't be found. You probably don't want this; it used to be used internally for [[editor]].\n\nThat said, `bind gs fillinput null [Tridactyl](https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/) is my favourite add-on` could probably come in handy.", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), false)],
- ["getInput", new SymbolMetadata("", new FunctionType([new TypeReferenceType("HTMLElement", [], false, false)], new StringType(false, false), false, false), true)],
- ["getinput", new SymbolMetadata("", new FunctionType([], new StringType(false, false), false, false), true)],
- ["getInputSelector", new SymbolMetadata("", new FunctionType([], new AnyType(true, false), false, false), true)],
- ["addTridactylEditorClass", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), true)],
- ["removeTridactylEditorClass", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), true)],
- ["editor", new SymbolMetadata("Opens your favourite editor (which is currently gVim) and fills the last used input with whatever you write into that file.\n**Requires that the native messenger is installed, see [[native]] and [[nativeinstall]]**.\n\nUses the `editorcmd` config option, default = `auto` looks through a list defined in lib/native.ts try find a sensible combination. If it's a bit slow, or chooses the wrong editor, or gives up completely, set editorcmd to something you want. The command must stay in the foreground until the editor exits.\n\nThe editorcmd needs to accept a filename, stay in the foreground while it's edited, save the file and exit. By default the filename is added to the end of editorcmd, if you require control over the position of that argument, the first occurrence of %f in editorcmd is replaced with the filename. %l, if it exists, is replaced with the line number of the cursor and %c with the column number. For example:\n```\nset editorcmd terminator -u -e \"vim %f '+normal!%lGzv%c|'\"\n```\n\nYou're probably better off using the default insert mode bind of `` (Ctrl-i) to access this.\n\nThis function returns a tuple containing the path to the file that was opened by the editor and its content. This enables creating commands such as the following one, which deletes the temporary file created by the editor:\n```\nalias editor_rm composite editor | jsb -p tri.native.run(`rm -f '${JS_ARG[0]}'`)\nbind --mode=insert editor_rm\nbind --mode=input editor_rm\n```", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["guiset_quiet", new SymbolMetadata("Like [[guiset]] but quieter.", new FunctionType([new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["guiset", new SymbolMetadata("Change which parts of the Firefox user interface are shown. **NB: This feature is experimental and might break stuff.**\n\nMight mangle your userChrome. Requires native messenger, and you must restart Firefox each time to see any changes (this can be done using [[restart]]). \n\nAlso flips the preference `toolkit.legacyUserProfileCustomizations.stylesheets` to true so that FF will read your userChrome.\n\nView available rules and options [here](/static/docs/modules/_src_lib_css_util_.html#potentialrules) and [here](/static/docs/modules/_src_lib_css_util_.html#metarules).\n\nExample usage: `guiset gui none`, `guiset gui full`, `guiset tabs autohide`.\n\nSome of the available options:\n\n- gui\n - full\n - none\n\n- tabs\n - always\n - autohide\n\n- navbar\n - always\n - autohide\n - none\n\n- hoverlink (the little link that appears when you hover over a link)\n - none\n - left\n - right\n - top-left\n - top-right\n\n- statuspanel (hoverlink + the indicator that appears when a website is loading)\n - none\n - left\n - right\n - top-left\n - top-right\n\nIf you want to use guiset in your tridactylrc, you might want to use [[guiset_quiet]] instead.", new FunctionType([new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["cssparse", new SymbolMetadata("", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), true)],
- ["loadtheme", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["unloadtheme", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["colourscheme", new SymbolMetadata("Changes the current theme.\n\nIf THEMENAME is any of the themes that can be found in the [Tridactyl repo](https://github.com/tridactyl/tridactyl/tree/master/src/static/themes) (e.g. 'dark'), the theme will be loaded from Tridactyl's internal storage.\n\nIf THEMENAME is set to any other value except `--url`, Tridactyl will attempt to use its native binary (see [[native]]) in order to load a CSS file named THEMENAME from disk. The CSS file has to be in a directory named \"themes\" and this directory has to be in the same directory as your tridactylrc. If this fails, Tridactyl will attempt to load the theme from its internal storage.\n\nLastly, themes can be loaded from URLs with `:colourscheme --url [url] [themename]`. They are stored internally - if you want to update the theme run the whole command again.\n\nNote that the theme name should NOT contain any dot.\n\nExample: `:colourscheme mysupertheme`\nOn linux, this will load ~/.config/tridactyl/themes/mysupertheme.css\n\n__NB__: due to Tridactyl's architecture, the theme will take a small amount of time to apply as each page is loaded. If this annoys you, you may use [userContent.css](http://kb.mozillazine.org/index.php?title=UserContent.css&printable=yes) to make changes to Tridactyl earlier. For example, users using the dark theme may like to put\n\n```\n:root {\n --tridactyl-bg: black !important;\n --tridactyl-fg: white !important;\n}\n```\n\nin their `userContent.css`. Follow [issue #2510](https://github.com/tridactyl/tridactyl/issues/2510) if you would like to find out when we have made a more user-friendly solution.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["setpref", new SymbolMetadata("Write a setting to your user.js file. Requires a [[restart]] after running to take effect.", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["removepref", new SymbolMetadata("Remove a setting from your user.js file.", new FunctionType([new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["fixamo_quiet", new SymbolMetadata("Like [[fixamo]] but quieter.\n\nNow purely a placebo as [[fixamo]] has been removed.", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["fixamo", new SymbolMetadata('Used to simply set\n```js\n "privacy.resistFingerprinting.block_mozAddonManager":true\n "extensions.webextensions.restrictedDomains":""\n```\nin about:config via user.js so that Tridactyl (and other extensions!) can be used on addons.mozilla.org and other sites.\n\nRemoved at the request of the Firefox Security team. Replacements exist in our exemplar RC file.\n\nRequires `native` and a `restart`.', new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["nativeopen", new SymbolMetadata("Uses the native messenger to open URLs.\n\n**Be *seriously* careful with this:**\n\n1. the implementation basically execs `firefox --new-tab `\n2. you can use it to open any URL you can open in the Firefox address bar,\n including ones that might cause side effects (firefox does not guarantee\n that about: pages ignore query strings).\n\nYou've been warned.\n\nThis uses the [[browser]] setting to know which binary to call. If you need to pass additional arguments to firefox (e.g. '--new-window'), make sure they appear before the url.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["exclaim", new SymbolMetadata("Run command in /bin/sh (unless you're on Windows), and print the output in the command line. Non-zero exit codes and stderr are ignored, currently.\n\nRequires the native messenger, obviously.\n\nIf you're using `exclaim` with arguments coming from a pipe, consider using [[shellescape]] to properly escape arguments and to prevent unsafe commands.\n\nIf you want to use a different shell, just prepend your command with whatever the invocation is and keep in mind that most shells require quotes around the command to be executed, e.g. `:exclaim xonsh -c \"1+2\"`.\n\nAliased to `!` but the exclamation mark **must be followed with a space**.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["exclaim_quiet", new SymbolMetadata("Like exclaim, but without any output to the command line.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["native", new SymbolMetadata("Tells you if the native messenger is installed and its version.\n\nFor snap, flatpak, and other sandboxed installations, additional setup is required \u2013 see https://github.com/tridactyl/tridactyl#extra-features-through-native-messaging.", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["nativeinstall", new SymbolMetadata("Copies the installation command for the native messenger to the clipboard and asks the user to run it in their shell.\n\nThe native messenger's source code may be found here: https://github.com/tridactyl/native_messenger/blob/master/src/native_main.nim\n\nIf your corporate IT policy disallows execution of binaries which have not been whitelisted but allows Python scripts, you may instead use the old native messenger by running `install.sh` or `win_install.ps1` from https://github.com/tridactyl/tridactyl/tree/master/native - the main downside is that it is significantly slower.\n\nFor snap, flatpak, and other sandboxed installations, additional setup is required \u2013 see https://github.com/tridactyl/tridactyl#extra-features-through-native-messaging.", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["mktridactylrc", new SymbolMetadata("Writes current config to a file.\n\nNB: an RC file is not required for your settings to persist: all settings are stored in a local Firefox storage database by default as soon as you set them.\n\nWith no arguments supplied the excmd will try to find an appropriate\nconfig path and write the rc file to there. Any argument given to the\nexcmd excluding the `-f` flag will be treated as a path to write the rc\nfile to relative to the native messenger's location (`~/.local/share/tridactyl/`). By default, it silently refuses to overwrite existing files.\n\nThe RC file will be split into sections that will be created if a config\nproperty is discovered within one of them:\n- General settings\n- Binds\n- Aliases\n- Autocmds\n- Autocontainers\n- Logging\n\nNote:\n- Subconfig paths fall back to using `js tri.config.set(key: obj)` notation.\n- This method is also used as a fallback mechanism for objects that didn't hit\n any of the heuristics.\n\nAvailable flags:\n- `-f` will overwrite the config file if it exists.\n- `--clipboard` write config to clipboard - no [[native]] required", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["source", new SymbolMetadata("Runs an RC file from disk or a URL\n\nThis function accepts a flag: `--url` to load a RC from a URL.\n\nIf no argument given, it will try to open ~/.tridactylrc, ~/.config/tridactyl/tridactylrc or $XDG_CONFIG_HOME/tridactyl/tridactylrc in reverse order. You may use a `_` in place of a leading `.` if you wish, e.g, if you use Windows.\n\nIf no url is specified with the `--url` flag, the current page's URL is used to locate the RC file. Ensure the URL you pass (or page you are on) is a \"raw\" RC file, e.g. https://raw.githubusercontent.com/tridactyl/tridactyl/master/.tridactylrc and not https://github.com/tridactyl/tridactyl/blob/master/.tridactylrc.\n\nTridactyl won't run on many raw pages due to a Firefox bug with Content Security Policy, so you may need to use the `source --url [URL]` form.\n\nOn Windows, the `~` expands to `%USERPROFILE%`.\n\nThe RC file is just a bunch of Tridactyl excmds (i.e, the stuff on this help page). Settings persist in local storage. There's an [example file](https://raw.githubusercontent.com/tridactyl/tridactyl/master/.tridactylrc) if you want it.\n\nThere is a [bug](https://github.com/tridactyl/tridactyl/issues/1409) where not all lines of the RC file are executed if you use `sanitise` at the top of it. We instead recommend you put `:bind ZZ composite sanitise tridactyllocal; qall` in your RC file and use `ZZ` to exit Firefox.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["source_quiet", new SymbolMetadata("Same as [[source]] but suppresses all errors", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["updatenative", new SymbolMetadata("Updates the native messenger if it is installed, using our GitHub repo. This is run every time Tridactyl is updated.\n\nIf you want to disable this, or point it to your own native messenger, edit the `nativeinstallcmd` setting.", new FunctionType([new BooleanType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["restart", new SymbolMetadata("Restarts firefox with the same commandline arguments.\n\nWarning: This can kill your tabs, especially if you :restart several times\nin a row", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["saveas", new SymbolMetadata("Download the current document.\n\nIf you have the native messenger v>=0.1.9 installed, the function accepts an optional argument, filename, which can be:\n- An absolute path\n- A path starting with ~, which will be expanded to your home directory\n- A relative path, relative to the native messenger executable (e.g. ~/.local/share/tridactyl on linux).\nIf filename is not given, a download dialogue will be opened. If filename is a directory, the file will be saved inside of it, its name being inferred from the URL. If the directories mentioned in the path do not exist or if a file already exists at this path, the file will be kept in your downloads folder and an error message will be given.\n\n**NB**: if a non-default save location is chosen, Firefox's download manager will say the file is missing. It is not - it is where you asked it to be saved.\n\nFlags:\n- `--overwrite`: overwrite the destination file.\n- `--cleanup`: removes the downloaded source file e.g. `$HOME/Downlods/downloaded.doc` if moving it to the desired directory fails.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tabSetActive", new SymbolMetadata("", new FunctionType([new NumberType(false, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), true)],
- ["getJumpPageId", new SymbolMetadata("This is used as an ID for the current page in the jumplist.\nIt has a potentially confusing behavior: if you visit site A, then site B, then visit site A again, the jumplist that was created for your first visit on A will be re-used for your second visit.\nAn ideal solution would be to have a counter that is incremented every time a new page is visited within the tab and use that as the return value for getJumpPageId but this doesn't seem to be trivial to implement.", new FunctionType([], new StringType(false, false), false, false), true)],
- ["saveJumps", new SymbolMetadata("", new FunctionType([new AnyType(true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["saveTabHistory", new SymbolMetadata("", new FunctionType([new AnyType(true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["curTabHistory", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["curJumps", new SymbolMetadata("Returns a promise for an object containing the jumplist of all pages accessed in the current tab.\nThe keys of the object currently are the page's URL, however this might change some day. Use [[getJumpPageId]] to access the jumplist of a specific page.", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["jumpnext", new SymbolMetadata("Calls [[jumpprev]](-n)", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["jumpprev", new SymbolMetadata("Similar to Pentadactyl or vim's jump list.\n\nWhen you scroll on a page, either by using the mouse or Tridactyl's key bindings, your position in the page will be saved after jumpdelay milliseconds (`:get jumpdelay` to know how many milliseconds that is). If you scroll again, you'll be able to go back to your previous position by using `:jumpprev 1`. If you need to go forward in the jumplist, use `:jumpprev -1`.\n\nKnown bug: Tridactyl will use the same jumplist for multiple visits to a same website in the same tab, see [github issue 834](https://github.com/tridactyl/tridactyl/issues/834).", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["markjump", new SymbolMetadata("Jumps to a local mark, a global mark, or the location before the last mark jump.\n[a-z] are local marks, [A-Z] are global marks and '`' is the location before the last mark jump.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["markjumplocal", new SymbolMetadata("Jumps to a local mark.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["markjumpglobal", new SymbolMetadata("Jumps to a global mark. If the tab with the mark no longer exists or its url differs from the mark's url,\njumps to another tab with the mark's url or creates it first if such tab does not exist.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["markjumpbefore", new SymbolMetadata("Jumps to a location saved before the last mark jump as long as the tab it's located in exists and its url didn't change.\nOverwrites the location before the last mark jump - repeating this method will jump back and forth between two locations.", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["scrolltab", new SymbolMetadata("Scrolls to a given position in a tab identified by tabId and prints a message in it.", new FunctionType([new NumberType(false, false), new NumberType(false, false), new NumberType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["markadd", new SymbolMetadata("Adds a global or a local mark. In case of a local mark, it will be assigned to the current page url.\nIf a mark is already assigned, it is overwritten.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["markaddlocal", new SymbolMetadata("Assigns a local mark to the current url and the given key. If a mark is already assigned, it is overwritten.\nTwo urls are considered the same if they're identical ignoring anchors.\nLocal marks are not persisted between browser restarts.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["markaddglobal", new SymbolMetadata("Assigns a global mark to the given key. If a mark is already assigned, it is overwritten.\nGlobal marks are persisted between browser restarts.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["addJump", new SymbolMetadata("Called on 'scroll' events.\nIf you want to have a function that moves within the page but doesn't add a\nlocation to the jumplist, make sure to set JUMPED to true before moving\naround.\nThe setTimeout call is required because sometimes a user wants to move\nsomewhere by pressing 'j' multiple times and we don't want to add the\nin-between locations to the jump list", new FunctionType([], new VoidType(false, false), false, false), true)],
- ["addTabHistory", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["unfocus", new SymbolMetadata("Blur (unfocus) the active element and enter normal mode", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["scrollpx", new SymbolMetadata("Scrolls the window or any scrollable child element by a pixels on the horizontal axis and b pixels on the vertical axis.", new FunctionType([new NumberType(false, false), new NumberType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["scrollto", new SymbolMetadata("If two numbers are given, treat as x and y values to give to window.scrollTo\nIf one number is given, scroll to that percentage along a chosen axis, defaulting to the y-axis. If the number has 'c' appended to it, it will be interpreted in radians.\n\nNote that if `a` is 0 or 100 and if the document is not scrollable in the given direction, Tridactyl will attempt to scroll the first scrollable element until it reaches the very bottom of that element.\n\nExamples:\n\n- `scrollto 50` -> scroll halfway down the page.\n- `scrollto 3.14c` -> scroll approximately 49.97465213% of the way down the page.", new FunctionType([new UnionType([
- new StringType(false, false),
- new NumberType(false, false)
- ], false, false), new UnionType([
- new NumberType(false, false),
- new LiteralTypeType("x", false, false),
- new LiteralTypeType("y", false, false)
- ], false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["scrollline", new SymbolMetadata("Scrolls the document of its first scrollable child element by n lines.\n\nThe height of a line is defined by the site's CSS. If Tridactyl can't get it, it'll default to 22 pixels.", new FunctionType([new NumberType(false, true), new NumberType(false, true)], new AnyType(true, false), false, false), false)],
- ["scrollpage", new SymbolMetadata("Scrolls the document by n pages.\nThe height of a page is the current height of the window.", new FunctionType([new NumberType(false, true), new NumberType(false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["find", new SymbolMetadata('Rudimentary find mode, left unbound by default as we don\'t currently support `incsearch`. Suggested binds:\n\n bind / fillcmdline find\n bind ? fillcmdline find --reverse\n bind n findnext --search-from-view\n bind N findnext --search-from-view --reverse\n bind gn findselect\n bind gN composite findnext --search-from-view --reverse; findselect\n bind , nohlsearch\n\nArgument: A string you want to search for.\n\nThis function accepts two flags: `-?` or `--reverse` to search from the bottom rather than the top and `-: n` or `--jump-to n` to jump directly to the nth match.\n\nThe behavior of this function is affected by the following setting:\n\n`findcase`: either "smart", "sensitive" or "insensitive". If "smart", find will be case-sensitive if the pattern contains uppercase letters.\n\nKnown bugs: find will currently happily jump to a non-visible element, and pressing n or N without having searched for anything will cause an error.', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["findnext", new SymbolMetadata("Jump to the next nth searched pattern.\n\nAvailable flags:\n- `-f` or `--search-from-view` to search from the current view instead of the previous match\n- `-?` or `--reverse` to reverse the sign of the number", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["clearsearchhighlight", new SymbolMetadata("", new FunctionType([], new AnyType(true, false), false, false), false)],
- ["findselect", new SymbolMetadata("Highlight the current find-mode match result and enter the visual mode.", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["history", new SymbolMetadata("", new FunctionType([new StringType(false, false), new NumberType(false, false)], new VoidType(false, false), false, false), true)],
- ["forward", new SymbolMetadata("Navigate forward one page in history.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), false)],
- ["back", new SymbolMetadata("Navigate back one page in history.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), false)],
- ["reload", new SymbolMetadata("Reload the next n tabs, starting with activeTab, possibly bypassingCache", new FunctionType([new NumberType(false, true), new BooleanType(false, true)], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["reloadall", new SymbolMetadata("Reloads all tabs, bypassing the cache if hard is set to true", new FunctionType([new BooleanType(false, true)], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["reloadallbut", new SymbolMetadata("Reloads all tabs except the current one, bypassing the cache if hard is set to true\nYou probably want to use [[reloaddead]] instead if you just want to be able to ensure Tridactyl is loaded in all tabs where it can be", new FunctionType([new BooleanType(false, true)], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["reloaddead", new SymbolMetadata("Reloads all tabs which Tridactyl isn't loaded in", new FunctionType([new BooleanType(false, true)], new TypeReferenceType("Promise", [new TupleType([
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false),
- new AnyType(true, false)
- ], false, false)], false, false), false, false), false)],
- ["reloadhard", new SymbolMetadata("Reload the next n tabs, starting with activeTab. bypass cache for all", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["open", new SymbolMetadata("Open a new page in the current tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["bmarks", new SymbolMetadata("Works exactly like [[open]], but only suggests bookmarks.\n\nIf you want to use optional flags, you should run `:set completions.Bmark.autoselect false` to prevent the spacebar from inserting the URL of the top bookmark.", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["open_quiet", new SymbolMetadata("Like [[open]] but doesn't make a new entry in history.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["url2args", new SymbolMetadata('If the url of the current document matches one of your search engines, will convert it to a list of arguments that open/tabopen will understand. If the url doesn\'t match any search engine, returns the url without modifications.\n\nFor example, if you have searchurls.gi set to "https://www.google.com/search?q=%s&tbm=isch", using this function on a page you opened using "gi butterflies" will return "gi butterflies".\n\nThis is useful when combined with fillcmdline, for example like this: `bind O composite url2args | fillcmdline open`.\n\nNote that this might break with search engines that redirect you to other pages/add GET parameters that do not exist in your searchurl.', new FunctionType([], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["removeSource", new SymbolMetadata("", new FunctionType([], new VoidType(false, false), false, false), true)],
- ["viewsource", new SymbolMetadata("Display the (HTML) source of the current page.\n\nBehaviour can be changed by the 'viewsource' setting.\n\nIf the 'viewsource' setting is set to 'default' rather than 'tridactyl',\nthe url the source of which should be displayed can be given as argument.\nOtherwise, the source of the current document will be displayed.", new FunctionType([new StringType(false, true)], new VoidType(false, false), false, false), false)],
- ["home", new SymbolMetadata('Go to the homepages you have set with `set homepages ["url1", "url2"]`.', new FunctionType([new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["help", new SymbolMetadata('Show this page.\n\n`:help something` jumps to the entry for something. Something can be an excmd, an alias for an excmd, a binding or a setting.\n\nOn the ex command page, the "nmaps" list is a list of all the bindings for the command you\'re seeing and the "exaliases" list lists all its aliases.\n\nIf there\'s a conflict (e.g. you have a "go" binding that does something, a "go" excmd that does something else and a "go" setting that does a third thing), the binding is chosen first, then the setting, then the excmd. In such situations, if you want to let Tridactyl know you\'re looking for something specfic, you can specify the following flags as first arguments:\n\n`-a`: look for an alias\n`-b`: look for a binding\n`-e`: look for an ex command\n`-s`: look for a setting\n\nIf the keyword you gave to `:help` is actually an alias for a composite command (see [[composite]]) , you will be taken to the help section for the first command of the pipeline. You will be able to see the whole pipeline by hovering your mouse over the alias in the "exaliases" list. Unfortunately there currently is no way to display these HTML tooltips from the keyboard.\n\ne.g. `:help bind`', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["apropos", new SymbolMetadata("Search through the help pages. Accepts the same flags as [[help]]. Only useful in interactive usage with completions; the command itself is just a wrapper for [[help]].", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tutor", new SymbolMetadata("Start the tutorial", new FunctionType([new StringType(false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["credits", new SymbolMetadata("Display Tridactyl's contributors in order of commits in a user-friendly fashion", new FunctionType([], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["no_mouse_mode", new SymbolMetadata('Hides the cursor and covers the current page in an overlay to prevent clicking on links with the mouse to force yourself to use hint mode.\n\nTo bring back mouse control, use [[mouse_mode]] or refresh the page.\n\nSuggested usage: `autocmd DocLoad .* no_mouse_mode`\n\n"There is no mouse".', new FunctionType([], new VoidType(false, false), false, false), false)],
- ["neo_mouse_mode", new SymbolMetadata('Matrix variant of [[no_mouse_mode]]\n\n"There is no mouse".\n\nCoincidentally added to Tridactyl at the same time as we reached 1337 stars on GitHub.', new FunctionType([], new VoidType(false, false), false, false), false)],
- ["snow_mouse_mode", new SymbolMetadata("Christmas variant of [[no_mouse_mode]] (if you live in $DEFAULT hemisphere).", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["pied_piper_mouse_mode", new SymbolMetadata("Music variant of [[no_mouse_mode]].", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["drawingstart", new SymbolMetadata("Drawable variant of [[no_mouse_mode]]\nIn this mode, you can use the mouse or a digital stylus to draw. To switch to an eraser, use [[drawingerasertoggle]]\nUse [[mouse_mode]] to return, or refresh page.\nSuggested usage: `autocmd DocLoad .* drawingstart\n\n**Warning**: Windows Ink enabled input devices don't work, disable it for your browser, or use a mouse.", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["drawingerasertoggle", new SymbolMetadata("Switch between pen and eraser for [[drawingstart]]\nSuggested usage: `bind e drawingerasertoggle`. If you have a digital pen, map the button to `e` to switch easily.", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["mouse_mode", new SymbolMetadata("Revert any variant of the [[no_mouse_mode]]\n\nSuggested usage: `bind mouse_mode` with the autocmd mentioned in [[no_mouse_mode]] or [[drawingstart]].", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["findRelLink", new SymbolMetadata("", new FunctionType([new TypeReferenceType("RegExp", [], false, false)], new TypeReferenceType("HTMLAnchorElement", [], false, false), false, false), true)],
- ["selectLast", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new TypeReferenceType("HTMLElement", [], false, false), false, false), true)],
- ["followpage", new SymbolMetadata("Find a likely next/previous link and follow it\n\nIf a link or anchor element with rel=rel exists, use that, otherwise fall back to:\n\n 1) find the last anchor on the page with innerText matching the appropriate `followpagepattern`.\n 2) call [[urlincrement]] with 1 or -1\n\nIf you want to support e.g. French:\n\n```\nset followpagepatterns.next ^(next|newer|prochain)\\b|\xBB|>>\nset followpagepatterns.prev ^(prev(ious)?|older|pr\xE9c\xE9dent)\\b|\xAB|<<\n```", new FunctionType([new UnionType([
- new LiteralTypeType("next", false, false),
- new LiteralTypeType("prev", false, false)
- ], false, true)], new VoidType(false, false), false, false), false)],
- ["urlincrement", new SymbolMetadata("Increment the current tab URL", new FunctionType([new NumberType(false, true), new NumberType(false, true)], new VoidType(false, false), false, false), false)],
- ["urlroot", new SymbolMetadata("Go to the root domain of the current URL", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["urlparent", new SymbolMetadata("Go to the parent URL of the current tab's URL", new FunctionType([new NumberType(false, true)], new VoidType(false, false), false, false), false)],
- ["urlmodify", new SymbolMetadata('Open a URL made by modifying the current URL\n\nThere are several modes:\n\n* Text replace mode: `urlmodify -t `\n\n Replaces the first instance of the text `old` with `new`.\n * `http://example.com` -> (`-t exa peta`) -> `http://petample.com`\n\n* Regex replacment mode: `urlmodify -r [flags]`\n\n Replaces the first match of the `regexp` with `new`. You can use\n flags `i` and `g` to match case-insensitively and to match\n all instances respectively\n * `http://example.com` -> (`-r [ea] X g`) -> `http://XxXmplX.com`\n\n* Query set mode: `urlmodify -s `\n\n Sets the value of a query to be a specific one. If the query already\n exists, it will be replaced.\n * `http://e.com?id=abc` -> (`-s foo bar`) -> `http://e.com?id=abc&foo=bar\n\n* Query replace mode: `urlmodify -q `\n\n Replace the value of a query with a new one:\n * `http://e.com?id=foo` -> (`-q id bar`) -> `http://e.com?id=bar\n\n* Query delete mode: `urlmodify -Q `\n\n Deletes the given query (and the value if any):\n * `http://e.com?id=foo&page=1` -> (`-Q id`) -> `http://e.com?page=1`\n\n* Graft mode: `urlmodify -g `\n\n "Grafts" a new tail on the URL path, possibly removing some of the old\n tail. Graft point indicates where the old URL is truncated before adding\n the new path.\n\n * `graft_point` >= 0 counts path levels, starting from the left\n (beginning). 0 will append from the "root", and no existing path will\n remain, 1 will keep one path level, and so on.\n * `graft_point` < 0 counts from the right (i.e. the end of the current\n path). -1 will append to the existing path, -2 will remove the last path\n level, and so on.\n\n ```plaintext\n http://website.com/this/is/the/path/component\n Graft point: ^ ^ ^ ^ ^ ^\n From left: 0 1 2 3 4 5\n From right: -6 -5 -4 -3 -2 -1\n ```\n\n Examples:\n\n * `http://e.com/issues/42` -> (`-g 0 foo`) -> `http://e.com/foo`\n * `http://e.com/issues/42` -> (`-g 1 foo`) -> `http://e.com/issues/foo`\n * `http://e.com/issues/42` -> (`-g -1 foo`) -> `http://e.com/issues/42/foo`\n * `http://e.com/issues/42` -> (`-g -2 foo`) -> `http://e.com/issues/foo`\n\n\n* URL Input: `urlmodify -*u `\n\n Each mode can be augmented to accept a URL as the last argument instead of\n the current url.\n\n Examples:\n\n * `urlmodify -tu `\n * `urlmodify -su `\n * `urlmodify -gu `', new FunctionType([new UnionType([
- new LiteralTypeType("-t", false, false),
- new LiteralTypeType("-r", false, false),
- new LiteralTypeType("-s", false, false),
- new LiteralTypeType("-q", false, false),
- new LiteralTypeType("-Q", false, false),
- new LiteralTypeType("-g", false, false),
- new LiteralTypeType("-tu", false, false),
- new LiteralTypeType("-ru", false, false),
- new LiteralTypeType("-su", false, false),
- new LiteralTypeType("-qu", false, false),
- new LiteralTypeType("-Qu", false, false),
- new LiteralTypeType("-gu", false, false)
- ], false, false), new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), false)],
- ["urlmodify_js", new SymbolMetadata("Like [[urlmodify]] but returns the modified URL for use with [[js]] and [[composite]]\n\nE.g.\n\n`:composite urlmodify_js -t www. old. | tabopen `", new FunctionType([new UnionType([
- new LiteralTypeType("-t", false, false),
- new LiteralTypeType("-r", false, false),
- new LiteralTypeType("-s", false, false),
- new LiteralTypeType("-q", false, false),
- new LiteralTypeType("-Q", false, false),
- new LiteralTypeType("-g", false, false),
- new LiteralTypeType("-tu", false, false),
- new LiteralTypeType("-ru", false, false),
- new LiteralTypeType("-su", false, false),
- new LiteralTypeType("-qu", false, false),
- new LiteralTypeType("-Qu", false, false),
- new LiteralTypeType("-gu", false, false)
- ], false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["geturlsforlinks", new SymbolMetadata("Returns the url of links that have a matching rel.\n\nDon't bind to this: it's an internal function.", new FunctionType([new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["zoom", new SymbolMetadata("Sets the current page's zoom level anywhere between 30% and 300%.\n\nIf you overshoot the level while using relative adjustments i.e. level > 300% or level < 30% the zoom level will be set to it's maximum or minimum position. Relative adjustments are made * in percentage points, i.e. `:zoom +10 true` increases the zoom level from 50% to 60% or from * 200% to 210%.", new FunctionType([new NumberType(false, true), new StringType(false, true), new StringType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["readerold", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["loadaucmds", new SymbolMetadata("", new FunctionType([new UnionType([
- new LiteralTypeType("UriChange", false, false),
- new LiteralTypeType("DocStart", false, false),
- new LiteralTypeType("DocLoad", false, false),
- new LiteralTypeType("DocEnd", false, false),
- new LiteralTypeType("TabEnter", false, false),
- new LiteralTypeType("TabLeft", false, false),
- new LiteralTypeType("FullscreenEnter", false, false),
- new LiteralTypeType("FullscreenLeft", false, false),
- new LiteralTypeType("FullscreenChange", false, false),
- new LiteralTypeType("HistoryState", false, false)
- ], false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["focusinput", new SymbolMetadata("Focus the last used input on the page", new FunctionType([new UnionType([
- new StringType(false, false),
- new NumberType(false, false)
- ], false, false)], new VoidType(false, false), false, false), false)],
- ["changelistjump", new SymbolMetadata("Focus the tab which contains the last focussed input element. If you're lucky, it will focus the right input, too.\n\nCurrently just goes to the last focussed input; being able to jump forwards and backwards is planned.", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["focusbyid", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), true)],
- ["tabIndexSetActive", new SymbolMetadata("", new FunctionType([new UnionType([
- new StringType(false, false),
- new NumberType(false, false)
- ], false, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), true)],
- ["tabnext", new SymbolMetadata("Switch to the next tab, wrapping round.\n\nIf increment is specified, move that many tabs forwards.", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["tabnext_gt", new SymbolMetadata("Switch to the next tab, wrapping round.\n\nIf an index is specified, go to the tab with that number (this mimics the\nbehaviour of `{count}gt` in vim, except that this command will accept a\ncount that is out of bounds (and will mod it so that it is within bounds as\nper [[tabmove]], etc)).", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tabprev", new SymbolMetadata("Switch to the previous tab, wrapping round.\n\nIf increment is specified, move that many tabs backwards.", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["tabpush", new SymbolMetadata("Pushes the current tab to another window. Only works for windows of the same type\n(can't push a non-private tab to a private window or a private tab to\na non-private window).\nIf *windowId* is not specified, pushes to the next newest window,\nwrapping around.", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new UnionType([
- new TypeReferenceType("Tab", [], false, false),
- new ArrayType(new TypeReferenceType("Tab", [], false, false), false, false)
- ], false, false)], false, false), false, false), false)],
- ["tabaudio", new SymbolMetadata("Switch to the tab currently playing audio, if any.", new FunctionType([], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["winmerge", new SymbolMetadata("Moves all of the targetted window's tabs to the current window. Only works for windows of the same type\n(can't merge a non-private tab with a private window).", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["parseWinTabIndex", new SymbolMetadata("Given a string of the format windowIndex.tabIndex, returns a tuple of\nnumbers corresponding to the window index and tab index or the current\nwindow and tab if the string doesn't have the right format.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new ArrayType(new NumberType(false, false), false, false)], false, false), false, false), false)],
- ["tabgrab", new SymbolMetadata("Moves a tab identified by a windowIndex.tabIndex id to the current window.\nOnly works for windows of the same type (can't grab a non-private tab from a\nprivate window and can't grab a private tab from a non-private window).", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new UnionType([
- new TypeReferenceType("Tab", [], false, false),
- new ArrayType(new TypeReferenceType("Tab", [], false, false), false, false)
- ], false, false)], false, false), false, false), false)],
- ["tabopen", new SymbolMetadata('Like [[open]], but in a new tab. If no address is given, it will open the newtab page, which can be set with `set newtab [url]`\n\nUse the `-c` flag followed by a container name to open a tab in said container. Tridactyl will try to fuzzy match a name if an exact match is not found (opening the tab in no container can be enforced with "firefox-default" or "none"). If any autocontainer directives are configured and -c is not set, Tridactyl will try to use the right container automatically using your configurations.\n\nUse the `-b` flag to open the tab in the background.\n\nUse the `-w` flag to wait for the web page to load before "returning". This only makes sense for use with [[composite]], which waits for each command to return before moving on to the next one, e.g. `composite tabopen -b -w news.bbc.co.uk ; tabnext`.\n\nThe special flag "--focus-address-bar" should focus the Firefox address bar after opening if no URL is provided.\n\nThese three can be combined in any order, but need to be placed as the first arguments.\n\nUnlike Firefox\'s Ctrl-t shortcut, this opens tabs immediately after the\ncurrently active tab rather than at the end of the tab list because that is\nthe authors\' preference.\n\nIf you would rather the Firefox behaviour `set tabopenpos last`. This\npreference also affects the clipboard, quickmarks, home, help, etc.\n\nIf you would rather the URL be opened as if you\'d middle clicked it, `set\ntabopenpos related`.\n\nHinting is controlled by `relatedopenpos`\n\nAlso see the [[searchengine]] and [[searchurls]] settings.', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["tabopenwait", new SymbolMetadata("Like [[tabopen]] but waits for the DOM to load before resolving its promise. Useful if you're hoping to execute ex-commands in that tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["tabopen_helper", new SymbolMetadata("", new FunctionType([new ObjectType(/* @__PURE__ */ new Map([]), false, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), true)],
- ["tabqueue", new SymbolMetadata("Passes its first argument to `tabopen -b`. Once the tab opened by `tabopen\n-b` is activated/selected/focused, opens its second argument with `tabopen\n-b`. Once the second tab is activated/selected/focused, opens its third\nargument with `tabopen -b` and so on and so forth until all arguments have\nbeen opened in a new tab or until a tab is closed without being\nactivated/selected/focused.\n\nExample usage:\n `tabqueue http://example.org http://example.com http://example.net`\n `composite hint -qpipe a href | tabqueue`", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["idFromIndex", new SymbolMetadata("Resolve a tab index to the tab id of the corresponding tab in this window.", new FunctionType([new UnionType([
- new StringType(false, false),
- new NumberType(false, false)
- ], false, true)], new TypeReferenceType("Promise", [new NumberType(false, false)], false, false), false, false), true)],
- ["tabFromIndex", new SymbolMetadata("Like [[idFromIndex]] but returns the whole tab object", new FunctionType([new UnionType([
- new StringType(false, false),
- new NumberType(false, false)
- ], false, true)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), true)],
- ["tabonly", new SymbolMetadata("Close all other tabs in this window", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["tabduplicate", new SymbolMetadata("Duplicate a tab.", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["tabdetach", new SymbolMetadata("Detach a tab, opening it in a new window.", new FunctionType([new NumberType(false, true)], new TypeReferenceType("Promise", [new TypeReferenceType("Window", [], false, false)], false, false), false, false), false)],
- ["fullscreen", new SymbolMetadata("Toggle fullscreen state", new FunctionType([], new TypeReferenceType("Promise", [new TypeReferenceType("Window", [], false, false)], false, false), false, false), false)],
- ["tabclose", new SymbolMetadata("Close a tab.\n\nKnown bug: autocompletion will make it impossible to close more than one tab at once if the list of numbers looks enough like an open tab's title or URL.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["tabcloseallto", new SymbolMetadata("Close all tabs to the side specified", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["undo", new SymbolMetadata('Restore the most recently closed item.\nThe default behaviour is to restore the most recently closed tab in the\ncurrent window unless the most recently closed item is a window.\n\nSupplying either "tab" or "window" as an argument will specifically only\nrestore an item of the specified type. Supplying "tab_strict" only restores\ntabs that were open in the current window.', new FunctionType([new StringType(false, true)], new TypeReferenceType("Promise", [new NumberType(false, false)], false, false), false, false), false)],
- ["tabmove", new SymbolMetadata("Move the current tab to be just in front of the index specified.\n\nKnown bug: This supports relative movement with `tabmove +pos` and `tabmove -pos`, but autocomplete doesn't know that yet and will override positive and negative indexes.\n\nPut a space in front of tabmove if you want to disable completion and have the relative indexes at the command line.\n\nBinds are unaffected.", new FunctionType([new StringType(false, true)], new TypeReferenceType("Promise", [new UnionType([
- new TypeReferenceType("Tab", [], false, false),
- new ArrayType(new TypeReferenceType("Tab", [], false, false), false, false)
- ], false, false)], false, false), false, false), false)],
- ["tabsort", new SymbolMetadata("Move tabs in current window according to various criteria:\n\n- `--containers` groups tabs by containers\n- `--title` sorts tabs by title\n- `--url` sorts tabs by url (the default)\n- `(tab1, tab2) => true|false`\n - sort by arbitrary comparison function. `tab{1,2}` are objects with properties described here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["pin", new SymbolMetadata("Pin the current tab", new FunctionType([], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["mute", new SymbolMetadata('Mute current tab or all tabs.\n\nPassing "all" to the excmd will operate on the mute state of all tabs.\nPassing "unmute" to the excmd will unmute.\nPassing "toggle" to the excmd will toggle the state of `browser.tabs.tab.MutedInfo`', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["winopen", new SymbolMetadata("Like [[tabopen]], but in a new window.\n\n`winopen -private [...]` will open the result in a private window (and won't store the command in your ex-history ;) ).\n\n`winopen -popup [...]` will open it in a popup window. You can combine the two for a private popup.\n\n`winopen -c containername [...]` will open the result in a container while ignoring other options given. See [[tabopen]] for more details on containers.\n\nExample: `winopen -popup -private ddg.gg`", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["winclose", new SymbolMetadata("Close a window.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["wintitle", new SymbolMetadata("Add/change a prefix to the current window title\n\nExample: `wintitle [Hovercraft research]`\n\nProtip: unicode emojis work :)", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new TypeReferenceType("Window", [], false, false)], false, false), false, false), false)],
- ["qall", new SymbolMetadata("Close all windows", new FunctionType([], new TypeReferenceType("Promise", [new ArrayType(new VoidType(false, false), false, false)], false, false), false, false), false)],
- ["sidebaropen", new SymbolMetadata("EXPERIMENTAL: like [[open]] but loads queries in the sidebar. Doesn't actually open the sidebar - see [[sidebartoggle]].\n\nNot all schemas are supported, such as `about:*` and Firefox's built-in search engines. Tridactyl's searchurls and jsurls work fine - `:set searchengine google` will be sufficient for most users.\n\nIf you try to open the command line in the sidebar things will break.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["jsua", new SymbolMetadata('Like [[jsb]] but preserves "user action" intent for use with certain web extension APIs. Can only be called with browser mode binds, e.g.\n\n`:bind --mode=browser jsua browser.sidebarAction.open(); tri.excmds.sidebaropen("https://mail.google.com/mail/mu")`', new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["sidebartoggle", new SymbolMetadata("Toggle the side bar. Can only be called through browser mode binds, e.g.\n\n`:bind --mode=browser sidebartoggle`", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["containerclose", new SymbolMetadata("Closes all tabs open in the same container across all windows.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["containercreate", new SymbolMetadata("Creates a new container. Note that container names must be unique and that the checks are case-insensitive.\n\nFurther reading https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextualIdentities/ContextualIdentity\n\nExample usage:\n - `:containercreate tridactyl green dollar`", new FunctionType([new StringType(false, false), new StringType(false, true), new StringType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["containerdelete", new SymbolMetadata("Delete a container. Closes all tabs associated with that container beforehand. Note: container names are case-insensitive.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["containerupdate", new SymbolMetadata("Update a container's information. Note that none of the parameters are optional and that container names are case-insensitive.\n\nExample usage:\n\n- Changing the container name: `:containerupdate banking blockchain green dollar`\n\n- Changing the container icon: `:containerupdate banking banking green briefcase`\n\n- Changing the container color: `:containerupdate banking banking purple dollar`", new FunctionType([new StringType(false, false), new StringType(false, false), new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["viewcontainers", new SymbolMetadata("Shows a list of the current containers in Firefox's native JSON viewer in the current tab.\n\nNB: Tridactyl cannot run on this page!", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["recontain", new SymbolMetadata("Opens the current tab in another container.\n\nThis is probably not a good idea if you care about tracking protection!\nTransfering URLs from one container to another allows websites to track\nyou across those containers.\n\nRead more here:\nhttps://github.com/mozilla/multi-account-containers/wiki/Moving-between-containers", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["setContentStateGroup", new SymbolMetadata("", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), true)],
- ["tgroupcreate", new SymbolMetadata("Create a new tab group in the current window. NB: use [[tgroupswitch]] instead\nin most cases, since it will create non-existent tab groups before switching\nto them.\n\nTab groups are a way of organizing different groups of related tabs within a\nsingle window. Groups allow you to have different named contexts and show\nonly the tabs for a single group at a time.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgroupswitch", new SymbolMetadata('Switch to a different tab group, hiding all other tabs.\n\n"%" denotes the current tab group and "#" denotes the tab group that was\nlast active. "A" indates a tab group that contains an audible tab. Use\n`:set completions.Tab.statusstylepretty true` to display a unicode character\ninstead.', new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgrouplast", new SymbolMetadata("Switch to the previously active tab group.", new FunctionType([], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgrouprename", new SymbolMetadata("Rename the current tab group.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgroupclose", new SymbolMetadata("Close all tabs in a tab group and delete the group.", new FunctionType([new StringType(false, true)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgroupmove", new SymbolMetadata("Move the current tab to another tab group, creating it if it does not exist.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), false)],
- ["tgroupabort", new SymbolMetadata("Delete all tab group information for the current window and show all tabs.", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["version", new SymbolMetadata("", new FunctionType([], new AnyType(true, false), false, false), false)],
- ["mode", new SymbolMetadata("Switch mode.\n\nFor now you probably shouldn't manually switch to other modes than `normal` and `ignore`. Make sure you're aware of the key bindings (ignoremaps) that will allow you to go come back to normal mode from ignore mode before you run `:mode ignore` otherwise you're going to have a hard time re-enabling Tridactyl.\n\nExample:\n - `mode ignore` to ignore almost all keys.\n\nIf you're looking for a way to temporarily disable Tridactyl, `mode ignore` might be what you're looking for.\n\nNote that when in ignore mode, Tridactyl will not switch to insert mode when focusing text areas/inputs. This is by design.\n\n**New feature:** you can add modes as simply as adding binds with `bind --mode=[newmodename]` and then enter the mode with `mode [newmodename]`.", new FunctionType([new AnyType(true, false)], new VoidType(false, false), false, false), false)],
- ["getnexttabs", new SymbolMetadata("", new FunctionType([new NumberType(false, false), new NumberType(false, true)], new TypeReferenceType("Promise", [new ArrayType(new NumberType(false, false), false, false)], false, false), false, false), true)],
- ["repeat", new SymbolMetadata("Repeats a `cmd` `n` times.\nIf `cmd` doesn't exist, re-executes the last exstr that was executed in the tab.\nExecutes the command once if `n` isn't defined either.\n\nThis re-executes the last *exstr*, not the last *excmd*. Some excmds operate internally by constructing and evaluating exstrs, others by directly invoking excmds without going through the exstr parser. For example, aucmds and keybindings evaluate exstrs and are repeatable, while commands like `:bmarks` directly invoke `:tabopen` and you'll repeat the `:bmarks` rather than the internal `:tabopen`.\n\nIt's difficult to execute this in the background script (`:jsb`, `:run_excmd`, `:autocmd TriStart`, `:source`), but if you you do, it will re-execute the last exstr that was executed in the background script. What this may have been is unpredictable and not precisely encouraged.", new FunctionType([new NumberType(false, true), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["composite", new SymbolMetadata("Split `cmds` on pipes (|) and treat each as its own command. Return values are passed as the last argument of the next ex command, e.g,\n\n`composite echo yes | fillcmdline` becomes `fillcmdline yes`. A more complicated example is the ex alias, `command current_url composite get_current_url | fillcmdline_notrail `, which is used in, e.g. `bind T current_url tabopen`.\n\nWorkaround: this should clearly be in the parser, but we haven't come up with a good way to deal with |s in URLs, search terms, etc. yet.\n\n`cmds` are also split with semicolons (;) and don't pass things along to each other.\n\nIf you wish to have a command that has semi-colons in it (e.g. some JavaScript or `hint -;`), first bind a [[command]] to it. For example, `command hint_focus -;`, and then `composite hint_focus; !s xdotool key Menu`.\n\nThe behaviour of combining ; and | in the same composite command is left as an exercise for the reader.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["shellescape", new SymbolMetadata("Escape command for safe use in shell with composite. E.g: `composite js MALICIOUS_WEBSITE_FUNCTION() | shellescape | exclaim ls`", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["escapehatch", new SymbolMetadata("Magic escape hatch: if Tridactyl can't run in the current tab, return to a tab in the current window where Tridactyl can run, making such a tab if it doesn't currently exist. If Tridactyl can run in the current tab, return focus to the document body from e.g. the URL bar or a video player.\n\nOnly useful if called from a background context, e.g. at the end of an RC file to ensure that when you start the browser you don't get trapped on an about: page, or via `bind --mode=browser escapehatch` (bound to `` by default).\n\nNB: when called via `bind --mode=browser`, we return focus from the address bar by opening and closing the \"sidebar\" (which is used exclusively for this purpose). If escapehatch is called in any other way, we cannot do this as Mozilla thinks it might [spook](https://extensionworkshop.com/documentation/publish/add-on-policies/#no-surprises) [you](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions) : ).\n\nThis sidebar hack will close other sidebars such a TreestyleTabs. You can disable it with `:set escapehatchsidebarhack false`, but Tridactyl will no longer be able to get focus back from certain places such as the address bar.", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["sleep", new SymbolMetadata("Sleep time_ms milliseconds.\nThis is probably only useful for composite commands that need to wait until the previous asynchronous command has finished running.", new FunctionType([new NumberType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["showcmdline", new SymbolMetadata("", new FunctionType([new BooleanType(false, true)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["hidecmdline", new SymbolMetadata("", new FunctionType([], new VoidType(false, false), false, false), true)],
- ["fillcmdline", new SymbolMetadata("Set the current value of the commandline to string *with* a trailing space", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["fillcmdline_notrail", new SymbolMetadata("Set the current value of the commandline to string *without* a trailing space", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["fillcmdline_nofocus", new SymbolMetadata("Show and fill the command line without focusing it", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["fillcmdline_tmp", new SymbolMetadata("Shows str in the command line for ms milliseconds. Recommended duration: 3000ms.", new FunctionType([new NumberType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["yank", new SymbolMetadata('Copy `content` to clipboard without feedback. Use `clipboard yank` for interactive use.\n\ne.g. `yank bob` puts "bob" in the clipboard; `composite js document.title | yank` puts the document title in the clipboard.', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new ArrayType(new AnyType(true, false), false, false)], false, false), false, false), false)],
- ["setclip", new SymbolMetadata("Copies a string to the clipboard/selection buffer depending on the user's preferences.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new ArrayType(new AnyType(true, false), false, false)], false, false), false, false), true)],
- ["setclip_webapi", new SymbolMetadata("Copies a string to the clipboard using the Clipboard API.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["getclip", new SymbolMetadata("Fetches the content of the clipboard/selection buffer depending on user's preferences\n\nExposed for use with [[composite]], e.g. `composite getclip | fillcmdline`", new FunctionType([new UnionType([
- new LiteralTypeType("clipboard", false, false),
- new LiteralTypeType("selection", false, false)
- ], false, true)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["getclip_webapi", new SymbolMetadata("Gets the clipboard content using the Clipboard API.", new FunctionType([], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), true)],
- ["clipboard", new SymbolMetadata('Use the system clipboard.\n\nIf `excmd === "open"`, call [[open]] with the contents of the clipboard. Similarly for [[tabopen]].\n\nIf `excmd === "yank"`, copy the current URL, or if given, the value of toYank, into the system clipboard.\n\nIf `excmd === "yankcanon"`, copy the canonical URL of the current page if it exists, otherwise copy the current URL.\n\nIf `excmd === "yankshort"`, copy the shortlink version of the current URL, and fall back to the canonical then actual URL. Known to work on https://yankshort.neocities.org/.\n\nIf `excmd === "yanktitle"`, copy the title of the open page.\n\nIf `excmd === "yankmd"`, copy the title and url of the open page formatted in Markdown for easy use on sites such as reddit. `yankorg` is similar but for Emacs orgmode.\n\nIf you\'re on Linux and the native messenger is installed, Tridactyl will call an external binary (either xclip or xsel) to read or write to your X selection buffer. If you want another program to be used, set "externalclipboardcmd" to its name and make sure it has the same interface as xsel/xclip ("-i"/"-o" and reading from stdin).\n\nWhen doing a read operation (i.e. open or tabopen), if "putfrom" is set to "selection", the X selection buffer will be read instead of the clipboard. Set "putfrom" to "clipboard" to use the clipboard.\n\nWhen doing a write operation, if "yankto" is set to "selection", only the X selection buffer will be written to. If "yankto" is set to "both", both the X selection and the clipboard will be written to. If "yankto" is set to "clipboard", only the clipboard will be written to.', new FunctionType([new UnionType([
- new LiteralTypeType("open", false, false),
- new LiteralTypeType("yank", false, false),
- new LiteralTypeType("yankshort", false, false),
- new LiteralTypeType("yankcanon", false, false),
- new LiteralTypeType("yanktitle", false, false),
- new LiteralTypeType("yankmd", false, false),
- new LiteralTypeType("yankorg", false, false),
- new LiteralTypeType("xselpaste", false, false),
- new LiteralTypeType("tabopen", false, false)
- ], false, true), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["yankimage", new SymbolMetadata("Copy an image to the clipboard.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["tab", new SymbolMetadata("Change active tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["taball", new SymbolMetadata("Wrapper for [[tab]] with multi-window completions", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tabcurrentrename", new SymbolMetadata("Rename current tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), true)],
- ["tabrename", new SymbolMetadata("Rename a tab.", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tab_helper", new SymbolMetadata("Helper to change active tab. Used by [[tab]] and [[taball]].", new FunctionType([new BooleanType(false, false), new BooleanType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["command", new SymbolMetadata("Similar to vim's `:command`. Maps one ex-mode command to another.\nIf command already exists, this will override it, and any new commands\nadded in a future release will be SILENTLY overridden. Aliases are\nexpanded recursively.\n\nExamples:\n - `command t tabopen`\n - `command tn tabnext_gt`\n - `command hello t` This will expand recursively into 'hello'->'tabopen'\n\nCommands/aliases are expanded as in a shell, so, given the commands above,\nentering `:tn 43` will expand to `:tabnext_gt 43`. You can use this to create\nyour own ex-commands in conjunction with [[js]], specifically `js -p` and `js -d`.\n\nNote that this is only for excmd -> excmd mappings. To map a normal-mode\ncommand to an excommand, see [[bind]].\n\nSee also:\n - [[comclear]]", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["comclear", new SymbolMetadata("Similar to vim's `comclear` command. Clears an excmd alias defined by\n`command`.\n\nFor example: `comclear helloworld` will reverse any changes caused\nby `command helloworld xxx`\n\nSee also:\n - [[command]]", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), false)],
- ["bind", new SymbolMetadata("Bind a sequence of keys to an excmd or view bound sequence.\n\nThis is an easier-to-implement bodge while we work on vim-style maps.\n\nExamples:\n\n - `bind G fillcmdline tabopen google`\n - `bind D composite tabclose | tab #` -> close current tab and switch to most recent previous tab\n - `bind j scrollline 20`\n - `bind F hint -b`\n\nYou can view binds by omitting the command line:\n\n - `bind j`\n - `bind k`\n\nYou can bind to modifiers and special keys by enclosing them with angle brackets, for example `bind z fullscreen`, `unbind ` (a favourite of people who use TreeStyleTabs :) ), or `bind forward`.\n\nModifiers are truncated to a single character, so Ctrl -> C, Alt -> A, and Shift -> S. Shift is a bit special as it is only required if Shift does not change the key inputted, e.g. `` is OK, but `` should just be `A`.\n\nYou can view all special key names here: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values\n\nUse [[composite]] if you want to execute multiple excmds. Use\n[[fillcmdline]] to put a string in the cmdline and focus the cmdline\n(otherwise the string is executed immediately).\n\nYou can bind to other modes with `bind --mode={insert|ignore|normal|input|ex|hint} ...`, e.g, `bind --mode=insert emacs qall` (NB: unlike vim, all preceeding characters will not be input), or `bind --mode=hint hint.reset`.\n\n`bind --mode=browser [key sequence] [ex command]` binds to a special mode which can be accessed all the time in all browser tabs - even tabs in which Tridactyl cannot run. It comes with a few caveats:\n\n- you may only have a few browser-mode binds at once. At the time of writing, this is 20, with 3 initially taken by Tridactyl. If you desperately need more, file an [[issue]].\n- the key sequence must consist of a single, simple key with at least one and no more than two modifiers. An error will be thrown if you try to bind to an invalid key sequence.\n- the `ex command` you bind to may not work fully unless you are on a tab which Tridactyl has access to. Generally, browser-wide actions like making or closing tabs will work but tab-specific actions like scrolling down or entering hint mode will not.\n\nA list of editor functions can be found\n[here](/static/docs/modules/_src_lib_editor_.html).\n\nSee also:\n\n - [[unbind]]\n - [[reset]]", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["bindshow", new SymbolMetadata("", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["bindwizard", new SymbolMetadata("Generate a key sequence from keypresses. Once Enter is pressed, the command line is filled with a [[bind]]\ncommand with the key sequence and provided arguments, which you can choose to modify and execute.\n\nIf you have `:set keyboardlayoutforce true`, it will bind commands to physical keys regardless of layout.\n\nAccepts the same arguments as [[bind]] (except for the key sequence which will be generated):\n\n - `bindwizard [command]`, then press the keys you want to bind, then hit Enter.\n - `bindwizard --mode=[mode] [command]` also works.\n\nYou can execute it without arguments to see what is bound to the keys you type.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["bindurl", new SymbolMetadata("Like [[bind]] but for a specific url pattern (also see [[seturl]]).", new FunctionType([new StringType(false, false), new StringType(false, false), new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["keymap", new SymbolMetadata("Deprecated: use `:set keyboardlayoutforce true` instead.\n\nMakes one key equivalent to another for the purposes of most of our parsers. Useful for international keyboard layouts. See user-provided examples for various layouts on our wiki: https://github.com/tridactyl/tridactyl/wiki/Internationalisation\n\ne.g,\n keymap \u0119 e", new FunctionType([new StringType(false, false), new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["searchsetkeyword", new SymbolMetadata("", new FunctionType([], new VoidType(false, false), false, false), true)],
- ["validateSetArgs", new SymbolMetadata("Validates arguments for set/seturl", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), false, false)], new ArrayType(new AnyType(true, false), false, false), false, false), true)],
- ["seturl", new SymbolMetadata("Usage: `seturl [pattern] key values`", new FunctionType([new StringType(false, false), new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["setmode", new SymbolMetadata("Usage: `setmode mode key values`", new FunctionType([new StringType(false, false), new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["set", new SymbolMetadata('Set a key value pair in config.\n\nUse to set any values found [here](/static/docs/classes/_src_lib_config_.default_config.html).\n\nArrays should be set using JS syntax, e.g. `:set blacklistkeys ["/",","]`.\n\ne.g.\n set searchurls.google https://www.google.com/search?q=\n set logging.messaging info\n\nIf no value is given, the value of the of the key will be displayed.\n\nSee also: [[unset]]', new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["firefoxsyncpull", new SymbolMetadata("Replaces your local configuration with that stored in the Firefox Sync area.\n\nIt does not merge your configurations: it overwrites.\n\nAlso see [[firefoxsyncpush]].", new FunctionType([], new AnyType(true, false), false, false), false)],
- ["firefoxsyncpush", new SymbolMetadata("Pushes your local configuration to the Firefox Sync area.\n\nIt does not merge your configurations: it overwrites.\n\nAlso see [[firefoxsyncpull]].", new FunctionType([], new AnyType(true, false), false, false), false)],
- ["getAutocmdEvents", new SymbolMetadata("", new FunctionType([], new ArrayType(new StringType(false, false), false, false), false, false), true)],
- ["autocmd", new SymbolMetadata("Set autocmds to run when certain events happen.", new FunctionType([new StringType(false, false), new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["autocontain", new SymbolMetadata('Automatically open a domain and all its subdomains in a specified container.\n\n__NB:__ You should use this command with an -s (sane mode) or -u (URL mode) flag. Usage without a flag uses an incorrect regular expression which may cause weird behaviour and has been left in for compatibility reasons.\n\nThis function accepts a `-u` flag to treat the pattern as a URL rather than a domain.\nFor example: `autocontain -u ^https?://([^/]*\\.|)youtube\\.com/ google` is equivalent to `autocontain -s youtube\\.com google`\n\nFor declaring containers that do not yet exist, consider using `auconcreatecontainer true` in your tridactylrc.\nThis allows Tridactyl to automatically create containers from your autocontain directives. Note that they will be random icons and colors.\n\nThe domain is passed through as a regular expression so there are a few gotchas to be aware of:\n* Unescaped periods will match *anything*. `autocontain -s google.co.uk work` will match `google!co$uk`. Escape your periods (i.e. `\\.`) or accept that you might get some false positives.\n* You can use regex in your pattern. `autocontain -s google\\.(co\\.uk|com) work` will match either `google.co.uk` or `google.com`. If multiple rules match a certain URL, the one with the longest regex will be picked.\n\nThis *should* now peacefully coexist with the Temporary Containers and Multi-Account Containers addons. Do not trust this claim. If a fight starts the participants will try to open infinite tabs. It is *strongly* recommended that you use a tridactylrc so that you can abort a sorceror\'s-apprentice scenario by killing firefox, commenting out all of autocontainer directives in your rc file, and restarting firefox to clean up the mess. There are a number of strange behaviors resulting from limited coordination between extensions. Redirects can be particularly surprising; for example, with `:autocontain -s will-redirect.example.org example` set and `will-redirect.example.org` redirecting to `redirected.example.org`, navigating to `will-redirect.example.org` will result in the new tab being in the `example` container under some conditions and in the `firefox-default` container under others.\n\nPass an optional space-separated list of proxy names to assign a proxy (followed by failover proxies) to a URL and open in a specified container.\nFor example: `autocontain [-{u,s}] pattern container proxy1 proxy2`\n\nTo assign a proxy and open in no container, use "firefox-default" or "none" as a container name.\nSee also:\n - [[proxyadd]]\n - [[proxyremove]]', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["proxyadd", new SymbolMetadata("Add a proxy for use with [[autocontain]] or `:set proxy`", new FunctionType([new StringType(false, false), new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["proxyremove", new SymbolMetadata("Remove proxies.", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), false)],
- ["autocmddelete", new SymbolMetadata("Remove autocmds", new FunctionType([new StringType(false, false), new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["blacklistadd", new SymbolMetadata("Helper function to put Tridactyl into ignore mode on the provided URL.\n\nSimply creates a DocStart [[autocmd]] that runs `mode ignore`. NB: ignore mode does have a few keybinds by default - see `:viewconfig ignoremaps`. These can be unbound with, e.g. `:unbind --mode=ignore `, or `:unbindurl [url] --mode=ignore `.\n\nRemove sites from the blacklist with `blacklistremove [url]` or `autocmddelete DocStart [url]`.\n\nIf you're looking for a way to temporarily disable Tridactyl, this might be what you're looking for. If you need to disable Tridactyl more thoroughly on a page look at `:help superignore` instead.\n\n", new FunctionType([new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["unbind", new SymbolMetadata("Unbind a sequence of keys so that they do nothing at all.\n\nSee also:\n\n - [[bind]]\n - [[reset]]", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["unbindurl", new SymbolMetadata("Unbind a sequence of keys you have set with [[bindurl]]. Note that this **kills** a bind, which means Tridactyl will pass it to the page on `pattern`. If instead you want to use the default setting again, use [[reseturl]].", new FunctionType([new StringType(false, false), new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["reset", new SymbolMetadata("Restores a sequence of keys to their default value.", new FunctionType([new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["reseturl", new SymbolMetadata("Restores a sequence of keys to their value in the global config for a specific URL pattern.\n\nSee also:\n - [[bind]]\n - [[unbind]]\n - [[reset]]\n - [[bindurl]]\n - [[unbindurl]]\n - [[seturl]]\n - [[unseturl]]\n - [[setmode]]\n - [[unsetmode]]", new FunctionType([new StringType(false, false), new StringType(false, false), new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["sanitise", new SymbolMetadata("Deletes various bits of Firefox or Tridactyl data\n\nThe list of possible arguments can be found here:\nhttps://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/browsingData/DataTypeSet\n\nAdditional Tridactyl-specific arguments are:\n- `commandline`: Removes the in-memory commandline history.\n- `tridactyllocal`: Removes all tridactyl storage local to this machine. Use it with\n commandline if you want to delete your commandline history.\n- `tridactylsync`: Removes all tridactyl storage associated with your Firefox Account (i.e, all user configuration, by default).\nThese arguments aren't affected by the timespan parameter.\n\nTimespan parameter:\n-t [0-9]+(m|h|d|w)\n\nExamples:\n\n- `sanitise all` -> Deletes __everything__, including any saved usernames / passwords(!)\n- `sanitise history` -> Deletes all history\n- `sanitise commandline tridactyllocal tridactylsync` -> Deletes every bit of data Tridactyl holds\n- `sanitise cookies -t 3d` -> Deletes cookies that were set during the last three days.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["quickmark", new SymbolMetadata("Bind a quickmark for the current URL or space-separated list of URLs to a key on the keyboard.\n\nAfterwards use go[key], gn[key], or gw[key] to [[open]], [[tabopen]], or\n[[winopen]] the URL respectively.\n\nExample:\n- `quickmark m https://mail.google.com/mail/u/0/#inbox`", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["get", new SymbolMetadata("Puts the contents of config value with keys `keys` into the commandline and the background page console\n\nIt's a bit rubbish, but we don't have a good way to provide feedback to the commandline yet.\n\nYou can view the log entry in the browser console (Ctrl-Shift-j).\n\nFor example, you might try `get nmaps` to see all of your current binds.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["viewconfig", new SymbolMetadata("Opens the current configuration in Firefox's native JSON viewer in a new tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new VoidType(false, false), false, false), false)],
- ["jsonview", new SymbolMetadata("View a JSON object in Firefox's JSON viewer.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new ArrayType(new AnyType(true, false), false, false)], false, false), false, false), false)],
- ["unseturl", new SymbolMetadata("Reset a site-specific setting.\n\nusage: `unseturl [pattern] key`", new FunctionType([new StringType(false, false), new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["unsetmode", new SymbolMetadata("Reset a mode-specific setting.\n\nusage: `unsetmode mode key`", new FunctionType([new StringType(false, false), new StringType(false, false)], new AnyType(true, false), false, false), false)],
- ["unset", new SymbolMetadata("Reset a config setting to default", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["setnull", new SymbolMetadata('"Delete" a default setting. E.g. `setnull searchurls.github` means `open github test` would search your default search engine for "github test".', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["hint", new SymbolMetadata("Hint a page.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["rot13", new SymbolMetadata("Perform rot13.\n\nTransforms all text nodes in the current tab via rot13. Only characters in\nthe ASCII range are considered.", new FunctionType([new NumberType(false, false)], new VoidType(false, false), false, false), false)],
- ["jumble", new SymbolMetadata("Perform text jumbling (reibadailty).\n\nShuffles letters except for first and last in all words in text nodes in the current tab. Only characters in\nthe ASCII range are considered.\n\nInspired by: https://www.newscientist.com/letter/mg16221887-600-reibadailty/", new FunctionType([], new VoidType(false, false), false, false), false)],
- ["run_exstr", new SymbolMetadata("Hacky ex string parser.\n\nUse it for fire-and-forget running of background commands in content.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["gobble", new SymbolMetadata("Initialize gobble mode.\n\nIf numKeysOrTerminator is a number, it will read the provided amount of keys;\nIf numKeysOrTerminator is a key or key combination like 'k', '' or '';\nit will read keys until the provided key is pressed.\nThen it will append the keypresses to `endCmd` and execute that string,\nalso appending arguments if provided.", new FunctionType([new StringType(false, false), new StringType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["getGotoSelectors", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new ArrayType(new ObjectType(/* @__PURE__ */ new Map([]), false, false), false, false)], false, false), false, false), true)],
- ["goto", new SymbolMetadata("Jump to selector.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["nmode", new SymbolMetadata("Initialize n [mode] mode.\n\nIn this special mode, a series of key sequences are executed as bindings from a different mode, as specified by the\n`mode` argument. After the count of accepted sequences is `n`, the finalizing ex command given as the `endexArr`\nargument is executed, which defaults to `mode ignore`.\n\nExample: `:nmode normal 1 mode ignore`\nThis looks up the next key sequence in the normal mode bindings, executes it, and switches the mode to `ignore`.\nIf the key sequence does not match a binding, it will be silently passed through to Firefox, but it will be counted\nfor the termination condition.", new FunctionType([new StringType(false, false), new NumberType(false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["tssReadFromCss", new SymbolMetadata("Read text content of elements matching the given selector", new FunctionType([new StringType(false, false)], new VoidType(false, false), false, false), false)],
- ["ttsread", new SymbolMetadata("Read the given text using the browser's text to speech functionality and\nthe settings currently set", new FunctionType([new UnionType([
- new LiteralTypeType("-t", false, false),
- new LiteralTypeType("-c", false, false)
- ], false, false), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["ttsvoices", new SymbolMetadata("Show a list of the voices available to the TTS system. These can be\nset in the config using `ttsvoice`", new FunctionType([], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["ttscontrol", new SymbolMetadata("Cancel current reading and clear pending queue\n\nArguments:\n - stop: cancel current and pending utterances", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["buildFilterConfigs", new SymbolMetadata("Build a set of FilterConfigs from a list of human-input filter\nspecs.", new FunctionType([new ArrayType(new StringType(false, false), false, false)], new ArrayType(new AnyType(true, false), false, false), false, false), true)],
- ["perfdump", new SymbolMetadata('Dump the raw json for our performance counters. Filters with\ntrailing slashes are class names, :start | :end | :measure specify\nwhat type of sample to pass through, and all others are function\nnames. All filters must match for a sample to be dumped.\n\nTridactyl does not collect performance information by default. To\nget this data you\'ll have to set the configuration option\n`perfcounters` to `"true"`. You may also want to examine the value\nof `perfsamples`.', new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["perfhistogram", new SymbolMetadata("Pretty-print a histogram of execution durations for you. Arguments\nare as above, with the addition that this automatically filters to\ncounter samples of type :measure.\n\nNote that this will display its output by opening a data: url with\ntext in the place of your current tab.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["bmark", new SymbolMetadata("Add or remove a bookmark.\n\nOptionally, you may give the bookmark a title. If no URL is given, a bookmark is added for the current page.\n\nIf a bookmark already exists for the URL, it is removed, even if a title is given.\n\nDoes not support creation of folders: you'll need to use the Firefox menus for that.", new FunctionType([new StringType(false, true), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new TypeReferenceType("BookmarkTreeNode", [], false, false)], false, false), false, false), false)],
- ["echo", new SymbolMetadata("", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new StringType(false, false), false, false), false)],
- ["js_helper", new SymbolMetadata("helper function for js and jsb\n\n-p to take a single extra argument located at the end of str[]\n-d[delimiter character] to take a space-separated array of arguments after the delimiter\n-s to load js script of a source file from the config path", new FunctionType([new ArrayType(new StringType(false, false), false, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), true)],
- ["js", new SymbolMetadata("Lets you execute JavaScript in the page context. If you want to get the result back, use\n\n `composite js ... | fillcmdline`", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["jsb", new SymbolMetadata("Lets you execute JavaScript in the background context. All the help from [[js]] applies. Gives you a different `tri` object which has access to more excmds and web-extension APIs.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["issue", new SymbolMetadata('Opens a new tab the url of which is "https://github.com/tridactyl/tridactyl/issues/new" and automatically fill add tridactyl, firefox and os version to the issue.', new FunctionType([], new TypeReferenceType("Promise", [new TypeReferenceType("Tab", [], false, false)], false, false), false, false), false)],
- ["text2qr", new SymbolMetadata("Generates a QR code for the given text. By default opens in new tab. Default binds close the new tab after 5 seconds.\nIf no text is passed as an argument then it checks if any text is selected and creates a QR code for that.\nIf no selection is found then it creates QR code for the current tab's URL\n\n`text2qr --popup [...]` will open the QR code in a new popup window\n\n`text2qr --window [...]` will open the QR code in a new window\n\n`text2qr --current [...]` will open in the current tab\n\n`text2qr --timeout [...]` closes the tab/window/popup after specified number of seconds\n\nExample: text2qr --timeout 5 --popup hello world", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["updatecheck", new SymbolMetadata("Checks if there are any stable updates available for Tridactyl.\n\nRelated settings:\n\n- `update.nag = true | false` - checks for updates on Tridactyl start.\n- `update.nagwait = 7` - waits 7 days before nagging you to update.\n- `update.checkintervalsecs = 86400` - waits 24 hours between checking for an update.", new FunctionType([new UnionType([
- new LiteralTypeType("manual", false, false),
- new LiteralTypeType("auto_polite", false, false),
- new LiteralTypeType("auto_impolite", false, false)
- ], false, true)], new TypeReferenceType("Promise", [new BooleanType(false, false)], false, false), false, false), false)],
- ["keyfeed", new SymbolMetadata("Feed some keys to Tridactyl's parser. E.g. `keyfeed jkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjkjjkj`.\n\nNB:\n\n- Does _not_ function like Vim's noremap - `bind j keyfeed j` will cause an infinite loop.\n- Doesn't work in exmode - i.e. `keyfeed t` won't work.", new FunctionType([new StringType(false, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["extoptions", new SymbolMetadata("Opens optionsUrl for the selected extension in a popup window.\n\nNB: Tridactyl cannot run on this page!", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["readerurl", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new StringType(false, false)], false, false), false, false), true)],
- ["reader", new SymbolMetadata("Open the current page as an article in reader view for easier reading. Flags `--tab` and `--window` open the article in new tabs and windows respectively.\n\nUse `:reader --old` to use Firefox's built-in reader mode, which Tridactyl can't run on.\n\n__NB:__ the reader page is a privileged environment which has access to all Tridactyl functions, notably the native messenger if you have it installed. We are parsing untrusted web-content to run in this environment. Mozilla's readability library will strip out most of these, then we use a sanitation library, `js-xss`, to strip out any remaining unsafe tags, but if there was a serious bug in this library, and a targeted attack against Tridactyl, an attacker could get remote code execution. If you're worried about this, use `:reader --old` instead or only use `:reader` on pages you trust.\n\nYou may use [userContent.css](http://kb.mozillazine.org/index.php?title=UserContent.css&printable=yes) to enhance or override default styling of the new reader view. The `body` of the page has id `tridactyl-reader` and the article content follows in a `main` tag. Therefore to alter default styling, you can do something like this in your `userContent.css`:\n\n```css\n#tridactyl-reader > main {\n width: 80vw !important;\n text-align: left;\n}\n```\n\nFollow [issue #4657](https://github.com/tridactyl/tridactyl/issues/4657) if you would like to find out when we have made a more user-friendly solution.", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["elementunhide", new SymbolMetadata("Restore the most recently hidden element. Repeated invocations restore the next-most-recently-hidden element.\n\n(Elements can be hidden with `;K` and `:hint -K`.)", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)]
- ]))],
- ["src/lib/config.ts", new FileMetadata(/* @__PURE__ */ new Map([["default_config", new ClassMetadata(/* @__PURE__ */ new Map([
- ["configversion", new SymbolMetadata("Internal version number Tridactyl uses to know whether it needs to update from old versions of the configuration.\n\nChanging this might do weird stuff.", new StringType(false, false), false)],
- ["subconfigs", new SymbolMetadata("Internal field to handle site-specific configs. Use :seturl/:unseturl to change these values.", new ObjectType(/* @__PURE__ */ new Map([["", new TypeReferenceType("DeepPartial", [new TypeReferenceType("default_config", [], false, false)], false, false)]]), false, false), false)],
- ["modesubconfigs", new SymbolMetadata("Internal field to handle mode-specific configs. Use :setmode/:unsetmode to change these values.\n\nChanging this might do weird stuff.", new ObjectType(/* @__PURE__ */ new Map([["", new TypeReferenceType("DeepPartial", [new TypeReferenceType("default_config", [], false, false)], false, false)]]), false, false), false)],
- ["priority", new SymbolMetadata("Internal field to handle site-specific config priorities. Use :seturl/:unseturl to change this value.", new NumberType(false, false), false)],
- ["exmaps", new SymbolMetadata("exmaps contains all of the bindings for the command line.\nYou can of course bind regular ex commands but also [editor functions](/static/docs/modules/_src_lib_editor_.html) and [commandline-specific functions](/static/docs/modules/_src_commandline_frame_.html).", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["ignoremaps", new SymbolMetadata('ignoremaps contain all of the bindings for "ignore mode".\n\nThey consist of key sequences mapped to ex commands.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["imaps", new SymbolMetadata('imaps contain all of the bindings for "insert mode".\n\nOn top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in insert mode.\n\nThey consist of key sequences mapped to ex commands.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["inputmaps", new SymbolMetadata('inputmaps contain all of the bindings for "input mode".\n\nOn top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in input mode.\n\nThey consist of key sequences mapped to ex commands.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["superignore", new SymbolMetadata('Disable Tridactyl almost completely within a page, e.g. `seturl ^https?://mail.google.com disable true`. Only takes affect on page reload.\n\nYou are usually better off using `blacklistadd` and `seturl [url] noiframe true` as you can then still use some Tridactyl binds, e.g. `shift-insert` for exiting ignore mode.\n\nNB: you should only use this with `seturl`. If you get trapped with Tridactyl disabled everywhere just run `tri unset superignore` in the Firefox address bar. If that still doesn\'t fix things, you can totally reset Tridactyl by running `tri help superignore` in the Firefox address bar, scrolling to the bottom of that page and then clicking "Reset Tridactyl config".', new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["nmaps", new SymbolMetadata('nmaps contain all of the bindings for "normal mode".\n\nThey consist of key sequences mapped to ex commands.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["vmaps", new SymbolMetadata("", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["hintmaps", new SymbolMetadata("", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["browsermaps", new SymbolMetadata('Browser-wide binds accessible in all modes and on pages where Tridactyl "cannot run".\n', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["leavegithubalone", new SymbolMetadata("Whether to allow pages (not necessarily github) to override `/`, which is a default Firefox binding.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["blacklistkeys", new SymbolMetadata("Which keys to protect from pages that try to override them. Requires [[leavegithubalone]] to be set to false.", new ArrayType(new StringType(false, false), false, false), false)],
- ["autocmds", new SymbolMetadata("Autocommands that run when certain events happen, and other conditions are met.\n\nRelated ex command: `autocmd`.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["keytranslatemap", new SymbolMetadata("", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["usekeytranslatemap", new SymbolMetadata("", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["keyboardlayoutforce", new SymbolMetadata('Instead of fetching actual character which depends on selected layout,\nuse machine code of a key and convert to character according to keyboardlayoutoverrides. The default layout mapping\nis US `qwerty`, but can be changed with [[keyboardlayoutbase]].\n\nThere is a much more detailed help page towards the end of `:tutor` under the title "Non-QWERTY layouts".\n\nRecommended for everyone with multiple or/and non-latin keyboard layouts. Make sure [[usekeytranslatemap]] is false\nif you have previously used `keymap`.', new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["keyboardlayoutbase", new SymbolMetadata("Base keyboard layout to use when [[keyboardlayoutforce]] is enabled. At the time of writing, the following layouts are supported: `qwerty, azerty, german, dvorak, uk, ca, bepo`. Requires page reload to take effect.\n\nIf your layout is missing, you can contribute it with the help of https://gistpreview.github.io/?324119c773fac31651f6422087b36804 - please just open an `:issue` with your layout and we'll add it.\n\nYou can manually override individual keys for a layout with [[keyboardlayoutoverrides]].", new UnionType([
- new LiteralTypeType("qwerty", false, false),
- new LiteralTypeType("azerty", false, false),
- new LiteralTypeType("german", false, false),
- new LiteralTypeType("dvorak", false, false),
- new LiteralTypeType("uk", false, false),
- new LiteralTypeType("ca", false, false),
- new LiteralTypeType("bepo", false, false)
- ], false, false), false)],
- ["keyboardlayoutoverrides", new SymbolMetadata('Override individual keys for a layout when [[keyboardlayoutforce]] is enabled. Changes take effect only after a page reload.\n\nKey codes for printable keys for [[keyboardlayoutforce]], lower and upper register. See https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values for the names of each key.\n\nNB: due to a Tridactyl bug, you cannot set this using array notation as you can for, e.g. [[homepage]].\nYou must instead set the lower and upper registers using a string with no spaces in it, for example\n`:set keyboardlayoutoverrides Digit2: 2"` for the British English layout.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["autocontain", new SymbolMetadata("Automatically place these sites in the named container.\n\nEach key corresponds to a URL fragment which, if contained within the page URL, the site will be opened in a container tab instead.", new AnyType(true, false), false)],
- ["proxy", new SymbolMetadata("Default proxy to use for all URLs. Has to be the name of a proxy. To add a proxy, see `:help proxyadd`. NB: usage with `:seturl` is buggy, use `:autocontain -s [regex to match URL] none [proxy]` instead", new StringType(false, false), false)],
- ["proxies", new SymbolMetadata("Definitions of proxies.\n\nYou can add a new proxy with `proxyadd proxyname proxyurl`", new AnyType(true, false), false)],
- ["noproxy", new SymbolMetadata("Whether to use proxy settings.\n\nIf set to `true`, all proxy settings will be ignored.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["autocontainmode", new SymbolMetadata("Strict mode will always ensure a domain is open in the correct container, replacing the current tab if necessary.\n\nRelaxed mode is less aggressive and instead treats container domains as a default when opening a new tab.", new UnionType([
- new LiteralTypeType("strict", false, false),
- new LiteralTypeType("relaxed", false, false)
- ], false, false), false)],
- ["exaliases", new SymbolMetadata("Aliases for the commandline.\n\nYou can make a new one with `command alias ex-command`.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["followpagepatterns", new SymbolMetadata("Used by `]]` and `[[` to look for links containing these words.\n\nEdit these if you want to add, e.g. other language support.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["searchengine", new SymbolMetadata("The default search engine used by `open search`. If empty string, your browser's default search engine will be used. If set to something, Tridactyl will first look at your [[searchurls]] and then at the search engines for which you have defined a keyword on `about:preferences#search`.", new StringType(false, false), false)],
- ["searchurls", new SymbolMetadata('Definitions of search engines for use via `open [keyword]`.\n\n`%s` will be replaced with your whole query and `%s1`, `%s2`, ..., `%sn` will be replaced with the first, second and nth word of your query. Also supports array slicing, e.g. `%s[2:4]`, `%s[5:]`. If there are none of these patterns in your search urls, your query will simply be appended to the searchurl.\n\nAliases are supported - for example, if you have a `google` searchurl, you can run `:set searchurls.g google` in which case `g` will act as if it was the `google` searchurl.\n\nExamples:\n- When running `open gi cute puppies`, with a `gi` searchurl defined with `set searchurls.gi https://www.google.com/search?q=%s&tbm=isch`, tridactyl will navigate to `https://www.google.com/search?q=cute puppies&tbm=isch`.\n- When running `tabopen translate en ja Tridactyl`, with a `translate` searchurl defined with `set searchurls.translate https://translate.google.com/#view=home&op=translate&sl=%s1&tl=%s2&text=%s3`, tridactyl will navigate to `https://translate.google.com/#view=home&op=translate&sl=en&tl=ja&text=Tridactyl`.\n\n[[setnull]] can be used to "delete" the default search engines. E.g. `setnull searchurls.google`.', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["jsurls", new SymbolMetadata('Like [[searchurls]] but must be a Javascript function that takes one argument (a single string with the remainder of the command line including spaces) and maps it to a valid href (or a promise that resolves to a valid href) that will be followed, e.g. `set jsurls.googleloud query => "https://google.com/search?q=" + query.toUpperCase()`\n\nNB: the href must be valid, i.e. it must include the protocol (e.g. "http://") and not just be e.g. "www.".', new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["newtab", new SymbolMetadata("URL the newtab will redirect to.\n\nAll usual rules about things you can open with `open` apply, with the caveat that you'll get interesting results if you try to use something that needs `nativeopen`: so don't try `about:newtab` or a `file:///` URI. You should instead use a data URI - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - or host a local webserver (e.g. Caddy).", new StringType(false, false), false)],
- ["viewsource", new SymbolMetadata("Whether `:viewsource` will use our own page that you can use Tridactyl binds on, or Firefox's default viewer, which you cannot use Tridactyl on.", new UnionType([
- new LiteralTypeType("tridactyl", false, false),
- new LiteralTypeType("default", false, false)
- ], false, false), false)],
- ["homepages", new SymbolMetadata('Pages opened with `gH`. In order to set this value, use `:set homepages ["example.org", "example.net", "example.com"]` and so on.', new ArrayType(new StringType(false, false), false, false), false)],
- ["hintchars", new SymbolMetadata("Characters to use in hint mode.\n\nThey are used preferentially from left to right.", new StringType(false, false), false)],
- ["hintfiltermode", new SymbolMetadata("The type of hinting to use. `vimperator` will allow you to filter links based on their names by typing non-hint chars. It is recommended that you use this in conjuction with the [[hintchars]] setting, which you should probably set to e.g, `5432167890`. \xB4vimperator-reflow\xB4 additionally updates the hint labels after filtering.", new UnionType([
- new LiteralTypeType("simple", false, false),
- new LiteralTypeType("vimperator", false, false),
- new LiteralTypeType("vimperator-reflow", false, false)
- ], false, false), false)],
- ["hintnames", new SymbolMetadata("Whether to optimise for the shortest possible names for each hint, or to use a simple numerical ordering. If set to `numeric`, overrides `hintchars` setting.", new UnionType([
- new LiteralTypeType("short", false, false),
- new LiteralTypeType("numeric", false, false),
- new LiteralTypeType("uniform", false, false)
- ], false, false), false)],
- ["hintuppercase", new SymbolMetadata("Whether to display the names for hints in uppercase.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["hintdelay", new SymbolMetadata("The delay in milliseconds in `vimperator` style hint modes after selecting a hint before you are returned to normal mode.\n\nThe point of this is to prevent accidental execution of normal mode binds due to people typing more than is necessary to choose a hint.", new NumberType(false, false), false)],
- ["hintshift", new SymbolMetadata("Controls whether hints should be shifted in quick-hints mode.\n\nHere's what it means: let's say you have hints from a to z but are only\ninterested in every second hint. You first press `a`, then `c`.\nTridactyl will realize that you skipped over `b`, and so that the next\nhint you're going to trigger is probably `e`. Tridactyl will shift all\nhint names so that `e` becomes `c`, `d` becomes `b`, `c` becomes `a` and\nso on.\nThis means that once you pressed `c`, you can keep on pressing `c` to\ntrigger every second hint. Only makes sense with hintnames = short.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["hintautoselect", new SymbolMetadata("Controls whether hints should be followed automatically.\n\nIf set to `false`, hints will only be followed upon confirmation. This applies to cases when there is only a single match or only one link on the page.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["allowautofocus", new SymbolMetadata("Controls whether the page can focus elements for you via js\n\nNB: will break fancy editors such as CodeMirror on Jupyter. Simply use `seturl` to whitelist pages you need it on.\n\nBest used in conjunction with browser.autofocus in `about:config`", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["preventautofocusjackhammer", new SymbolMetadata("Uses a loop to prevent focus until you interact with a page. Only recommended for use via `seturl` for problematic sites as it can be a little heavy on CPU if running on all tabs. Should be used in conjuction with [[allowautofocus]]", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["smoothscroll", new SymbolMetadata("Whether to use Tridactyl's (bad) smooth scrolling.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["scrollduration", new SymbolMetadata("How viscous you want smooth scrolling to feel.", new NumberType(false, false), false)],
- ["tabopenpos", new SymbolMetadata("Where to open tabs opened with `tabopen` - to the right of the current tab, or at the end of the tabs.", new UnionType([
- new LiteralTypeType("next", false, false),
- new LiteralTypeType("last", false, false),
- new LiteralTypeType("related", false, false)
- ], false, false), false)],
- ["tabclosepinned", new SymbolMetadata("When enabled (the default), running tabclose will close the tabs whether they are pinned or not. When disabled, tabclose will fail with an error if a tab is pinned.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["tabsort", new SymbolMetadata("Controls which tab order to use when numbering tabs. Either mru = sort by most recent tab or default = by tab index\n\nApplies to all places where Tridactyl numbers tabs including `:tab`, `:tabnext_gt` etc. (so, for example, with `:set tabsort mru` `2gt` would take you to the second most recently used tab, not the second tab in the tab bar).", new UnionType([
- new LiteralTypeType("default", false, false),
- new LiteralTypeType("mru", false, false)
- ], false, false), false)],
- ["relatedopenpos", new SymbolMetadata("Where to open tabs opened with hinting - as if it had been middle clicked, to the right of the current tab, or at the end of the tabs.", new UnionType([
- new LiteralTypeType("next", false, false),
- new LiteralTypeType("last", false, false),
- new LiteralTypeType("related", false, false)
- ], false, false), false)],
- ["ttsvoice", new SymbolMetadata('The name of the voice to use for text-to-speech. You can get the list of installed voices by running the following snippet: `js alert(window.speechSynthesis.getVoices().reduce((a, b) => a + " " + b.name))`', new StringType(false, false), false)],
- ["ttsvolume", new SymbolMetadata("Controls text-to-speech volume. Has to be a number between 0 and 1.", new NumberType(false, false), false)],
- ["ttsrate", new SymbolMetadata("Controls text-to-speech speed. Has to be a number between 0.1 and 10.", new NumberType(false, false), false)],
- ["ttspitch", new SymbolMetadata("Controls text-to-speech pitch. Has to be between 0 and 2.", new NumberType(false, false), false)],
- ["gimode", new SymbolMetadata('When set to "nextinput", pressing `` after gi selects the next input.\n\nWhen set to "firefox", `` behaves like normal, focusing the next tab-indexed element regardless of type.', new UnionType([
- new LiteralTypeType("nextinput", false, false),
- new LiteralTypeType("firefox", false, false)
- ], false, false), false)],
- ["cursorpos", new SymbolMetadata("Decides where to place the cursor when selecting non-empty input fields", new UnionType([
- new LiteralTypeType("beginning", false, false),
- new LiteralTypeType("end", false, false)
- ], false, false), false)],
- ["theme", new SymbolMetadata("The theme to use.\n\nPermitted values: run `:composite js tri.styling.THEMES | fillcmdline` to find out.", new StringType(false, false), false)],
- ["customthemes", new SymbolMetadata("Storage for custom themes\n\nMaps theme names to CSS. Predominantly used automatically by [[colourscheme]] to store themes read from disk, as documented by [[colourscheme]]. Setting this manually is untested but might work provided that [[colourscheme]] is then used to change the theme to the right theme name.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["modeindicator", new SymbolMetadata("Whether to display the mode indicator or not.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["modeindicatormodes", new SymbolMetadata("Whether to display the mode indicator in various modes. Ignored if modeindicator set to false.", new ObjectType(/* @__PURE__ */ new Map([["", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false)]]), false, false), false)],
- ["jumpdelay", new SymbolMetadata("Milliseconds before registering a scroll in the jumplist", new NumberType(false, false), false)],
- ["logging", new SymbolMetadata("Logging levels. Unless you're debugging Tridactyl, it's unlikely you'll ever need to change these.", new ObjectType(/* @__PURE__ */ new Map([["", new UnionType([
- new LiteralTypeType("never", false, false),
- new LiteralTypeType("error", false, false),
- new LiteralTypeType("warning", false, false),
- new LiteralTypeType("info", false, false),
- new LiteralTypeType("debug", false, false)
- ], false, false)]]), false, false), false)],
- ["noiframe", new SymbolMetadata(`Disables the commandline iframe. Dangerous setting, use [[seturl]] to set it. If you ever set this setting to "true" globally and then want to set it to false again, you can do this by opening Tridactyl's preferences page from about:addons.`, new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["noiframeon", new SymbolMetadata("", new ArrayType(new StringType(false, false), false, false), false)],
- ["editorcmd", new SymbolMetadata('Insert / input mode edit-in-$EDITOR command to run\nThis has to be a command that stays in the foreground for the whole editing session\n"auto" will attempt to find a sane editor in your path.\nPlease send your requests to have your favourite terminal moved further up the list to /dev/null.\n (but we are probably happy to add your terminal to the list if it isn\'t already there.)\n\nExample values:\n- linux: `xterm -e vim`\n- windows: `start cmd.exe /c \\"vim\\"`.\n\nAlso see [:editor](/static/docs/modules/_src_excmds_.html#editor).', new StringType(false, false), false)],
- ["rsscmd", new SymbolMetadata('Command that should be run by the [[rssexec]] ex command. Has the\nfollowing format:\n- %u: url\n- %t: title\n- %y: type (rss, atom, xml...)\nWarning: This is a very large footgun. %u will be inserted without any\nkind of escaping, hence you must obey the following rules if you care\nabout security:\n- Do not use a composite command. If you need a composite command,\ncreate an alias.\n- Do not use `js` or `jsb`. If you need to use them, create an alias.\n- Do not insert any %u, %t or %y in shell commands run by the native\nmessenger. Use pipes instead.\n\nHere\'s an example of how to save an rss url in a file on your disk\nsafely:\n`alias save_rss jsb -p tri.native.run("cat >> ~/.config.newsboat/urls", JS_ARG)`\n`set rsscmd save_rss %u`\nThis is safe because the url is passed to jsb as an argument rather than\nbeing expanded inside of the string it will execute and because it is\npiped to the shell command rather than being expanded inside of it.', new StringType(false, false), false)],
- ["browser", new SymbolMetadata("The browser executable to look for in commands such as `restart`. Not as mad as it seems if you have multiple versions of Firefox...", new StringType(false, false), false)],
- ["yankto", new SymbolMetadata("Which clipboard to store items in. Requires the native messenger to be installed.", new UnionType([
- new LiteralTypeType("clipboard", false, false),
- new LiteralTypeType("selection", false, false),
- new LiteralTypeType("both", false, false)
- ], false, false), false)],
- ["putfrom", new SymbolMetadata("Which clipboard to retrieve items from. Requires the native messenger to be installed.\n\nPermitted values: `clipboard`, or `selection`.", new UnionType([
- new LiteralTypeType("clipboard", false, false),
- new LiteralTypeType("selection", false, false)
- ], false, false), false)],
- ["externalclipboardcmd", new SymbolMetadata("Clipboard command to try to get the selection from (e.g. `xsel` or `xclip`)", new StringType(false, false), false)],
- ["downloadsskiphistory", new SymbolMetadata("Whether downloads (e.g. via ;s hint modes) appear in your download history.\n\nNB: will cause downloads to fail silently if Tridactyl is not allowed to run in private windows (regardless of whether you are trying to call it in a private window).", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["downloadforbiddenchars", new SymbolMetadata("Set of characters that are to be considered illegal as download filenames.", new StringType(false, false), false)],
- ["downloadforbiddenreplacement", new SymbolMetadata("Value that will be used to replace the illegal character(s), if found, in the download filename.", new StringType(false, false), false)],
- ["downloadforbiddennames", new SymbolMetadata('Comma-separated list of whole filenames which, if match\nwith the download filename, will be suffixed with the\n"downloadforbiddenreplacement" value.', new StringType(false, false), false)],
- ["nativeinstallcmd", new SymbolMetadata('Set this to something weird if you want to have fun every time Tridactyl tries to update its native messenger.\n\n%TAG will be replaced with your version of Tridactyl for stable builds, or "master" for beta builds\n\nNB: Windows has its own platform-specific default.', new StringType(false, false), false)],
- ["update", new SymbolMetadata("Used by :updatecheck and related built-in functionality to automatically check for updates and prompt users to upgrade.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["profiledir", new SymbolMetadata("Profile directory to use with native messenger with e.g, `guiset`.", new StringType(false, false), false)],
- ["tabopencontaineraware", new SymbolMetadata("If enabled, tabopen opens a new tab in the currently active tab's container.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["containerindicator", new SymbolMetadata("If moodeindicator is enabled, containerindicator will color the border of the mode indicator with the container color.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["auconcreatecontainer", new SymbolMetadata("Autocontain directives create a container if it doesn't exist already.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["tabgroupnewtaburls", new SymbolMetadata("Initial urls to navigate to when creating a new tab for a new tab group.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["tabshowhidden", new SymbolMetadata("Whether :tab shows completions for hidden tabs (e.g. tabs in other tab groups).", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["historyresults", new SymbolMetadata("Number of most recent results to ask Firefox for. We display the top 20 or so most frequently visited ones.", new NumberType(false, false), false)],
- ["bmarkweight", new SymbolMetadata("When displaying bookmarks in history completions, how many page views to pretend they have.", new NumberType(false, false), false)],
- ["searchurlweight", new SymbolMetadata("When displaying searchurls in history completions, how many page views to pretend they have.", new NumberType(false, false), false)],
- ["gotoselector", new SymbolMetadata("Default selector for :goto command.", new StringType(false, false), false)],
- ["completions", new SymbolMetadata("General completions options - NB: options are set according to our internal completion source name - see - `src/completions/[name].ts` in the Tridactyl source.", new ObjectType(/* @__PURE__ */ new Map([]), false, false), false)],
- ["findresults", new SymbolMetadata("Number of results that should be shown in completions. -1 for unlimited", new NumberType(false, false), false)],
- ["findcontextlen", new SymbolMetadata("Number of characters to use as context for the matches shown in completions", new NumberType(false, false), false)],
- ["findcase", new SymbolMetadata("Whether find should be case-sensitive", new UnionType([
- new LiteralTypeType("smart", false, false),
- new LiteralTypeType("sensitive", false, false),
- new LiteralTypeType("insensitive", false, false)
- ], false, false), false)],
- ["findhighlighttimeout", new SymbolMetadata("How long find highlights should persist in milliseconds. `<= 0` means they persist until cleared", new NumberType(false, false), false)],
- ["incsearch", new SymbolMetadata("Whether Tridactyl should jump to the first match when using `:find`", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["minincsearchlen", new SymbolMetadata("How many characters should be typed before triggering incsearch/completions", new NumberType(false, false), false)],
- ["csp", new SymbolMetadata('Deprecated.\nChange this to "clobber" to ruin the "Content Security Policy" of all sites a bit and make Tridactyl run a bit better on some of them, e.g. raw.github*', new UnionType([
- new LiteralTypeType("untouched", false, false),
- new LiteralTypeType("clobber", false, false)
- ], false, false), false)],
- ["wordpattern", new SymbolMetadata("JavaScript RegExp used to recognize words in text.* functions (e.g. text.transpose_words). Should match any character belonging to a word.", new StringType(false, false), false)],
- ["perfcounters", new SymbolMetadata("Activate tridactyl's performance counters. These have a\nmeasurable performance impact, since every sample is a few\nhundred bytes and we sample tridactyl densely, but they're good\nwhen you're trying to optimize things.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["perfsamples", new SymbolMetadata(`How many samples to store from the perf counters.
-
-Each performance entry is two numbers (16 bytes), an entryType
-of either "mark" or "measure" (js strings are utf-16 ad we have
-two marks for each measure, so amortize to about 10 bytes per
-entry), and a string name that for Tridactyl object will be
-about 40 (utf-16) characters (80 bytes), plus object overhead
-roughly proportional to the string-length of the name of the
-constructor (in this case something like 30 bytes), for a total
-of what we'll call 128 bytes for ease of math.
-
-We want to store, by default, about 1MB of performance
-statistics, so somewhere around 10k samples.`, new StringType(false, false), false)],
- ["modeindicatorshowkeys", new SymbolMetadata("Show (partial) command in the mode indicator.\nCorresponds to 'showcmd' option of vi.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["urlparenttrailingslash", new SymbolMetadata("Whether a trailing slash is appended when we get the parent of a url with\ngu (or other means).", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["visualenterauto", new SymbolMetadata("Whether to enter visual mode when text is selected. Visual mode can always be entered with `:mode visual`.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["visualexitauto", new SymbolMetadata("Whether to return to normal mode when text is deselected.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["escapehatchsidebarhack", new SymbolMetadata("Whether to open and close the sidebar quickly to get focus back to the page when is pressed.\n\nDisable if the fact that it closes TreeStyleTabs gets on your nerves too much : )\n\nNB: when disabled, can't get focus back from the address bar, but it can still get it back from lots of other places (e.g. Flash-style video players)", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)],
- ["completionfuzziness", new SymbolMetadata("Threshold for fuzzy matching on completions. Lower => stricter matching. Range between 0 and 1: 0 corresponds to perfect matches only. 1 will match anything.\n\nhttps://fusejs.io/api/options.html#threshold", new NumberType(false, false), false)],
- ["readerurlintitle", new SymbolMetadata("Whether to show article url in the document.title of Reader View.", new UnionType([
- new LiteralTypeType("false", false, false),
- new LiteralTypeType("true", false, false)
- ], false, false), false)]
- ]))]]), /* @__PURE__ */ new Map([
- ["o", new SymbolMetadata("", new FunctionType([new AnyType(true, false)], new AnyType(true, false), false, false), true)],
- ["schlepp", new SymbolMetadata("", new FunctionType([new AnyType(true, false)], new VoidType(false, false), false, false), true)],
- ["getDeepProperty", new SymbolMetadata("Given an object and a target, extract the target if it exists, else return undefined", new FunctionType([new AnyType(true, false), new ArrayType(new StringType(false, false), false, false)], new AnyType(true, false), false, false), true)],
- ["setDeepProperty", new SymbolMetadata("Create the key path target if it doesn't exist and set the final property to value.\n\nIf the path is an empty array, replace the obj.", new FunctionType([new AnyType(true, false), new AnyType(true, false), new AnyType(true, false)], new AnyType(true, false), false, false), true)],
- ["mergeDeep", new SymbolMetadata("", new FunctionType([new AnyType(true, false), new AnyType(true, false)], new AnyType(true, false), false, false), true)],
- ["getURL", new SymbolMetadata("", new FunctionType([new StringType(false, false), new ArrayType(new StringType(false, false), false, false)], new AnyType(true, false), false, false), true)],
- ["get", new SymbolMetadata("Get the value of the key target.\n\nIf the user has not specified a key, use the corresponding key from\ndefaults, if one exists, else undefined.", new FunctionType([new UnionType([
- new LiteralTypeType("rsscmd", false, false),
- new LiteralTypeType("theme", false, false),
- new LiteralTypeType("autocmds", false, false),
- new LiteralTypeType("exaliases", false, false),
- new LiteralTypeType("modesubconfigs", false, false),
- new LiteralTypeType("allowautofocus", false, false),
- new LiteralTypeType("autocontain", false, false),
- new LiteralTypeType("proxies", false, false),
- new LiteralTypeType("update", false, false),
- new LiteralTypeType("imaps", false, false),
- new LiteralTypeType("viewsource", false, false),
- new LiteralTypeType("nmaps", false, false),
- new LiteralTypeType("configversion", false, false),
- new TypeReferenceType("... 89 more ...", [], false, false),
- new LiteralTypeType("readerurlintitle", false, false)
- ], false, true), new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), true)],
- ["getDynamic", new SymbolMetadata("Get the value of the key target.\n\nPlease only use this with targets that will be used at runtime - it skips static checks. Prefer [[get]].", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new AnyType(true, false), false, false), false)],
- ["getAsyncDynamic", new SymbolMetadata("Get the value of the key target.\n\nPlease only use this with targets that will be used at runtime - it skips static checks. Prefer [[getAsync]].", new FunctionType([new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new AnyType(true, false)], false, false), false, false), false)],
- ["getAsync", new SymbolMetadata("Get the value of the key target, but wait for config to be loaded from the\ndatabase first if it has not been at least once before.\n\nThis is useful if you are a content script and you've just been loaded.", new FunctionType([new UnionType([
- new LiteralTypeType("rsscmd", false, false),
- new LiteralTypeType("theme", false, false),
- new LiteralTypeType("autocmds", false, false),
- new LiteralTypeType("exaliases", false, false),
- new LiteralTypeType("modesubconfigs", false, false),
- new LiteralTypeType("allowautofocus", false, false),
- new LiteralTypeType("autocontain", false, false),
- new LiteralTypeType("proxies", false, false),
- new LiteralTypeType("update", false, false),
- new LiteralTypeType("imaps", false, false),
- new LiteralTypeType("viewsource", false, false),
- new LiteralTypeType("nmaps", false, false),
- new LiteralTypeType("configversion", false, false),
- new TypeReferenceType("... 89 more ...", [], false, false),
- new LiteralTypeType("readerurlintitle", false, false)
- ], false, true), new ArrayType(new StringType(false, false), true, false)], new TypeReferenceType("Promise", [new TypeReferenceType("...", [], false, false)], false, false), false, false), true)],
- ["push", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["pull", new SymbolMetadata("", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), false)],
- ["setURL", new SymbolMetadata("", new FunctionType([new AnyType(true, false), new ArrayType(new AnyType(true, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["set", new SymbolMetadata('Full target specification, then value\n\ne.g.\n set("nmaps", "o", "open")\n set("search", "default", "google")\n set("aucmd", "BufRead", "memrise.com", "open memrise.com")', new FunctionType([new ArrayType(new AnyType(true, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["unsetURL", new SymbolMetadata("", new FunctionType([new AnyType(true, false), new ArrayType(new AnyType(true, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["unset", new SymbolMetadata("Delete the key at target in USERCONFIG if it exists", new FunctionType([new ArrayType(new AnyType(true, false), true, false)], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["save", new SymbolMetadata("Save the config back to storage API.\n\nConfig is not synchronised between different instances of this module until\nsometime after this happens.", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["update", new SymbolMetadata(`Updates the config to the latest version.
-Proposed semantic for config versionning:
-- x.y -> x+1.0 : major architectural changes
-- x.y -> x.y+1 : renaming settings/changing their types
-There's no need for an updater if you're only adding a new setting/changing
-a default setting
-
-When adding updaters, don't forget to set("configversion", newversionnumber)!`, new FunctionType([], new TypeReferenceType("Promise", [new BooleanType(false, false)], false, false), false, false), true)],
- ["init", new SymbolMetadata("Read all user configuration from storage API then notify any waiting asynchronous calls\n\nasynchronous calls generated by getAsync.", new FunctionType([], new TypeReferenceType("Promise", [new VoidType(false, false)], false, false), false, false), true)],
- ["addChangeListener", new SymbolMetadata("", new FunctionType([new TypeReferenceType("P", [], false, false), new FunctionType([new AnyType(true, false), new AnyType(true, false)], new VoidType(false, false), false, false)], new VoidType(false, false), false, false), true)],
- ["removeChangeListener", new SymbolMetadata("", new FunctionType([new TypeReferenceType("P", [], false, false), new FunctionType([new AnyType(true, false), new AnyType(true, false)], new VoidType(false, false), false, false)], new VoidType(false, false), false, false), true)],
- ["parseConfig", new SymbolMetadata('Parse the config into a string representation of a .tridactylrc config file.\nTries to parse the config into sectionable chunks based on keywords.\nBinds, aliases, autocmds and logging settings each have their own section while the rest are dumped into "General Settings".', new FunctionType([], new StringType(false, false), false, false), false)]
- ]))]
- ]));
- var staticThemes = ["auto", "dark", "default", "greenmat", "halloween", "midnight", "quake", "quakelight", "shydactyl"];
-
- // src/completions/Apropos.ts
- var AproposCompletionOption = class extends CompletionOptionHTML {
- constructor(name, doc, flag) {
- super();
- this.name = name;
- this.fuseKeys = [];
- this.value = `${flag} ${name}`;
- this.html = html`
The library tries to provide pure JavaScript tool(s) to create reactive interfaces using …
# Event-driven programming (3 parts separation ≡ 3PS)
Let's introduce the basic principle on which the library is built. We'll use the JavaScript listener as a starting point.
// pseudo code!
-const onchage=
- event=>
- console.log("Reacting to the:", event); // A
-input.addEventListener("change", onchange); // B
-input.dispatchEvent(new Event("change")); // C
-
As we can see, in the code at location “A” we define how to react when the function is called with any event as an argument. At that moment, we don't care who/why/how the function was called. Similarly, at point “B”, we reference to a function to be called on the event without caring what the function will do at that time. Finally, at point “C”, we tell the application that a change has occurred, in the input, and we don't care if/how someone is listening for the event.
import { el } from "./esm-with-signals.js";
-import { S } from "./esm-with-signals.js";
-const clicks= S(0); // A
-document.body.append(
- el().append(
- el("p", S(()=>
- "Hello World "+"🎉".repeat(clicks()) // B
- )),
- el("button", {
- type: "button",
- onclick: ()=> clicks(clicks()+1), // C
- textContent: "Fire",
- })
- )
-);
-
The library introduces a new “type” of variable/constant called signal allowing us to to use introduced 3PS pattern in our applications. As you can see it in the example above.
Also please notice that there is very similar 3PS pattern used for separate creation of UI and business logic.
The 3PS is very simplified definition of the pattern. There are more deep/academic definitions more precisely describe usage in specific situations, see for example MVVM or MVC.
\ No newline at end of file
diff --git a/docs_src/index.html.js b/docs/index.html.js
similarity index 100%
rename from docs_src/index.html.js
rename to docs/index.html.js
diff --git a/docs_src/jsconfig.json b/docs/jsconfig.json
similarity index 100%
rename from docs_src/jsconfig.json
rename to docs/jsconfig.json
diff --git a/docs_src/layout/head.html.js b/docs/layout/head.html.js
similarity index 100%
rename from docs_src/layout/head.html.js
rename to docs/layout/head.html.js
diff --git a/docs_src/layout/simplePage.html.js b/docs/layout/simplePage.html.js
similarity index 100%
rename from docs_src/layout/simplePage.html.js
rename to docs/layout/simplePage.html.js
diff --git a/docs/p02-elements.html b/docs/p02-elements.html
deleted file mode 100644
index 9b225bc..0000000
--- a/docs/p02-elements.html
+++ /dev/null
@@ -1,147 +0,0 @@
-`deka-dom-el` — Elements
`deka-dom-el` — Elements
Basic concepts of elements modifications and creations.
Native JavaScript DOM elements creations
Let’s go through all patterns we would like to use and what needs to be improved for better experience.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm.js
-import {
- assign,
- el, createElement,
- elNS, createElementNS
-} from "deka-dom-el";
-el===createElement
-elNS===createElementNS
-// “internal” utils
-import {
- assignAttribute,
- classListDeclarative,
- chainableAppend
-} from "deka-dom-el";
-
You can create a native DOM element by using the document.createElement(). It is also possible to provide a some attribute(s) declaratively using Object.assign(). More precisely, this way you can sets some IDL also known as a JavaScript property.
The assign function provides improved behaviour of Object.assign(). You can declaratively sets any IDL and attribute of the given element. Function prefers IDL and fallback to the element.setAttribute if there is no writable property in the element prototype.
You can study all JavaScript elements interfaces to the corresponding HTML elements. All HTML elements inherits from HTMLElement. To see all available IDLs for example for paragraphs, see HTMLParagraphElement. Moreover, the assign provides a way to sets declaratively some convenient properties:
It is possible to sets data-*/aria-* attributes using object notation.
In opposite, it is also possible to sets data-*/aria-* attribute using camelCase notation.
You can use string or object as a value for style property.
className (IDL – preffered)/class are ways to add CSS classes to the element. You can use string (similarly to class="…" syntax in HTML) or array of strings. This is handy to concat conditional classes.
Use classList to toggle specific classes. This will be handy later when the reactivity via signals is beeing introduced.
The assign also accepts the undefined as a value for any property to remove it from the element declaratively. Also for some IDL the corresponding attribute is removed as it can be confusing. For example, natievly the element’s id is removed by setting the IDL to an empty string.
You can use = or . to force processing given key as attribute/property of the element.
For processing, the assign internally uses assignAttribute and classListDeclarative.
You can use functions for encapsulation (repeating) logic. The el accepts function as first argument. In that case, the function should return dom elements and the second argument for el is argument for given element.
As you can see, in case of state-less/basic components there is no difference between calling component function directly or using el function.
It is nice to use similar naming convention as native DOM API. This allows us to use the destructuring assignment syntax and keep track of the native API (things are best remembered through regular use).
Similarly to the native DOM API (document.createElementNS) for non-HTML elements we need to tell JavaScript which kind of the element to create. We can use the elNS function:
import { elNS, assign } from "./esm-with-signals.js";
-const elSVG= elNS("http://www.w3.org/2000/svg");
-const elMath= elNS("http://www.w3.org/1998/Math/MathML");
-document.body.append(
- elSVG("svg"), // see https://developer.mozilla.org/en-US/docs/Web/SVG and https://developer.mozilla.org/en-US/docs/Web/API/SVGElement
- elMath("math") // see https://developer.mozilla.org/en-US/docs/Web/MathML and https://developer.mozilla.org/en-US/docs/Web/MathML/Global_attributes
-);
-
-console.log(
- document.body.innerHTML.includes("<svg></svg><math></math>")
-)
-
\ No newline at end of file
diff --git a/docs_src/p02-elements.html.js b/docs/p02-elements.html.js
similarity index 100%
rename from docs_src/p02-elements.html.js
rename to docs/p02-elements.html.js
diff --git a/docs/p03-events.html b/docs/p03-events.html
deleted file mode 100644
index d72dca4..0000000
--- a/docs/p03-events.html
+++ /dev/null
@@ -1,94 +0,0 @@
-`deka-dom-el` — Events and Addons
`deka-dom-el` — Events and Addons
Using not only events in UI declaratively.
Listenning to the native DOM events and other Addons
We quickly introduce helper to listening to the native DOM events. And library syntax/pattern so-called Addon to incorporate not only this in UI templates declaratively.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm.js
-import { on, dispatchEvent } from "deka-dom-el";
-
-/** @type {ddeElementAddon} */
-
In JavaScript you can listen to the native DOM events of the given element by using element.addEventListener(type, listener, options). The library provides an alternative (on) accepting the differen order of the arguments:
el("button", { textContent: "click me" }, on("click", console.log))
In the first example we force to use HTML attribute (it corresponds to <button onclick="console.log(event)">click me</button>). Side note: this can be useful in case of SSR. To study difference, you can read a nice summary here: GIST @WebReflection/web_events.md.
From practical point of view, Addons are just functions that accept any HTML element as their first parameter. You can see that the on(…) fullfills this requirement.
You can use Addons as ≥3rd argument of el function. This way is possible to extends your templates by additional (3rd party) functionalities. But for now mainly, you can add events listeners:
As the example shows, you can also provide types in JSDoc+TypeScript by using global type ddeElementAddon. Also notice, you can use Addons to get element reference.
Addons are called immediately when the element is created, even it is not connected to live DOM yet. Therefore, you can understand the Addon to be “oncreate” event.
The library provide three additional live-cycle events corresponding to how they are named in a case of custom elements: on.connected, on.disconnected and on.attributeChanged.
For Custom elements, we will later introduce a way to replace *Callback syntax with dde:* events. The on.* functions then listen to the appropriate Custom Elements events (see Custom element lifecycle callbacks | MDN).
But, in case of regular elemnets the MutationObserver | MDN is internaly used to track these events. Therefore, there are some drawbacks:
To proper listener registration, you need to use on.* not `on("dde:*", …)`!
Use sparingly! Internally, library must loop of all registered events and fires event properly. It is good practice to use the fact that if an element is removed, its children are also removed! In this spirit, we will introduce later the host syntax to register, clean up procedures when the component is removed from the app.
To provide intuitive behaviour, similar also to how the life-cycle events works in other frameworks/libraries, deka-dom-el library ensures that on.connected and on.disconnected are called only once and only when the element, is (dis)connected to live DOM. The solution is inspired by Vue. For using native behaviour re-(dis)connecting element, use:
custom MutationObserver or logic in (dis)connectedCallback or…
on(<event>, <listener>[, <options>])(<element>) — just <element>.addEventListener(<event>, <listener>[, <options>])
on.<live-cycle>(<event>, <listener>[, <options>])(<element>) — corresponds to custom elemnets callbacks <live-cycle>Callback(...){...}. To connect to custom element see following page, else it is simulated by MutationObserver.
dispatchEvent(<event>[, <options>])(element) — just <element>.dispatchEvent(new Event(<event>[, <options>]))
\ No newline at end of file
diff --git a/docs_src/p03-events.html.js b/docs/p03-events.html.js
similarity index 100%
rename from docs_src/p03-events.html.js
rename to docs/p03-events.html.js
diff --git a/docs/p04-observables.html b/docs/p04-observables.html
deleted file mode 100644
index 47b7a65..0000000
--- a/docs/p04-observables.html
+++ /dev/null
@@ -1,150 +0,0 @@
-`deka-dom-el` — Observables and reactivity
`deka-dom-el` — Observables and reactivity
Handling reactivity in UI via observables.
Using observables to manage reactivity
How a program responds to variable data or user interactions is one of the fundamental problems of programming. If we desire to solve the issue in a declarative manner, observables may be a viable approach.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-observables.js
-import { O, observable } from "deka-dom-el/observables";
-O===observable
-/** @type {ddeObservable} */
-/** @type {ddeAction} */
-/** @type {ddeActions} */
-
Using observables, we split program logic into the three parts. Firstly (α), we create a variable (constant) representing reactive value. Somewhere later, we can register (β) a logic reacting to the observable value changes. Similarly, in a remaining part (γ), we can update the observable value.
import { O } from "./esm-with-observables.js";
-// α — `observable` represents a reactive value
-const observable= O(0);
-// β — just reacts on observable changes
-O.on(observable, console.log);
-// γ — just updates the value
-const update= ()=> observable(observable()+1);
-
-update();
-const interval= 5*1000;
-setTimeout(clearInterval, 10*interval,
- setInterval(update, interval));
-
Observables are implemented in the library as functions. To see current value of observable, just call it without any arguments console.log(observable()). To update the observable value, pass any argument observable('a new value'). For listenning the observable value changes, use O.on(observable, console.log).
Similarly to the on function to register DOM events listener. You can use AbortController/AbortSignal to off/stop listenning. In example, you also found the way for representing “live” piece of code computation pattern (derived observable):
O(/* primitive */) allows you to declare simple reactive variables, typically around immutableprimitive types. However, it may also be necessary to use reactive arrays, objects, or other complex reactive structures.
In some way, you can compare it with useReducer hook from React. So, the O(<data>, <actions>) pattern creates a store “machine”. We can then invoke (dispatch) registered action by calling O.action(<observable>, <name>, ...<args>) after the action call the observable calls all its listeners. This can be stopped by calling this.stopPropagation() in the method representing the given action. As it can be seen in examples, the “store” value is available also in the function for given action (this.value).
To derived attribute based on value of observable variable just use the observable as a value of the attribute (assign(element, { attribute: O('value') })). assign/el provides ways to glue reactive attributes/classes more granularly into the DOM. Just use dedicated build-in attributes dataset, ariaset and classList.
For computation, you can use the “derived observable” (see above) like assign(element, { textContent: O(()=> 'Hello '+WorldObservable()) }). This is read-only observable its value is computed based on given function and updated when any observable used in the function changes.
To represent part of the template filled dynamically based on the observable value use O.el(observable, DOMgenerator). This was already used in the todo example above or see:
\ No newline at end of file
diff --git a/docs/p04-signals.html b/docs/p04-signals.html
deleted file mode 100644
index 35cf3f3..0000000
--- a/docs/p04-signals.html
+++ /dev/null
@@ -1,150 +0,0 @@
-`deka-dom-el` — Signals and reactivity
`deka-dom-el` — Signals and reactivity
Handling reactivity in UI via signals.
Using signals to manage reactivity
How a program responds to variable data or user interactions is one of the fundamental problems of programming. If we desire to solve the issue in a declarative manner, signals may be a viable approach.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js
-import { S, signal } from "deka-dom-el/signals";
-S===signal
-/** @type {ddeSignal} */
-/** @type {ddeAction} */
-/** @type {ddeActions} */
-
Using signals, we split program logic into the three parts. Firstly (α), we create a variable (constant) representing reactive value. Somewhere later, we can register (β) a logic reacting to the signal value changes. Similarly, in a remaining part (γ), we can update the signal value.
import { S } from "./esm-with-signals.js";
-// α — `signal` represents a reactive value
-const signal= S(0);
-// β — just reacts on signal changes
-S.on(signal, console.log);
-// γ — just updates the value
-const update= ()=> signal(signal()+1);
-
-update();
-const interval= 5*1000;
-setTimeout(clearInterval, 10*interval,
- setInterval(update, interval));
-
Signals are implemented in the library as functions. To see current value of signal, just call it without any arguments console.log(signal()). To update the signal value, pass any argument signal('a new value'). For listenning the signal value changes, use S.on(signal, console.log).
Similarly to the on function to register DOM events listener. You can use AbortController/AbortSignal to off/stop listenning. In example, you also found the way for representing “live” piece of code computation pattern (derived signal):
S(/* primitive */) allows you to declare simple reactive variables, typically, around immutableprimitive types. However, it may also be necessary to use reactive arrays, objects, or other complex reactive structures.
In some way, you can compare it with useReducer hook from React. So, the S(<data>, <actions>) pattern creates a store “machine”. We can then invoke (dispatch) registered action by calling S.action(<signal>, <name>, ...<args>) after the action call the signal calls all its listeners. This can be stopped by calling this.stopPropagation() in the method representing the given action. As it can be seen in examples, the “store” value is available also in the function for given action (this.value).
To derived attribute based on value of signal variable just use the signal as a value of the attribute (assign(element, { attribute: S('value') })). assign/el provides ways to glue reactive attributes/classes more granularly into the DOM. Just use dedicated build-in attributes dataset, ariaset and classList.
For computation, you can use the “derived signal” (see above) like assign(element, { textContent: S(()=> 'Hello '+WorldSignal()) }). This is read-only signal its value is computed based on given function and updated when any signal used in the function changes.
To represent part of the template filled dynamically based on the signal value use S.el(signal, DOMgenerator). This was already used in the todo example above or see:
\ No newline at end of file
diff --git a/docs_src/p04-signals.html.js b/docs/p04-signals.html.js
similarity index 100%
rename from docs_src/p04-signals.html.js
rename to docs/p04-signals.html.js
diff --git a/docs/p05-scopes.html b/docs/p05-scopes.html
deleted file mode 100644
index 8bfb5e0..0000000
--- a/docs/p05-scopes.html
+++ /dev/null
@@ -1,183 +0,0 @@
-`deka-dom-el` — Scopes and components
`deka-dom-el` — Scopes and components
Organizing UI into components
Using functions as UI components
For state-less components we can use functions as UI components (see “Elements” page). But in real life, we may need to handle the component live-cycle and provide JavaScript the way to properly use the Garbage collection.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js
-import { scope, el } from "deka-dom-el";
-/** @type {ddeElementAddon} */
-
The library therefore use scopes to provide these functionalities.
The host is the name for the element representing the component. This is typically element returned by function. To get reference, you can use scope.host() to applly addons just use scope.host(...<addons>).
import { el, on, scope } from "./esm-with-signals.js";
-const { host }= scope;
-host(
- element=> console.log(
- "This represents Addon/oninit for root",
- element.outerHTML
- )
-);
-console.log(
- "This represents the reference to the host element of root",
- host().outerHTML
-);
-document.body.append(
- el(component)
-);
-function component(){
- const { host }= scope;
- host(
- element=> console.log(
- "This represents Addon/oninit for the component",
- element.outerHTML
- )
- );
- const onclick= on("click", function(ev){
- console.log(
- "This represents the reference to the host element of the component",
- host().outerHTML
- );
- })
- return el("div", null, onclick).append(
- el("strong", "Component")
- );
-}
-
To better understanding we implement function elClass helping to create component as class instances.
As you can see, the scope.host() is stored temporarily and synchronously. Therefore, at least in the beginning of using library, it is the good practise to store host in the root of your component. As it may be changed, typically when there is asynchronous code in the component.
import { el, scope, on, dispatchEvent } from "deka-dom-el";
-document.body.append(
- el(component)
-);
-function component(){
- const { host }= scope; // good practise!
-
- host(
- console.log,
- on("click", function redispatch(){
- // this `host` ↘ still corresponds to the host ↖ of the component
- dispatchEvent("redispatch")(host());
- })
- );
- // this `host` ↘ still corresponds to the host ↖ of the component
- setTimeout(()=> dispatchEvent("timeout")(host()), 750)
- return el("p", "Clickable paragraph!");
-}
-
The host is internally used to register the cleaning procedure, when the component (host element) is removed from the DOM.
import { el, empty, on } from "./esm-with-signals.js";
-document.body.append(
- el(component),
- el("button", {
- textContent: "Remove",
- onclick: ()=> empty(document.body),
- type: "button"
- })
-);
-import { S } from "./esm-with-signals.js";
-function component(){
- const textContent= S("Click to change text.");
-
- const onclickChange= on("click", function redispatch(){
- textContent("Text changed! "+(new Date()).toString())
- });
- return el("p", textContent, onclickChange);
-}
-
The text content of the paragraph is changing when the value of the signal textContent is changed. Internally, there is association between textContent and the paragraph, similar to using S.on(textContent, /* update the paragraph */).
This listener must be removed when the component is removed from the DOM. To do it, the library assign internally on.disconnected(/* remove the listener */)(host()) to the host element.
The library DOM API and signals works ideally when used declaratively. It means, you split your app logic into three parts as it was itroduced in Signals.
Strictly speaking, the imperative way of using the library is not prohibited. Just be careful (rather avoid) mixing declarative approach (using signals) and imperative manipulation of elements.
/* PSEUDO-CODE!!! */
-import { el, on, scope } from "deka-dom-el";
-function component(){
- const { host }= scope;
- const ul= el("ul");
- const ac= new AbortController();
- fetchAPI({ signal: ac.signal }).then(data=> {
- data.forEach(d=> ul.append(el("li", d)));
- });
- host(
- /* element was remove before data fetched */
- on.disconnected(()=> ac.abort())
- );
- return ul;
- /**
- * NEVER EVER!!
- * let data;
- * fetchAPI().then(d=> data= O(d));
- *
- * OR NEVER EVER!!
- * const ul= el("ul");
- * fetchAPI().then(d=> {
- * const data= O("data");
- * ul.append(el("li", data));
- * });
- *
- * // THE HOST IS PROBABLY DIFFERENT THAN
- * // YOU EXPECT AND OBSERVABLES MAY BE
- * // UNEXPECTEDLY REMOVED!!!
- * */
-}
-
\ No newline at end of file
diff --git a/docs_src/p05-scopes.html.js b/docs/p05-scopes.html.js
similarity index 100%
rename from docs_src/p05-scopes.html.js
rename to docs/p05-scopes.html.js
diff --git a/docs/p06-customElement.html b/docs/p06-customElement.html
deleted file mode 100644
index ed6737e..0000000
--- a/docs/p06-customElement.html
+++ /dev/null
@@ -1,242 +0,0 @@
-`deka-dom-el` — Web Components
`deka-dom-el` — Web Components
Using custom elements in combinantion with DDE
Using web components in combinantion with DDE
The DDE library allows for use within Web Components for dom-tree generation. However, in order to be able to use signals (possibly mapping to registered observedAttributes) and additional functionality is (unfortunately) required to use helpers provided by the library.
// use NPM or for example https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js
-import {
- customElementRender,
- customElementWithDDE,
- observedAttributes,
-} from "deka-dom-el";
-/** @type {ddePublicElementTagNameMap} */
-import { S } from "deka-dom-el/signals";
-S.observedAttributes;
-
-// “internal” utils
-import { lifecyclesToEvents } from "deka-dom-el";
-
Web Components, specifically Custom Elements, are a set of web platform APIs that allow you to create new HTML tags with custom functionality encapsulated within them. This allows for the creation of reusable components that can be used across web applications.
To start with, let’s see how to use native Custom Elements. As starting point please read Using Custom Elementson MDN. To sum up and for mnemonic see following code overview:
export class HTMLCustomElement extends HTMLElement{
- static tagName= "custom-element"; // just suggestion, we can use `el(HTMLCustomElement.tagName)`
- static observedAttributes= [ "custom-attribute" ];
- constructor(){
- super();
- // nice place to prepare custom element
- }
- connectedCallback(){
- // nice place to render custom element
- }
- attributeChangedCallback(name, oldValue, newValue){
- // listen to attribute changes (see `observedAttributes`)
- }
- disconnectedCallback(){
- // nice place to clean up
- }
- // for example, we can mirror get/set prop to attribute
- get customAttribute(){ return this.getAttribute("custom-attribute"); }
- set customAttribute(value){ this.setAttribute("custom-attribute", value); }
-}
-customElements.define(HTMLCustomElement.tagName, HTMLCustomElement);
-
For more advanced use of Custom Elements, the summary Handy Custom Elements Patterns may be useful. Especially pay attention to linking HTML attributes and defining setters/getters, this is very helpful to use in combination with the library (el(HTMLCustomElement.tagName, { customAttribute: "new-value" });).
Also see the Life Cycle Events sections, very similarly we would like to use DDE events. To do it, the library provides function customElementWithDDE…
import { customElementWithDDE, el, on } from "./esm-with-signals.js";
-export class HTMLCustomElement extends HTMLElement{
- static tagName= "custom-element";
- connectedCallback(){
- this.append(
- el("p", "Hello from custom element!")
- );
- }
-}
-customElementWithDDE(HTMLCustomElement);
-customElements.define(HTMLCustomElement.tagName, HTMLCustomElement);
-
-const instance= el(HTMLCustomElement.tagName);
-on.connected( // preffered
- e=> console.log("Element connected to the DOM (v1):", e)
-)(instance);
-instance.addEventListener(
- "dde:connected",
- e=> console.log("Element connected to the DOM (v2):", e)
-);
-document.body.append(
- instance,
-);
-
Custom Elements with DDE
The customElementWithDDE function is only (small) part of the inregration of the library. More important for coexistence is render component function as a body of the Custom Element. For that, you can use customElementRender with arguments instance reference, target for connection, render function and optional properties (will be passed to the render function) see later…
…as you can see, you can use components created based on the documentation previously introduced. To unlock full potential, use with combination customElementWithDDE (allows to use livecycle events) and observedAttributes (converts attributes to render function arguments — default) or S.observedAttributes (converts attributes to signals).
Shadow DOM is a web platform feature that allows for the encapsulation of a component’s internal DOM tree from the rest of the document. This means that styles and scripts applied to the document will not affect the component’s internal DOM, and vice versa.
The use of shadow DOM to encapsulate the internal structure of the custom element, which affects how the custom element can be styled and modified using JavaScript and CSS.
The ability to access and modify the internal structure of the custom element using JavaScript, which is affected by the use of shadow DOM and the mode of the shadow DOM.
The use of slots to allow for the insertion of content from the parent document into the custom element, which is affected by the use of shadow DOM and the mode of the shadow DOM.
customElementRender(<custom-element>, <connect-target>, <render-function>[, <properties>]) — use function to render DOM structure for given <custom-element>
customElementWithDDE(<custom-element>) — register <custom-element> to DDE library, see also `lifecyclesToEvents`, can be also used as decorator
observedAttributes(<custom-element>) — returns record of observed attributes (keys uses camelCase)
S.observedAttributes(<custom-element>) — returns record of observed attributes (keys uses camelCase and values are signals)
lifecyclesToEvents(<class-declaration>) — convert lifecycle methods to events, can be also used as decorator
simulateSlots(<class-instance>, <body>[, <mapper>]) — simulate slots for Custom Elements without shadow DOM
simulateSlots(<dde-component>[, <mapper>]) — simulate slots for “dde”/functional components